@loadbare/app 0.13.0 → 0.14.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.
Files changed (42) hide show
  1. package/dist/build/assemble.d.ts.map +1 -1
  2. package/dist/build/assemble.js +31 -1
  3. package/dist/build/assemble.js.map +1 -1
  4. package/dist/core/lb-constants.d.ts +11 -1
  5. package/dist/core/lb-constants.d.ts.map +1 -1
  6. package/dist/core/lb-constants.js +34 -0
  7. package/dist/core/lb-constants.js.map +1 -1
  8. package/dist/core/lb-types.d.ts +27 -0
  9. package/dist/core/lb-types.d.ts.map +1 -1
  10. package/dist/core/lb-types.js.map +1 -1
  11. package/dist/hub/lb-apply.d.ts +20 -3
  12. package/dist/hub/lb-apply.d.ts.map +1 -1
  13. package/dist/hub/lb-apply.js +64 -8
  14. package/dist/hub/lb-apply.js.map +1 -1
  15. package/dist/hub/lb-hub.browser.d.ts.map +1 -1
  16. package/dist/hub/lb-hub.browser.js +341 -21
  17. package/dist/hub/lb-hub.browser.js.map +1 -1
  18. package/dist/server/lb-express.d.ts +13 -3
  19. package/dist/server/lb-express.d.ts.map +1 -1
  20. package/dist/server/lb-express.js +30 -12
  21. package/dist/server/lb-express.js.map +1 -1
  22. package/dist/server/lb-server.d.ts +31 -1
  23. package/dist/server/lb-server.d.ts.map +1 -1
  24. package/dist/server/lb-server.js +112 -2
  25. package/dist/server/lb-server.js.map +1 -1
  26. package/docs/TECHREF-1.0.md +294 -21
  27. package/docs/comparison.md +6 -4
  28. package/docs/possible-ideas.md +146 -26
  29. package/docs/reference/custom-elements.md +97 -1
  30. package/docs/reference/data-binding.md +303 -4
  31. package/docs/reference/page-files.md +76 -3
  32. package/docs/reference/server.md +20 -0
  33. package/docs/reference/widgets.md +33 -10
  34. package/docs/roadmap.md +9 -2
  35. package/package.json +1 -1
  36. package/skills/loadbare-app/SKILL.md +50 -7
  37. package/skills/loadbare-app/references/TECHREF-1.0.md +294 -21
  38. package/skills/loadbare-app/references/custom-elements.md +97 -1
  39. package/skills/loadbare-app/references/data-binding.md +303 -4
  40. package/skills/loadbare-app/references/page-files.md +76 -3
  41. package/skills/loadbare-app/references/server.md +20 -0
  42. package/skills/loadbare-app/references/widgets.md +33 -10
@@ -121,6 +121,7 @@ no row fills.
121
121
  | Element | Receives the value as |
122
122
  |------------------------------------------------------|-----------------------------------------|
123
123
  | `<input>`, `<select>`, `<textarea>` | Its `value`, and `lb-column-value` |
124
+ | `<input type="checkbox">` | Its `checked`, and `lb-column-value` |
124
125
  | A form-associated custom element with `value` | Its `value`, and `lb-column-value` |
125
126
  | Any other custom element | `lb-column-value` only |
126
127
  | Any other element | Its text content, and `lb-column-value` |
@@ -132,12 +133,26 @@ element that is not a control keeps the content the builder placed in it
132
133
  from its element file, and renders `lb-column-value` itself; see
133
134
  [Custom Elements](./custom-elements.md#receiving-a-value).
134
135
 
135
- A checkbox, a radio button and a file input receive nothing, and the hub
136
- reports it to the console.
136
+ A radio button and a file input receive nothing, and the hub reports it to
137
+ the console.
137
138
 
138
139
  The hub hands every value to the browser as the server sent it. What a
139
140
  number, a date or a null looks like is decided in the query.
140
141
 
142
+ ### Checkboxes
143
+
144
+ A checkbox is a control. It is checked when its column is anything but
145
+ `false` or null, and it sends `"true"` or `"false"`:
146
+
147
+ ```html
148
+ <input type="checkbox" lb-column="active" lb-request="lb-row-update" />
149
+ ```
150
+
151
+ Checked follows the rule `lb-show` follows, so a query spells a flag as a
152
+ boolean, and the string `"false"` is checked. Unchecked sends `"false"`
153
+ rather than nothing, so a flag can be set back. The checkbox's `value`
154
+ attribute means nothing to the hub.
155
+
141
156
  ### Rows
142
157
 
143
158
  Write a `<template>` inside the element carrying `lb-query`, holding one
@@ -414,7 +429,8 @@ Every request has one shape:
414
429
  ```
415
430
 
416
431
  The hub takes `query`, `key` and `values` from where the element sits, and
417
- sends each when it has one. The server runs the handler for the name and
432
+ sends each when it has one. A request acting on several rows carries `keys`
433
+ in place of `key`; see [Selecting rows](#selecting-rows). The server runs the handler for the name and
418
434
  answers with response items, which land like any others.
419
435
 
420
436
  ### Committing
@@ -461,7 +477,8 @@ carrying `lb-request`:
461
477
  4. Otherwise: every control whose form owner is the element's form owner.
462
478
 
463
479
  The hub gathers from controls only, and skips a control that belongs to a
464
- query nested inside the group. A form owner includes a control outside the
480
+ query nested inside the group, except that a form gathers the rows of a
481
+ query nested in its own; see [A form over a set of rows](#a-form-over-a-set-of-rows). A form owner includes a control outside the
465
482
  form that names it with the HTML `form` attribute, which is how a table row,
466
483
  where a form cannot go, sends one:
467
484
 
@@ -492,6 +509,99 @@ ancestor `lb-query` and row of the element carrying `lb-request` instead.
492
509
  Controls gathered from two different queries are an error, and the hub
493
510
  sends nothing.
494
511
 
512
+ ### A form over a set of rows
513
+
514
+ A form gathers the live rows of a query nested in its own query as well as
515
+ its own controls: a master and its details, entered together. Each nested
516
+ row goes as its key and the values of its own controls, under the nested
517
+ query's name, in `rows`:
518
+
519
+ ```html
520
+ <form lb-query="paychecks" lb-request="lb-row-insert">
521
+ <input lb-column="pay_date" type="date" />
522
+ <table>
523
+ <tbody lb-query="deduction_types">
524
+ <template>
525
+ <tr>
526
+ <td lb-column="label"></td>
527
+ <td><input lb-column="amount" /></td>
528
+ </tr>
529
+ </template>
530
+ </tbody>
531
+ </table>
532
+ <button type="submit">Save</button>
533
+ </form>
534
+ ```
535
+
536
+ ```json
537
+ {
538
+ "name": "lb-row-insert",
539
+ "query": "paychecks",
540
+ "values": { "pay_date": "2026-10-02" },
541
+ "rows": {
542
+ "deduction_types": [
543
+ { "key": "401k", "values": { "amount": "50" } },
544
+ { "key": "dental", "values": { "amount": "" } }
545
+ ]
546
+ }
547
+ }
548
+ ```
549
+
550
+ The list of deduction types lives only in the database: the nested query
551
+ answers it, and the form shows one input per row.
552
+
553
+ - Every live row of the nested query goes, whatever its values. What an
554
+ empty value means, such as no deduction of that type, is the handler's.
555
+ - One level only. A query nested inside a nested row shows the same rows in
556
+ every row around it, so it is not gathered.
557
+ - An insert, an update and a declared request carry `rows`. A delete does
558
+ not.
559
+ - A form whose only controls are in nested rows still sends, for its own
560
+ query, with empty `values`.
561
+ - A live row gathers nothing nested, as before.
562
+
563
+ The handler for the form's query receives `rows` beside `values`, and writes
564
+ the master and its details together; see [crud](./page-files.md#crud).
565
+
566
+ A nested query answers once for the page, so its rows are the same wherever
567
+ they show. The form enters a new master with its details, or edits the
568
+ master the page shows, whose details the nested query reads from the same
569
+ query parm. A form [pointed at a row](#editing-a-row-in-one-form) fills its
570
+ own controls from that row; its nested rows stay the nested query's answer.
571
+
572
+ ### A row not yet entered
573
+
574
+ A row whose key is empty is a new one, not yet entered. It arises two ways:
575
+ a `row` query answers with an empty key, as one showing the master a query
576
+ parm names does when the parm is empty, or New points a form (see
577
+ [Editing a row in one form](#editing-a-row-in-one-form)). Either way the
578
+ element carries `lb-key-value=""`.
579
+
580
+ | Request | From a row not yet entered |
581
+ |------------------|---------------------------------------|
582
+ | `lb-row-insert` | Sent, with no `key` |
583
+ | A declared one | Sent, with no `key` |
584
+ | `lb-row-update` | Not sent: there is nothing to update |
585
+ | `lb-row-delete` | Not sent: there is nothing to delete |
586
+
587
+ An update or delete not sent is the row's state, not a mistake, and nothing
588
+ is reported. So a control that saves its own column with
589
+ `lb-request="lb-row-update"` saves on a row on record, and on a new row only
590
+ holds what a submit will gather:
591
+
592
+ ```html
593
+ <section lb-query="account">
594
+ <form id="account-form">
595
+ <input lb-column="name" lb-request="lb-row-update" />
596
+ </form>
597
+ <button type="submit" form="account-form" lb-request="lb-row-insert">Save new</button>
598
+ </section>
599
+ ```
600
+
601
+ The same holds for a request a custom element sends carrying `key: ""`.
602
+ An update or delete with no row around it at all has no key either, and
603
+ that is reported to the console.
604
+
495
605
  ### Inserting, updating and deleting rows
496
606
 
497
607
  Loadbare provides three requests. Each runs the handler the page declares
@@ -528,6 +638,152 @@ failed insert leaves the entry for the user to correct.
528
638
  Leave `lb-request` off a control inside a form or a live row that sends its
529
639
  own update, or the same edit is written twice.
530
640
 
641
+ ### Editing a row in one form
642
+
643
+ A table, or any other set of rows, that the user edits or adds to has one
644
+ form on the page, naming the same query. It sits anywhere, outside every
645
+ row. Buttons point it with HTML's `commandfor` and `command`:
646
+
647
+ | Command | On a button | The hub |
648
+ |----------------|-------------------------------------|---------------------------------------------|
649
+ | `--lb-edit` | In a live row of the form's query | Fills the form from that row, keyed by it |
650
+ | `--lb-new` | Anywhere | Starts the form empty, for an insert |
651
+ | `--lb-release` | Anywhere | Lets the form go without saving |
652
+
653
+ HTML requires a custom command to begin with `--`.
654
+
655
+ ```html
656
+ <tbody lb-query="paychecks">
657
+ <template>
658
+ <tr>
659
+ <td lb-column="pay_date"></td>
660
+ <td lb-column="gross"></td>
661
+ <td><button type="button" commandfor="paycheck" command="--lb-edit">Edit</button></td>
662
+ </tr>
663
+ </template>
664
+ </tbody>
665
+ <button type="button" commandfor="paycheck" command="--lb-new">New</button>
666
+
667
+ <dialog>
668
+ <form id="paycheck" lb-query="paychecks" lb-request="lb-row-update">
669
+ <input lb-column="pay_date" type="date" />
670
+ <input lb-column="gross" />
671
+ <button type="submit">Save</button>
672
+ <button type="submit" lb-request="lb-row-insert">Save new</button>
673
+ <button type="button" commandfor="paycheck" command="--lb-release">Cancel</button>
674
+ </form>
675
+ </dialog>
676
+ ```
677
+
678
+ Edit fills the form from the row as the hub already holds it, with no
679
+ round trip, including columns no element in the table shows. The user
680
+ edits a row they can see, so the row is on the page. A row that has to be
681
+ fetched to be edited is another page, with that row as its master.
682
+
683
+ The hub stamps the form with the row's key, so the form's request carries
684
+ it, and stamps the row `lb-row-editing`. New stamps an empty key, making the
685
+ form [a row not yet entered](#a-row-not-yet-entered), and resets every
686
+ control to its default. The form's state is in its `lb-key-value`
687
+ stamp:
688
+
689
+ | `lb-key-value` | The form is |
690
+ |----------------|-----------------------------|
691
+ | A key | Editing that row |
692
+ | Empty | Entering a new row |
693
+ | Absent | Not in use |
694
+
695
+ A stylesheet shows Save or Save new by it:
696
+
697
+ ```css
698
+ form[lb-key-value=""] [type="submit"]:not([lb-request]),
699
+ form:not([lb-key-value=""]) [lb-request="lb-row-insert"] {
700
+ display: none;
701
+ }
702
+ ```
703
+
704
+ An `lb-show` in the form reads from the row it was pointed at. With no row,
705
+ every column is null, so `lb-show="!id"` shows only while entering a new
706
+ row.
707
+
708
+ A successful request from the form lets it go, as Cancel does: the form
709
+ empties, its controls return to their defaults, and the stamps go. A failed
710
+ one leaves the form as the user had it, to correct.
711
+
712
+ Inside a `<dialog>`, Edit and New open the dialog modally, and letting go
713
+ closes it. The dialog closing in any way HTML closes one lets the form go:
714
+ Escape, `command="close"`, or `method="dialog"`. A form in no dialog opens
715
+ nothing. It is always showing, as a detail panel beside the table is, or a
716
+ stylesheet shows it while it has a key:
717
+
718
+ ```css
719
+ form:not([lb-key-value]) {
720
+ display: none;
721
+ }
722
+ ```
723
+
724
+ The form names a `rows` query and holds no row template, so the query
725
+ landing again lands nothing on it, and what the user has typed stays.
726
+
727
+ A button inside a form that carries a command is `type="button"`, or it
728
+ submits the form instead.
729
+
730
+ ### Selecting rows
731
+
732
+ A checkbox carrying `lb-select` in a row template selects the live row it
733
+ sits in. It is not a column: it carries no `lb-column`, lands nothing and
734
+ is not gathered. The hub stamps the row `lb-row-selected` while it is
735
+ ticked.
736
+
737
+ A request for the query that names no one row then acts on the rows
738
+ selected, and carries their keys as `keys`:
739
+
740
+ ```html
741
+ <tbody lb-query="transactions">
742
+ <template>
743
+ <tr>
744
+ <td><input type="checkbox" lb-select lb-show="selecting" /></td>
745
+ <td lb-column="description"></td>
746
+ <td lb-column="amount"></td>
747
+ </tr>
748
+ </template>
749
+ </tbody>
750
+
751
+ <form lb-query="transactions" lb-request="lb-row-update">
752
+ <lb-picker lb-query="accounts" lb-column="acct" exp-label="Account" exp-column="name"></lb-picker>
753
+ <button type="submit">Apply</button>
754
+ <button type="button" lb-request="lb-row-delete">Delete</button>
755
+ </form>
756
+ ```
757
+
758
+ ```json
759
+ { "name": "lb-row-update", "query": "transactions", "keys": ["4", "9"], "values": { "acct": "12" } }
760
+ ```
761
+
762
+ | Request | With rows selected | With none ticked |
763
+ |------------------|----------------------------------------|----------------------|
764
+ | `lb-row-update` | Sent with `keys` | Not sent |
765
+ | `lb-row-delete` | Sent with `keys` | Not sent |
766
+ | A declared one | Sent with `keys` | Sent with `keys: []` |
767
+ | `lb-row-insert` | Sent as ever; the selection is not its | Sent as ever |
768
+
769
+ An update or delete with nothing ticked has nothing to act on, and nothing
770
+ is reported. A request from inside a row still names that row alone. The
771
+ server runs the page's `rowUpdate` or `rowDelete` once for each key, as for
772
+ each row alone, and refreshes once; see [crud](./page-files.md#crud).
773
+
774
+ After the request succeeds, the hub clears the selection. A failed one
775
+ leaves it, to try again.
776
+
777
+ Only a checkbox that is showing counts. Turning a selector off with
778
+ `lb-show` also clears its tick, so leaving a selecting mode abandons the
779
+ selection rather than keeping it out of sight. With every selector off, a
780
+ request for the query is an ordinary one again.
781
+
782
+ Which rows are selected, and whether the page is in a selecting mode, is
783
+ interaction state. A mode the URL keeps, such as `?selecting=1`, reaches
784
+ the rows as a column the query computes from the parm, which `lb-show`
785
+ reads.
786
+
531
787
  ### Declared requests
532
788
 
533
789
  A request name the page declares under `handlers` runs the application's
@@ -557,6 +813,7 @@ The hub stamps the element that committed:
557
813
  |----------------------|-----------------------------------------------|
558
814
  | `lb-request-pending` | The round trip is in flight |
559
815
  | `lb-request-error` | The round trip failed, until the next request |
816
+ | `lb-request-refused` | The handler refused it; see [Refusals](#refusals) |
560
817
 
561
818
  `lb-request-error` covers a non-2xx response, a network failure and a
562
819
  timeout alike. The hub aborts a round trip after ten seconds, and sets
@@ -574,6 +831,44 @@ pending button is already disabled and a stylesheet only shows it:
574
831
  }
575
832
  ```
576
833
 
834
+ ### Refusals
835
+
836
+ A handler that refuses a request says why, in words for the user; see
837
+ [Refusing a request](./page-files.md#refusing-a-request). The hub shows
838
+ them where they belong:
839
+
840
+ - A message for the request as a whole is the value of the
841
+ `lb-request-refused` stamp on the element that committed, empty when the
842
+ refusal has none.
843
+ - A message for a column goes on the control the request gathered it from,
844
+ as HTML's own validity: `setCustomValidity`, the `:invalid` pseudo-class,
845
+ and the browser's own bubble for the first, which takes focus.
846
+
847
+ A stylesheet shows the whole-request message with no script:
848
+
849
+ ```css
850
+ form[lb-request-refused]:not([lb-request-refused=""])::after {
851
+ content: attr(lb-request-refused);
852
+ color: firebrick;
853
+ }
854
+ input:invalid {
855
+ outline: 2px solid firebrick;
856
+ }
857
+ ```
858
+
859
+ A refusal is not a failure: `lb-request-error` is not stamped, and nothing
860
+ is reported to the console.
861
+
862
+ A refusal stands until the user edits any control the request gathered,
863
+ resets its form, or sends from the same element again. Then every message
864
+ it put up goes at once, since the next submit is a new question for the
865
+ handler. While a control carries a message the browser holds its form's
866
+ submit, as for any invalid control, so the user edits before trying again.
867
+
868
+ A form-associated custom element takes a column's message when it has
869
+ `setCustomValidity` and `reportValidity`; see
870
+ [Being a control](./custom-elements.md#being-a-control).
871
+
577
872
  ### The request event
578
873
 
579
874
  The hub dispatches every request as a bubbling `lb-request` event from the
@@ -620,3 +915,7 @@ expansion, and refuses to build:
620
915
  - `lb-show` on a `<template>`, or on a row template's root
621
916
  - `lb-show` with no `lb-query` around it
622
917
  - `lb-show="!"` or `lb-show="!!column"`, which reverse no column
918
+ - `lb-select` on anything but `<input type="checkbox">`, outside a row
919
+ template, or beside `lb-column` or `lb-request`
920
+ - a `command` beginning `--lb-` that is not one of the three commands
921
+ - one of the three commands with no `commandfor`
@@ -137,10 +137,14 @@ name:
137
137
  | `name` | The request name, from `lb-request` |
138
138
  | `query` | The query the request is for |
139
139
  | `key` | The key of the row the request is for |
140
+ | `keys` | The keys of the rows selected, in place of `key` |
141
+ | `rows` | A form's nested rows, by query: each `key` and `values` |
140
142
  | `values` | The gathered control values, by column |
141
143
 
142
144
  The hub sends `query`, `key` and `values` when it finds them; see
143
- [Gathering](./data-binding.md#gathering).
145
+ [Gathering](./data-binding.md#gathering). It sends `keys` for a request that
146
+ acts on the rows the user selected; see
147
+ [Selecting rows](./data-binding.md#selecting-rows).
144
148
 
145
149
  ### onPageEnter
146
150
 
@@ -191,10 +195,34 @@ the query they operate on:
191
195
 
192
196
  | Request name | Runs | `run` receives |
193
197
  |-----------------|-------------|------------------|
194
- | `lb-row-insert` | `rowInsert` | `query`, `values` |
195
- | `lb-row-update` | `rowUpdate` | `query`, `key`, `values` |
198
+ | `lb-row-insert` | `rowInsert` | `query`, `values`, and `rows` from a form |
199
+ | `lb-row-update` | `rowUpdate` | `query`, `key`, `values`, and `rows` from a form |
196
200
  | `lb-row-delete` | `rowDelete` | `query`, `key` |
197
201
 
202
+ An `lb-row-update` or `lb-row-delete` carrying `keys` runs `rowUpdate` or
203
+ `rowDelete` once for each key, with that key, so a handler written for one
204
+ row serves several. The patches the runs return are laid together, and the
205
+ refresh set runs once. A `url()` returned for one of several rows is
206
+ reported and ignored. A declared request receives `keys` as it is.
207
+
208
+ `rows` holds the rows of a query nested in the form the request came from,
209
+ by query name, each with its `key` and the `values` of its own controls; see
210
+ [A form over a set of rows](./data-binding.md#a-form-over-a-set-of-rows).
211
+ The handler writes the master and its details together, deciding what each
212
+ row's values mean, such as an empty amount being no row at all:
213
+
214
+ ```ts
215
+ rowInsert: {
216
+ run: async (ctx, { values, rows }) => {
217
+ const id = await ctx.db.insertPaycheck(values);
218
+ for (const { key, values: row } of rows?.deduction_types ?? []) {
219
+ if (row.amount !== "") await ctx.db.insertDeduction(id, key, row.amount);
220
+ }
221
+ },
222
+ refresh: ["paychecks"],
223
+ },
224
+ ```
225
+
198
226
  ```ts
199
227
  // src/pages/directory.requests.ts
200
228
  import { patch, type Requests } from "@loadbare/app/server";
@@ -333,3 +361,48 @@ Post/Redirect/Get without the redirect. The refresh set does not run, and
333
361
  nothing else `run` returned is sent, since both answered for the URL the page
334
362
  left. The loaded page reads the new parms through `contextFor`; see
335
363
  [the Express server](./server.md#database-layer).
364
+
365
+ ### Refusing a request
366
+
367
+ A handler refuses a request by throwing `refusal()`, with words written for
368
+ the user:
369
+
370
+ ```ts
371
+ import { refusal, type Requests } from "@loadbare/app/server";
372
+
373
+ export const requests: Requests = {
374
+ handlers: {
375
+ enterPaycheck: {
376
+ run: async (ctx, { values }) => {
377
+ if (Number(values!.amount) <= 0) {
378
+ throw refusal({ amount: "Must be more than zero" });
379
+ }
380
+ const overlap = await ctx.db.overlappingSeries(values!);
381
+ if (overlap) {
382
+ throw refusal(
383
+ `That series already has paychecks from ${overlap.from} through ${overlap.to}.`,
384
+ );
385
+ }
386
+ await ctx.db.enterPaycheck(values!);
387
+ },
388
+ refresh: ["paychecks"],
389
+ },
390
+ },
391
+ };
392
+ ```
393
+
394
+ | Call | The browser shows |
395
+ |----------------------------------|--------------------------------------------|
396
+ | `refusal("message")` | The message, for the request as a whole |
397
+ | `refusal({ column: "message" })` | Each message on the control for its column |
398
+ | `refusal("message", { ... })` | Both |
399
+
400
+ Throw it, from the handler or from anything the handler calls, and whatever
401
+ the application has open rolls back as for any throw. A column names a
402
+ control the request gathered. See [Refusals](./data-binding.md#refusals)
403
+ for how the browser shows them.
404
+
405
+ A refusal is the only error whose words reach the browser. Anything else a
406
+ handler throws is a failure, answered with nothing in it, so a stack or a
407
+ database message never reaches a page.
408
+
@@ -72,6 +72,26 @@ path, so the application cannot be hosted under a subpath such as
72
72
  whole path space through unchanged.
73
73
 
74
74
  Leave `express.json()` to `hubRoutes`, which mounts it on its own routes.
75
+ Pass its options through `hubRoutes` instead.
76
+
77
+ ## Options
78
+
79
+ `hubRoutes` takes an optional third argument, an object with one key per
80
+ concern:
81
+
82
+ | Option | Description |
83
+ |--------|----------------------------------------------------------|
84
+ | `json` | Options for `express.json()`, passed to it unchanged |
85
+
86
+ A request body over 100 KB, the `express.json()` default, is refused with a
87
+ 413 before any handler runs, and the server log names the option that raises
88
+ it. Raise it for an application whose pages send a file's text as a value:
89
+
90
+ ```ts
91
+ app.use(hubRoutes(hub, contextFor, { json: { limit: "5mb" } }));
92
+ ```
93
+
94
+ The limit covers every page's requests.
75
95
 
76
96
  ## Running the server
77
97
 
@@ -1,8 +1,8 @@
1
1
  # The Basic Widget Library
2
2
 
3
- Ten widgets: `lb-input`, `lb-select`, `lb-options`, `lb-picker`, `lb-table`,
4
- `lb-unknown-page`, `lb-confirm`, `lb-form`, `lb-insert-dialog` and
5
- `lb-master`. Every one of them is an ordinary custom element, written
3
+ Eleven widgets: `lb-input`, `lb-select`, `lb-options`, `lb-picker`,
4
+ `lb-table`, `lb-unknown-page`, `lb-confirm`, `lb-form`, `lb-insert-dialog`,
5
+ `lb-master` and `lb-checkbox`. Every one of them is an ordinary custom element, written
6
6
  against the contracts in [Custom Elements](./custom-elements.md#html) for its
7
7
  definition and [Custom Elements](./custom-elements.md#code) for its class.
8
8
 
@@ -26,7 +26,9 @@ for where a listed package sits in the cascade.
26
26
  `lb-input`, `lb-select`, `lb-options` and `lb-picker` are controls:
27
27
  form-associated custom elements with a `value` property that fire `change`.
28
28
  Each carries `lb-column` and `lb-request` itself, the way an `<input>` does;
29
- see [Being a control](./custom-elements.md#being-a-control).
29
+ see [Being a control](./custom-elements.md#being-a-control). Each passes a
30
+ refusal's message for its column to the native control inside it; see
31
+ [Refusals](./data-binding.md#refusals).
30
32
 
31
33
  ## `lb-input`
32
34
 
@@ -186,8 +188,8 @@ succeeded, and leaves it open on a refusal.
186
188
  ## `lb-form`
187
189
 
188
190
  A `<form>` over one row's controls. A row with a key saves each control's
189
- column on `change`; a row whose key is empty is new, and the widget stops an
190
- `lb-row-update` that carries no key, so its controls wait for a submit.
191
+ column on `change`; a row whose key is empty is new, and the hub sends no
192
+ update for it, so its controls wait for a submit. A definition only.
191
193
 
192
194
  | Parameter | Fills |
193
195
  |-----------|-----------------|
@@ -210,16 +212,37 @@ answers with a patch holding the new row.
210
212
 
211
213
  ## `lb-master`
212
214
 
213
- A set, one of its rows, and the buttons that act on the set: Copy, Delete,
214
- Save new and Cancel, each shown only for a row on record or a new one. A
215
- definition only, built from `lb-form` and `lb-confirm`. Copy sends `copy`, a
216
- request the page declares.
215
+ A set, one of its rows, and the buttons that act on the set: New, Copy,
216
+ Delete, Save new and Cancel, each shown only for a row on record or a new
217
+ one. A definition only, built from `lb-form` and `lb-confirm`. New sends
218
+ `new` and Copy sends `copy`, requests the page declares; `new` returns
219
+ `url()` emptying the parm that names the row.
217
220
 
218
221
  | Parameter | Fills |
219
222
  |---------------|--------------------------------------------|
220
223
  | `exp-row` | The `lb-query` of the row the form shows |
221
224
  | `exp-form-id` | The form's `id`, `master-form` when absent |
222
225
 
226
+ ## `lb-checkbox`
227
+
228
+ A checkbox and its label as one element, for an application to style. A
229
+ definition only: a native checkbox is already a control (see
230
+ [Checkboxes](./data-binding.md#checkboxes)), so the widget is the markup, a
231
+ `<label>` holding the `<input type="checkbox">` and a `<span>` with the
232
+ text. The column and request go on the checkbox inside, so they arrive as
233
+ expansion attributes.
234
+
235
+ Unlike `lb-input`, it has no script making the tag the control. A value
236
+ that lands before a widget's script has loaded arrives only as the string
237
+ stamp `lb-column-value`, and a script checkbox would read `"false"` as
238
+ checked. The hub sets a native checkbox's `checked` directly.
239
+
240
+ | Parameter | Fills |
241
+ |---------------|-----------------------------------------------|
242
+ | `exp-column` | The checkbox's `lb-column` |
243
+ | `exp-label` | The label's text |
244
+ | `exp-request` | The checkbox's `lb-request`, none when absent |
245
+
223
246
  ## `lb-unknown-page`
224
247
 
225
248
  The chrome's dialog for a URL that names no page, as one tag: