@loadbare/app 0.11.0 → 0.13.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 (56) hide show
  1. package/dist/build/assemble.d.ts.map +1 -1
  2. package/dist/build/assemble.js +61 -1
  3. package/dist/build/assemble.js.map +1 -1
  4. package/dist/build/cli.js +2 -1
  5. package/dist/build/cli.js.map +1 -1
  6. package/dist/build/elements.d.ts +9 -1
  7. package/dist/build/elements.d.ts.map +1 -1
  8. package/dist/build/elements.js +50 -0
  9. package/dist/build/elements.js.map +1 -1
  10. package/dist/build/origins.d.ts +2 -0
  11. package/dist/build/origins.d.ts.map +1 -1
  12. package/dist/build/origins.js +1 -1
  13. package/dist/build/origins.js.map +1 -1
  14. package/dist/core/lb-constants.d.ts +26 -1
  15. package/dist/core/lb-constants.d.ts.map +1 -1
  16. package/dist/core/lb-constants.js +79 -0
  17. package/dist/core/lb-constants.js.map +1 -1
  18. package/dist/core/lb-types.d.ts +58 -18
  19. package/dist/core/lb-types.d.ts.map +1 -1
  20. package/dist/core/lb-types.js +74 -11
  21. package/dist/core/lb-types.js.map +1 -1
  22. package/dist/hub/lb-apply.d.ts +44 -16
  23. package/dist/hub/lb-apply.d.ts.map +1 -1
  24. package/dist/hub/lb-apply.js +694 -49
  25. package/dist/hub/lb-apply.js.map +1 -1
  26. package/dist/hub/lb-hub.browser.d.ts.map +1 -1
  27. package/dist/hub/lb-hub.browser.js +168 -36
  28. package/dist/hub/lb-hub.browser.js.map +1 -1
  29. package/dist/server/lb-express.d.ts +6 -4
  30. package/dist/server/lb-express.d.ts.map +1 -1
  31. package/dist/server/lb-express.js +32 -14
  32. package/dist/server/lb-express.js.map +1 -1
  33. package/dist/server/lb-server.d.ts +49 -10
  34. package/dist/server/lb-server.d.ts.map +1 -1
  35. package/dist/server/lb-server.js +87 -28
  36. package/dist/server/lb-server.js.map +1 -1
  37. package/docs/TECHREF-1.0.md +364 -72
  38. package/docs/comparison.md +16 -10
  39. package/docs/possible-ideas.md +188 -0
  40. package/docs/reference/chrome.md +22 -1
  41. package/docs/reference/custom-elements.md +90 -29
  42. package/docs/reference/data-binding.md +132 -7
  43. package/docs/reference/page-files.md +48 -11
  44. package/docs/reference/server.md +4 -0
  45. package/docs/reference/widgets.md +94 -24
  46. package/docs/roadmap.md +10 -6
  47. package/docs/testing.md +21 -10
  48. package/package.json +2 -3
  49. package/skills/loadbare-app/SKILL.md +85 -12
  50. package/skills/loadbare-app/references/TECHREF-1.0.md +364 -72
  51. package/skills/loadbare-app/references/chrome.md +22 -1
  52. package/skills/loadbare-app/references/custom-elements.md +90 -29
  53. package/skills/loadbare-app/references/data-binding.md +132 -7
  54. package/skills/loadbare-app/references/page-files.md +48 -11
  55. package/skills/loadbare-app/references/server.md +4 -0
  56. package/skills/loadbare-app/references/widgets.md +94 -24
@@ -1,7 +1,8 @@
1
1
  # The Basic Widget Library
2
2
 
3
- Six widgets: `lb-input`, `lb-select`, `lb-options`, `lb-picker`, `lb-table`,
4
- `lb-unknown-page`. Every one of them is an ordinary custom element, written
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
5
6
  against the contracts in [Custom Elements](./custom-elements.md#html) for its
6
7
  definition and [Custom Elements](./custom-elements.md#code) for its class.
7
8
 
@@ -43,6 +44,7 @@ write the same edit twice.
43
44
  | Parameter | Fills |
44
45
  |----------------|----------------------------------|
45
46
  | `exp-label` | The visible `<label>` text |
47
+ | `exp-type` | The input's `type`, `text` when absent |
46
48
  | `exp-readonly` | The input's `readonly` attribute |
47
49
 
48
50
  ## `lb-select`
@@ -67,9 +69,7 @@ writes the row template inside the widget:
67
69
 
68
70
  ```html
69
71
  <lb-options lb-query="statuses" lb-column="status" lb-request="lb-row-update" exp-label="Status">
70
- <template data-group="category">
71
- <option lb-column="label"></option>
72
- </template>
72
+ <template><option lb-column="label"></option></template>
73
73
  </lb-options>
74
74
  ```
75
75
 
@@ -79,9 +79,15 @@ writes the row template inside the widget:
79
79
 
80
80
  - Each option's `value` is its row's key, the `lb-key-value` the hub stamps
81
81
  on the live row, so the widget holds a key and shows a label.
82
- - `data-group` on the row template sections the options into `<optgroup>`s,
83
- one per distinct value of that column, added and removed as rows arrive
84
- and leave.
82
+ - A group template holding an `<optgroup>` puts the options in groups, one
83
+ per run of the query's order's leading term. The widget labels each
84
+ `<optgroup>` from the `lb-group-value` the hub stamps on it:
85
+
86
+ ```html
87
+ <template lb-group>
88
+ <optgroup><template><option lb-column="label"></option></template></optgroup>
89
+ </template>
90
+ ```
85
91
  - Its `value` selects the option with that key, including an option that
86
92
  arrives after the value did.
87
93
 
@@ -100,7 +106,6 @@ one option showing one column:
100
106
  lb-request="lb-row-update"
101
107
  exp-label="Status"
102
108
  exp-column="label"
103
- exp-group="category"
104
109
  ></lb-picker>
105
110
  ```
106
111
 
@@ -108,10 +113,9 @@ one option showing one column:
108
113
  |--------------|-----------------------------------------|
109
114
  | `exp-label` | The visible `<label>` text |
110
115
  | `exp-column` | The column each option shows |
111
- | `exp-group` | The row template's `data-group` |
112
116
 
113
- An option built from two columns, or a row with a second element, is
114
- `lb-options` with the page's own row template.
117
+ An option built from two columns, a row with a second element, or options
118
+ in groups, is `lb-options` with the page's own templates.
115
119
 
116
120
  ## `lb-table`
117
121
 
@@ -123,11 +127,14 @@ row, the row template, and optionally a footer, each as a `<template>`:
123
127
  <template lb-exp-template="head">
124
128
  <tr><th>Date</th><th>Amount</th></tr>
125
129
  </template>
126
- <template data-sort="date" data-group="month">
127
- <tr><td lb-column="date"></td><td lb-column="amount"></td></tr>
130
+ <template lb-group>
131
+ <tr><th colspan="2" lb-column="month"></th></tr>
132
+ <template>
133
+ <tr><td lb-column="date"></td><td lb-column="amount"></td></tr>
134
+ </template>
128
135
  </template>
129
136
  <template lb-exp-template="foot">
130
- <tr lb-query="ledger-total"><td>Total</td><td lb-column="total"></td></tr>
137
+ <tr><td>Total</td><td lb-sum="amount"></td></tr>
131
138
  </template>
132
139
  </lb-table>
133
140
  ```
@@ -140,15 +147,78 @@ row, the row template, and optionally a footer, each as a `<template>`:
140
147
  |-----------------------------------|-----------------------------------------|
141
148
  | `<template lb-exp-template="head">` | The `<thead>` |
142
149
  | `<template lb-exp-template="foot">` | The `<tfoot>` |
143
- | Any other `<template>` | The row template, in the `<tbody>` |
144
-
145
- - `data-group` on the row template sections rows under a heading row, one
146
- per distinct value of that column, spanning every column of the row.
147
- - `data-sort` orders rows within a section, or within the whole body with no
148
- grouping, by the text of that column.
149
- - The footer is not a row of `ledger`. Its `<tr>` names a `row` query of its
150
- own, which lands on the `<tr>` itself. A grand total is a second query over
151
- the same data.
150
+ | Any other `<template>` | The row or group template, in the `<tbody>` |
151
+
152
+ - The hub places the rows by the query's order and builds its groups. The
153
+ rows land in the one `<tbody>`, so a group here is a heading row with its
154
+ rows after it.
155
+ - The footer is not a row of `ledger`. An aggregate there covers every row;
156
+ a figure that is not a sum of the rows, such as a budget, is a `<tr>`
157
+ naming a `row` query of its own.
158
+ - A `<template lb-exp-template="ghost">` is a blank row for entering a new
159
+ one, in a `<tbody>` of its own. The widget joins its controls to a form
160
+ outside the table, since a `<form>` cannot wrap a `<tr>`, and puts the
161
+ cursor back in it once an insert from it succeeds.
162
+ - After rows land, the widget scrolls the row the page's own request created
163
+ or moved into view.
164
+
165
+ ## `lb-confirm`
166
+
167
+ A button that asks before it sends. The page writes the question inside the
168
+ tag, and the request goes on the dialog's confirm button, so nothing reaches
169
+ the hub until the user says yes:
170
+
171
+ ```html
172
+ <lb-confirm exp-label="Delete" exp-request="lb-row-delete">
173
+ Delete <b lb-column="name"></b>?
174
+ </lb-confirm>
175
+ ```
176
+
177
+ | Parameter | Fills |
178
+ |---------------|--------------------------------------------------|
179
+ | `exp-label` | The text of the button that opens the dialog |
180
+ | `exp-request` | The confirm button's `lb-request` |
181
+ | `exp-confirm` | The confirm button's text, `Confirm` when absent |
182
+
183
+ The widget closes the dialog once `lb-request-done` says the request
184
+ succeeded, and leaves it open on a refusal.
185
+
186
+ ## `lb-form`
187
+
188
+ 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
+
192
+ | Parameter | Fills |
193
+ |-----------|-----------------|
194
+ | `exp-id` | The form's `id` |
195
+
196
+ ## `lb-insert-dialog`
197
+
198
+ A row entered in a modal dialog, written once outside every row and opened
199
+ with `commandfor` and `command="show-modal"`. Save is the form's
200
+ `lb-row-insert`; on success the widget chooses the new row in the nearest
201
+ `lb-options` around the button that opened it, and closes. The handler
202
+ answers with a patch holding the new row.
203
+
204
+ | Parameter | Fills |
205
+ |-------------|---------------------------------------------------|
206
+ | `exp-id` | The dialog's `id` |
207
+ | `exp-title` | The dialog's heading |
208
+ | `exp-query` | The form's `lb-query`, which it inserts into |
209
+ | `exp-save` | The Save button's text, `Save` when absent |
210
+
211
+ ## `lb-master`
212
+
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.
217
+
218
+ | Parameter | Fills |
219
+ |---------------|--------------------------------------------|
220
+ | `exp-row` | The `lb-query` of the row the form shows |
221
+ | `exp-form-id` | The form's `id`, `master-form` when absent |
152
222
 
153
223
  ## `lb-unknown-page`
154
224