@jsenv/navi 0.29.443 → 0.29.444
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 +57 -16
- package/dist/dev/jsenv_navi.js.map +6 -6
- package/dist/jsenv_navi.js +45 -15
- package/dist/jsenv_navi.js.map +6 -6
- package/docs/AI_INSTRUCTIONS.md +6 -4
- package/docs/actions.md +6 -2
- package/docs/control_value.md +28 -8
- package/package.json +1 -1
package/docs/AI_INSTRUCTIONS.md
CHANGED
|
@@ -114,8 +114,8 @@ start when unsure which export solves a problem.
|
|
|
114
114
|
Before any handler whose body only assigns state.
|
|
115
115
|
- `control_value.md` — who holds a control's value; `--navi-update` for a button
|
|
116
116
|
proposing one; a `defaultValue` follows the record it was read from; empty
|
|
117
|
-
keeps the shape of the question
|
|
118
|
-
`uiAction`.
|
|
117
|
+
keeps the shape of the question; what a checkbox is worth (`boolean` for a
|
|
118
|
+
yes/no). Before wiring a value with `value` + `uiAction`.
|
|
119
119
|
- `control_object.md` — one value made of several controls: `ControlGroup` versus
|
|
120
120
|
`Form`, naming, `<Picker type="object">`, a settings sheet, controls that are
|
|
121
121
|
not there (lazy slides, popups, deferred boxes, items outside the render
|
|
@@ -226,8 +226,10 @@ start when unsure which export solves a problem.
|
|
|
226
226
|
`<Input type="checkbox">`/`<Input type="radio">`; there is no `Checkbox`),
|
|
227
227
|
`Select`, `Picker` and the others work with nothing wired: inside a `Form`, the
|
|
228
228
|
form reads them when it sends. When the app needs the value, bind it with
|
|
229
|
-
`signal`.
|
|
230
|
-
a
|
|
229
|
+
`signal`. A checkbox is HTML's (`"on"` or its `value`, `undefined` unchecked);
|
|
230
|
+
a yes/no is `<Input type="checkbox" boolean>`, `true` or `false`. `action`
|
|
231
|
+
reacts to a change that can fail or take time; it is not how a control is
|
|
232
|
+
wired. Never `onChange` + manual state.
|
|
231
233
|
- **A gesture is named, not read by hand**: `interactions={{ swipe_right: … }}`
|
|
232
234
|
on any `Box`, so on any component — never a `pointerdown` listener of your own.
|
|
233
235
|
- **Texts**: a user-visible sentence containing a value is one template with
|
package/docs/actions.md
CHANGED
|
@@ -313,13 +313,17 @@ the control's value, so the callback receives what the control now holds.
|
|
|
313
313
|
```jsx
|
|
314
314
|
// ✓ the box shows it is saving, says so if the save fails, and goes back to
|
|
315
315
|
// where it was — nothing to write for any of it
|
|
316
|
-
<Input type="checkbox" action={(visibility) => saveMe({ visibility })} />
|
|
316
|
+
<Input type="checkbox" boolean action={(visibility) => saveMe({ visibility })} />
|
|
317
317
|
|
|
318
318
|
// ✗ same save, and the user learns nothing: no pending state, and a failure
|
|
319
319
|
// leaves the box showing something the server never accepted
|
|
320
|
-
<Input type="checkbox" uiAction={(visibility) => saveMe({ visibility })} />
|
|
320
|
+
<Input type="checkbox" boolean uiAction={(visibility) => saveMe({ visibility })} />
|
|
321
321
|
```
|
|
322
322
|
|
|
323
|
+
`boolean` makes the box a yes/no, `true` or `false`; without it, unchecked is
|
|
324
|
+
`undefined` and the save sends nothing (see
|
|
325
|
+
[control_value.md](./control_value.md#what-a-checkbox-is-worth)).
|
|
326
|
+
|
|
323
327
|
The give-away is an `async` `uiAction`, or one that calls something that writes:
|
|
324
328
|
`uiAction` never waits for what it starts, so nobody is left holding the result.
|
|
325
329
|
To merely REMEMBER the value rather than send it, neither is the answer: bind a
|
package/docs/control_value.md
CHANGED
|
@@ -14,6 +14,7 @@ somewhere else in the app.
|
|
|
14
14
|
- [Drawing what a control holds](#drawing-what-a-control-holds)
|
|
15
15
|
- [What a signal holds, control by control](#what-a-signal-holds-control-by-control)
|
|
16
16
|
- [Empty keeps the shape of the question](#empty-keeps-the-shape-of-the-question)
|
|
17
|
+
- [What a checkbox is worth](#what-a-checkbox-is-worth)
|
|
17
18
|
- [Which controls take a `signal`](#which-controls-take-a-signal)
|
|
18
19
|
- [The PROP is what controls, not its value](#the-prop-is-what-controls-not-its-value)
|
|
19
20
|
- [A yes/no shown as two rows](#a-yesno-shown-as-two-rows)
|
|
@@ -281,18 +282,37 @@ it holds something. A list of days nobody picked is `[]`, not `""`:
|
|
|
281
282
|
| `Picker type="array"`, `List selectable multiple` | `[]` |
|
|
282
283
|
| `Picker type="object"` | `{}` |
|
|
283
284
|
| text/number/date `Input`, `Select` | `""` |
|
|
284
|
-
| `Input type="checkbox"
|
|
285
|
-
| radio,
|
|
285
|
+
| `Input type="checkbox" boolean` | `false` |
|
|
286
|
+
| radio, any other checkbox | absent |
|
|
286
287
|
|
|
287
288
|
This is what a clear (`--navi-clear`, a row's cross) leaves behind and what the
|
|
288
289
|
object around it carries, so `value.days || []` is not needed.
|
|
289
290
|
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
checkbox
|
|
291
|
+
## What a checkbox is worth
|
|
292
|
+
|
|
293
|
+
A checkbox answers the way HTML's does: checked it carries its `value`,
|
|
294
|
+
unchecked it carries nothing. `boolean` makes it a yes/no instead:
|
|
295
|
+
|
|
296
|
+
| checkbox | checked | unchecked |
|
|
297
|
+
| -------------- | -------- | ----------- |
|
|
298
|
+
| no `value` | `"on"` | `undefined` |
|
|
299
|
+
| `value="toto"` | `"toto"` | `undefined` |
|
|
300
|
+
| `value={true}` | `true` | `undefined` |
|
|
301
|
+
| `boolean` | `true` | `false` |
|
|
302
|
+
|
|
303
|
+
That is what it hands everywhere: to its own `action` and `uiAction`, and to
|
|
304
|
+
the form or group around it. Only a bound `signal` differs: it holds whether the
|
|
305
|
+
box is checked, a boolean in every row above.
|
|
306
|
+
|
|
307
|
+
Choose by what the box asks:
|
|
308
|
+
|
|
309
|
+
- **A yes/no** (a setting, a consent, a favourite) is `boolean`. Unchecked has
|
|
310
|
+
to say "no", and `undefined` says nothing: `{ favourite: undefined }` is sent
|
|
311
|
+
as `{}`, the server changes nothing, and the box shows a "no" nobody
|
|
312
|
+
accepted.
|
|
313
|
+
- **A member of a set** (several checkboxes sharing a `name`, each adding its
|
|
314
|
+
value) takes its own `value`, or none for `"on"`. Unchecked carries nothing,
|
|
315
|
+
so the group gathers only the checked ones into an array.
|
|
296
316
|
|
|
297
317
|
## Which controls take a `signal`
|
|
298
318
|
|