@loadbare/app 0.8.2 → 0.10.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/README.md +3 -3
- package/dist/build/assemble.d.ts.map +1 -1
- package/dist/build/assemble.js +74 -66
- package/dist/build/assemble.js.map +1 -1
- package/dist/build/expand.d.ts.map +1 -1
- package/dist/build/expand.js +20 -19
- package/dist/build/expand.js.map +1 -1
- package/dist/build/locations.d.ts +2 -3
- package/dist/build/locations.d.ts.map +1 -1
- package/dist/build/locations.js +2 -3
- package/dist/build/locations.js.map +1 -1
- package/dist/build/pages.d.ts +3 -4
- package/dist/build/pages.d.ts.map +1 -1
- package/dist/build/pages.js +3 -4
- package/dist/build/pages.js.map +1 -1
- package/dist/core/lb-constants.d.ts +25 -23
- package/dist/core/lb-constants.d.ts.map +1 -1
- package/dist/core/lb-constants.js +95 -158
- package/dist/core/lb-constants.js.map +1 -1
- package/dist/core/lb-types.d.ts +73 -75
- package/dist/core/lb-types.d.ts.map +1 -1
- package/dist/core/lb-types.js +58 -5
- package/dist/core/lb-types.js.map +1 -1
- package/dist/hub/lb-apply.d.ts +47 -37
- package/dist/hub/lb-apply.d.ts.map +1 -1
- package/dist/hub/lb-apply.js +174 -193
- package/dist/hub/lb-apply.js.map +1 -1
- package/dist/hub/lb-hub.browser.d.ts +1 -1
- package/dist/hub/lb-hub.browser.d.ts.map +1 -1
- package/dist/hub/lb-hub.browser.js +419 -415
- package/dist/hub/lb-hub.browser.js.map +1 -1
- package/dist/server/lb-express.d.ts +20 -13
- package/dist/server/lb-express.d.ts.map +1 -1
- package/dist/server/lb-express.js +50 -52
- package/dist/server/lb-express.js.map +1 -1
- package/dist/server/lb-server.d.ts +81 -116
- package/dist/server/lb-server.d.ts.map +1 -1
- package/dist/server/lb-server.js +151 -48
- package/dist/server/lb-server.js.map +1 -1
- package/docs/TECHREF-1.0.md +893 -558
- package/docs/comparison.md +222 -185
- package/docs/prior-art.md +15 -14
- package/docs/reference/builder.md +9 -3
- package/docs/reference/chrome.md +107 -56
- package/docs/reference/custom-elements.md +199 -173
- package/docs/reference/data-binding.md +375 -370
- package/docs/reference/overview.md +12 -10
- package/docs/reference/page-files.md +161 -86
- package/docs/reference/server.md +13 -7
- package/docs/reference/widgets.md +104 -110
- package/docs/roadmap.md +36 -31
- package/docs/terms-of-art.md +57 -0
- package/docs/testing.md +97 -68
- package/docs/theory.md +92 -58
- package/docs/tutorials/010-pages-and-navigation.md +20 -12
- package/docs/tutorials/020-css.md +6 -3
- package/docs/tutorials/030-html-decomposition.md +9 -7
- package/docs/tutorials/040-displaying-data.md +30 -13
- package/docs/tutorials/{050-actions.md → 050-requests.md} +25 -15
- package/docs/tutorials/060-custom-element-code.md +17 -16
- package/docs/tutorials/065-conditional-rendering.md +34 -23
- package/docs/tutorials/070-displaying-a-list.md +29 -21
- package/docs/tutorials/072-inserting-into-a-list.md +24 -16
- package/docs/tutorials/074-deleting-from-a-list.md +9 -7
- package/docs/tutorials/076-updating-a-list-item.md +11 -10
- package/docs/tutorials/080-widget-requests.md +71 -43
- package/docs/tutorials/090-using-widget-libraries.md +22 -22
- package/package.json +1 -1
- package/skills/loadbare-app/SKILL.md +178 -111
- package/skills/loadbare-app/references/TECHREF-1.0.md +893 -558
- package/skills/loadbare-app/references/builder.md +9 -3
- package/skills/loadbare-app/references/chrome.md +107 -56
- package/skills/loadbare-app/references/custom-elements.md +199 -173
- package/skills/loadbare-app/references/data-binding.md +375 -370
- package/skills/loadbare-app/references/overview.md +12 -10
- package/skills/loadbare-app/references/page-files.md +161 -86
- package/skills/loadbare-app/references/server.md +13 -7
- package/skills/loadbare-app/references/widgets.md +104 -110
- package/docs/analysis-accidental-complexity.md +0 -149
- package/docs/analysis-closed-set.md +0 -210
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: loadbare-app
|
|
3
|
-
description: Build server-bound web applications with Loadbare/app. Covers the file conventions the builder finds by name (`chrome.html`, `*.page.html`, `*.queries.ts`, `*.requests.ts`, `imports.ts`, `<tag>.html`, `<tag>.browser.ts`); the `lb-*` attribute vocabulary that
|
|
3
|
+
description: Build server-bound web applications with Loadbare/app. Covers the file conventions the builder finds by name (`chrome.html`, `*.page.html`, `*.queries.ts`, `*.requests.ts`, `imports.ts`, `<tag>.html`, `<tag>.browser.ts`); the `lb-*` attribute vocabulary that lands query rows on HTML and issues requests (`lb-query`, `lb-column`, `lb-show`, `lb-request`); queries declared with `row(key, run)` and `rows(key, run)`; the URL as the hub's own query `lb-url`, with `lb-url-link`, `lb-url-push` and `lb-url-unknown`; build-time expansion with `exp-*` parameters, `lb-exp-slot` and `lb-exp-template`; custom elements as form-associated controls and row hosts; the Express wiring with `hubRoutes`; and the `@loadbare/widgets` library. Use whenever a task involves `@loadbare/app`, `@loadbare/widgets`, `loadbare-app-build`, an `lb-` attribute, or a page, query, request or custom element file in a Loadbare application. The model is not React, htmx or REST, and cannot be inferred from them.
|
|
4
4
|
license: Apache-2.0
|
|
5
5
|
metadata:
|
|
6
6
|
package: "@loadbare/app"
|
|
@@ -11,17 +11,19 @@ metadata:
|
|
|
11
11
|
|
|
12
12
|
Loadbare/app builds a whole application into one HTML document, one client
|
|
13
13
|
script and one stylesheet. The server answers named queries with rows and
|
|
14
|
-
|
|
15
|
-
them. No component renders anything, and no page fetches
|
|
14
|
+
runs named requests; the hub in the browser lands those rows on the elements
|
|
15
|
+
that name them. No component renders anything, and no page fetches
|
|
16
|
+
anything.
|
|
16
17
|
|
|
17
|
-
|
|
18
|
-
row holds
|
|
19
|
-
|
|
18
|
+
Everything is a query. A query is a name for rows, of kind `row` or `rows`,
|
|
19
|
+
with a key column. A row holds columns, and a column holds one value. The
|
|
20
|
+
URL itself is a query, `lb-url`, that the hub serves. Hold on to that: most
|
|
21
|
+
wrong designs come from sending a shape a relational answer cannot have.
|
|
20
22
|
|
|
21
23
|
## Build every change before handing it over
|
|
22
24
|
|
|
23
|
-
`loadbare-app-build` is the checker. It expands every page and
|
|
24
|
-
refuses what it cannot ship, naming the tag and the file:
|
|
25
|
+
`loadbare-app-build` is the checker. It expands every page and custom
|
|
26
|
+
element and refuses what it cannot ship, naming the tag and the file:
|
|
25
27
|
|
|
26
28
|
```bash
|
|
27
29
|
loadbare-app-build --src src --out dist
|
|
@@ -40,9 +42,9 @@ tsc --noEmit
|
|
|
40
42
|
`dist/pages.ts` imports page files with their `.ts` extensions, so the
|
|
41
43
|
application's `tsconfig.json` needs `allowImportingTsExtensions`.
|
|
42
44
|
|
|
43
|
-
|
|
44
|
-
`createHub` refuses a
|
|
45
|
-
|
|
45
|
+
Write, build, fix, and repeat until the build is clean. Then start the
|
|
46
|
+
server: `createHub` refuses a page that declares a reserved name at startup,
|
|
47
|
+
and the server console reports a query that answers with the wrong kind.
|
|
46
48
|
Restart the server after adding or changing a `.queries.ts` or
|
|
47
49
|
`.requests.ts` file.
|
|
48
50
|
|
|
@@ -58,9 +60,9 @@ src/
|
|
|
58
60
|
pages/
|
|
59
61
|
index.page.html the page for /
|
|
60
62
|
members.page.html the page for /members
|
|
61
|
-
members.queries.ts
|
|
62
|
-
members.requests.ts
|
|
63
|
-
|
|
63
|
+
members.queries.ts the queries members shows
|
|
64
|
+
members.requests.ts the requests members answers
|
|
65
|
+
elements/
|
|
64
66
|
note-card.html the markup <note-card> expands into
|
|
65
67
|
visit-count.browser.ts the class <visit-count> registers
|
|
66
68
|
server.ts
|
|
@@ -74,18 +76,22 @@ A page is an HTML fragment that lands in `<main>`:
|
|
|
74
76
|
|
|
75
77
|
```html
|
|
76
78
|
<!-- src/pages/members.page.html -->
|
|
77
|
-
<
|
|
79
|
+
<title>Members</title>
|
|
80
|
+
<h1>Members</h1>
|
|
78
81
|
|
|
79
|
-
<
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
82
|
+
<p lb-query="dues">Dues collected this year: <span lb-column="total"></span></p>
|
|
83
|
+
|
|
84
|
+
<section lb-query="roster">
|
|
85
|
+
<form lb-request="lb-row-insert">
|
|
86
|
+
<input lb-column="name" placeholder="Name" />
|
|
87
|
+
<button type="submit">Add member</button>
|
|
83
88
|
</form>
|
|
89
|
+
|
|
84
90
|
<ul>
|
|
85
|
-
<template
|
|
91
|
+
<template>
|
|
86
92
|
<li>
|
|
87
|
-
<
|
|
88
|
-
<button lb-
|
|
93
|
+
<input lb-column="name" lb-request="lb-row-update" />
|
|
94
|
+
<button lb-request="lb-row-delete">Remove</button>
|
|
89
95
|
</li>
|
|
90
96
|
</template>
|
|
91
97
|
</ul>
|
|
@@ -94,11 +100,11 @@ A page is an HTML fragment that lands in `<main>`:
|
|
|
94
100
|
|
|
95
101
|
```ts
|
|
96
102
|
// src/pages/members.queries.ts
|
|
97
|
-
import {
|
|
103
|
+
import { row, rows, type Queries } from "@loadbare/app/server";
|
|
98
104
|
|
|
99
105
|
export const queries: Queries = {
|
|
100
|
-
dues: row((ctx) => ctx.db.duesTotal()),
|
|
101
|
-
roster:
|
|
106
|
+
dues: row("year", (ctx) => ctx.db.duesTotal()),
|
|
107
|
+
roster: rows("id", (ctx) => ctx.db.members()),
|
|
102
108
|
};
|
|
103
109
|
```
|
|
104
110
|
|
|
@@ -115,6 +121,12 @@ export const requests: Requests = {
|
|
|
115
121
|
}),
|
|
116
122
|
refresh: ["dues"],
|
|
117
123
|
},
|
|
124
|
+
rowUpdate: {
|
|
125
|
+
run: async (ctx, { key, values }) => ({
|
|
126
|
+
roster: patch({ rows: [await ctx.db.updateMember(key, values)] }),
|
|
127
|
+
}),
|
|
128
|
+
refresh: [],
|
|
129
|
+
},
|
|
118
130
|
rowDelete: {
|
|
119
131
|
run: async (ctx, { key }) => {
|
|
120
132
|
await ctx.db.removeMember(key);
|
|
@@ -133,111 +145,166 @@ Re-read this list when a build fails or a design will not fit. Each item is
|
|
|
133
145
|
a place a reasonable instinct from React, Vue, htmx or REST produces an
|
|
134
146
|
error or a dead end.
|
|
135
147
|
|
|
148
|
+
**The server declares every query's kind and key.** Declare each query with
|
|
149
|
+
`row(key, run)` or `rows(key, run)`, key column first. The markup names the
|
|
150
|
+
query with `lb-query` and the columns it shows with `lb-column`, and repeats
|
|
151
|
+
neither the kind nor the key. A page that needs the same data as one row
|
|
152
|
+
and as a set declares two queries. Every query has a key; an aggregate row
|
|
153
|
+
answers with a constant one.
|
|
154
|
+
|
|
136
155
|
**There is no template language.** No `{#if}`, no `v-for`, no `map()`. A
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
`"
|
|
156
|
+
set of rows is an element carrying `lb-query` with a `<template>` inside it,
|
|
157
|
+
the row template, which the hub clones once per row. A `row` query with no
|
|
158
|
+
row template lands on the element itself. A `rows` query with no row
|
|
159
|
+
template lands nothing, which is what an insert form naming its query is. A
|
|
160
|
+
condition is `lb-show="<column>"`: write every possibility into the page and
|
|
161
|
+
let a column decide which is present. The column is a boolean or null; the
|
|
162
|
+
string `"false"` counts as present.
|
|
142
163
|
|
|
143
164
|
**`{{placeholder}}` is build time only.** It reads an `exp-` attribute on
|
|
144
165
|
the tag, never data. Write it as an entire attribute value or an entire
|
|
145
166
|
text node. Name parameters in lowercase with hyphens: HTML lowercases
|
|
146
167
|
`exp-inputClass` before expansion sees it.
|
|
147
168
|
|
|
148
|
-
**
|
|
149
|
-
|
|
150
|
-
|
|
169
|
+
**Position comes from ancestry, not props.** `lb-column` and `lb-show` read
|
|
170
|
+
from the nearest ancestor row: a live row, or an element a `row` query
|
|
171
|
+
landed on. A nested `lb-query` begins a new query. An element with
|
|
172
|
+
`lb-column` and no ancestor row receives nothing, and the hub still gathers
|
|
173
|
+
from it.
|
|
174
|
+
|
|
175
|
+
**A column never holds rows.** Master-detail is a `row` query and a `rows`
|
|
176
|
+
query under two names. Many masters with their details is one `rows` query
|
|
177
|
+
of joined rows, grouped for display by a custom element's `lbPlaceRow`. A
|
|
178
|
+
query nested inside another query's row template receives the same rows in
|
|
179
|
+
every outer row; use it for a picker, never for per-row detail.
|
|
180
|
+
|
|
181
|
+
**Every request has one shape.** `lb-request` names the request, and the
|
|
182
|
+
hub sends `{ name, query, key, values }` as present: `query` from the
|
|
183
|
+
nearest ancestor `lb-query`, `key` from the nearest ancestor row of that
|
|
184
|
+
query, and `values` gathered from controls by their `lb-column`.
|
|
185
|
+
|
|
186
|
+
**An element commits on its own event.** A form on `submit`, a control on
|
|
187
|
+
`change`, anything else on `click`. A click on interactive content inside
|
|
188
|
+
the element (a link, a button, a control, a label) belongs to that content
|
|
189
|
+
and commits nothing. A submit button never commits on click;
|
|
190
|
+
on submit, the submitter's `lb-request` wins over the form's. A native
|
|
191
|
+
`<input lb-column="name" lb-request="lb-row-update">` saves that one column
|
|
192
|
+
on `change`. Inside a form, leave `lb-request` off the controls and put it
|
|
193
|
+
on the form.
|
|
194
|
+
|
|
195
|
+
**Gathering follows the form, the live row, or the form owner.** An element
|
|
196
|
+
with `lb-column` gathers its own value alone. A `<form>` gathers every
|
|
197
|
+
control whose form owner it is. An element in a live row gathers that live
|
|
198
|
+
row. Anything else gathers its form owner's controls. A `<form>` cannot
|
|
199
|
+
wrap a `<tr>`, so an insert row in a table puts its controls in a form
|
|
200
|
+
elsewhere with the HTML `form` attribute. Checkboxes, radio buttons and
|
|
201
|
+
file inputs are not controls here: they receive no value and are not
|
|
202
|
+
gathered.
|
|
203
|
+
|
|
204
|
+
**Three requests are Loadbare's.** `lb-row-insert` needs `query` and
|
|
205
|
+
`values`, `lb-row-update` needs `query`, `key` and `values`, and
|
|
206
|
+
`lb-row-delete` needs `query` and `key`. The page permits each under
|
|
207
|
+
`crud`, keyed by query name, as `rowInsert`, `rowUpdate` and `rowDelete`.
|
|
208
|
+
Each works on a `row` query as well as a `rows` query, since the element a
|
|
209
|
+
`row` lands on carries its key. Every other request name is a declared
|
|
210
|
+
request, under `handlers`. Anything undeclared is refused.
|
|
211
|
+
|
|
212
|
+
**Write `rowUpdate` as a partial update.** A form sends every control it
|
|
213
|
+
owns; a single control sends its one column. Set the columns `values`
|
|
214
|
+
names, leave the rest alone, and check the names against the columns the
|
|
215
|
+
page may edit.
|
|
151
216
|
|
|
152
|
-
**
|
|
153
|
-
|
|
154
|
-
|
|
217
|
+
**Return a patch when the change has a known extent.** `patch({ rows })`
|
|
218
|
+
for rows added or edited, `patch({ drop })` for keys removed, with
|
|
219
|
+
`refresh: []`. List a query in `refresh` only when its membership or order
|
|
220
|
+
changed in a way the handler cannot name.
|
|
155
221
|
|
|
156
|
-
**
|
|
157
|
-
|
|
158
|
-
for display by a widget's `lbPlaceRow`. A list nested inside another list's
|
|
159
|
-
rows receives the same rows in every outer row; use it for a picker, never
|
|
160
|
-
for per-row detail.
|
|
222
|
+
**Format values in the query.** The hub does no type conversion. What a
|
|
223
|
+
number, date or null looks like is decided on the server.
|
|
161
224
|
|
|
162
225
|
**A URL's path names a page, never a resource.** Do not design
|
|
163
|
-
`/accounts/42`. A row is addressed by `
|
|
164
|
-
element sits.
|
|
226
|
+
`/accounts/42`. A row is addressed by `query` and `key`, taken from where
|
|
227
|
+
the element sits.
|
|
165
228
|
|
|
166
229
|
**The query string is what the page has on screen.** Which record a page
|
|
167
230
|
shows, a filter, a date range: each is a query parm,
|
|
168
231
|
`/accounts?acct=23&from=2026-09-09`, so a reload, a bookmark or a mailed link
|
|
169
|
-
shows the same thing.
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
232
|
+
shows the same thing. The hub serves the query `lb-url`, of kind `row`,
|
|
233
|
+
keyed by `lb-path`, with `lb-page-label`, `lb-page-unknown`, and one column
|
|
234
|
+
per query parm. A control inside `lb-query="lb-url"` carrying
|
|
235
|
+
`lb-request="lb-row-update"` writes its parm; the hub replaces the history
|
|
236
|
+
entry, or pushes one when the control carries `lb-url-push`, and reloads the
|
|
237
|
+
page's queries with no request to the server. An `<a lb-url-link>` moves
|
|
238
|
+
to its `href`. Queries still take no arguments: `contextFor(req, parms)`
|
|
239
|
+
puts parms onto `ctx`, and a query reads them there. Read them from
|
|
240
|
+
`parms`, never `req.query`, because `contextFor` may be called twice for one
|
|
241
|
+
request. A parm is user input, so validate it where it is read. Do not
|
|
242
|
+
keep a selection in server state set by a handler.
|
|
243
|
+
|
|
244
|
+
**A handler moves the URL with `url()`.** After an insert, only the server
|
|
245
|
+
knows the new key; after a delete, only the server knows the parm should
|
|
246
|
+
go. Have `run` return `url({ acct: String(id) })`, or `url({ acct: "" })`
|
|
247
|
+
to remove the parm, or `url({ "lb-path": "/accounts", acct: "5" })` to
|
|
248
|
+
enter another page with only the parms named. The page loads at the new URL
|
|
249
|
+
in the same round trip. This is Post/Redirect/Get without the redirect. See
|
|
250
|
+
[moving the URL](references/page-files.md#moving-the-url).
|
|
251
|
+
|
|
252
|
+
**A page names itself with `<title>`.** The builder lifts a page file's
|
|
253
|
+
`<title>` and the hub shows it as `lb-page-label` and as the document title.
|
|
254
|
+
A page without one is labeled by its stub.
|
|
177
255
|
|
|
178
256
|
**Loadbare is for applications, not sites.** Every route is answered with
|
|
179
257
|
`app.html`, and a path that names no page is found in the browser, not
|
|
180
|
-
answered with a 404.
|
|
258
|
+
answered with a 404. The hub opens a `<dialog lb-url-unknown
|
|
259
|
+
lb-query="lb-url">` in the chrome for it.
|
|
181
260
|
|
|
182
261
|
**There are no endpoints to write.** `hubRoutes(hub, contextFor)` is the
|
|
183
|
-
whole data channel.
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
**
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
no value and are not gathered. This is an open item, not a mistake in the
|
|
211
|
-
page.
|
|
212
|
-
|
|
213
|
-
**`lb-` belongs to Loadbare.** Invent no `lb-` attribute, and name no
|
|
214
|
-
query or action with the prefix. Import attribute names in widget code from
|
|
215
|
-
`@loadbare/app/constants`; never write them as string literals.
|
|
216
|
-
|
|
217
|
-
**Name a widget script `<tag>.browser.ts`.** A plain `<tag>.ts` stays on
|
|
218
|
-
the server and the tag goes unregistered.
|
|
219
|
-
|
|
220
|
-
**Light DOM, global CSS.** No shadow root, no scoping. Style empty lists
|
|
221
|
-
with `[lb-row-count="0"]`, pending requests with `[lb-pending]`, and failed
|
|
222
|
-
ones with `[lb-error]`.
|
|
262
|
+
whole data channel.
|
|
263
|
+
|
|
264
|
+
**The developer writes `lb-*` attributes in markup, and script never
|
|
265
|
+
assigns them.** The builder refuses any `lb-` attribute other than
|
|
266
|
+
`lb-query`, `lb-column`, `lb-show`, `lb-request`, `lb-url-link`,
|
|
267
|
+
`lb-url-push` and `lb-url-unknown`. Everything else with the prefix is a
|
|
268
|
+
stamp the hub or the builder writes.
|
|
269
|
+
|
|
270
|
+
**`lb-` belongs to Loadbare.** The application should never name anything
|
|
271
|
+
with the `lb-` prefix anywhere: no attribute, query, column, request, custom
|
|
272
|
+
element, event, or custom element method beginning `lb`. Import attribute
|
|
273
|
+
names in custom element code from `@loadbare/app/constants`; never write
|
|
274
|
+
them as string literals.
|
|
275
|
+
|
|
276
|
+
**A custom element takes part as a control.** A form-associated custom
|
|
277
|
+
element (`static formAssociated = true`) with a `value` property that fires
|
|
278
|
+
`change` is a control: the hub sets its `value`, gathers it, and commits it
|
|
279
|
+
on `change`. Any other custom element keeps its content and receives the
|
|
280
|
+
column as its `lb-column-value` attribute.
|
|
281
|
+
|
|
282
|
+
**Name a custom element script `<tag>.browser.ts`.** A plain `<tag>.ts`
|
|
283
|
+
stays on the server and the tag goes unregistered.
|
|
284
|
+
|
|
285
|
+
**Light DOM, global CSS.** No shadow root, no scoping. Style an empty
|
|
286
|
+
query with `[lb-query-row-count="0"]`, a request in flight with
|
|
287
|
+
`[lb-request-pending]`, a failed one with `[lb-request-error]`, and a value
|
|
288
|
+
with `[lb-column-value="overdue"]`.
|
|
223
289
|
|
|
224
290
|
**Host at the origin root.** The hub reaches its route by absolute path, so
|
|
225
291
|
a subpath such as `example.com/myapp/` does not work.
|
|
226
292
|
|
|
227
|
-
##
|
|
293
|
+
## Custom elements
|
|
228
294
|
|
|
229
|
-
A
|
|
230
|
-
neither is a build error. The HTML is expanded at build time into the
|
|
231
|
-
children; the class is an ordinary custom element with no base class.
|
|
295
|
+
A custom element is `<tag>.html`, `<tag>.browser.ts`, or both, and a tag
|
|
296
|
+
with neither is a build error. The HTML is expanded at build time into the
|
|
297
|
+
tag's children; the class is an ordinary custom element with no base class.
|
|
232
298
|
|
|
233
|
-
Reach for
|
|
234
|
-
and a condition need none. A
|
|
235
|
-
|
|
236
|
-
|
|
299
|
+
Reach for one only when plain HTML cannot do the job. A set of rows, a form
|
|
300
|
+
and a condition need none. A custom element exists to be a control of its
|
|
301
|
+
own, or to place and scaffold rows through the two hooks the hub calls,
|
|
302
|
+
`lbPlaceRow` and `lbRowsLanded` (the `RowsHost` interface).
|
|
237
303
|
|
|
238
304
|
Before writing one, check `@loadbare/widgets`: `lb-input`, `lb-select`,
|
|
239
|
-
`lb-options`, `lb-
|
|
240
|
-
|
|
305
|
+
`lb-options`, `lb-picker`, `lb-table`, `lb-unknown-page`. The first four
|
|
306
|
+
are form-associated controls that carry `lb-column` and `lb-request`
|
|
307
|
+
themselves. Install the package and list it in `src/imports.ts`:
|
|
241
308
|
|
|
242
309
|
```ts
|
|
243
310
|
export default ["@loadbare/widgets"];
|
|
@@ -252,15 +319,15 @@ with the package, so no network is needed.
|
|
|
252
319
|
|
|
253
320
|
- [`references/overview.md`](references/overview.md) — the map of the
|
|
254
321
|
reference, by part of the application.
|
|
255
|
-
- [`references/data-binding.md`](references/data-binding.md) —
|
|
256
|
-
|
|
257
|
-
|
|
322
|
+
- [`references/data-binding.md`](references/data-binding.md) — landing,
|
|
323
|
+
gathering, requests, conditions and request state. Start here for
|
|
324
|
+
anything in a page.
|
|
258
325
|
- [`references/page-files.md`](references/page-files.md) — queries,
|
|
259
|
-
`onPageEnter`,
|
|
326
|
+
`onPageEnter`, handlers, `crud`, refresh and patch, and `url()`.
|
|
260
327
|
- [`references/custom-elements.md`](references/custom-elements.md) —
|
|
261
|
-
expansion, parameters, slots, destinations, and
|
|
262
|
-
- [`references/chrome.md`](references/chrome.md) — the chrome,
|
|
263
|
-
|
|
328
|
+
expansion, parameters, slots, destinations, and custom element code.
|
|
329
|
+
- [`references/chrome.md`](references/chrome.md) — the chrome, and the URL
|
|
330
|
+
as the query `lb-url`.
|
|
264
331
|
- [`references/server.md`](references/server.md) — the Express server and
|
|
265
332
|
the request context.
|
|
266
333
|
- [`references/builder.md`](references/builder.md) — the builder's options,
|
|
@@ -271,5 +338,5 @@ with the package, so no network is needed.
|
|
|
271
338
|
- [`references/TECHREF-1.0.md`](references/TECHREF-1.0.md) — the reserved
|
|
272
339
|
names, what a URL names and
|
|
273
340
|
[query parms](references/TECHREF-1.0.md#query-parms), and the open items
|
|
274
|
-
that block 1.0. Read it before designing around
|
|
275
|
-
|
|
341
|
+
that block 1.0. Read it before designing around something the other
|
|
342
|
+
references do not mention.
|