@loadbare/app 0.22.0 → 0.23.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.
- package/dist/build/build.d.ts +16 -0
- package/dist/build/build.d.ts.map +1 -1
- package/dist/build/build.js +77 -5
- package/dist/build/build.js.map +1 -1
- package/dist/hub/lb-apply.d.ts.map +1 -1
- package/dist/hub/lb-apply.js +12 -6
- package/dist/hub/lb-apply.js.map +1 -1
- package/docs/miswarts.md +3 -2
- package/docs/reference/data-binding.md +13 -9
- package/docs/reference/dev-server.md +10 -3
- package/docs/temp-proposals.md +251 -0
- package/package.json +1 -1
- package/skills/loadbare-app/SKILL.md +2 -1
- package/skills/loadbare-app/references/data-binding.md +13 -9
- package/skills/loadbare-app/references/dev-server.md +10 -3
- package/skills/loadbare-app/references/miswarts.md +3 -2
|
@@ -173,18 +173,21 @@ column the user sorts or filters raw, and format it in the element.
|
|
|
173
173
|
|
|
174
174
|
### Checkboxes
|
|
175
175
|
|
|
176
|
-
A checkbox is a control. It
|
|
177
|
-
|
|
178
|
-
|
|
176
|
+
A checkbox is a control. It sends `"true"` or `"false"`
|
|
177
|
+
([miswart](../miswarts.md#checkboxes-and-radio-groups-always-gather-a-value)),
|
|
178
|
+
and it is checked when its column is anything but `false`, null, `"false"`
|
|
179
|
+
or `""`:
|
|
179
180
|
|
|
180
181
|
```html
|
|
181
182
|
<input type="checkbox" lb-column="active" lb-request="lb-row-update" />
|
|
182
183
|
```
|
|
183
184
|
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
185
|
+
A checkbox lands what it sends, so it shows the same state after a round
|
|
186
|
+
trip through a query whose values are strings, such as `lb-url` or
|
|
187
|
+
`lb-choices`. A query parm the URL does not carry lands as `""`, so the
|
|
188
|
+
checkbox is unchecked. Unchecked sends `"false"` rather than nothing, so a
|
|
189
|
+
flag can be set back. The checkbox's `value` attribute means nothing to the
|
|
190
|
+
hub.
|
|
188
191
|
|
|
189
192
|
### Radio buttons
|
|
190
193
|
|
|
@@ -464,8 +467,9 @@ are heading rows beside their rows:
|
|
|
464
467
|
Content after the nested template lands after the group's rows, which is
|
|
465
468
|
where a group's footer goes.
|
|
466
469
|
|
|
467
|
-
A heading is filled from its group's first row
|
|
468
|
-
|
|
470
|
+
A heading is filled from its group's first row as an element in a row is,
|
|
471
|
+
`href`s from `lb-url-parm` included, so it may show a column other than the
|
|
472
|
+
one the group breaks on. A row an edit from inside the list
|
|
469
473
|
moved to another group stays under its old heading, and the heading shows
|
|
470
474
|
the row as it stood, until the rows are placed again. The hub stamps each top-level
|
|
471
475
|
element of a group with `lb-group-live`, `lb-group-column` and
|
|
@@ -105,6 +105,7 @@ own from them.
|
|
|
105
105
|
|--------------|------------------------|--------------------------------------------------------------|
|
|
106
106
|
| `watchApp` | `@loadbare/app/build` | Builds, rebuilds on a change, and reports each build |
|
|
107
107
|
| `buildApp` | `@loadbare/app/build` | Builds once |
|
|
108
|
+
| `watchTree` | `@loadbare/app/build` | Reports each changed file under a directory |
|
|
108
109
|
| `appServer` | `@loadbare/app/dev` | The application's server as a child process, restarted on demand |
|
|
109
110
|
| `gate` | `@loadbare/app/dev` | Holds requests while any reason to hold them stands |
|
|
110
111
|
| `devProxy` | `@loadbare/app/dev` | The browser's port, passing requests through a gate |
|
|
@@ -123,6 +124,13 @@ fails. A build writes nothing until every output is ready, so a failed one
|
|
|
123
124
|
leaves the last good build in place. `loadbare-app-build` is a thin command
|
|
124
125
|
over these two.
|
|
125
126
|
|
|
127
|
+
`watchTree(root, onFile)` calls `onFile(file)` for each file under `root`
|
|
128
|
+
that is changed, added or removed, with its path relative to `root`. It
|
|
129
|
+
watches each directory, including those made later, so a file saved by
|
|
130
|
+
replacing it, as `sed -i` and many editors save, is reported on every save.
|
|
131
|
+
Node's `fs.watch` with `recursive: true` loses such a file on Linux after
|
|
132
|
+
its first save. It returns `{ close() }`. `watchApp` watches `src` with it.
|
|
133
|
+
|
|
126
134
|
`appServer({ entry, port, portEnv, node, log })` returns `{ restart(),
|
|
127
135
|
stop(), state }`. `restart()` stops the server if it runs, starts it, and
|
|
128
136
|
resolves once it accepts connections, or has exited instead. `state` is
|
|
@@ -143,8 +151,7 @@ a plain message when the port is in use.
|
|
|
143
151
|
A dev server that also restarts on a change to `config/`:
|
|
144
152
|
|
|
145
153
|
```ts
|
|
146
|
-
import {
|
|
147
|
-
import { watchApp } from "@loadbare/app/build";
|
|
154
|
+
import { watchApp, watchTree } from "@loadbare/app/build";
|
|
148
155
|
import { appServer, devProxy, gate } from "@loadbare/app/dev";
|
|
149
156
|
|
|
150
157
|
const held = gate();
|
|
@@ -163,7 +170,7 @@ const watcher = watchApp({
|
|
|
163
170
|
held.open("build");
|
|
164
171
|
},
|
|
165
172
|
});
|
|
166
|
-
|
|
173
|
+
watchTree("config", () => void restart());
|
|
167
174
|
|
|
168
175
|
await watcher.ready;
|
|
169
176
|
await restart();
|
|
@@ -0,0 +1,251 @@
|
|
|
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.
|
package/package.json
CHANGED
|
@@ -265,7 +265,8 @@ control whose form owner it is. An element in a live row gathers that live
|
|
|
265
265
|
row. Anything else gathers its form owner's controls. A `<form>` cannot
|
|
266
266
|
wrap a `<tr>`, so an insert row in a table puts its controls in a form
|
|
267
267
|
elsewhere with the HTML `form` attribute. A checkbox is a control: checked
|
|
268
|
-
unless its column is `false
|
|
268
|
+
unless its column is `false`, null, `"false"` or `""`, and gathered as
|
|
269
|
+
`"true"` or `"false"`.
|
|
269
270
|
A radio button is a control: checked when its `value` is the column's
|
|
270
271
|
value, and the group gathers the one checked, or `""`. In a row template
|
|
271
272
|
the hub stamps its `name` with the row's key, so each row is its own group.
|
|
@@ -173,18 +173,21 @@ column the user sorts or filters raw, and format it in the element.
|
|
|
173
173
|
|
|
174
174
|
### Checkboxes
|
|
175
175
|
|
|
176
|
-
A checkbox is a control. It
|
|
177
|
-
|
|
178
|
-
|
|
176
|
+
A checkbox is a control. It sends `"true"` or `"false"`
|
|
177
|
+
([miswart](./miswarts.md#checkboxes-and-radio-groups-always-gather-a-value)),
|
|
178
|
+
and it is checked when its column is anything but `false`, null, `"false"`
|
|
179
|
+
or `""`:
|
|
179
180
|
|
|
180
181
|
```html
|
|
181
182
|
<input type="checkbox" lb-column="active" lb-request="lb-row-update" />
|
|
182
183
|
```
|
|
183
184
|
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
185
|
+
A checkbox lands what it sends, so it shows the same state after a round
|
|
186
|
+
trip through a query whose values are strings, such as `lb-url` or
|
|
187
|
+
`lb-choices`. A query parm the URL does not carry lands as `""`, so the
|
|
188
|
+
checkbox is unchecked. Unchecked sends `"false"` rather than nothing, so a
|
|
189
|
+
flag can be set back. The checkbox's `value` attribute means nothing to the
|
|
190
|
+
hub.
|
|
188
191
|
|
|
189
192
|
### Radio buttons
|
|
190
193
|
|
|
@@ -464,8 +467,9 @@ are heading rows beside their rows:
|
|
|
464
467
|
Content after the nested template lands after the group's rows, which is
|
|
465
468
|
where a group's footer goes.
|
|
466
469
|
|
|
467
|
-
A heading is filled from its group's first row
|
|
468
|
-
|
|
470
|
+
A heading is filled from its group's first row as an element in a row is,
|
|
471
|
+
`href`s from `lb-url-parm` included, so it may show a column other than the
|
|
472
|
+
one the group breaks on. A row an edit from inside the list
|
|
469
473
|
moved to another group stays under its old heading, and the heading shows
|
|
470
474
|
the row as it stood, until the rows are placed again. The hub stamps each top-level
|
|
471
475
|
element of a group with `lb-group-live`, `lb-group-column` and
|
|
@@ -105,6 +105,7 @@ own from them.
|
|
|
105
105
|
|--------------|------------------------|--------------------------------------------------------------|
|
|
106
106
|
| `watchApp` | `@loadbare/app/build` | Builds, rebuilds on a change, and reports each build |
|
|
107
107
|
| `buildApp` | `@loadbare/app/build` | Builds once |
|
|
108
|
+
| `watchTree` | `@loadbare/app/build` | Reports each changed file under a directory |
|
|
108
109
|
| `appServer` | `@loadbare/app/dev` | The application's server as a child process, restarted on demand |
|
|
109
110
|
| `gate` | `@loadbare/app/dev` | Holds requests while any reason to hold them stands |
|
|
110
111
|
| `devProxy` | `@loadbare/app/dev` | The browser's port, passing requests through a gate |
|
|
@@ -123,6 +124,13 @@ fails. A build writes nothing until every output is ready, so a failed one
|
|
|
123
124
|
leaves the last good build in place. `loadbare-app-build` is a thin command
|
|
124
125
|
over these two.
|
|
125
126
|
|
|
127
|
+
`watchTree(root, onFile)` calls `onFile(file)` for each file under `root`
|
|
128
|
+
that is changed, added or removed, with its path relative to `root`. It
|
|
129
|
+
watches each directory, including those made later, so a file saved by
|
|
130
|
+
replacing it, as `sed -i` and many editors save, is reported on every save.
|
|
131
|
+
Node's `fs.watch` with `recursive: true` loses such a file on Linux after
|
|
132
|
+
its first save. It returns `{ close() }`. `watchApp` watches `src` with it.
|
|
133
|
+
|
|
126
134
|
`appServer({ entry, port, portEnv, node, log })` returns `{ restart(),
|
|
127
135
|
stop(), state }`. `restart()` stops the server if it runs, starts it, and
|
|
128
136
|
resolves once it accepts connections, or has exited instead. `state` is
|
|
@@ -143,8 +151,7 @@ a plain message when the port is in use.
|
|
|
143
151
|
A dev server that also restarts on a change to `config/`:
|
|
144
152
|
|
|
145
153
|
```ts
|
|
146
|
-
import {
|
|
147
|
-
import { watchApp } from "@loadbare/app/build";
|
|
154
|
+
import { watchApp, watchTree } from "@loadbare/app/build";
|
|
148
155
|
import { appServer, devProxy, gate } from "@loadbare/app/dev";
|
|
149
156
|
|
|
150
157
|
const held = gate();
|
|
@@ -163,7 +170,7 @@ const watcher = watchApp({
|
|
|
163
170
|
held.open("build");
|
|
164
171
|
},
|
|
165
172
|
});
|
|
166
|
-
|
|
173
|
+
watchTree("config", () => void restart());
|
|
167
174
|
|
|
168
175
|
await watcher.ready;
|
|
169
176
|
await restart();
|
|
@@ -60,8 +60,9 @@ group.
|
|
|
60
60
|
set a flag back to false, or clear a choice, and nothing on the wire
|
|
61
61
|
cannot say either.
|
|
62
62
|
|
|
63
|
-
**Why it terminates.** It applies only to
|
|
64
|
-
|
|
63
|
+
**Why it terminates.** It applies only to these two controls. A
|
|
64
|
+
checkbox lands `"false"` and `""` as unchecked, so it lands what it
|
|
65
|
+
gathered.
|
|
65
66
|
|
|
66
67
|
## Rows hidden by a filter
|
|
67
68
|
|