shelving 1.322.3 → 1.323.0
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/docs/guides/building-with-shelving.md +1 -1
- package/docs/llms-full.txt +61 -47
- package/docs/ui/BackButton.md +1 -1
- package/docs/ui/Meta.md +2 -2
- package/docs/ui/Navigation.md +4 -4
- package/docs/ui/NavigationEntryState.md +2 -2
- package/docs/ui/NavigationPosition.md +2 -2
- package/docs/ui/NavigationProps.md +3 -3
- package/docs/ui/NavigationStore/back.md +1 -1
- package/docs/ui/NavigationStore/forward.md +1 -1
- package/docs/ui/NavigationStore/history.md +3 -2
- package/docs/ui/NavigationStore/replace.md +1 -1
- package/docs/ui/NavigationStore.md +26 -15
- package/docs/ui/RouteCache.md +7 -5
- package/docs/ui/RouteCacheProps.md +1 -1
- package/docs/ui/StackButton.md +5 -5
- package/docs/ui/mergeMeta.md +1 -1
- package/package.json +1 -1
- package/ui/router/BackButton.md +1 -1
- package/ui/router/Navigation.d.ts +4 -3
- package/ui/router/Navigation.js +1 -1
- package/ui/router/Navigation.md +2 -2
- package/ui/router/Navigation.test.tsx +11 -1
- package/ui/router/Navigation.tsx +6 -5
- package/ui/router/NavigationStore.d.ts +32 -24
- package/ui/router/NavigationStore.js +42 -27
- package/ui/router/NavigationStore.md +18 -10
- package/ui/router/NavigationStore.test.ts +90 -23
- package/ui/router/NavigationStore.tsx +58 -41
- package/ui/router/RouteCache.d.ts +5 -3
- package/ui/router/RouteCache.js +20 -7
- package/ui/router/RouteCache.md +3 -2
- package/ui/router/RouteCache.tsx +30 -9
- package/ui/router/StackButton.d.ts +2 -2
- package/ui/router/StackButton.js +3 -3
- package/ui/router/StackButton.md +3 -3
- package/ui/router/StackButton.tsx +3 -3
- package/ui/util/meta.d.ts +2 -2
- package/ui/util/meta.ts +2 -2
|
@@ -922,7 +922,7 @@ If every file in that list is in the right place, the client and server share on
|
|
|
922
922
|
- `<RouteConfig path>` kept a page mounted for its tabs (for example `/dave/{tab}`). Instead, add `className="replace"` to each in-page tab link: `<Button href="/dave/posts" className="replace">Posts</Button>`. A replace keeps the same page mounted, with no slide and no new history entry.
|
|
923
923
|
- `<RouteConfig cache={false}>` unmounted a create form when you left it. Instead, clear the form after a successful submit: change the `key` of the `<Form>`, or call `form.reset()` on a plain HTML form. See `<RouteCache>` for an example.
|
|
924
924
|
4. **Canonical URLs.** `<Head>` no longer writes browser history itself. When a page renders a `<Head>` with a `url` that is not the current URL, `<Head>` calls `NavigationStore.replace()`. You do not need to change anything, but do not also call `window.history.replaceState()` for it.
|
|
925
|
-
5. **Add stacks (optional).** For an app with a tab bar, set `stacks` on `<Navigation>` to the root path of each tab, in tab order: `<Navigation stacks={["/home", "/discover", "/profile"]}>`. Each link then opens a new page in the current tab, wherever it points. Set `stack` on `<Navigation>` to the stack the app opens in. With no `stack`, the
|
|
925
|
+
5. **Add stacks (optional).** For an app with a tab bar, set `stacks` on `<Navigation>` to the root path of each tab, in tab order: `<Navigation stacks={["/home", "/discover", "/profile"]}>`. Each link then opens a new page in the current tab, wherever it points. Set `stack` on `<Navigation>` to the stack the app opens in. With no `stack`, the page floats (its stack is `null`): it is outside every tab, so no tab is selected until the user taps a tab, or the app names a stack. Deep links and login pages float. `/` is a normal stack root, so a Home tab can be `/`. A login page calls `nav.replace("/home", "/home")` to send the user into the Home tab.
|
|
926
926
|
6. **Use the new buttons (optional).**
|
|
927
927
|
- `<StackButton stack="/home">` is a tab bar button. It goes to the page you left in that tab, goes back to the tab's root when you are already in it, and scrolls to the top at the root.
|
|
928
928
|
- `<BackButton href="/home"/>` goes back to the page before this one in the current tab, or to `href` when there is none.
|
package/docs/llms-full.txt
CHANGED
|
@@ -1084,7 +1084,7 @@ If every file in that list is in the right place, the client and server share on
|
|
|
1084
1084
|
- `<RouteConfig path>` kept a page mounted for its tabs (for example `/dave/{tab}`). Instead, add `className="replace"` to each in-page tab link: `<Button href="/dave/posts" className="replace">Posts</Button>`. A replace keeps the same page mounted, with no slide and no new history entry.
|
|
1085
1085
|
- `<RouteConfig cache={false}>` unmounted a create form when you left it. Instead, clear the form after a successful submit: change the `key` of the `<Form>`, or call `form.reset()` on a plain HTML form. See `<RouteCache>` for an example.
|
|
1086
1086
|
4. **Canonical URLs.** `<Head>` no longer writes browser history itself. When a page renders a `<Head>` with a `url` that is not the current URL, `<Head>` calls `NavigationStore.replace()`. You do not need to change anything, but do not also call `window.history.replaceState()` for it.
|
|
1087
|
-
5. **Add stacks (optional).** For an app with a tab bar, set `stacks` on `<Navigation>` to the root path of each tab, in tab order: `<Navigation stacks={["/home", "/discover", "/profile"]}>`. Each link then opens a new page in the current tab, wherever it points. Set `stack` on `<Navigation>` to the stack the app opens in. With no `stack`, the
|
|
1087
|
+
5. **Add stacks (optional).** For an app with a tab bar, set `stacks` on `<Navigation>` to the root path of each tab, in tab order: `<Navigation stacks={["/home", "/discover", "/profile"]}>`. Each link then opens a new page in the current tab, wherever it points. Set `stack` on `<Navigation>` to the stack the app opens in. With no `stack`, the page floats (its stack is `null`): it is outside every tab, so no tab is selected until the user taps a tab, or the app names a stack. Deep links and login pages float. `/` is a normal stack root, so a Home tab can be `/`. A login page calls `nav.replace("/home", "/home")` to send the user into the Home tab.
|
|
1088
1088
|
6. **Use the new buttons (optional).**
|
|
1089
1089
|
- `<StackButton stack="/home">` is a tab bar button. It goes to the page you left in that tab, goes back to the tab's root when you are already in it, and scrolls to the top at the root.
|
|
1090
1090
|
- `<BackButton href="/home"/>` goes back to the page before this one in the current tab, or to `href` when there is none.
|
|
@@ -33314,7 +33314,7 @@ The back button for a page header. It goes back to the page before this one in t
|
|
|
33314
33314
|
**Things to know:**
|
|
33315
33315
|
|
|
33316
33316
|
- It goes to the page before this one in the current stack. If you opened a post from a search, it goes back to the search.
|
|
33317
|
-
- It goes to `href` when the stack has no page before this one: for example, when the app was opened at this page. So a back button always has somewhere to go. Set `href` to the page's natural parent. On
|
|
33317
|
+
- It goes to `href` when the stack has no page before this one: for example, when the app was opened at this page. So a back button always has somewhere to go. Set `href` to the page's natural parent. On a floating page (for example a deep link), it goes to `href` and stays floating. To go into a stack, the user taps a `<StackButton>`.
|
|
33318
33318
|
- It is a plain link with `className="back"`. `<Navigation>` turns a click into `NavigationStore.back()`, so the page slides back. A middle-click opens the link in a new browser tab.
|
|
33319
33319
|
- Its default content is a `<LeftIcon>` and its default `title` is "Back". Pass `children` and `title` to change them.
|
|
33320
33320
|
- It takes the usual `<Button>` props, except `onClick`.
|
|
@@ -33393,7 +33393,7 @@ Props for `<Navigation>`: the initial `Meta` (url, root and stack), the `stacks`
|
|
|
33393
33393
|
```ts
|
|
33394
33394
|
{
|
|
33395
33395
|
readonly stacks?: readonly AbsolutePath[] | undefined;
|
|
33396
|
-
readonly stack?: AbsolutePath | undefined;
|
|
33396
|
+
readonly stack?: AbsolutePath | null | undefined;
|
|
33397
33397
|
}
|
|
33398
33398
|
```
|
|
33399
33399
|
|
|
@@ -33401,8 +33401,8 @@ Props for `<Navigation>`: the initial `Meta` (url, root and stack), the `stacks`
|
|
|
33401
33401
|
|
|
33402
33402
|
| Property | Type | Description |
|
|
33403
33403
|
| --- | --- | --- |
|
|
33404
|
-
| `stacks` | `readonly AbsolutePath[] \| undefined` | Root path of each stack, in tab order, for an app with a tab bar (for example `["/home", "/discover", "/profile"]`). - Each stack keeps its own pages, so each tab remembers where you left it, and a back button goes back within its tab. -
|
|
33405
|
-
| `stack` | `AbsolutePath \| undefined` | Stack of the page the app opens at (for example `"/home"`), like `url` and `root`. - Read from this prop, else from the surrounding `<Meta>`, else `
|
|
33404
|
+
| `stacks` | `readonly AbsolutePath[] \| undefined` | Root path of each stack, in tab order, for an app with a tab bar (for example `["/home", "/discover", "/profile"]`). - Each stack keeps its own pages, so each tab remembers where you left it, and a back button goes back within its tab. - A page outside these stacks is floating: its stack is `null`, and no tab is selected. - With no stacks, every page floats. Read only. Optional. |
|
|
33405
|
+
| `stack` | `AbsolutePath \| null \| undefined` | Stack of the page the app opens at (for example `"/home"`), like `url` and `root`. - Read from this prop, else from the surrounding `<Meta>`, else `null` (floating). - Used only when the opening history entry has no saved stack. A reload keeps the stack it had. Read only. Optional. |
|
|
33406
33406
|
|
|
33407
33407
|
|
|
33408
33408
|
---
|
|
@@ -33434,7 +33434,7 @@ Give it `stacks` for an app with a tab bar. Each stack is one tab with its own h
|
|
|
33434
33434
|
- It publishes each page change inside `startTransition()` with a `"forward"` or `"back"` transition type, so a `<Transition>` such as `<HorizontalTransition>` slides the page. A replace has no transition.
|
|
33435
33435
|
- The browser back and forward buttons slide too. Inside a stack the direction comes from the depth of the page. Across stacks it comes from tab order.
|
|
33436
33436
|
- When the browser already animated the change (for example a swipe-back on a phone), there is no view transition, so the page does not slide twice.
|
|
33437
|
-
- It publishes `stack` (the root of the current stack) into `<Meta>` beside `url`, so any component can read the current tab with `requireMeta().stack`.
|
|
33437
|
+
- It publishes `stack` (the root of the current stack) into `<Meta>` beside `url`, so any component can read the current tab with `requireMeta().stack`. On a floating page (outside every stack) `stack` is `null`. With no `stacks`, every page floats.
|
|
33438
33438
|
- It reads the start URL and root from the surrounding `<Meta>`, so set `url` and `root` on an ancestor `<App>` or `<HTML>`. In the browser the URL falls back to `window.location.href`.
|
|
33439
33439
|
- `<Router>` works with no `<Navigation>` (server renders, static renders, tests). `<Navigation>` only makes the URL live on the client.
|
|
33440
33440
|
|
|
@@ -33507,7 +33507,7 @@ const stack = STACKS.find(s => path === s || path.startsWith(`${s}/`));
|
|
|
33507
33507
|
|
|
33508
33508
|
Put the transition **outside** `<RouteCache>`, around the whole cache. Safari (iOS 18) loses the exit animation when each page has its own `<ViewTransition>`.
|
|
33509
33509
|
|
|
33510
|
-
The app opens in the `stack` you set on `<Navigation>` (or on the surrounding `<Meta>`, like `url` and `root`), else
|
|
33510
|
+
The app opens in the `stack` you set on `<Navigation>` (or on the surrounding `<Meta>`, like `url` and `root`), else the page **floats**: its stack is `null`. A floating page, such as a deep link or a login page, is outside every tab: no tab is selected, and links from it stay floating until you tap a tab or name a stack (for example `nav.replace("/home", "/home")` after a login). `/` is a normal stack root, so a Home tab at `/` is never mixed up with floating pages. See `NavigationStore`.
|
|
33511
33511
|
|
|
33512
33512
|
Each link pushes a new page onto the current stack, wherever it points. So a link from `/home` to `/profile/settings` opens the settings page in the Home tab, and the Profile tab stays where it was. Tap a `<StackButton>` to change tab.
|
|
33513
33513
|
|
|
@@ -33556,8 +33556,8 @@ Navigation({ children, stacks = [], ...meta }: NavigationProps): ReactElement
|
|
|
33556
33556
|
| Param | Type | Description |
|
|
33557
33557
|
| --- | --- | --- |
|
|
33558
33558
|
| `meta` | `NavigationProps` | |
|
|
33559
|
-
| `.stacks` | `readonly AbsolutePath[] \| undefined` | Root path of each stack, in tab order, for an app with a tab bar (for example `["/home", "/discover", "/profile"]`). - Each stack keeps its own pages, so each tab remembers where you left it, and a back button goes back within its tab. -
|
|
33560
|
-
| `.stack` | `AbsolutePath \| undefined` | Stack of the page the app opens at (for example `"/home"`), like `url` and `root`. - Read from this prop, else from the surrounding `<Meta>`, else `
|
|
33559
|
+
| `.stacks` | `readonly AbsolutePath[] \| undefined` | Root path of each stack, in tab order, for an app with a tab bar (for example `["/home", "/discover", "/profile"]`). - Each stack keeps its own pages, so each tab remembers where you left it, and a back button goes back within its tab. - A page outside these stacks is floating: its stack is `null`, and no tab is selected. - With no stacks, every page floats. Read only. Optional. |
|
|
33560
|
+
| `.stack` | `AbsolutePath \| null \| undefined` | Stack of the page the app opens at (for example `"/home"`), like `url` and `root`. - Read from this prop, else from the surrounding `<Meta>`, else `null` (floating). - Used only when the opening history entry has no saved stack. A reload keeps the stack it had. Read only. Optional. |
|
|
33561
33561
|
|
|
33562
33562
|
## Returns
|
|
33563
33563
|
|
|
@@ -33635,7 +33635,7 @@ State that `NavigationStore` saves on each browser history entry.
|
|
|
33635
33635
|
|
|
33636
33636
|
```ts
|
|
33637
33637
|
{
|
|
33638
|
-
readonly stack: AbsolutePath;
|
|
33638
|
+
readonly stack: AbsolutePath | null;
|
|
33639
33639
|
readonly depth: number;
|
|
33640
33640
|
}
|
|
33641
33641
|
```
|
|
@@ -33644,7 +33644,7 @@ State that `NavigationStore` saves on each browser history entry.
|
|
|
33644
33644
|
|
|
33645
33645
|
| Property | Type | Description |
|
|
33646
33646
|
| --- | --- | --- |
|
|
33647
|
-
| `stack` | `AbsolutePath` | Root path of the stack this page is in. Read only. |
|
|
33647
|
+
| `stack` | `AbsolutePath \| null` | Root path of the stack this page is in, or `null` for a floating page. Read only. |
|
|
33648
33648
|
| `depth` | `number` | Position of this page in its stack, where `0` is the root. Read only. |
|
|
33649
33649
|
|
|
33650
33650
|
|
|
@@ -33663,7 +33663,7 @@ Where the app is now in its stacks: the current stack and depth, the top depth o
|
|
|
33663
33663
|
|
|
33664
33664
|
```ts
|
|
33665
33665
|
{
|
|
33666
|
-
readonly tops:
|
|
33666
|
+
readonly tops: ReadonlyMap<AbsolutePath | null, number>;
|
|
33667
33667
|
readonly parent: AbsolutePath | undefined;
|
|
33668
33668
|
}
|
|
33669
33669
|
```
|
|
@@ -33672,7 +33672,7 @@ Where the app is now in its stacks: the current stack and depth, the top depth o
|
|
|
33672
33672
|
|
|
33673
33673
|
| Property | Type | Description |
|
|
33674
33674
|
| --- | --- | --- |
|
|
33675
|
-
| `tops` | `
|
|
33675
|
+
| `tops` | `ReadonlyMap<AbsolutePath \| null, number>` | Depth of the top page of each stack that has pages, including the floating stack (`null`). Read only. |
|
|
33676
33676
|
| `parent` | `AbsolutePath \| undefined` | The page before the current one in its stack, or `undefined` at the bottom of the stack. Read only. |
|
|
33677
33677
|
|
|
33678
33678
|
|
|
@@ -33688,7 +33688,9 @@ Store that holds the current navigation URL, drives browser history, and keeps a
|
|
|
33688
33688
|
|
|
33689
33689
|
- Extends `URLStore`, so its `value` is the current URL.
|
|
33690
33690
|
- With the browser Navigation API, each history entry saves a `NavigationEntryState`, and each stack is read from `navigation.entries()` when it is needed. Nothing else is kept.
|
|
33691
|
-
- `stack` is a sub-store that holds the root of the current stack. It only changes when the stack changes.
|
|
33691
|
+
- `stack` is a sub-store that holds the root of the current stack, or `null` for a floating page. It only changes when the stack changes.
|
|
33692
|
+
- A page outside the listed stacks is floating: its stack is `null`. The floating stack has no root page and no tab.
|
|
33693
|
+
- In a listed stack, depth `0` is always the stack's root path.
|
|
33692
33694
|
- Without the Navigation API (older browsers and server renders) there are no stacks: `stack` stays the starting stack, `history()` is empty, and `stack` arguments are ignored.
|
|
33693
33695
|
- Owned by `<Navigation>`. Read it with `requireNavigation()`.
|
|
33694
33696
|
|
|
@@ -33696,9 +33698,11 @@ The store that holds the current URL, drives browser history, and keeps one stac
|
|
|
33696
33698
|
|
|
33697
33699
|
**Things to know:**
|
|
33698
33700
|
|
|
33699
|
-
- `NavigationStore.stacks` is the root path of each stack, in tab order, from the `stacks` prop on `<Navigation>`.
|
|
33700
|
-
- A page that is not in a listed stack is **
|
|
33701
|
-
-
|
|
33701
|
+
- `NavigationStore.stacks` is the root path of each stack, in tab order, from the `stacks` prop on `<Navigation>`. `/` is a normal stack root, like any other path.
|
|
33702
|
+
- A page that is not in a listed stack is **floating**: its stack is `null`. See [Floating pages](#floating-pages).
|
|
33703
|
+
- In a listed stack, depth `0` is always the stack's root path. A deeper page always has the root below it.
|
|
33704
|
+
- `NavigationStore.stack` is a sub-store that holds the root of the current stack, or `null` on a floating page. It changes only when the stack changes, so `useStore(nav.stack)` re-renders only on a tab change.
|
|
33705
|
+
- `NavigationStore.path` is the current path relative to the app root, without its `?query`.
|
|
33702
33706
|
- `NavigationStore.history()` returns the pages in the current stack (or a given stack), root first.
|
|
33703
33707
|
- `NavigationStore.position` is the current stack and depth, the depth of the top page of each stack, and the page before this one. `<RouteCache>` and `<BackButton>` use it.
|
|
33704
33708
|
- All URLs resolve against the store's `base`. Each method also takes a full same-origin URL.
|
|
@@ -33713,17 +33717,23 @@ The store that holds the current URL, drives browser history, and keeps one stac
|
|
|
33713
33717
|
| `replace(href, stack?)` | Changes the URL of the current page. The stack, the depth and the mounted page stay the same. No new history entry. With another `stack`, the page moves into that stack: at its root if `href` is the root, else on top of its pages. | None |
|
|
33714
33718
|
| `history(stack?)` | Returns the pages in `stack`, root first. | — |
|
|
33715
33719
|
|
|
33716
|
-
`stack` defaults to the current stack.
|
|
33720
|
+
`stack` defaults to the current stack. Pass `null` to name the floating stack.
|
|
33721
|
+
|
|
33722
|
+
## Floating pages
|
|
33723
|
+
|
|
33724
|
+
A page changes stack only when you say so: with a `<StackButton>`, or with a `stack` argument to `forward()`, `back()` or `replace()`. Links never change stack. The page the app opens at starts in the `stack` set on `<Navigation>` (or the surrounding `<Meta>`), else it **floats**: its stack is `null`. For example: a deep link into the app, a fresh open of `/post/9`, or a login page.
|
|
33717
33725
|
|
|
33718
|
-
|
|
33726
|
+
- The floating stack is outside every tab. It has no root page and no `<StackButton>`, so no stack button is selected on a floating page.
|
|
33727
|
+
- Links from a floating page push deeper in the floating stack, even a link to a stack root.
|
|
33728
|
+
- To leave the floating stack, tap a `<StackButton>`, or name the stack. To move a page back into it, pass `null` as the `stack`.
|
|
33729
|
+
- `<RouteCache>` gives floating pages no protection: they are dropped like any other page past `maxCached`.
|
|
33730
|
+
- With no `stacks`, every page floats.
|
|
33719
33731
|
|
|
33720
|
-
|
|
33732
|
+
## Opening the app
|
|
33721
33733
|
|
|
33722
|
-
- On an unstacked page, no `<StackButton>` is selected.
|
|
33723
|
-
- Links from an unstacked page push deeper in the `/` stack, even a link to a stack root.
|
|
33724
|
-
- To leave the `/` stack, tap a `<StackButton>`, or name the stack.
|
|
33725
33734
|
- To select a tab when the app starts, set `stack` on `<Navigation>`. The app decides which stack the opening URL belongs to. After a reload, each history entry keeps the stack it had.
|
|
33726
|
-
-
|
|
33735
|
+
- A deep page the app opens at, in a listed stack, starts at depth 1, so the stack root is its parent. A `<StackButton>` or a back gesture then goes to the root. A stack root starts at depth 0.
|
|
33736
|
+
- A `stack` that is not in `stacks` is ignored: the page floats.
|
|
33727
33737
|
|
|
33728
33738
|
For example, a login page sends the user home after they log in, and names the Home stack:
|
|
33729
33739
|
|
|
@@ -33797,7 +33807,7 @@ nav.forward("/home/post/1");
|
|
|
33797
33807
|
## Signatures
|
|
33798
33808
|
|
|
33799
33809
|
```ts
|
|
33800
|
-
new NavigationStore(url: PossibleURL = typeof window === "undefined" ? "/" : window.location.href, base?: PossibleURL, stack: AbsolutePath =
|
|
33810
|
+
new NavigationStore(url: PossibleURL = typeof window === "undefined" ? "/" : window.location.href, base?: PossibleURL, stack: AbsolutePath | null = null, ...stacks: AbsolutePath[])
|
|
33801
33811
|
```
|
|
33802
33812
|
|
|
33803
33813
|
## Parameters
|
|
@@ -33806,7 +33816,7 @@ new NavigationStore(url: PossibleURL = typeof window === "undefined" ? "/" : win
|
|
|
33806
33816
|
| --- | --- | --- |
|
|
33807
33817
|
| `url` | `PossibleURL` | Defaults to `typeof window === "undefined" ? "/" : window.location.href`. |
|
|
33808
33818
|
| `base` | `PossibleURL` | Optional. |
|
|
33809
|
-
| `stack` | `AbsolutePath` | Defaults to `
|
|
33819
|
+
| `stack` | `AbsolutePath \| null` | Defaults to `null`. |
|
|
33810
33820
|
| `stacks` | `AbsolutePath[]` | |
|
|
33811
33821
|
|
|
33812
33822
|
## Returns
|
|
@@ -33819,9 +33829,10 @@ new NavigationStore(url: PossibleURL = typeof window === "undefined" ? "/" : win
|
|
|
33819
33829
|
|
|
33820
33830
|
| Property | Type | Description |
|
|
33821
33831
|
| --- | --- | --- |
|
|
33822
|
-
| `stacks` | `readonly AbsolutePath[]` | Root path of each stack, in tab order.
|
|
33823
|
-
| `stack` | `Store<AbsolutePath>` | Root path of the current stack
|
|
33832
|
+
| `stacks` | `readonly AbsolutePath[]` | Root path of each stack, in tab order. With none, every page floats. Read only. |
|
|
33833
|
+
| `stack` | `Store<AbsolutePath \| null>` | Root path of the current stack, or `null` for a floating page. - It starts at the `stack` given to the constructor (default `null`). Without the Navigation API, it stays there. Read only. |
|
|
33824
33834
|
| `transition` | `TransitionType \| null` | Transition type of the most recent change, read by `<Navigation>` when the value changes. - `null` means no transition: a replace, a change the browser already animated (for example a swipe-back), or no Navigation API. Defaults to `null`. |
|
|
33835
|
+
| `path` | `AbsolutePath \| undefined` | Path of the current URL relative to the app root (without its `?query`), or `undefined` if the URL is outside the app. Read only. |
|
|
33825
33836
|
| `position` | `NavigationPosition \| undefined` | Where the app is now: the current stack and depth, and the top depth of each stack. Read only. |
|
|
33826
33837
|
|
|
33827
33838
|
## Methods
|
|
@@ -33860,13 +33871,14 @@ listen(): () => void
|
|
|
33860
33871
|
|
|
33861
33872
|
Get the pages in a stack, root first, or every page in every stack.
|
|
33862
33873
|
- Read from the browser history entries up to the current one.
|
|
33863
|
-
- A stack whose root entry is
|
|
33874
|
+
- A listed stack whose root entry is not in the history (a deep link, or the browser keeps a limited history) still starts with its root.
|
|
33875
|
+
- The floating stack (`null`) has no root, so it starts with its oldest page.
|
|
33864
33876
|
- Without the Navigation API this is always empty.
|
|
33865
33877
|
|
|
33866
33878
|
## Signatures
|
|
33867
33879
|
|
|
33868
33880
|
```ts
|
|
33869
|
-
history(stack: AbsolutePath = this.stack.value): AbsolutePath[]
|
|
33881
|
+
history(stack: AbsolutePath | null = this.stack.value): AbsolutePath[]
|
|
33870
33882
|
```
|
|
33871
33883
|
|
|
33872
33884
|
|
|
@@ -33886,7 +33898,7 @@ Go forward to a URL, as a link does.
|
|
|
33886
33898
|
## Signatures
|
|
33887
33899
|
|
|
33888
33900
|
```ts
|
|
33889
|
-
forward(possible: PossibleURL, stack: AbsolutePath = this.stack.value): void
|
|
33901
|
+
forward(possible: PossibleURL, stack: AbsolutePath | null = this.stack.value): void
|
|
33890
33902
|
```
|
|
33891
33903
|
|
|
33892
33904
|
|
|
@@ -33906,7 +33918,7 @@ Go back to a URL, as a back button does.
|
|
|
33906
33918
|
## Signatures
|
|
33907
33919
|
|
|
33908
33920
|
```ts
|
|
33909
|
-
back(possible: PossibleURL, stack: AbsolutePath = this.stack.value): void
|
|
33921
|
+
back(possible: PossibleURL, stack: AbsolutePath | null = this.stack.value): void
|
|
33910
33922
|
```
|
|
33911
33923
|
|
|
33912
33924
|
|
|
@@ -33925,7 +33937,7 @@ Replace the current URL, with no transition.
|
|
|
33925
33937
|
## Signatures
|
|
33926
33938
|
|
|
33927
33939
|
```ts
|
|
33928
|
-
replace(possible: PossibleURL, stack: AbsolutePath = this.stack.value): void
|
|
33940
|
+
replace(possible: PossibleURL, stack: AbsolutePath | null = this.stack.value): void
|
|
33929
33941
|
```
|
|
33930
33942
|
|
|
33931
33943
|
|
|
@@ -33951,7 +33963,7 @@ Props for `<RouteCache>`: the `maxCached` size and the content `children` to kee
|
|
|
33951
33963
|
|
|
33952
33964
|
| Property | Type | Description |
|
|
33953
33965
|
| --- | --- | --- |
|
|
33954
|
-
| `maxCached` | `number \| undefined` | Number of pages to keep mounted (but hidden), so the whole state of each one (scroll position, toggles, searches, form input, focus) is still there when you come back to it. - The top page of each stack
|
|
33966
|
+
| `maxCached` | `number \| undefined` | Number of pages to keep mounted (but hidden), so the whole state of each one (scroll position, toggles, searches, form input, focus) is still there when you come back to it. - The root page and the top page of each listed stack are never dropped, even past the limit, so a tab always shows the page you left and always has its root below. - Floating pages get no such protection. - Set to `0` (or less) to turn the cache off and unmount each page as you leave it. Read only. Defaults to `10`. |
|
|
33955
33967
|
| `children` | `ReactNode` | The content to render for the current page and keep alive (hidden) for the other pages in the stacks. Read only. |
|
|
33956
33968
|
|
|
33957
33969
|
|
|
@@ -33968,8 +33980,9 @@ Keep-alive page cache for the pages in the navigation stacks. Put it in a layout
|
|
|
33968
33980
|
- Keeps each page in the stacks mounted but hidden (with React's `<Activity>`), so going back to a page, or switching back to a tab, shows it exactly as you left it.
|
|
33969
33981
|
- Each page is keyed by its stack and its depth in that stack, not by its URL. So `NavigationStore.replace()` (a canonical URL, an in-page tab) keeps the same page mounted, and the same URL open in two tabs is two separate pages.
|
|
33970
33982
|
- A page leaves the cache as soon as it leaves its stack: when you go back from it, or when a stack is popped to its root. After a browser back, a browser forward shows that page fresh.
|
|
33971
|
-
- The top page of each stack
|
|
33972
|
-
-
|
|
33983
|
+
- The root page and the top page of each listed stack are never dropped. Other pages, and every floating page, can be dropped past `maxCached`, and show fresh (from the top) when you come back to them.
|
|
33984
|
+
- When the current page is deeper than its stack's root and the root page is not cached (for example after a deep link), the root page is rendered hidden, so a swipe-back can show it.
|
|
33985
|
+
- Each kept page is frozen under its own `<MetaContext>` and `NavigationPositionContext`, so the same `children` element renders a different page for each URL, and a hidden page never re-renders for another page's URL.
|
|
33973
33986
|
- `<Activity mode="hidden">` keeps a hidden page's state but unmounts its effects, so its subscriptions and timers pause and resume as it is hidden and shown.
|
|
33974
33987
|
- Without the browser Navigation API (older browsers, server renders), or with `maxCached` of `0`, it renders the current page directly with no cache.
|
|
33975
33988
|
|
|
@@ -33982,11 +33995,12 @@ Layouts do not include a cache. The app composes it, so it can also choose the t
|
|
|
33982
33995
|
- Each page is keyed by its stack and its depth in that stack, not by its URL. See `NavigationStore` for how stacks work.
|
|
33983
33996
|
- A page leaves the cache when it leaves its stack: when you go back from it, or when its stack goes back to the root. So a page you went back from mounts fresh the next time you open it.
|
|
33984
33997
|
- After a browser back, the browser forward button shows the next page fresh (from the top), because that page left its stack when you went back.
|
|
33985
|
-
- The top page of each stack
|
|
33998
|
+
- The root page and the top page of each listed stack are never dropped, so each tab always shows the page you left, and always has its root below. Other pages, and every floating page, are dropped (least recently used first) past `maxCached`, and mount fresh when you come back to them.
|
|
33999
|
+
- When the current page is deeper than its stack's root and the root page is not cached (for example after a deep link), the cache renders the root page hidden, so a swipe-back can show it. A hidden page runs no effects until it is shown.
|
|
33986
34000
|
- `NavigationStore.replace()` and `className="replace"` links keep the same page mounted. A replace to another URL for the same component (for example from `/post/1` to `/post/2`) keeps its state. To reset the state, wrap the page content in an element with a `key`, for example `<Fragment key={id}>`.
|
|
33987
34001
|
- The same URL open in two stacks is two separate pages.
|
|
33988
34002
|
- A form that makes something stays in the cache with its input. Clear it after a successful submit, so it is empty the next time you see it (see the example below).
|
|
33989
|
-
- Each kept page is frozen under its own `<Meta
|
|
34003
|
+
- Each kept page is frozen under its own `<Meta>` and `NavigationPositionContext`, so a hidden page never re-renders for another page's URL.
|
|
33990
34004
|
- `<Activity mode="hidden">` keeps a hidden page's state but unmounts its effects, so subscriptions, observers (for example infinite scroll) and timers pause and resume as the page is hidden and shown.
|
|
33991
34005
|
- **Nesting:** layout, then transition, then `<RouteCache>`, then `<Scroll vertical cover>`, then `<PageLoader>`, then `<Router>`. See the usage below.
|
|
33992
34006
|
- The scroll box goes **inside** the cache, so each kept page has its own scroll box and keeps its own scroll position. A scroll box outside the cache is shared by every page, so pages lose their scroll.
|
|
@@ -34059,7 +34073,7 @@ RouteCache({ maxCached = 10, children }: RouteCacheProps): ReactNode
|
|
|
34059
34073
|
| Param | Type | Description |
|
|
34060
34074
|
| --- | --- | --- |
|
|
34061
34075
|
| `props` | `RouteCacheProps` | |
|
|
34062
|
-
| `.maxCached` | `number \| undefined` | Number of pages to keep mounted (but hidden), so the whole state of each one (scroll position, toggles, searches, form input, focus) is still there when you come back to it. - The top page of each stack
|
|
34076
|
+
| `.maxCached` | `number \| undefined` | Number of pages to keep mounted (but hidden), so the whole state of each one (scroll position, toggles, searches, form input, focus) is still there when you come back to it. - The root page and the top page of each listed stack are never dropped, even past the limit, so a tab always shows the page you left and always has its root below. - Floating pages get no such protection. - Set to `0` (or less) to turn the cache off and unmount each page as you leave it. Read only. Defaults to `10`. |
|
|
34063
34077
|
| `.children` | `ReactNode` | The content to render for the current page and keep alive (hidden) for the other pages in the stacks. Read only. |
|
|
34064
34078
|
|
|
34065
34079
|
## Returns
|
|
@@ -34424,8 +34438,8 @@ Props for `<StackButton>`: the `stack` it opens, plus the usual `Button` props e
|
|
|
34424
34438
|
|
|
34425
34439
|
Button for one stack in a tab bar.
|
|
34426
34440
|
- Tap another stack's button: go to the page you left in that stack. The page slides left or right by tab order.
|
|
34427
|
-
- Tap the current stack's button: go back to its root.
|
|
34428
|
-
- Tap it again
|
|
34441
|
+
- Tap the current stack's button: go back to its root path.
|
|
34442
|
+
- Tap it again on the root path: scroll the page to the top.
|
|
34429
34443
|
- It is selected while its stack is the current stack.
|
|
34430
34444
|
- Without the browser Navigation API (and in a server render) it is a plain link to the stack's root.
|
|
34431
34445
|
|
|
@@ -34434,9 +34448,9 @@ A button for one stack in a tab bar. It acts like a tab button in a phone app.
|
|
|
34434
34448
|
**Things to know:**
|
|
34435
34449
|
|
|
34436
34450
|
- Tap another stack's button: go to the page you left in that stack. The page slides left or right, by tab order.
|
|
34437
|
-
- Tap the current stack's button: go back to the root of the stack. The page slides back.
|
|
34438
|
-
- Tap it again
|
|
34439
|
-
- It is selected (`aria-current`) while its stack is the current stack. On
|
|
34451
|
+
- Tap the current stack's button: go back to the root path of the stack. The page slides back. If the root is not in the history (for example after a deep link), it opens the root.
|
|
34452
|
+
- Tap it again on the root path: scroll the page to the top. It scrolls the window, and each visible `<main>` or `[data-scroll]` element.
|
|
34453
|
+
- It is selected (`aria-current`) while its stack is the current stack. On a floating page (for example a deep link or a login page), no stack button is selected.
|
|
34440
34454
|
- `stack` must be one of the `stacks` on `<Navigation>`.
|
|
34441
34455
|
- It takes the usual `<Button>` props, except `href`, `onClick` and `selected`.
|
|
34442
34456
|
- Without the browser Navigation API, and in a server render, it is a plain link to the stack's root. It is selected while its stack is the starting stack.
|
|
@@ -38884,7 +38898,7 @@ Combined meta data for a website page — title, URLs, description, CSP, tags, l
|
|
|
38884
38898
|
{
|
|
38885
38899
|
readonly root?: ImmutableURL | undefined;
|
|
38886
38900
|
readonly url?: ImmutableURL | undefined;
|
|
38887
|
-
readonly stack?: AbsolutePath | undefined;
|
|
38901
|
+
readonly stack?: AbsolutePath | null | undefined;
|
|
38888
38902
|
readonly app?: string | undefined;
|
|
38889
38903
|
readonly title?: string | undefined;
|
|
38890
38904
|
readonly description?: string | undefined;
|
|
@@ -38905,7 +38919,7 @@ Combined meta data for a website page — title, URLs, description, CSP, tags, l
|
|
|
38905
38919
|
| --- | --- | --- |
|
|
38906
38920
|
| `root` | `ImmutableURL \| undefined` | Base URL for the app (used to resolve `url` and set as `<base>` tag in `<Head>`). Read only. Optional. |
|
|
38907
38921
|
| `url` | `ImmutableURL \| undefined` | URL of the current page (used as the initial URL for routing, and as the page's canonical URL in `<Head>`). Read only. Optional. |
|
|
38908
|
-
| `stack` | `AbsolutePath \| undefined` | Root path of the current stack (for example `"/home"`). Set it above `<Navigation>` to choose the stack the app opens in. `<Navigation>` publishes the live stack, which is `
|
|
38922
|
+
| `stack` | `AbsolutePath \| null \| undefined` | Root path of the current stack (for example `"/home"`). Set it above `<Navigation>` to choose the stack the app opens in. `<Navigation>` publishes the live stack, which is `null` for a floating page. Read only. Optional. |
|
|
38909
38923
|
| `app` | `string \| undefined` | Title of the entire application. Read only. Optional. |
|
|
38910
38924
|
| `title` | `string \| undefined` | Title of the current page (set as `<title>` in `<Head>` Read only. Optional. |
|
|
38911
38925
|
| `description` | `string \| undefined` | Description of the current page. Read only. Optional. |
|
|
@@ -39051,7 +39065,7 @@ mergeMeta(meta1: Meta, meta2: PossibleMeta, caller: AnyCaller = mergeMeta): Meta
|
|
|
39051
39065
|
| `meta1` | `Meta` | The existing fully-resolved `Meta` to merge into. |
|
|
39052
39066
|
| `.root` | `ImmutableURL \| undefined` | Base URL for the app (used to resolve `url` and set as `<base>` tag in `<Head>`). Read only. Optional. |
|
|
39053
39067
|
| `.url` | `ImmutableURL \| undefined` | URL of the current page (used as the initial URL for routing, and as the page's canonical URL in `<Head>`). Read only. Optional. |
|
|
39054
|
-
| `.stack` | `AbsolutePath \| undefined` | Root path of the current stack (for example `"/home"`). Set it above `<Navigation>` to choose the stack the app opens in. `<Navigation>` publishes the live stack, which is `
|
|
39068
|
+
| `.stack` | `AbsolutePath \| null \| undefined` | Root path of the current stack (for example `"/home"`). Set it above `<Navigation>` to choose the stack the app opens in. `<Navigation>` publishes the live stack, which is `null` for a floating page. Read only. Optional. |
|
|
39055
39069
|
| `.app` | `string \| undefined` | Title of the entire application. Read only. Optional. |
|
|
39056
39070
|
| `.title` | `string \| undefined` | Title of the current page (set as `<title>` in `<Head>` Read only. Optional. |
|
|
39057
39071
|
| `.description` | `string \| undefined` | Description of the current page. Read only. Optional. |
|
package/docs/ui/BackButton.md
CHANGED
|
@@ -13,7 +13,7 @@ The back button for a page header. It goes back to the page before this one in t
|
|
|
13
13
|
**Things to know:**
|
|
14
14
|
|
|
15
15
|
- It goes to the page before this one in the current stack. If you opened a post from a search, it goes back to the search.
|
|
16
|
-
- It goes to `href` when the stack has no page before this one: for example, when the app was opened at this page. So a back button always has somewhere to go. Set `href` to the page's natural parent. On
|
|
16
|
+
- It goes to `href` when the stack has no page before this one: for example, when the app was opened at this page. So a back button always has somewhere to go. Set `href` to the page's natural parent. On a floating page (for example a deep link), it goes to `href` and stays floating. To go into a stack, the user taps a `<StackButton>`.
|
|
17
17
|
- It is a plain link with `className="back"`. `<Navigation>` turns a click into `NavigationStore.back()`, so the page slides back. A middle-click opens the link in a new browser tab.
|
|
18
18
|
- Its default content is a `<LeftIcon>` and its default `title` is "Back". Pass `children` and `title` to change them.
|
|
19
19
|
- It takes the usual `<Button>` props, except `onClick`.
|
package/docs/ui/Meta.md
CHANGED
|
@@ -11,7 +11,7 @@ Combined meta data for a website page — title, URLs, description, CSP, tags, l
|
|
|
11
11
|
{
|
|
12
12
|
readonly root?: ImmutableURL | undefined;
|
|
13
13
|
readonly url?: ImmutableURL | undefined;
|
|
14
|
-
readonly stack?: AbsolutePath | undefined;
|
|
14
|
+
readonly stack?: AbsolutePath | null | undefined;
|
|
15
15
|
readonly app?: string | undefined;
|
|
16
16
|
readonly title?: string | undefined;
|
|
17
17
|
readonly description?: string | undefined;
|
|
@@ -32,7 +32,7 @@ Combined meta data for a website page — title, URLs, description, CSP, tags, l
|
|
|
32
32
|
| --- | --- | --- |
|
|
33
33
|
| `root` | `ImmutableURL \| undefined` | Base URL for the app (used to resolve `url` and set as `<base>` tag in `<Head>`). Read only. Optional. |
|
|
34
34
|
| `url` | `ImmutableURL \| undefined` | URL of the current page (used as the initial URL for routing, and as the page's canonical URL in `<Head>`). Read only. Optional. |
|
|
35
|
-
| `stack` | `AbsolutePath \| undefined` | Root path of the current stack (for example `"/home"`). Set it above `<Navigation>` to choose the stack the app opens in. `<Navigation>` publishes the live stack, which is `
|
|
35
|
+
| `stack` | `AbsolutePath \| null \| undefined` | Root path of the current stack (for example `"/home"`). Set it above `<Navigation>` to choose the stack the app opens in. `<Navigation>` publishes the live stack, which is `null` for a floating page. Read only. Optional. |
|
|
36
36
|
| `app` | `string \| undefined` | Title of the entire application. Read only. Optional. |
|
|
37
37
|
| `title` | `string \| undefined` | Title of the current page (set as `<title>` in `<Head>` Read only. Optional. |
|
|
38
38
|
| `description` | `string \| undefined` | Description of the current page. Read only. Optional. |
|
package/docs/ui/Navigation.md
CHANGED
|
@@ -25,7 +25,7 @@ Give it `stacks` for an app with a tab bar. Each stack is one tab with its own h
|
|
|
25
25
|
- It publishes each page change inside `startTransition()` with a `"forward"` or `"back"` transition type, so a `<Transition>` such as `<HorizontalTransition>` slides the page. A replace has no transition.
|
|
26
26
|
- The browser back and forward buttons slide too. Inside a stack the direction comes from the depth of the page. Across stacks it comes from tab order.
|
|
27
27
|
- When the browser already animated the change (for example a swipe-back on a phone), there is no view transition, so the page does not slide twice.
|
|
28
|
-
- It publishes `stack` (the root of the current stack) into `<Meta>` beside `url`, so any component can read the current tab with `requireMeta().stack`.
|
|
28
|
+
- It publishes `stack` (the root of the current stack) into `<Meta>` beside `url`, so any component can read the current tab with `requireMeta().stack`. On a floating page (outside every stack) `stack` is `null`. With no `stacks`, every page floats.
|
|
29
29
|
- It reads the start URL and root from the surrounding `<Meta>`, so set `url` and `root` on an ancestor `<App>` or `<HTML>`. In the browser the URL falls back to `window.location.href`.
|
|
30
30
|
- `<Router>` works with no `<Navigation>` (server renders, static renders, tests). `<Navigation>` only makes the URL live on the client.
|
|
31
31
|
|
|
@@ -98,7 +98,7 @@ const stack = STACKS.find(s => path === s || path.startsWith(`${s}/`));
|
|
|
98
98
|
|
|
99
99
|
Put the transition **outside** `<RouteCache>`, around the whole cache. Safari (iOS 18) loses the exit animation when each page has its own `<ViewTransition>`.
|
|
100
100
|
|
|
101
|
-
The app opens in the `stack` you set on `<Navigation>` (or on the surrounding `<Meta>`, like `url` and `root`), else
|
|
101
|
+
The app opens in the `stack` you set on `<Navigation>` (or on the surrounding `<Meta>`, like `url` and `root`), else the page **floats**: its stack is `null`. A floating page, such as a deep link or a login page, is outside every tab: no tab is selected, and links from it stay floating until you tap a tab or name a stack (for example `nav.replace("/home", "/home")` after a login). `/` is a normal stack root, so a Home tab at `/` is never mixed up with floating pages. See `NavigationStore`.
|
|
102
102
|
|
|
103
103
|
Each link pushes a new page onto the current stack, wherever it points. So a link from `/home` to `/profile/settings` opens the settings page in the Home tab, and the Profile tab stays where it was. Tap a `<StackButton>` to change tab.
|
|
104
104
|
|
|
@@ -147,8 +147,8 @@ Navigation({ children, stacks = [], ...meta }: NavigationProps): ReactElement
|
|
|
147
147
|
| Param | Type | Description |
|
|
148
148
|
| --- | --- | --- |
|
|
149
149
|
| `meta` | `NavigationProps` | |
|
|
150
|
-
| `.stacks` | `readonly AbsolutePath[] \| undefined` | Root path of each stack, in tab order, for an app with a tab bar (for example `["/home", "/discover", "/profile"]`). - Each stack keeps its own pages, so each tab remembers where you left it, and a back button goes back within its tab. -
|
|
151
|
-
| `.stack` | `AbsolutePath \| undefined` | Stack of the page the app opens at (for example `"/home"`), like `url` and `root`. - Read from this prop, else from the surrounding `<Meta>`, else `
|
|
150
|
+
| `.stacks` | `readonly AbsolutePath[] \| undefined` | Root path of each stack, in tab order, for an app with a tab bar (for example `["/home", "/discover", "/profile"]`). - Each stack keeps its own pages, so each tab remembers where you left it, and a back button goes back within its tab. - A page outside these stacks is floating: its stack is `null`, and no tab is selected. - With no stacks, every page floats. Read only. Optional. |
|
|
151
|
+
| `.stack` | `AbsolutePath \| null \| undefined` | Stack of the page the app opens at (for example `"/home"`), like `url` and `root`. - Read from this prop, else from the surrounding `<Meta>`, else `null` (floating). - Used only when the opening history entry has no saved stack. A reload keeps the stack it had. Read only. Optional. |
|
|
152
152
|
|
|
153
153
|
## Returns
|
|
154
154
|
|
|
@@ -9,7 +9,7 @@ State that `NavigationStore` saves on each browser history entry.
|
|
|
9
9
|
|
|
10
10
|
```ts
|
|
11
11
|
{
|
|
12
|
-
readonly stack: AbsolutePath;
|
|
12
|
+
readonly stack: AbsolutePath | null;
|
|
13
13
|
readonly depth: number;
|
|
14
14
|
}
|
|
15
15
|
```
|
|
@@ -18,5 +18,5 @@ State that `NavigationStore` saves on each browser history entry.
|
|
|
18
18
|
|
|
19
19
|
| Property | Type | Description |
|
|
20
20
|
| --- | --- | --- |
|
|
21
|
-
| `stack` | `AbsolutePath` | Root path of the stack this page is in. Read only. |
|
|
21
|
+
| `stack` | `AbsolutePath \| null` | Root path of the stack this page is in, or `null` for a floating page. Read only. |
|
|
22
22
|
| `depth` | `number` | Position of this page in its stack, where `0` is the root. Read only. |
|
|
@@ -11,7 +11,7 @@ Where the app is now in its stacks: the current stack and depth, the top depth o
|
|
|
11
11
|
|
|
12
12
|
```ts
|
|
13
13
|
{
|
|
14
|
-
readonly tops:
|
|
14
|
+
readonly tops: ReadonlyMap<AbsolutePath | null, number>;
|
|
15
15
|
readonly parent: AbsolutePath | undefined;
|
|
16
16
|
}
|
|
17
17
|
```
|
|
@@ -20,5 +20,5 @@ Where the app is now in its stacks: the current stack and depth, the top depth o
|
|
|
20
20
|
|
|
21
21
|
| Property | Type | Description |
|
|
22
22
|
| --- | --- | --- |
|
|
23
|
-
| `tops` | `
|
|
23
|
+
| `tops` | `ReadonlyMap<AbsolutePath \| null, number>` | Depth of the top page of each stack that has pages, including the floating stack (`null`). Read only. |
|
|
24
24
|
| `parent` | `AbsolutePath \| undefined` | The page before the current one in its stack, or `undefined` at the bottom of the stack. Read only. |
|
|
@@ -11,7 +11,7 @@ Props for `<Navigation>`: the initial `Meta` (url, root and stack), the `stacks`
|
|
|
11
11
|
```ts
|
|
12
12
|
{
|
|
13
13
|
readonly stacks?: readonly AbsolutePath[] | undefined;
|
|
14
|
-
readonly stack?: AbsolutePath | undefined;
|
|
14
|
+
readonly stack?: AbsolutePath | null | undefined;
|
|
15
15
|
}
|
|
16
16
|
```
|
|
17
17
|
|
|
@@ -19,5 +19,5 @@ Props for `<Navigation>`: the initial `Meta` (url, root and stack), the `stacks`
|
|
|
19
19
|
|
|
20
20
|
| Property | Type | Description |
|
|
21
21
|
| --- | --- | --- |
|
|
22
|
-
| `stacks` | `readonly AbsolutePath[] \| undefined` | Root path of each stack, in tab order, for an app with a tab bar (for example `["/home", "/discover", "/profile"]`). - Each stack keeps its own pages, so each tab remembers where you left it, and a back button goes back within its tab. -
|
|
23
|
-
| `stack` | `AbsolutePath \| undefined` | Stack of the page the app opens at (for example `"/home"`), like `url` and `root`. - Read from this prop, else from the surrounding `<Meta>`, else `
|
|
22
|
+
| `stacks` | `readonly AbsolutePath[] \| undefined` | Root path of each stack, in tab order, for an app with a tab bar (for example `["/home", "/discover", "/profile"]`). - Each stack keeps its own pages, so each tab remembers where you left it, and a back button goes back within its tab. - A page outside these stacks is floating: its stack is `null`, and no tab is selected. - With no stacks, every page floats. Read only. Optional. |
|
|
23
|
+
| `stack` | `AbsolutePath \| null \| undefined` | Stack of the page the app opens at (for example `"/home"`), like `url` and `root`. - Read from this prop, else from the surrounding `<Meta>`, else `null` (floating). - Used only when the opening history entry has no saved stack. A reload keeps the stack it had. Read only. Optional. |
|
|
@@ -5,11 +5,12 @@
|
|
|
5
5
|
|
|
6
6
|
Get the pages in a stack, root first, or every page in every stack.
|
|
7
7
|
- Read from the browser history entries up to the current one.
|
|
8
|
-
- A stack whose root entry is
|
|
8
|
+
- A listed stack whose root entry is not in the history (a deep link, or the browser keeps a limited history) still starts with its root.
|
|
9
|
+
- The floating stack (`null`) has no root, so it starts with its oldest page.
|
|
9
10
|
- Without the Navigation API this is always empty.
|
|
10
11
|
|
|
11
12
|
## Signatures
|
|
12
13
|
|
|
13
14
|
```ts
|
|
14
|
-
history(stack: AbsolutePath = this.stack.value): AbsolutePath[]
|
|
15
|
+
history(stack: AbsolutePath | null = this.stack.value): AbsolutePath[]
|
|
15
16
|
```
|