@jsenv/navi 0.29.456 → 0.29.457
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 +38 -10
- package/dist/dev/jsenv_navi.js.map +3 -3
- package/dist/jsenv_navi.js +38 -10
- package/dist/jsenv_navi.js.map +3 -3
- package/docs/interactions.md +27 -0
- package/package.json +1 -1
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** —
|