@loadbare/app 0.24.0 → 0.26.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 +1 -2
  2. package/dist/build/assemble.d.ts.map +1 -1
  3. package/dist/build/assemble.js +61 -53
  4. package/dist/build/assemble.js.map +1 -1
  5. package/dist/build/cli.d.ts +4 -10
  6. package/dist/build/cli.d.ts.map +1 -1
  7. package/dist/build/cli.js +11 -33
  8. package/dist/build/cli.js.map +1 -1
  9. package/dist/build/declared.js +1 -1
  10. package/dist/build/declared.js.map +1 -1
  11. package/dist/core/lb-constants.d.ts +8 -18
  12. package/dist/core/lb-constants.d.ts.map +1 -1
  13. package/dist/core/lb-constants.js +32 -72
  14. package/dist/core/lb-constants.js.map +1 -1
  15. package/dist/core/lb-types.d.ts +12 -11
  16. package/dist/core/lb-types.d.ts.map +1 -1
  17. package/dist/core/lb-types.js +7 -0
  18. package/dist/core/lb-types.js.map +1 -1
  19. package/dist/hub/lb-apply.d.ts +23 -37
  20. package/dist/hub/lb-apply.d.ts.map +1 -1
  21. package/dist/hub/lb-apply.js +205 -518
  22. package/dist/hub/lb-apply.js.map +1 -1
  23. package/dist/hub/lb-hub.browser.d.ts.map +1 -1
  24. package/dist/hub/lb-hub.browser.js +159 -132
  25. package/dist/hub/lb-hub.browser.js.map +1 -1
  26. package/dist/hub/lb-lifecycle.d.ts +2 -2
  27. package/dist/hub/lb-lifecycle.d.ts.map +1 -1
  28. package/dist/hub/lb-lifecycle.js +9 -17
  29. package/dist/hub/lb-lifecycle.js.map +1 -1
  30. package/dist/server/lb-express.d.ts.map +1 -1
  31. package/dist/server/lb-express.js +3 -3
  32. package/dist/server/lb-express.js.map +1 -1
  33. package/dist/server/lb-server.d.ts +35 -19
  34. package/dist/server/lb-server.d.ts.map +1 -1
  35. package/dist/server/lb-server.js +141 -88
  36. package/dist/server/lb-server.js.map +1 -1
  37. package/docs/binding-cases.md +150 -0
  38. package/docs/comparison.md +20 -29
  39. package/docs/miswarts.md +2 -2
  40. package/docs/reference/css.md +2 -15
  41. package/docs/reference/custom-elements.md +6 -8
  42. package/docs/reference/data-binding.md +100 -185
  43. package/docs/reference/names.md +11 -27
  44. package/docs/reference/page-files.md +4 -14
  45. package/docs/reference/server.md +0 -1
  46. package/docs/testing.md +2 -5
  47. package/package.json +1 -1
  48. package/skills/loadbare-app/SKILL.md +66 -56
  49. package/skills/loadbare-app/references/css.md +2 -15
  50. package/skills/loadbare-app/references/custom-elements.md +6 -8
  51. package/skills/loadbare-app/references/data-binding.md +100 -185
  52. package/skills/loadbare-app/references/miswarts.md +2 -2
  53. package/skills/loadbare-app/references/names.md +11 -27
  54. package/skills/loadbare-app/references/page-files.md +4 -14
  55. package/skills/loadbare-app/references/server.md +0 -1
  56. package/docs/temp-proposals.md +0 -251
@@ -1,251 +0,0 @@
1
- # Proposals
2
-
3
- Working notes for changes not yet made. Not part of the skill.
4
-
5
- ## The mental model
6
-
7
- A `row` maps to an HTML form. It supports select, insert, update and delete.
8
- The hub handles the basics, such as resetting a form after an insert, and
9
- lifecycle methods let a custom element add behavior of its own.
10
-
11
- `rows` treats each of its rows as a `row`, and allows insert, update and
12
- delete of several rows at once. It also places its rows by sorting and
13
- filtering, each with an automatic or a manual flag.
14
-
15
- A form sends a parent `row` with its nested `rows` in one submit, and the
16
- handler writes them together. This is the foreign key.
17
-
18
- The URL names the page, and its query parms are the server's filters. The
19
- user's own sorts and filters are choices, held in `lb-choices`.
20
-
21
- Requests go up, from the element that committed through its ancestors to the
22
- hub, which completes them from what surrounds the element. Commands go
23
- sideways, by id to the element they name, carrying the button that sent them,
24
- and never reach the server. Lifecycle methods go down, from the hub to the
25
- custom elements it placed.
26
-
27
- What lies past this belongs to the application. It reaches the hub as fields
28
- a custom element supplies on a request, and through lifecycle methods the hub
29
- calls on a custom element.
30
-
31
- ## 1. Values kept across inserts
32
-
33
- Package: `@loadbare/widgets`. No change to `@loadbare/app`.
34
-
35
- ### Today
36
-
37
- After an insert succeeds, the hub resets the form the insert was gathered
38
- from, then calls `lbRequestDone` on the attached custom elements from the
39
- committing element outward. `detail.request.values` holds the values the
40
- insert sent, by column. A ghost row starts over empty, and each control
41
- returns to its HTML default.
42
-
43
- A page that wants some columns to carry over to the next row, such as a date
44
- or an account during a run of entries, has no way to say so.
45
-
46
- ### Proposal
47
-
48
- A widget around the list, `lb-keep` or similar, names the columns to keep:
49
-
50
- ```html
51
- <lb-keep exp-columns="date, account">
52
- <lb-table lb-query="entries">
53
- ...
54
- </lb-table>
55
- </lb-keep>
56
- ```
57
-
58
- In `lbRequestDone`, after a successful `lb-row-insert`, the widget sets each
59
- named column's control in the committing row back to the value the insert
60
- sent. The hub's reset and the refill run in one synchronous stretch, so the
61
- empty row is never painted.
62
-
63
- - A column not named returns to its HTML default: `value` on an input,
64
- `selected` on an option. A control with no default comes back blank.
65
- - A reset the user asks for, with a reset button, sends no request and is
66
- not followed by `lbRequestDone`. It clears every column.
67
- - Kept values live in the controls. A reload starts the row empty.
68
-
69
- ### Open
70
-
71
- - A starting value taken from the page, not from the last insert: ef's
72
- paychecks page enters a paycheck while showing a series, and the new
73
- paycheck's series is the one showing. A possible form is a default named
74
- as `query.column`.
75
- - Whether every wrapped control in `@loadbare/widgets` takes an HTML
76
- default.
77
-
78
- ## 2. Sorted and filtered placement
79
-
80
- Package: `@loadbare/app`.
81
-
82
- ### Today
83
-
84
- When a patch lands on a list, the hub either places the rows by the order and
85
- the filter, or holds them where they stand. It holds them when the request
86
- was sent from inside the list: the list is the nearest element carrying
87
- `lb-query` around the element that committed, or the request came from a form
88
- that `--lb-edit` pointed at one of its rows.
89
-
90
- Where the committing element sits is the only input to that decision. Two
91
- cases in ef come out wrong:
92
-
93
- - Matching. "Create rule and apply it" is a form in a side panel. Its answer
94
- patches the rows the rule matched, and under the filter "Unmatched only"
95
- they disappear. The user wants them to stay showing for review. An offset
96
- chosen with the form `--lb-edit` points at a row is held, so the two ways of
97
- matching a transaction behave differently.
98
- - Paychecks. "Change from here…" is a form pointed with `--lb-edit`, so its
99
- answer is held. The answer replaces the rest of the year, and the new
100
- paychecks land after the last row of the series, out of date order. The
101
- page carries a Re-sort button for this.
102
-
103
- Neither table has edits in its rows. Every edit on both is made in a form
104
- outside the table.
105
-
106
- ### Proposal
107
-
108
- The element carrying `lb-query` declares each kind of placement, `auto` or
109
- `manual`. Both default to `auto`. Spelling is open; for illustration:
110
-
111
- ```html
112
- <lb-table lb-query="entries" lb-order="entries_order"
113
- lb-filter="description, txn_date, is_unmatched"
114
- lb-order-placement="manual" lb-filter-placement="manual">
115
- ```
116
-
117
- The rule about where a request was sent from is removed.
118
-
119
- Each line of today's held behavior falls under one flag:
120
-
121
- | The answer | `manual` | Flag |
122
- | -------------------------------------- | ---------------------------------- | ------ |
123
- | Changes a column the order reads | The row stays where it stands | order |
124
- | Creates a row | The row goes last in its group | order |
125
- | Changes the column its group breaks on | The row stays under its heading | order |
126
- | Changes a row so the filter hides it | The row stays showing | filter |
127
- | Drops a row | The row leaves, under either value | — |
128
-
129
- Under `auto`, the rows are placed by the order and the filter on every
130
- landing.
131
-
132
- Every combination has a use:
133
-
134
- | Order | Filter | Example |
135
- | -------- | -------- | -------------------------------------------------------- |
136
- | `auto` | `auto` | Paychecks: a regenerated schedule lands in date order |
137
- | `manual` | `manual` | Matching: answered rows stay in place for review |
138
- | `auto` | `manual` | Answered rows stay showing and move into the order |
139
- | `manual` | `auto` | A to-do list: an edit does not move a row, done hides it |
140
-
141
- A row left where the order or the filter would not leave it is stamped, as
142
- `lb-row-unsorted` is today, and counted in `lb-query-unsorted-count`. The rows
143
- are placed by both again when the page loads, when the user's order or filter
144
- changes, and on `--lb-sort`.
145
-
146
- ### The command
147
-
148
- `--lb-sort` today places the rows by both the order and the filter, so a row
149
- kept despite the filter leaves on it. Under the flags it is renamed for what
150
- it does, `--lb-place` or similar.
151
-
152
- A side set to `auto` is in place after every landing, so one command does
153
- what each list needs:
154
-
155
- | Order | Filter | The command |
156
- | -------- | -------- | ----------------- |
157
- | `manual` | `auto` | Sorts |
158
- | `auto` | `manual` | Filters |
159
- | `manual` | `manual` | Sorts and filters |
160
- | `auto` | `auto` | Changes nothing |
161
-
162
- Separate `--lb-sort` and `--lb-filter` differ from it only when both sides are
163
- `manual` and the user applies one without the other. No case for that is in
164
- hand.
165
-
166
- ### Effect on ef
167
-
168
- - Matching declares both `manual`. The rule's answer and the offset form
169
- behave alike, wherever the form sits.
170
- - Paychecks declares nothing. The Re-sort button and its comment are removed.
171
-
172
- ### Effect on other pages
173
-
174
- A list that relies on being held today, such as an editable `lb-table` with a
175
- ghost row, declares `manual` to keep its behavior. Under `auto`, a row edited
176
- in place moves into the order, and a row entered in the ghost row is placed by
177
- the order.
178
-
179
- ### Open
180
-
181
- - The attribute names.
182
- - One stamp for both kinds of out-of-place row, or one for each, so a page can
183
- style a row out of order apart from a row kept despite the filter. The
184
- commands follow the stamps. One stamp has one count, one button shown while
185
- it is not 0, and one command. Two stamps let a page show Re-sort and
186
- Re-filter apart, each with its own command, `--lb-sort` and `--lb-filter`,
187
- beside the one for both. Every name carries the `--` prefix, or the
188
- browser ignores it.
189
-
190
- ## 3. Child rows entered with their parent
191
-
192
- Package: `@loadbare/app`.
193
-
194
- ### Today
195
-
196
- A form gathers the live rows of a query nested in its own, and sends them in
197
- `rows` beside its own `values`. The handler writes the parent and its child
198
- rows together. A live row is one the nested query answered, so the child rows
199
- exist before the form is sent: ef's paycheck form sends one amount per
200
- deduction type, and the types come from the database.
201
-
202
- A row not yet entered, carrying `lb-key-value=""`, arises only as a single
203
- row: a `row` query answering with an empty key, or a form pointed by
204
- `--lb-new`. A list holds no row not yet entered.
205
-
206
- ptracking's flight page enters a flight, then its arrivals. The arrivals
207
- section shows once the flight is on record, and each arrival is its own
208
- `lb-row-insert` from the ghost row, keyed by the `flight_id` parm. The
209
- arrivals handler refuses an insert with no flight: "Save the flight first."
210
- Most flights have one arrival, and pattern work is one arrival with a
211
- quantity, so the usual entry is two saves and a second form.
212
-
213
- ### Proposal
214
-
215
- A list may hold rows not yet entered.
216
-
217
- 1. Inside a parent not yet entered, the list's Add puts a row not yet entered
218
- into the list, and sends nothing.
219
- 2. The parent's form gathers those rows with its insert, each with no key,
220
- under the nested query's name in `rows`.
221
- 3. The parent's handler inserts the parent and its child rows in one
222
- transaction, and answers both. The rows not yet entered are replaced by
223
- the rows the answer lands.
224
- 4. Once the parent is on record, the list's Add inserts as it does today.
225
-
226
- A row not yet entered in a list follows the existing rules for one:
227
-
228
- - Its controls carrying `lb-request="lb-row-update"` send nothing and hold
229
- what the parent's submit gathers. Once the row is on record, they save as
230
- they change.
231
- - A delete from it sends nothing. The row is removed from the list.
232
- - A refusal of the parent's insert leaves it in place, and a column's message
233
- goes on its control, as for any control the request gathered.
234
-
235
- ### Effect on ptracking
236
-
237
- - The arrivals list moves inside the flight's form, and loses
238
- `lb-show="on_record"`.
239
- - The flight's `rowInsert` accepts `rows.arrivals` and inserts both.
240
- `detailCrud` writes the parent alone today.
241
- - A flight with one arrival is one save. A flight with three approaches is
242
- three rows not yet entered and one save.
243
-
244
- ### Open
245
-
246
- - The command that adds a row not yet entered: the ghost row's insert,
247
- changing meaning while the parent is not on record, or a command of its own.
248
- - `lb-table` joins the ghost row's controls to a form of its own, outside the
249
- table, with the `form` attribute. A ghost row inside a parent's form then
250
- belongs to the ghost row's form, not the parent's.
251
- - One level only, as for a form over a set of rows today.