shelving 1.320.0 → 1.321.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 +26 -0
- package/docs/llms-full.txt +629 -257
- package/docs/ui/BackButton.md +75 -0
- package/docs/ui/BackButtonProps.md +21 -0
- package/docs/ui/ClickableProps.md +0 -2
- package/docs/ui/Head.md +2 -2
- package/docs/ui/HorizontalTransition.md +1 -1
- package/docs/ui/LinkClickable.md +0 -1
- package/docs/ui/Meta.md +3 -1
- package/docs/ui/Navigation.md +93 -37
- package/docs/ui/NavigationEntryState.md +22 -0
- package/docs/ui/NavigationPosition.md +24 -0
- package/docs/ui/NavigationPositionContext.md +8 -0
- package/docs/ui/NavigationProps.md +12 -2
- package/docs/ui/NavigationStore/back.md +6 -4
- package/docs/ui/NavigationStore/forward.md +6 -2
- package/docs/ui/NavigationStore/history.md +15 -0
- package/docs/ui/NavigationStore/listen.md +14 -0
- package/docs/ui/NavigationStore/replace.md +15 -0
- package/docs/ui/NavigationStore.md +100 -19
- package/docs/ui/RouteCache.md +72 -36
- package/docs/ui/RouteCacheProps.md +3 -3
- package/docs/ui/Router.md +4 -2
- package/docs/ui/StackButton.md +64 -0
- package/docs/ui/StackButtonProps.md +21 -0
- package/docs/ui/VerticalTransition.md +1 -1
- package/docs/ui/mergeMeta.md +2 -1
- package/docs/ui.md +13 -10
- package/package.json +1 -1
- package/ui/button/Clickable.d.ts +1 -3
- package/ui/button/Clickable.js +2 -2
- package/ui/button/Clickable.tsx +0 -4
- package/ui/page/Head.d.ts +2 -2
- package/ui/page/Head.js +9 -8
- package/ui/page/Head.tsx +8 -6
- package/ui/router/BackButton.d.ts +22 -0
- package/ui/router/BackButton.js +19 -0
- package/ui/router/BackButton.md +47 -0
- package/ui/router/BackButton.tsx +34 -0
- package/ui/router/Navigation.d.ts +22 -12
- package/ui/router/Navigation.js +67 -51
- package/ui/router/Navigation.md +84 -27
- package/ui/router/Navigation.test.tsx +27 -7
- package/ui/router/Navigation.tsx +90 -53
- package/ui/router/NavigationContext.d.ts +9 -1
- package/ui/router/NavigationContext.js +9 -0
- package/ui/router/NavigationContext.tsx +11 -1
- package/ui/router/NavigationStore.d.ts +126 -19
- package/ui/router/NavigationStore.js +301 -30
- package/ui/router/NavigationStore.md +82 -9
- package/ui/router/NavigationStore.test.ts +384 -0
- package/ui/router/NavigationStore.tsx +347 -30
- package/ui/router/RouteCache.d.ts +15 -22
- package/ui/router/RouteCache.js +36 -47
- package/ui/router/RouteCache.md +59 -16
- package/ui/router/RouteCache.tsx +55 -62
- package/ui/router/Router.d.ts +2 -1
- package/ui/router/Router.js +9 -14
- package/ui/router/Router.md +2 -1
- package/ui/router/Router.tsx +9 -20
- package/ui/router/StackButton.d.ts +24 -0
- package/ui/router/StackButton.js +35 -0
- package/ui/router/StackButton.md +34 -0
- package/ui/router/StackButton.tsx +44 -0
- package/ui/router/index.d.ts +2 -2
- package/ui/router/index.js +2 -2
- package/ui/router/index.ts +2 -2
- package/ui/transition/HorizontalTransition.md +1 -1
- package/ui/transition/VerticalTransition.md +1 -1
- package/ui/util/meta.d.ts +4 -1
- package/ui/util/meta.ts +4 -1
- package/docs/ui/NavigationStore/redirect.md +0 -12
- package/docs/ui/RouteConfig.md +0 -75
- package/docs/ui/RouteConfigProps.md +0 -24
- package/docs/ui/RouteContext.md +0 -6
- package/docs/ui/RouteState.md +0 -30
- package/ui/router/RouteConfig.d.ts +0 -28
- package/ui/router/RouteConfig.js +0 -30
- package/ui/router/RouteConfig.md +0 -42
- package/ui/router/RouteConfig.tsx +0 -44
- package/ui/router/RouteContext.d.ts +0 -22
- package/ui/router/RouteContext.js +0 -8
- package/ui/router/RouteContext.tsx +0 -26
|
@@ -4,46 +4,120 @@
|
|
|
4
4
|
- Import: `import { NavigationStore } from "shelving/ui";`
|
|
5
5
|
- Extends: `URLStore`
|
|
6
6
|
|
|
7
|
-
Store
|
|
7
|
+
Store that holds the current navigation URL, drives browser history, and keeps a stack of pages for each tab.
|
|
8
8
|
|
|
9
|
-
- Extends `URLStore
|
|
10
|
-
-
|
|
11
|
-
- `
|
|
12
|
-
-
|
|
9
|
+
- Extends `URLStore`, so its `value` is the current URL.
|
|
10
|
+
- 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.
|
|
11
|
+
- `stack` is a sub-store that holds the root of the current stack. It only changes when the stack changes.
|
|
12
|
+
- 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.
|
|
13
|
+
- Owned by `<Navigation>`. Read it with `requireNavigation()`.
|
|
13
14
|
|
|
14
|
-
The store
|
|
15
|
+
The store that holds the current URL, drives browser history, and keeps one stack of pages for each tab. It extends `URLStore`, so its `value` is the current URL. `<Navigation>` owns it. Read it with `requireNavigation()`, and do not make your own.
|
|
15
16
|
|
|
16
17
|
**Things to know:**
|
|
17
18
|
|
|
18
|
-
- `
|
|
19
|
-
-
|
|
20
|
-
-
|
|
19
|
+
- `NavigationStore.stacks` is the root path of each stack, in tab order, from the `stacks` prop on `<Navigation>`. With no stacks the app has one stack at `/`.
|
|
20
|
+
- A page that is not in a listed stack is **unstacked**: it is in the `/` stack. See [Unstacked pages](#unstacked-pages).
|
|
21
|
+
- `NavigationStore.stack` is a sub-store that holds the root of the current stack. It is always set: with no stacks it is `"/"`. It changes only when the stack changes, so `useStore(nav.stack)` re-renders only on a tab change.
|
|
22
|
+
- `NavigationStore.history()` returns the pages in the current stack (or a given stack), root first.
|
|
23
|
+
- `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.
|
|
24
|
+
- All URLs resolve against the store's `base`. Each method also takes a full same-origin URL.
|
|
25
|
+
- Without the browser Navigation API there is no stack history: `stack` stays the starting stack, `history()` returns `[]`, `position` is `undefined`, and every `stack` argument is ignored. `forward()` and `back()` push a history entry, and `replace()` replaces it.
|
|
26
|
+
|
|
27
|
+
## Methods
|
|
28
|
+
|
|
29
|
+
| Method | What it does | Slide |
|
|
30
|
+
|---|---|---|
|
|
31
|
+
| `forward(href, stack?)` | Opens `href` as a new page on top of the stack. If `href` is the top page of another stack, it switches to that stack (a tab switch). If `href` is the current URL, it is a replace. | Forward. Across stacks, by tab order. |
|
|
32
|
+
| `back(href, stack?)` | Goes back to `href`. If `href` is in the stack, the stack goes back to it, and the pages above it leave the stack. If `href` is the root of the stack, the stack goes to its root. Otherwise `href` takes the place of the top page of the stack. | Back |
|
|
33
|
+
| `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 |
|
|
34
|
+
| `history(stack?)` | Returns the pages in `stack`, root first. | — |
|
|
35
|
+
|
|
36
|
+
`stack` defaults to the current stack.
|
|
37
|
+
|
|
38
|
+
## Unstacked pages
|
|
39
|
+
|
|
40
|
+
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 in the `/` stack. A page in the `/` stack is **unstacked**. For example: a deep link into the app, a fresh open of `/post/9`, or a login page.
|
|
41
|
+
|
|
42
|
+
- On an unstacked page, no `<StackButton>` is selected.
|
|
43
|
+
- Links from an unstacked page push deeper in the `/` stack, even a link to a stack root.
|
|
44
|
+
- To leave the `/` stack, tap a `<StackButton>`, or name the stack.
|
|
45
|
+
- 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.
|
|
46
|
+
- If you list `/` as one of the `stacks`, it is a normal tab, and unstacked pages open in it.
|
|
47
|
+
|
|
48
|
+
For example, a login page sends the user home after they log in, and names the Home stack:
|
|
49
|
+
|
|
50
|
+
```tsx
|
|
51
|
+
const nav = requireNavigation();
|
|
52
|
+
nav.replace("/home", "/home");
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## How stacks work
|
|
56
|
+
|
|
57
|
+
The store saves a small state on each browser history entry: the `stack` the page is in, and its `depth` in that stack (`0` is the root). See `NavigationEntryState`. To read a stack, the store walks back through the browser history from the current entry. It takes the newest entry in that stack, then the newest earlier entry with a lower depth, and so on down to depth `0`.
|
|
58
|
+
|
|
59
|
+
Why depth? A browser history entry cannot be changed or removed. So when you go back in one stack while another stack's pages are after it in the history, the store cannot go back in the browser. It pushes a new entry for the page you went back to, at that page's depth. The pages that were above it now have a higher depth than the newest entry, so they are no longer in the stack.
|
|
60
|
+
|
|
61
|
+
For example, with tabs `/home` and `/profile`:
|
|
62
|
+
|
|
63
|
+
| Step | New history entry | Home stack | Profile stack |
|
|
64
|
+
|---|---|---|---|
|
|
65
|
+
| Start at `/home` | `/home` (depth 0) | `/home` | — |
|
|
66
|
+
| Open a post | `/home/post/1` (depth 1) | `/home`, `/home/post/1` | — |
|
|
67
|
+
| Tap the Profile tab | `/profile` (depth 0) | `/home`, `/home/post/1` | `/profile` |
|
|
68
|
+
| Tap the Home tab | `/home/post/1` (depth 1) | `/home`, `/home/post/1` | `/profile` |
|
|
69
|
+
| Tap the back button | `/home` (depth 0) | `/home` | `/profile` |
|
|
70
|
+
|
|
71
|
+
When the page you go back to is the entry just before the current one, `back()` goes back in the browser history and pushes nothing.
|
|
72
|
+
|
|
73
|
+
The browser back and forward buttons walk the history entries one at a time, as usual. Each entry knows its stack and depth, so the stacks are always right and the slide goes the right way.
|
|
21
74
|
|
|
22
75
|
## Usage
|
|
23
76
|
|
|
24
77
|
```tsx
|
|
25
|
-
import { requireNavigation } from "shelving/ui";
|
|
78
|
+
import { Button, requireNavigation } from "shelving/ui";
|
|
26
79
|
|
|
27
80
|
function LogoutButton() {
|
|
28
81
|
const nav = requireNavigation();
|
|
29
|
-
return <Button onClick={() => nav.
|
|
82
|
+
return <Button onClick={() => nav.replace("/login")}>Log out</Button>;
|
|
30
83
|
}
|
|
31
84
|
```
|
|
32
85
|
|
|
33
|
-
|
|
86
|
+
Read the current stack in a component:
|
|
87
|
+
|
|
88
|
+
```tsx
|
|
89
|
+
import { useStore } from "shelving/react";
|
|
90
|
+
import { requireNavigation } from "shelving/ui";
|
|
91
|
+
|
|
92
|
+
function TabTitle() {
|
|
93
|
+
const nav = requireNavigation();
|
|
94
|
+
const stack = useStore(nav.stack).value;
|
|
95
|
+
return <h1>{stack === "/profile" ? "Profile" : "Home"}</h1>;
|
|
96
|
+
}
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
List the pages in a stack (for example, for breadcrumbs):
|
|
100
|
+
|
|
101
|
+
```tsx
|
|
102
|
+
const nav = requireNavigation();
|
|
103
|
+
nav.history("/home"); // ["/home", "/home/post/1", "/home/post/1/comments"]
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
Make a store by hand only in tests:
|
|
34
107
|
|
|
35
108
|
```tsx
|
|
36
109
|
import { NavigationStore } from "shelving/ui";
|
|
37
110
|
|
|
38
|
-
|
|
39
|
-
nav
|
|
111
|
+
// URL, root, starting stack, then the stacks in tab order.
|
|
112
|
+
const nav = new NavigationStore("https://example.com/home", "https://example.com/", "/home", "/home", "/profile");
|
|
113
|
+
nav.forward("/home/post/1");
|
|
40
114
|
```
|
|
41
115
|
|
|
42
116
|
|
|
43
117
|
## Signatures
|
|
44
118
|
|
|
45
119
|
```ts
|
|
46
|
-
new NavigationStore(url: PossibleURL = typeof window === "undefined" ? "/" : window.location.href, base?: PossibleURL)
|
|
120
|
+
new NavigationStore(url: PossibleURL = typeof window === "undefined" ? "/" : window.location.href, base?: PossibleURL, stack: AbsolutePath = "/", ...stacks: AbsolutePath[])
|
|
47
121
|
```
|
|
48
122
|
|
|
49
123
|
## Parameters
|
|
@@ -52,6 +126,8 @@ new NavigationStore(url: PossibleURL = typeof window === "undefined" ? "/" : win
|
|
|
52
126
|
| --- | --- | --- |
|
|
53
127
|
| `url` | `PossibleURL` | Defaults to `typeof window === "undefined" ? "/" : window.location.href`. |
|
|
54
128
|
| `base` | `PossibleURL` | Optional. |
|
|
129
|
+
| `stack` | `AbsolutePath` | Defaults to `"/"`. |
|
|
130
|
+
| `stacks` | `AbsolutePath[]` | |
|
|
55
131
|
|
|
56
132
|
## Returns
|
|
57
133
|
|
|
@@ -63,10 +139,15 @@ new NavigationStore(url: PossibleURL = typeof window === "undefined" ? "/" : win
|
|
|
63
139
|
|
|
64
140
|
| Property | Type | Description |
|
|
65
141
|
| --- | --- | --- |
|
|
66
|
-
| `
|
|
142
|
+
| `stacks` | `readonly AbsolutePath[]` | Root path of each stack, in tab order. A single-stack app has one root. Read only. |
|
|
143
|
+
| `stack` | `Store<AbsolutePath>` | Root path of the current stack. - Always set. With no `stacks`, it is `"/"`. - It starts at the `stack` given to the constructor (default `"/"`). Without the Navigation API, it stays there. Read only. |
|
|
144
|
+
| `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`. |
|
|
145
|
+
| `position` | `NavigationPosition \| undefined` | Where the app is now: the current stack and depth, and the top depth of each stack. Read only. |
|
|
67
146
|
|
|
68
147
|
## Methods
|
|
69
148
|
|
|
70
|
-
- [NavigationStore.
|
|
71
|
-
- [NavigationStore.
|
|
72
|
-
- [NavigationStore.
|
|
149
|
+
- [NavigationStore.listen()](NavigationStore/listen.md): Start listening to the browser (back, forward and swipe).
|
|
150
|
+
- [NavigationStore.history()](NavigationStore/history.md): Get the pages in a stack, root first, or every page in every stack.
|
|
151
|
+
- [NavigationStore.forward()](NavigationStore/forward.md): Go forward to a URL, as a link does.
|
|
152
|
+
- [NavigationStore.back()](NavigationStore/back.md): Go back to a URL, as a back button does.
|
|
153
|
+
- [NavigationStore.replace()](NavigationStore/replace.md): Replace the current URL, with no transition.
|
package/docs/ui/RouteCache.md
CHANGED
|
@@ -3,50 +3,86 @@
|
|
|
3
3
|
- Kind: component
|
|
4
4
|
- Import: `import { RouteCache } from "shelving/ui";`
|
|
5
5
|
|
|
6
|
-
Keep-alive page cache
|
|
7
|
-
|
|
8
|
-
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
-
|
|
12
|
-
-
|
|
13
|
-
-
|
|
14
|
-
-
|
|
15
|
-
|
|
16
|
-
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
scroll position of every cached page is preserved — surrounding chrome (sidebar, drawer state) stays
|
|
20
|
-
outside the cache, so it is neither duplicated nor remounted on navigation.
|
|
21
|
-
- When `maxCached <= 0` the page is rendered directly with no caching (it unmounts as you leave it).
|
|
22
|
-
|
|
23
|
-
A keep-alive page cache. Drop it into a layout around its scrolling content region: it reads the current URL from the surrounding `<Meta>` context and keeps a handful of recently-visited pages mounted but *hidden* (using React's [`<Activity>`](https://react.dev/reference/react/Activity)), so navigating back or forward to a page restores its entire DOM and component state — scroll position of every scroll container, open/closed toggles, in-progress searches, form inputs, focus — instead of remounting it fresh at the top.
|
|
24
|
-
|
|
25
|
-
Shelving's `<SidebarLayout>` and `<CenteredLayout>` already wrap their scrollable content column in one for you, so pages rendered inside them keep their state across navigation automatically. Reach for it by hand only when building a custom layout.
|
|
6
|
+
Keep-alive page cache for the pages in the navigation stacks. Drop it into a layout around its scrolling content region.
|
|
7
|
+
|
|
8
|
+
- 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.
|
|
9
|
+
- 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.
|
|
10
|
+
- 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.
|
|
11
|
+
- The top page of each stack is never dropped. Other pages can be dropped past `maxCached`, and show fresh (from the top) when you come back to them.
|
|
12
|
+
- Each kept page is frozen under its own `<MetaContext>`, so the same `children` element renders a different page for each URL, and a hidden page never re-renders for another page's URL.
|
|
13
|
+
- `<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.
|
|
14
|
+
- Without the browser Navigation API (older browsers, server renders), or with `maxCached` of `0`, it renders the current page directly with no cache.
|
|
15
|
+
|
|
16
|
+
A keep-alive cache for the pages in the navigation stacks. Put it in a layout around the scrolling content region. It keeps each page in the stacks mounted but hidden (with React's [`<Activity>`](https://react.dev/reference/react/Activity)), so when you go back to a page, or switch back to a tab, the page is exactly as you left it: scroll position, toggles, searches, form input and focus.
|
|
17
|
+
|
|
18
|
+
`<SidebarLayout>` and `<CenteredLayout>` already wrap their content in a `<RouteCache>`. Use it by hand only in a custom layout.
|
|
26
19
|
|
|
27
20
|
**Things to know:**
|
|
28
21
|
|
|
29
|
-
-
|
|
30
|
-
- A page
|
|
31
|
-
-
|
|
32
|
-
- The
|
|
33
|
-
-
|
|
34
|
-
-
|
|
35
|
-
-
|
|
36
|
-
-
|
|
22
|
+
- Each page is keyed by its stack and its depth in that stack, not by its URL. See `NavigationStore` for how stacks work.
|
|
23
|
+
- 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.
|
|
24
|
+
- 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.
|
|
25
|
+
- The top page of each stack is never dropped, so each tab always shows the page you left. Other pages are dropped (least recently used first) past `maxCached`, and mount fresh when you come back to them.
|
|
26
|
+
- `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}>`.
|
|
27
|
+
- The same URL open in two stacks is two separate pages.
|
|
28
|
+
- 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).
|
|
29
|
+
- Each kept page is frozen under its own `<Meta>`, so a hidden page never re-renders for another page's URL.
|
|
30
|
+
- `<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.
|
|
31
|
+
- The cache must wrap the scroll container itself to keep each page's scroll. So it goes in the layout around the scrolling column, not inside the router. Chrome outside the cache (a sidebar, a tab bar) is not duplicated or remounted.
|
|
32
|
+
- Put a page `<Transition>` around the `<RouteCache>`, not inside it. Safari (iOS 18) loses the exit animation when each page has its own `<ViewTransition>`.
|
|
33
|
+
- Without the browser Navigation API, or with `maxCached={0}`, there is no cache: the current page renders directly and unmounts when you leave it.
|
|
37
34
|
|
|
38
35
|
## Usage
|
|
39
36
|
|
|
40
37
|
```tsx
|
|
41
|
-
import { RouteCache } from "shelving/ui";
|
|
38
|
+
import { HorizontalTransition, RouteCache, Router } from "shelving/ui";
|
|
39
|
+
|
|
40
|
+
function MyLayout() {
|
|
41
|
+
return (
|
|
42
|
+
<HorizontalTransition>
|
|
43
|
+
<RouteCache>
|
|
44
|
+
<main className="scroll">
|
|
45
|
+
<Router routes={ROUTES}/>
|
|
46
|
+
</main>
|
|
47
|
+
</RouteCache>
|
|
48
|
+
</HorizontalTransition>
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
Keep fewer pages:
|
|
42
54
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
</SidebarLayout>
|
|
55
|
+
```tsx
|
|
56
|
+
<RouteCache maxCached={5}>
|
|
57
|
+
<Router routes={ROUTES}/>
|
|
58
|
+
</RouteCache>
|
|
48
59
|
```
|
|
49
60
|
|
|
61
|
+
Clear a create form after it saves. Change the `key` of the `<Form>`, so it mounts again with no input:
|
|
62
|
+
|
|
63
|
+
```tsx
|
|
64
|
+
import { useState } from "react";
|
|
65
|
+
import { Form, requireNavigation } from "shelving/ui";
|
|
66
|
+
|
|
67
|
+
function NewPostPage() {
|
|
68
|
+
const nav = requireNavigation();
|
|
69
|
+
const [formKey, setFormKey] = useState(0);
|
|
70
|
+
return (
|
|
71
|
+
<Form
|
|
72
|
+
key={formKey}
|
|
73
|
+
schema={POST_SCHEMA}
|
|
74
|
+
onSubmit={async data => {
|
|
75
|
+
const id = await createPost(data);
|
|
76
|
+
setFormKey(k => k + 1);
|
|
77
|
+
nav.forward(`/post/${id}`);
|
|
78
|
+
}}
|
|
79
|
+
/>
|
|
80
|
+
);
|
|
81
|
+
}
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
For a plain HTML `<form>`, call `form.reset()` after the submit.
|
|
85
|
+
|
|
50
86
|
|
|
51
87
|
## Signatures
|
|
52
88
|
|
|
@@ -59,8 +95,8 @@ RouteCache({ maxCached = 10, children }: RouteCacheProps): ReactNode
|
|
|
59
95
|
| Param | Type | Description |
|
|
60
96
|
| --- | --- | --- |
|
|
61
97
|
| `props` | `RouteCacheProps` | |
|
|
62
|
-
| `.maxCached` | `number \| undefined` | Number of
|
|
63
|
-
| `.children` | `ReactNode` | The content to render for the current
|
|
98
|
+
| `.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 is never dropped, even past the limit, so a tab always shows the page you left. - Set to `0` (or less) to turn the cache off and unmount each page as you leave it. Read only. Defaults to `10`. |
|
|
99
|
+
| `.children` | `ReactNode` | The content to render for the current page and keep alive (hidden) for the other pages in the stacks. Read only. |
|
|
64
100
|
|
|
65
101
|
## Returns
|
|
66
102
|
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
- Kind: interface
|
|
4
4
|
- Import: `import { RouteCacheProps } from "shelving/ui";`
|
|
5
5
|
|
|
6
|
-
Props for `<RouteCache
|
|
6
|
+
Props for `<RouteCache>`: the `maxCached` size and the content `children` to keep alive for each page in the stacks.
|
|
7
7
|
|
|
8
8
|
## Signatures
|
|
9
9
|
|
|
@@ -18,5 +18,5 @@ Props for `<RouteCache>` — the `maxCached` size and the content `children` to
|
|
|
18
18
|
|
|
19
19
|
| Property | Type | Description |
|
|
20
20
|
| --- | --- | --- |
|
|
21
|
-
| `maxCached` | `number \| undefined` | Number of
|
|
22
|
-
| `children` | `ReactNode` | The content to render for the current
|
|
21
|
+
| `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 is never dropped, even past the limit, so a tab always shows the page you left. - Set to `0` (or less) to turn the cache off and unmount each page as you leave it. Read only. Defaults to `10`. |
|
|
22
|
+
| `children` | `ReactNode` | The content to render for the current page and keep alive (hidden) for the other pages in the stacks. Read only. |
|
package/docs/ui/Router.md
CHANGED
|
@@ -8,7 +8,8 @@ Match the current URL against `routes` and render the matched element.
|
|
|
8
8
|
- When `base` is set, the effective path is the URL after stripping the base prefix.
|
|
9
9
|
- Nest by putting another `<Router>` inside a route's value; pass `base="/section"` (or wrap in `<Meta>`) to scope.
|
|
10
10
|
- Route `{placeholders}` are passed as props to function/component route values along with merged URL `?query` params. They are not published into context — descendants of a `ReactElement`-valued route can't see them automatically.
|
|
11
|
-
-
|
|
11
|
+
- Inside `<Navigation>` with the Navigation API, each page in a stack is a new page: a link mounts a new page, and `NavigationStore.replace()` keeps the same page mounted (it re-renders with the new URL). A replace that renders another component still mounts it fresh.
|
|
12
|
+
- Elsewhere, each path is a new page, so a component route remounts when the path changes.
|
|
12
13
|
- Returns `null` when there's no URL in context or the URL is outside the base.
|
|
13
14
|
|
|
14
15
|
A pure URL matcher: it reads the current URL from the surrounding `<Meta>` context, matches it against a `routes` table, and renders the matched element. It has no client requirements, so it works for SSR, static rendering, and tests with no `<Navigation>` at all — wrap it in `<Navigation>` on the client to get live URL updates.
|
|
@@ -19,6 +20,7 @@ A pure URL matcher: it reads the current URL from the surrounding `<Meta>` conte
|
|
|
19
20
|
- `<Router>` accepts `PossibleMeta` props (`url`, `base`, etc.) to override the surrounding context — this is how nested routers scope themselves.
|
|
20
21
|
- With a `base` set, the path used for matching is the URL after `matchURLPrefix()` strips the base prefix; URLs outside the base render as `null`.
|
|
21
22
|
- Pass `fallback` to control no-match behaviour. An explicit `null` renders nothing; leaving it `undefined` throws a `NotFoundError`.
|
|
23
|
+
- Inside `<Navigation>` with stacks, each page in a stack is a new page: a link mounts a new page, and `NavigationStore.replace()` keeps the same page mounted (it re-renders with the new URL). Elsewhere each path is a new page.
|
|
22
24
|
- `<Router>` itself does not cache pages — wrap it in a `<RouteCache>` (or use a layout that already does) to keep recently-visited pages mounted but hidden so back/forward navigation restores their state.
|
|
23
25
|
|
|
24
26
|
## Usage
|
|
@@ -133,7 +135,7 @@ const SIDEBARRED_ROUTES = {
|
|
|
133
135
|
|
|
134
136
|
### Keeping page state
|
|
135
137
|
|
|
136
|
-
By default a page is unmounted when you navigate away and mounted fresh when you return — so scroll position, open/closed toggles, in-progress searches, form inputs, and focus are all lost, and you land back at the top. Wrap the router (or its scrolling content region) in a `<RouteCache>` to keep recently-visited pages mounted but hidden so their state is
|
|
138
|
+
By default a page is unmounted when you navigate away and mounted fresh when you return — so scroll position, open/closed toggles, in-progress searches, form inputs, and focus are all lost, and you land back at the top. Wrap the router (or its scrolling content region) in a `<RouteCache>` to keep recently-visited pages mounted but hidden so their state is still there when you go back to them, or switch back to their tab. Shelving's `<SidebarLayout>` and `<CenteredLayout>` already do this for you.
|
|
137
139
|
|
|
138
140
|
### SSR / static rendering
|
|
139
141
|
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
# StackButton
|
|
2
|
+
|
|
3
|
+
- Kind: component
|
|
4
|
+
- Import: `import { StackButton } from "shelving/ui";`
|
|
5
|
+
|
|
6
|
+
Button for one stack in a tab bar.
|
|
7
|
+
- Tap another stack's button: go to the page you left in that stack. The page slides left or right by tab order.
|
|
8
|
+
- Tap the current stack's button: go back to its root.
|
|
9
|
+
- Tap it again at the root: scroll the page to the top.
|
|
10
|
+
- It is selected while its stack is the current stack.
|
|
11
|
+
- Without the browser Navigation API (and in a server render) it is a plain link to the stack's root.
|
|
12
|
+
|
|
13
|
+
A button for one stack in a tab bar. It acts like a tab button in a phone app.
|
|
14
|
+
|
|
15
|
+
**Things to know:**
|
|
16
|
+
|
|
17
|
+
- Tap another stack's button: go to the page you left in that stack. The page slides left or right, by tab order.
|
|
18
|
+
- Tap the current stack's button: go back to the root of the stack. The page slides back.
|
|
19
|
+
- Tap it again at the root: scroll the page to the top. It scrolls the window, and each visible `<main>` or `[data-scroll]` element.
|
|
20
|
+
- It is selected (`aria-current`) while its stack is the current stack. On an unstacked page (for example a deep link or a login page), no stack button is selected.
|
|
21
|
+
- `stack` must be one of the `stacks` on `<Navigation>`.
|
|
22
|
+
- It takes the usual `<Button>` props, except `href`, `onClick` and `selected`.
|
|
23
|
+
- 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.
|
|
24
|
+
- In a server-rendered app, the server renders a link and the browser renders a button, so React warns about a hydration mismatch on the first render. A client-only app (with `<App>`) has no mismatch.
|
|
25
|
+
|
|
26
|
+
## Usage
|
|
27
|
+
|
|
28
|
+
```tsx
|
|
29
|
+
import { Navigation, StackButton } from "shelving/ui";
|
|
30
|
+
import { HomeIcon, SearchIcon, UserIcon } from "./icons.js";
|
|
31
|
+
|
|
32
|
+
<Navigation stacks={["/home", "/discover", "/profile"]}>
|
|
33
|
+
{/* … */}
|
|
34
|
+
<nav className="tab-bar">
|
|
35
|
+
<StackButton stack="/home" title="Home"><HomeIcon/></StackButton>
|
|
36
|
+
<StackButton stack="/discover" title="Discover"><SearchIcon/></StackButton>
|
|
37
|
+
<StackButton stack="/profile" title="Profile"><UserIcon/></StackButton>
|
|
38
|
+
</nav>
|
|
39
|
+
</Navigation>
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## Styling
|
|
43
|
+
|
|
44
|
+
`<StackButton>` renders a `<Button>`, so it has the same styling hooks. See `<Button>`.
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
## Signatures
|
|
48
|
+
|
|
49
|
+
```ts
|
|
50
|
+
StackButton({ stack, ...props }: StackButtonProps): ReactElement
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## Parameters
|
|
54
|
+
|
|
55
|
+
| Param | Type | Description |
|
|
56
|
+
| --- | --- | --- |
|
|
57
|
+
| `props` | `StackButtonProps` | |
|
|
58
|
+
| `.stack` | `AbsolutePath` | Root path of the stack this button opens. It must be one of the `stacks` on `<Navigation>`. Read only. |
|
|
59
|
+
|
|
60
|
+
## Returns
|
|
61
|
+
|
|
62
|
+
| Type | Description |
|
|
63
|
+
| --- | --- |
|
|
64
|
+
| `ReactElement` | |
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# StackButtonProps
|
|
2
|
+
|
|
3
|
+
- Kind: interface
|
|
4
|
+
- Import: `import { StackButtonProps } from "shelving/ui";`
|
|
5
|
+
- Extends: `Omit<ButtonProps, "href" | "onClick" | "selected">`
|
|
6
|
+
|
|
7
|
+
Props for `<StackButton>`: the `stack` it opens, plus the usual `Button` props except `href` and `onClick`.
|
|
8
|
+
|
|
9
|
+
## Signatures
|
|
10
|
+
|
|
11
|
+
```ts
|
|
12
|
+
{
|
|
13
|
+
readonly stack: AbsolutePath;
|
|
14
|
+
}
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Properties
|
|
18
|
+
|
|
19
|
+
| Property | Type | Description |
|
|
20
|
+
| --- | --- | --- |
|
|
21
|
+
| `stack` | `AbsolutePath` | Root path of the stack this button opens. It must be one of the `stacks` on `<Navigation>`. Read only. |
|
|
@@ -10,7 +10,7 @@ A direction-aware `<Transition>` preset that slides its children vertically —
|
|
|
10
10
|
**Things to know:**
|
|
11
11
|
|
|
12
12
|
- Slides down by default and when the type is `"forward"`; slides up when the type is `"back"`.
|
|
13
|
-
- Inside `<Navigation>` the direction is automatic: a link click
|
|
13
|
+
- Inside `<Navigation>` the direction is automatic: a link click or `NavigationStore.forward()` sets the `"forward"` type, and a `className="back"` link or `NavigationStore.back()` sets `"back"`. The browser back and forward buttons set the type from the page's place in its stack. `NavigationStore.replace()` has no transition. Outside `<Navigation>`, set the direction with `setTransitionType("forward" | "back")` inside a `startTransition()` callback — see `<Transition>`.
|
|
14
14
|
- Pass `overlay` to raise the transition group above surrounding content during the animation (`z-index: 100`).
|
|
15
15
|
- The old and new content slide a full height apart, so they sit edge to edge and never overlap.
|
|
16
16
|
- The slide is clipped to the element's own box (`overflow: clip` on the group), so it does not paint over the content around it.
|
package/docs/ui/mergeMeta.md
CHANGED
|
@@ -22,7 +22,8 @@ mergeMeta(meta1: Meta, meta2: PossibleMeta, caller: AnyCaller = mergeMeta): Meta
|
|
|
22
22
|
| --- | --- | --- |
|
|
23
23
|
| `meta1` | `Meta` | The existing fully-resolved `Meta` to merge into. |
|
|
24
24
|
| `.root` | `ImmutableURL \| undefined` | Base URL for the app (used to resolve `url` and set as `<base>` tag in `<Head>`). Read only. Optional. |
|
|
25
|
-
| `.url` | `ImmutableURL \| undefined` | URL of the current page (used
|
|
25
|
+
| `.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. |
|
|
26
|
+
| `.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 `"/"` for an unstacked page. Read only. Optional. |
|
|
26
27
|
| `.app` | `string \| undefined` | Title of the entire application. Read only. Optional. |
|
|
27
28
|
| `.title` | `string \| undefined` | Title of the current page (set as `<title>` in `<Head>` Read only. Optional. |
|
|
28
29
|
| `.description` | `string \| undefined` | Description of the current page. Read only. Optional. |
|
package/docs/ui.md
CHANGED
|
@@ -193,13 +193,14 @@ The components below are listed in the index following this page; this is the sh
|
|
|
193
193
|
- [Empty](ui/Empty.md): Message for a list with nothing in it: centred, grey content with space around it.
|
|
194
194
|
- [Notice](ui/Notice.md): Block-level status callout with an icon and message, used to highlight feedback.
|
|
195
195
|
- [Notices](ui/Notices.md): Render the global list of notices and subscribe to incoming "notice" events.
|
|
196
|
-
- [Head](ui/Head.md): Emit the current page's head metadata and
|
|
196
|
+
- [Head](ui/Head.md): Emit the current page's head metadata, and replace the browser URL with the page's canonical URL.
|
|
197
197
|
- [HTML](ui/HTML.md): Render the full <html> document shell wrapping <head> and <body>.
|
|
198
198
|
- [Page](ui/Page.md): Wrap a single page (or screen) within an app, applying its meta and head tags.
|
|
199
|
-
- [
|
|
200
|
-
- [
|
|
201
|
-
- [
|
|
199
|
+
- [BackButton](ui/BackButton.md): Back button for the current stack.
|
|
200
|
+
- [Navigation](ui/Navigation.md): Top-level navigation provider, with one stack of pages for each tab.
|
|
201
|
+
- [RouteCache](ui/RouteCache.md): Keep-alive page cache for the pages in the navigation stacks. Drop it into a layout around its scrolling content region.
|
|
202
202
|
- [Router](ui/Router.md): Match the current URL against routes and render the matched element.
|
|
203
|
+
- [StackButton](ui/StackButton.md): Button for one stack in a tab bar.
|
|
203
204
|
- [Scroll](ui/Scroll.md): Wrap children in a scrollable container with horizontal and/or vertical scrolling enabled.
|
|
204
205
|
- [Cell](ui/Cell.md): Table cell.
|
|
205
206
|
- [Table](ui/Table.md): Table block — rendered as <table>.
|
|
@@ -321,7 +322,7 @@ The components below are listed in the index following this page; this is the sh
|
|
|
321
322
|
- [FormStore](ui/FormStore.md): Reactive store holding the current (possibly partial and invalid) value of a form, plus its field messages.
|
|
322
323
|
- [NoticesStore](ui/NoticesStore.md): Store holding the live list of NoticeStore notices currently shown.
|
|
323
324
|
- [NoticeStore](ui/NoticeStore.md): Store holding a single notice's content and status, owned by a NoticesStore.
|
|
324
|
-
- [NavigationStore](ui/NavigationStore.md): Store
|
|
325
|
+
- [NavigationStore](ui/NavigationStore.md): Store that holds the current navigation URL, drives browser history, and keeps a stack of pages for each tab.
|
|
325
326
|
|
|
326
327
|
## Interfaces
|
|
327
328
|
|
|
@@ -455,11 +456,13 @@ The components below are listed in the index following this page; this is the sh
|
|
|
455
456
|
- [NoticesProps](ui/NoticesProps.md): Props for <Notices> — the place for the list, and flex styling variants for the notices container.
|
|
456
457
|
- [HTMLProps](ui/HTMLProps.md): Props for <HTML> — initial Meta (language/root/app) plus the page children.
|
|
457
458
|
- [PageProps](ui/PageProps.md): Props for <Page> — per-page Meta (title, description, etc.) plus the page children.
|
|
458
|
-
- [
|
|
459
|
-
- [
|
|
460
|
-
- [
|
|
461
|
-
- [
|
|
459
|
+
- [BackButtonProps](ui/BackButtonProps.md): Props for <BackButton>: the href to go back to when the stack has no page before this one, plus the usual Button props except onClick.
|
|
460
|
+
- [NavigationProps](ui/NavigationProps.md): Props for <Navigation>: the initial Meta (url, root and stack), the stacks, and optional children.
|
|
461
|
+
- [NavigationEntryState](ui/NavigationEntryState.md): State that NavigationStore saves on each browser history entry.
|
|
462
|
+
- [NavigationPosition](ui/NavigationPosition.md): Where the app is now in its stacks: the current stack and depth, the top depth of each stack, and the page before the current one.
|
|
463
|
+
- [RouteCacheProps](ui/RouteCacheProps.md): Props for <RouteCache>: the maxCached size and the content children to keep alive for each page in the stacks.
|
|
462
464
|
- [RouterProps](ui/RouterProps.md): Props for <Router> — the routes to match against plus an optional fallback.
|
|
465
|
+
- [StackButtonProps](ui/StackButtonProps.md): Props for <StackButton>: the stack it opens, plus the usual Button props except href and onClick.
|
|
463
466
|
- [BlockVariants](ui/BlockVariants.md): Variants for block level elements.
|
|
464
467
|
- [ColorVariants](ui/ColorVariants.md): Variant props for colouring an element, e.g. color="purple".
|
|
465
468
|
- [DurationVariants](ui/DurationVariants.md): Variant props for the transition duration of an element, e.g. duration="fast".
|
|
@@ -560,7 +563,7 @@ The components below are listed in the index following this page; this is the sh
|
|
|
560
563
|
- [LOADING_NOTICE](ui/LOADING_NOTICE.md): Shared loading <Notice> element showing the loading spinner.
|
|
561
564
|
- [NOTICES](ui/NOTICES.md): Global NoticesStore shown by <Notices>, accepting any of the default statuses.
|
|
562
565
|
- [NavigationContext](ui/NavigationContext.md): React context holding the current NavigationStore, provided by <Navigation>.
|
|
563
|
-
- [
|
|
566
|
+
- [NavigationPositionContext](ui/NavigationPositionContext.md): React context holding where the app is in its stacks, published by <Navigation> with each URL change.
|
|
564
567
|
- [STATUSES](ui/STATUSES.md): Tuple of the status names selectable via the status variant prop.
|
|
565
568
|
- [TINT_CLASS](ui/TINT_CLASS.md): CSS class that (re)calculates the full ladder of tint shades from the current global tint colour.
|
|
566
569
|
- [FADE_TRANSITION_CLASS](ui/FADE_TRANSITION_CLASS.md): View transition class that fades content in and out.
|
package/package.json
CHANGED
package/ui/button/Clickable.d.ts
CHANGED
|
@@ -32,8 +32,6 @@ export interface ClickableProps extends OptionalChildProps {
|
|
|
32
32
|
title?: string | undefined;
|
|
33
33
|
/** Whether this is the selected item in a group. Sets `aria-pressed` on a `<button>`, or `aria-current` on an `<a>`. */
|
|
34
34
|
selected?: boolean | undefined;
|
|
35
|
-
/** If `href` is present, then `<Navigation>` opens the link with a back transition. Use it for a "back to" link. Sets `data-back` on the `<a>`. */
|
|
36
|
-
back?: boolean | undefined;
|
|
37
35
|
}
|
|
38
36
|
/**
|
|
39
37
|
* Props for a clickable that also accepts a `className` for styling.
|
|
@@ -62,7 +60,7 @@ export declare function Clickable(props: StylableClickableProps): ReactElement;
|
|
|
62
60
|
* @example <LinkClickable href="/about" className="link">About</LinkClickable>
|
|
63
61
|
* @see https://shelving.cc/ui/LinkClickable
|
|
64
62
|
*/
|
|
65
|
-
export declare function LinkClickable({ href, disabled, target, download, title, selected,
|
|
63
|
+
export declare function LinkClickable({ href, disabled, target, download, title, selected, children, className, }: StylableClickableProps): ReactElement;
|
|
66
64
|
/**
|
|
67
65
|
* Render a `<button>` element that runs its `onClick` handler through a `BusyStore` and shows a loading spinner while busy.
|
|
68
66
|
* - Notifies the user of the handler's returned value (success) or thrown value (error).
|
package/ui/button/Clickable.js
CHANGED
|
@@ -30,13 +30,13 @@ export function Clickable(props) {
|
|
|
30
30
|
* @example <LinkClickable href="/about" className="link">About</LinkClickable>
|
|
31
31
|
* @see https://shelving.cc/ui/LinkClickable
|
|
32
32
|
*/
|
|
33
|
-
export function LinkClickable({ href, disabled = !href, target, download, title, selected,
|
|
33
|
+
export function LinkClickable({ href, disabled = !href, target, download, title, selected, children = "Go", className, }) {
|
|
34
34
|
// Resolve `href` against the current page URL and site root so site-absolute paths (`/foo`) honour the base subfolder.
|
|
35
35
|
const { url, root } = requireMeta();
|
|
36
36
|
const link = disabled ? undefined : getLink(href, url, root);
|
|
37
37
|
// Is this link "active" compared to the current URL?
|
|
38
38
|
const active = isURLActive(link, url);
|
|
39
|
-
return (_jsx("a", { href: link?.href, title: title, download: download, target: target, className: getClass(className) || undefined, "aria-current": active ? "page" : selected ? "true" : undefined,
|
|
39
|
+
return (_jsx("a", { href: link?.href, title: title, download: download, target: target, className: getClass(className) || undefined, "aria-current": active ? "page" : selected ? "true" : undefined, children: children }));
|
|
40
40
|
}
|
|
41
41
|
/**
|
|
42
42
|
* Render a `<button>` element that runs its `onClick` handler through a `BusyStore` and shows a loading spinner while busy.
|
package/ui/button/Clickable.tsx
CHANGED
|
@@ -43,8 +43,6 @@ export interface ClickableProps extends OptionalChildProps {
|
|
|
43
43
|
title?: string | undefined;
|
|
44
44
|
/** Whether this is the selected item in a group. Sets `aria-pressed` on a `<button>`, or `aria-current` on an `<a>`. */
|
|
45
45
|
selected?: boolean | undefined;
|
|
46
|
-
/** If `href` is present, then `<Navigation>` opens the link with a back transition. Use it for a "back to" link. Sets `data-back` on the `<a>`. */
|
|
47
|
-
back?: boolean | undefined;
|
|
48
46
|
}
|
|
49
47
|
|
|
50
48
|
/**
|
|
@@ -90,7 +88,6 @@ export function LinkClickable({
|
|
|
90
88
|
download,
|
|
91
89
|
title,
|
|
92
90
|
selected,
|
|
93
|
-
back,
|
|
94
91
|
children = "Go",
|
|
95
92
|
className,
|
|
96
93
|
}: StylableClickableProps): ReactElement {
|
|
@@ -109,7 +106,6 @@ export function LinkClickable({
|
|
|
109
106
|
target={target}
|
|
110
107
|
className={getClass(className) || undefined}
|
|
111
108
|
aria-current={active ? "page" : selected ? "true" : undefined}
|
|
112
|
-
data-back={back || undefined}
|
|
113
109
|
>
|
|
114
110
|
{children}
|
|
115
111
|
</a>
|