@jsenv/navi 0.29.456 → 0.29.458
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/dist/dev/jsenv_navi.js +60 -16
- package/dist/dev/jsenv_navi.js.map +4 -4
- package/dist/jsenv_navi.js +60 -16
- package/dist/jsenv_navi.js.map +4 -4
- package/docs/dynamic_import.md +18 -0
- package/docs/interactions.md +27 -0
- package/package.json +1 -1
package/docs/dynamic_import.md
CHANGED
|
@@ -145,6 +145,24 @@ that asks for nothing (`() => true`).
|
|
|
145
145
|
`routeAction(route, action, undefined, { prefetch: false })` keeps a param-less
|
|
146
146
|
read that is not worth a hover out of it.
|
|
147
147
|
|
|
148
|
+
A page only some readers may download keeps its condition out of the params and
|
|
149
|
+
says it with `when`: a condition on app state, not on the address, so the link
|
|
150
|
+
still prefetches the action, as long as the condition holds when the pointer
|
|
151
|
+
arrives. A reader for whom it does not hold downloads nothing, not even by
|
|
152
|
+
typing the address.
|
|
153
|
+
|
|
154
|
+
```js
|
|
155
|
+
const VIDEO_PAGE_CODE = routeAction(
|
|
156
|
+
VIDEO_ROUTE,
|
|
157
|
+
() => import("./video_page.jsx").then((m) => m.VideoPage),
|
|
158
|
+
undefined,
|
|
159
|
+
{ when: () => meIsAdminSignal.value },
|
|
160
|
+
);
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
The link reads `when` as it is at that moment, not as the address it leads to
|
|
164
|
+
will make it: a condition that reads the address belongs in the params.
|
|
165
|
+
|
|
148
166
|
A prefetch that fails is not reported: nothing on screen asked for it. The failure
|
|
149
167
|
stays on the action, and a failed action is run again by whatever asks next — the
|
|
150
168
|
arrival, which shows its own failure, and every later hover alike.
|
package/docs/interactions.md
CHANGED
|
@@ -122,6 +122,33 @@ how to detect gets a dev warning naming the detectors that exist. The carrying
|
|
|
122
122
|
family and the surface have a file each:
|
|
123
123
|
[drag_interactions.md](./drag_interactions.md) and [pan_zoom.md](./pan_zoom.md).
|
|
124
124
|
|
|
125
|
+
A declared key takes the key: the browser's default for it does not happen as
|
|
126
|
+
well, whether the gate lets it through or refuses it. On a field this includes
|
|
127
|
+
the field's own keys — the caret, typing — so a text field can say what its
|
|
128
|
+
arrows do, through the same gate as a number field's:
|
|
129
|
+
|
|
130
|
+
```jsx
|
|
131
|
+
const step = (event, seconds) => {
|
|
132
|
+
const input = findEvent(event, "keydown").target;
|
|
133
|
+
const next = formatTime(parseTime(input.value) + seconds);
|
|
134
|
+
dispatchRequestSetUIState(input, next, { event });
|
|
135
|
+
};
|
|
136
|
+
|
|
137
|
+
<Input
|
|
138
|
+
value={formatTime(start)}
|
|
139
|
+
interactions={{
|
|
140
|
+
"keyboard:arrowup": (event) => step(event, 1),
|
|
141
|
+
"keyboard:arrowdown": (event) => step(event, -1),
|
|
142
|
+
"keyboard:shift+arrowup": (event) => step(event, 60),
|
|
143
|
+
"keyboard:shift+arrowdown": (event) => step(event, -60),
|
|
144
|
+
}}
|
|
145
|
+
/>;
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
A shortcut is matched with its exact modifiers, so Shift is a key of its own.
|
|
149
|
+
Keys declared on something around a field — a list item, a row — leave the
|
|
150
|
+
field inside every key it has a use for.
|
|
151
|
+
|
|
125
152
|
## Which interaction asked
|
|
126
153
|
|
|
127
154
|
An interaction navi makes is **dispatched as an event of its own name** —
|