@loadbare/app 0.18.0 → 0.18.1
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/hub/lb-apply.d.ts +12 -4
- package/dist/hub/lb-apply.d.ts.map +1 -1
- package/dist/hub/lb-apply.js +45 -5
- package/dist/hub/lb-apply.js.map +1 -1
- package/dist/hub/lb-hub.browser.js +3 -3
- package/dist/hub/lb-hub.browser.js.map +1 -1
- package/docs/TECHREF-1.0.md +50 -56
- package/docs/comparison.md +1 -2
- package/docs/reference/data-binding.md +23 -2
- package/docs/roadmap.md +17 -9
- package/package.json +1 -1
- package/skills/loadbare-app/SKILL.md +5 -2
- package/skills/loadbare-app/references/TECHREF-1.0.md +50 -56
- package/skills/loadbare-app/references/data-binding.md +23 -2
package/docs/roadmap.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# Roadmap
|
|
2
2
|
|
|
3
|
-
Release 1.0 is optimized to prove that a Loadbare app
|
|
4
|
-
|
|
3
|
+
Release 1.0 is optimized to prove that a Loadbare app holds a median 300ms
|
|
4
|
+
round trip from click to paint. See [Theory](./theory.md).
|
|
5
5
|
|
|
6
6
|
What follows is everything not yet decided or not yet built: release
|
|
7
7
|
candidates, risks not worth solving speculatively, and open design
|
|
@@ -30,13 +30,6 @@ read from a query parm. Whether a response may say the server already
|
|
|
30
30
|
sorted it is open: the server may not sort as the browser does, and for a
|
|
31
31
|
thousand rows the hub's sort is a small cost.
|
|
32
32
|
|
|
33
|
-
### Nesting
|
|
34
|
-
|
|
35
|
-
Whether a live row may hold rows of its own detail (master-detail, an
|
|
36
|
-
expanding row). [Theory](./theory.md) already flags this as possibly load-bearing if
|
|
37
|
-
disallowed. Worth a decision-in-principle the first time a master-detail
|
|
38
|
-
page is built, even before the mechanism is needed elsewhere.
|
|
39
|
-
|
|
40
33
|
### Events while a request is in flight
|
|
41
34
|
|
|
42
35
|
The hub ignores a commit on an element carrying `lb-request-pending`.
|
|
@@ -90,6 +83,9 @@ If the hub were configured with a URL for the data channel, the entire app
|
|
|
90
83
|
could be delivered from a static origin, such as an S3 bucket or static web
|
|
91
84
|
server.
|
|
92
85
|
|
|
86
|
+
`<lb-hub>` reads no attributes, so the data channel's URL, and a timeout an
|
|
87
|
+
application outgrows, can arrive as attributes on it.
|
|
88
|
+
|
|
93
89
|
### Tree-shaking CSS by tag name
|
|
94
90
|
|
|
95
91
|
Release 1.0 concatenates every `.css` file under `src`, and every one inside
|
|
@@ -110,6 +106,18 @@ Most valuable against a large imported widget library, where an app uses a
|
|
|
110
106
|
small fraction of what ships. Revisit when a real app's `app.css` is big
|
|
111
107
|
enough to measure.
|
|
112
108
|
|
|
109
|
+
### HTML validation in the build
|
|
110
|
+
|
|
111
|
+
A page can be well formed and still break HTML's rules for what an element
|
|
112
|
+
may hold, such as a `<div>` inside a `<p>`. The parser rearranges it
|
|
113
|
+
silently, the same way at build time and in the browser. The builder could
|
|
114
|
+
run html-validate on the source or the expanded output, as an opt-in.
|
|
115
|
+
|
|
116
|
+
### A whole row for a custom element
|
|
117
|
+
|
|
118
|
+
A column lands one element at a time. An optional `lbAcceptRow` beside
|
|
119
|
+
`lbRowsLanded` would hand a custom element its whole row.
|
|
120
|
+
|
|
113
121
|
### Options on `createHub`
|
|
114
122
|
|
|
115
123
|
Global hooks, transaction wrapping, error handling and a CSRF token each
|
package/package.json
CHANGED
|
@@ -244,8 +244,11 @@ row. Anything else gathers its form owner's controls. A `<form>` cannot
|
|
|
244
244
|
wrap a `<tr>`, so an insert row in a table puts its controls in a form
|
|
245
245
|
elsewhere with the HTML `form` attribute. A checkbox is a control: checked
|
|
246
246
|
unless its column is `false` or null, and gathered as `"true"` or `"false"`.
|
|
247
|
-
|
|
248
|
-
and
|
|
247
|
+
A radio button is a control: checked when its `value` is the column's
|
|
248
|
+
value, and the group gathers the one checked, or `""`. In a row template
|
|
249
|
+
the hub stamps its `name` with the row's key, so each row is its own group.
|
|
250
|
+
File inputs are not controls here: they receive no value and are not
|
|
251
|
+
gathered.
|
|
249
252
|
|
|
250
253
|
**A form that adds to a set chosen elsewhere is written once, outside every
|
|
251
254
|
row.** A form cannot sit inside another form or in a table row, so a dialog
|
|
@@ -15,39 +15,14 @@ they must be resolved before we declare 1.0.
|
|
|
15
15
|
|
|
16
16
|
### Data types
|
|
17
17
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
`lb-column-value` when it lands on one that is not a control.
|
|
18
|
+
A value renders by browser coercion when it lands on an HTML text element or
|
|
19
|
+
a control, and by whatever the custom element does with `lb-column-value`
|
|
20
|
+
when it lands on one that is not a control. A `rows` query may declare a
|
|
21
|
+
column's type, which the [order](#order), a [filter](#filters), `lb-min` and
|
|
22
|
+
`lb-max` read.
|
|
24
23
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
column's type, and an [aggregate](#aggregates) reads a sum or an average
|
|
28
|
-
from a JSON number or a string holding a plain decimal. A `rows` query may
|
|
29
|
-
declare a column's type, which the order, a filter, `lb-min` and `lb-max`
|
|
30
|
-
read the column as in place of its JSON type. No declared type changes how
|
|
31
|
-
a value renders.
|
|
32
|
-
|
|
33
|
-
We will then see if a useful solution emerges that Loadbare/app should
|
|
34
|
-
handle.
|
|
35
|
-
|
|
36
|
-
### Form controls
|
|
37
|
-
|
|
38
|
-
- **Radio buttons are not implemented.** A value does not land on one and
|
|
39
|
-
the hub does not gather one. A radio group is several elements answering
|
|
40
|
-
to one column.
|
|
41
|
-
|
|
42
|
-
### Custom element hooks
|
|
43
|
-
|
|
44
|
-
Loadbare/app owns every method name beginning with `lb` on a custom element.
|
|
45
|
-
That decision is firm; what the set contains is not.
|
|
46
|
-
|
|
47
|
-
- **Decide whether a custom element may receive a whole row.** A column
|
|
48
|
-
lands one element at a time and offers no escape hatch. An optional
|
|
49
|
-
`lbAcceptRow` would sit beside `lbRowsLanded`, and this is the most likely
|
|
50
|
-
first request from a custom element author.
|
|
24
|
+
- **Decide who formats a value.** The hub could own formatting, or take it
|
|
25
|
+
from the application as configuration or as code.
|
|
51
26
|
|
|
52
27
|
### Nested queries
|
|
53
28
|
|
|
@@ -83,18 +58,8 @@ But the allowed values may depend on other values in the row.
|
|
|
83
58
|
repository with several applications gets one per application. `--src`
|
|
84
59
|
stays a flag, since it is what locates the file. State the precedence
|
|
85
60
|
between a flag and a key once. Its key names join the permanent surface,
|
|
86
|
-
so this lands before 1.0 or not at all.
|
|
87
|
-
-
|
|
88
|
-
definition would let the builder ship only what survives expansion.
|
|
89
|
-
Recommend deferring the mechanism and reserving the configuration key, so
|
|
90
|
-
that it lands as an opt-in rather than as a silent drop.
|
|
91
|
-
- **Decide whether the build validates HTML.** A page can be well formed and
|
|
92
|
-
still break HTML's rules for what an element may hold, such as a `<div>`
|
|
93
|
-
inside a `<p>`. The parser rearranges it silently, the same way at build
|
|
94
|
-
time and in the browser, so nothing reports it. Checking those rules is a
|
|
95
|
-
validator's job, and html-validate is one the builder could run on the
|
|
96
|
-
source or on the expanded output. Deciding it after 1.0 is free if it
|
|
97
|
-
lands as an opt-in, and it may need a configuration key.
|
|
61
|
+
so this lands before 1.0 or not at all. It reserves a key for the
|
|
62
|
+
roadmap's tree-shaking CSS by tag name.
|
|
98
63
|
- **Confirm the three output names.** `app.html`, `client.js` and `app.css`
|
|
99
64
|
are about to be fixed in `staticRoutes` as well as in the builder.
|
|
100
65
|
|
|
@@ -103,16 +68,15 @@ But the allowed values may depend on other values in the row.
|
|
|
103
68
|
None of this is surface. It is listed here because trimming it is free
|
|
104
69
|
today and breaking after 1.0.
|
|
105
70
|
|
|
106
|
-
- **Audit what the hub does.**
|
|
107
|
-
|
|
71
|
+
- **Audit what the hub does.** Every routine it runs answers to an `lb-*`
|
|
72
|
+
attribute, a [reserved query](#reserved-queries), or a
|
|
73
|
+
[reserved event](#reserved-events) or [method](#reserved-methods). Trim
|
|
74
|
+
whatever does not, and leave what stays clean: no dead code, no routine
|
|
75
|
+
written twice, no comment the code contradicts.
|
|
108
76
|
- **Keep the rest as constants.** The endpoint, `index` and the timeout are
|
|
109
77
|
linkage between the builder and the hub rather than facts an application
|
|
110
78
|
varies. Adding a knob for any of them buys a second shape of application
|
|
111
79
|
to reason about.
|
|
112
|
-
- **Give the hub a configuration channel without using it.** `<lb-hub>` reads
|
|
113
|
-
no attributes at all, which is the free landing spot for the roadmap's
|
|
114
|
-
static-origin split and for a timeout an application eventually outgrows.
|
|
115
|
-
Reserve the idea, build nothing.
|
|
116
80
|
|
|
117
81
|
## The build
|
|
118
82
|
|
|
@@ -220,7 +184,8 @@ it is sent to the browser on initial page load, no HTML is ever sent
|
|
|
220
184
|
again.
|
|
221
185
|
|
|
222
186
|
The developer writes `lb-*` attributes in markup. Script never assigns
|
|
223
|
-
them. The hub and the builder write only their stamps
|
|
187
|
+
them. The hub and the builder write only their stamps, and the hub writes
|
|
188
|
+
the `name` of a radio button in a row template. See
|
|
224
189
|
[The markup checks](#the-markup-checks).
|
|
225
190
|
|
|
226
191
|
### Expansion
|
|
@@ -457,8 +422,8 @@ unless its name begins with `lb-`.
|
|
|
457
422
|
| Any other element | Its text content |
|
|
458
423
|
|
|
459
424
|
A control is an `<input>`, `<select>` or `<textarea>`, or a form-associated
|
|
460
|
-
custom element with a `value` property that fires `change`. A checkbox
|
|
461
|
-
|
|
425
|
+
custom element with a `value` property that fires `change`. A checkbox and
|
|
426
|
+
a radio button are controls too, by the rules below. A
|
|
462
427
|
form-associated custom element declares `static formAssociated = true`.
|
|
463
428
|
|
|
464
429
|
The hub stamps `lb-column-value` with the value on every element it sets.
|
|
@@ -481,9 +446,18 @@ attribute means nothing to the hub.
|
|
|
481
446
|
<input type="checkbox" lb-column="active" lb-request="lb-row-update" />
|
|
482
447
|
```
|
|
483
448
|
|
|
484
|
-
|
|
485
|
-
`
|
|
486
|
-
|
|
449
|
+
A radio button's state is `checked` as well. The hub checks it when its
|
|
450
|
+
`value` attribute equals the value as a string, and unchecks it otherwise,
|
|
451
|
+
`null` included. Of the radio buttons naming one column, the hub gathers
|
|
452
|
+
the `value` of the one checked, or `""` when none is.
|
|
453
|
+
|
|
454
|
+
```html
|
|
455
|
+
<input type="radio" lb-column="shift" value="day" lb-request="lb-row-update" />
|
|
456
|
+
<input type="radio" lb-column="shift" value="night" lb-request="lb-row-update" />
|
|
457
|
+
```
|
|
458
|
+
|
|
459
|
+
An `<input>` of type `file` receives nothing, not even `lb-column-value`,
|
|
460
|
+
and the hub reports it to the console. The hub does not gather one either.
|
|
487
461
|
|
|
488
462
|
A `<select>` with no option for the value shows no selection.
|
|
489
463
|
|
|
@@ -1583,6 +1557,26 @@ whose name begins with `lb` and a capital and is not in
|
|
|
1583
1557
|
Script never assigns an `lb-` attribute, so the markup states every one
|
|
1584
1558
|
that exists, and checking the markup is sound.
|
|
1585
1559
|
|
|
1560
|
+
### Uncommon layouts
|
|
1561
|
+
|
|
1562
|
+
The hub supports these layouts and adds no check to refuse them. They are
|
|
1563
|
+
uncommon, and Loadbare/app does not shape itself around them.
|
|
1564
|
+
|
|
1565
|
+
- **A radio button in a row template.** The browser groups radio buttons
|
|
1566
|
+
by `name`, and a row template repeats one `name` in every live row. The
|
|
1567
|
+
hub stamps each radio button's `name` with the `name` written, or its
|
|
1568
|
+
column when none is, followed by `-` and the live row's key, so each live
|
|
1569
|
+
row holds a group of its own.
|
|
1570
|
+
- **Several rows not yet entered, each holding radio buttons.** A
|
|
1571
|
+
[row not yet entered](#a-row-not-yet-entered) has an empty key, so the
|
|
1572
|
+
radio buttons of every such row share one `name` and form one group.
|
|
1573
|
+
- **Radio buttons populated from a query.** A radio button in a query's row
|
|
1574
|
+
template answers to that query's row, as any element there does, so which
|
|
1575
|
+
row and column it lands from and gathers to follows from where the layout
|
|
1576
|
+
puts it. The result is the same as in any framework that populates radio
|
|
1577
|
+
buttons from a query. A choice among a query's rows is better made with a
|
|
1578
|
+
form-associated control, such as `lb-options` in `@loadbare/widgets`.
|
|
1579
|
+
|
|
1586
1580
|
## Application files
|
|
1587
1581
|
|
|
1588
1582
|
### Chrome
|
|
@@ -124,6 +124,7 @@ no row fills.
|
|
|
124
124
|
|------------------------------------------------------|-----------------------------------------|
|
|
125
125
|
| `<input>`, `<select>`, `<textarea>` | Its `value`, and `lb-column-value` |
|
|
126
126
|
| `<input type="checkbox">` | Its `checked`, and `lb-column-value` |
|
|
127
|
+
| `<input type="radio">` | Its `checked`, and `lb-column-value` |
|
|
127
128
|
| A form-associated custom element with `value` | Its `value`, and `lb-column-value` |
|
|
128
129
|
| Any other custom element | `lb-column-value` only |
|
|
129
130
|
| Any other element | Its text content, and `lb-column-value` |
|
|
@@ -135,8 +136,7 @@ element that is not a control keeps the content the builder placed in it
|
|
|
135
136
|
from its element file, and renders `lb-column-value` itself; see
|
|
136
137
|
[Custom Elements](./custom-elements.md#receiving-a-value).
|
|
137
138
|
|
|
138
|
-
A
|
|
139
|
-
the console.
|
|
139
|
+
A file input receives nothing, and the hub reports it to the console.
|
|
140
140
|
|
|
141
141
|
The hub hands every value to the browser as the server sent it. What a
|
|
142
142
|
number, a date or a null looks like is decided in the query.
|
|
@@ -155,6 +155,27 @@ boolean, and the string `"false"` is checked. Unchecked sends `"false"`
|
|
|
155
155
|
rather than nothing, so a flag can be set back. The checkbox's `value`
|
|
156
156
|
attribute means nothing to the hub.
|
|
157
157
|
|
|
158
|
+
### Radio buttons
|
|
159
|
+
|
|
160
|
+
A radio button is a control. It is checked when its `value` is the
|
|
161
|
+
column's value as a string, and unchecked otherwise. Of the radio buttons
|
|
162
|
+
naming one column, the hub gathers the `value` of the one checked, or `""`
|
|
163
|
+
when none is:
|
|
164
|
+
|
|
165
|
+
```html
|
|
166
|
+
<input type="radio" lb-column="shift" value="day" lb-request="lb-row-update" />
|
|
167
|
+
<input type="radio" lb-column="shift" value="night" lb-request="lb-row-update" />
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
In a row template, the hub stamps each radio button's `name` with the
|
|
171
|
+
`name` written, or its column when none is, followed by `-` and the live
|
|
172
|
+
row's key, so each live row holds a group of its own. Rows not yet entered
|
|
173
|
+
share the empty key, and so share one group.
|
|
174
|
+
|
|
175
|
+
A radio button in a query's row template answers to that query's row, as
|
|
176
|
+
any element there does. A choice among a query's rows is better made with
|
|
177
|
+
a form-associated control, such as `lb-options` in `@loadbare/widgets`.
|
|
178
|
+
|
|
158
179
|
### Rows
|
|
159
180
|
|
|
160
181
|
Write a `<template>` inside the element carrying `lb-query`, holding one
|