@jsenv/navi 0.29.447 → 0.29.449

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.
@@ -83,7 +83,8 @@ start when unsure which export solves a problem.
83
83
  running (`{ run: true }` is the fallback), `action` versus `uiAction`, an
84
84
  action and a command on one press. Before running an action from a component.
85
85
  - `resource.md` — `resource()` and its relations (never an `op` discriminator),
86
- `GET_RANGE`, a search as the same `GET_MANY`, `withParams()` scopes and
86
+ `GET_RANGE` (its inclusive `end`, the count for the screen around the list, a
87
+ question following a search field), a search as the same `GET_MANY`, `withParams()` scopes and
87
88
  `dependencies`, `persist` (and `keepPageOnScreen` for the page on screen), a
88
89
  function versus the verb's instance. Before writing a resource, and before
89
90
  caching a response yourself.
package/docs/resource.md CHANGED
@@ -269,13 +269,20 @@ const GAME = resource("game", {
269
269
 
270
270
  The callback receives the bound params merged with the range the list asks for
271
271
  (`start`, `end`, `limit`, `before`, `after`, `around`), and `{ signal }`,
272
- aborted when the list stops wanting those rows. It returns a range the way a
273
- `Content-Range` does: **`{ items, start, count }`** — these rows, at this place,
274
- out of that many. `start` may be omitted when the list asked for one at or after
275
- `0` (a negative `start` counts back from the end, and the source must then say
276
- where the slice landed); `count` defaults to `start + items.length`. The items
277
- are upserted on their way in, so the list draws store items, never copies of the
278
- JSON.
272
+ aborted when the list stops wanting those rows. `end` is the last place asked
273
+ for, included, as in `Range: items=0-99`: `limit` is `end - start + 1`, and an
274
+ API whose end is excluded is called with `start + limit`. It returns a range the
275
+ way a `Content-Range` does: **`{ items, start, count }`** — these rows, at this
276
+ place, out of that many. `start` may be omitted when the list asked for one at
277
+ or after `0` (a negative `start` counts back from the end, and the source must
278
+ then say where the slice landed); `count` defaults to `start + items.length`.
279
+ The items are upserted on their way in, so the list draws store items, never
280
+ copies of the JSON.
281
+
282
+ The count is also what the screen around the list says — "5 of 83 books". The
283
+ run hands it out with `onCountChange`: `undefined` until a slice has answered,
284
+ then each count a slice brings, and again for each collection the run draws, so
285
+ the number always belongs to the rows on screen.
279
286
 
280
287
  But the list keeps the object it was handed, and an update replaces the item
281
288
  object (the store holds values, which is what makes a change detectable). So a
@@ -304,6 +311,30 @@ rows staying on screen
304
311
  reads a collection, so it lives on the resource (or on a `withParams()` of it),
305
312
  not on a relation.
306
313
 
314
+ ### A question that follows a search field
315
+
316
+ A reader bound to other params is another collection, and the run draws it
317
+ from its first item — it needs no `key` for that. A param following what is
318
+ typed then makes one collection per key, and one request each, the server
319
+ receiving every one even when the list calls it off. `debounce` on the run
320
+ waits for the reader to hold still, and keeps the collection from before drawn
321
+ meanwhile, `refreshing`:
322
+
323
+ ```jsx
324
+ <List.Items
325
+ itemsAction={BOOK.GET_RANGE.bindParams({ q: searchSignal.value })}
326
+ debounce={300}
327
+ onCountChange={(count) => {
328
+ bookCountSignal.value = count;
329
+ }}
330
+ renderItem={renderBook}
331
+ />
332
+ ```
333
+
334
+ A `key` that follows the field defeats it: the run remounts at each key, and
335
+ its wait with it. Demo: `src/control/demos/integration/1_list_loaded_by_scroll_demo.html`
336
+ ("Une recherche qui suit la frappe").
337
+
307
338
  ## Searching the same collection
308
339
 
309
340
  A screen showing a collection soon asks a second question about it: the list
package/docs/scroll.md CHANGED
@@ -536,10 +536,14 @@ whatever `loading` says afterwards.
536
536
  item and the index it is given rather than closing over state.
537
537
 
538
538
  The rest — `virtualItemSize`, the room an item not drawn is held at (uniform
539
- items, or the smallest one of a mixed list — the worst case, see above), a `key`
540
- on the run when the collection changes as a whole (never to refresh it, see
539
+ items, or the smallest one of a mixed list — the worst case, see above), a
540
+ collection that changes as a whole (another array, another reader — drawn from
541
+ its first item; never a `key` to refresh it, see
541
542
  [list_refresh.md](./list_refresh.md#a-paginated-list-stays-on-screen-too)),
542
- `groupBy` for sections — is in the JSDoc of `List` and `List.Items`
543
+ `debounce` for a question following a search field
544
+ ([resource.md](./resource.md#a-question-that-follows-a-search-field)),
545
+ `onCountChange` for the screen around the list to say how many items there
546
+ are, `groupBy` for sections — is in the JSDoc of `List` and `List.Items`
543
547
  (`src/control/list/list.jsx`). Demos:
544
548
  `src/control/demos/17_virtual_scroll_and_filter_demo.html` (a run in memory,
545
549
  searched), `src/control/demos/integration/1_list_loaded_by_scroll_demo.html` (a
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jsenv/navi",
3
- "version": "0.29.447",
3
+ "version": "0.29.449",
4
4
  "type": "module",
5
5
  "description": "Library of components including navigation to create frontend applications",
6
6
  "repository": {