@lango-project/lango-client 0.2.1 → 0.4.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/LICENSE +1 -0
- package/NOTICE +5 -1
- package/README.md +570 -906
- package/cli/.lango/localization.mjs +108 -0
- package/{dist/node → cli}/.lango/runtime.mjs +112 -19
- package/cli/.lango/vendor/i18next.LICENSE +21 -0
- package/cli/.lango/vendor/i18next.mjs +2434 -0
- package/cli/create.mjs +62 -0
- package/cli/create.mjs.map +1 -0
- package/dist/.lango/localization.mjs +108 -0
- package/dist/.lango/runtime.mjs +112 -19
- package/dist/.lango/vendor/i18next.LICENSE +21 -0
- package/dist/.lango/vendor/i18next.mjs +2434 -0
- package/dist/accordion.mjs +277 -0
- package/dist/accordion.mjs.map +1 -0
- package/dist/activities.mjs +185 -0
- package/dist/activities.mjs.map +1 -0
- package/dist/app.mjs +636 -0
- package/dist/app.mjs.map +1 -0
- package/dist/boot.mjs +24 -0
- package/dist/boot.mjs.map +1 -0
- package/dist/bootstrap-LICENSE +21 -0
- package/dist/bootstrap.min.css +6 -0
- package/dist/bootstrap.min.css.map +1 -0
- package/dist/button.mjs +77 -0
- package/dist/button.mjs.map +1 -0
- package/dist/chip.mjs +134 -0
- package/dist/chip.mjs.map +1 -0
- package/dist/client.css +95 -0
- package/dist/collections.mjs +77 -0
- package/dist/collections.mjs.map +1 -0
- package/dist/combo_box.mjs +408 -0
- package/dist/combo_box.mjs.map +1 -0
- package/dist/content.mjs +123 -0
- package/dist/content.mjs.map +1 -0
- package/dist/control.mjs +139 -0
- package/dist/control.mjs.map +1 -0
- package/dist/date_input.mjs +242 -0
- package/dist/date_input.mjs.map +1 -0
- package/dist/error_reporter.mjs +136 -0
- package/dist/error_reporter.mjs.map +1 -0
- package/dist/fields.mjs +454 -0
- package/dist/fields.mjs.map +1 -0
- package/dist/file_input.mjs +227 -0
- package/dist/file_input.mjs.map +1 -0
- package/dist/form.mjs +272 -0
- package/dist/form.mjs.map +1 -0
- package/dist/heartbeat.mjs +167 -254
- package/dist/heartbeat.mjs.map +1 -1
- package/dist/index.html +18 -0
- package/dist/indicators.mjs +127 -0
- package/dist/indicators.mjs.map +1 -0
- package/dist/input_changes.mjs +58 -0
- package/dist/input_changes.mjs.map +1 -0
- package/dist/input_group.mjs +38 -0
- package/dist/input_group.mjs.map +1 -0
- package/dist/layouts.mjs +195 -0
- package/dist/layouts.mjs.map +1 -0
- package/dist/library.mjs +130 -807
- package/dist/library.mjs.map +1 -1
- package/dist/longpoll.mjs +254 -0
- package/dist/longpoll.mjs.map +1 -0
- package/dist/main.mjs +138 -0
- package/dist/main.mjs.map +1 -0
- package/dist/markdown.mjs +61 -0
- package/dist/markdown.mjs.map +1 -0
- package/dist/menus.mjs +468 -0
- package/dist/menus.mjs.map +1 -0
- package/dist/navigation.mjs +260 -410
- package/dist/navigation.mjs.map +1 -1
- package/dist/numeric_input.mjs +181 -0
- package/dist/numeric_input.mjs.map +1 -0
- package/dist/otp_input.mjs +113 -0
- package/dist/otp_input.mjs.map +1 -0
- package/dist/presentations.mjs +852 -0
- package/dist/presentations.mjs.map +1 -0
- package/dist/renderer.mjs +293 -0
- package/dist/renderer.mjs.map +1 -0
- package/dist/rich_content.mjs +99 -0
- package/dist/rich_content.mjs.map +1 -0
- package/dist/tables.mjs +369 -0
- package/dist/tables.mjs.map +1 -0
- package/dist/tabs.mjs +205 -0
- package/dist/tabs.mjs.map +1 -0
- package/dist/templates.mjs +46 -0
- package/dist/templates.mjs.map +1 -0
- package/dist/vendor/DOMPurify-LICENSE +202 -0
- package/dist/vendor/dompurify.mjs +2540 -0
- package/dist/vendor/flatpickr-LICENSE.md +21 -0
- package/dist/vendor/flatpickr.min.css +13 -0
- package/dist/vendor/flatpickr.mjs +2340 -0
- package/dist/vendor/flatpickr.mjs.map +7 -0
- package/dist/vendor/marked-LICENSE.md +44 -0
- package/dist/vendor/marked.esm.js.map +7 -0
- package/dist/vendor/marked.mjs +85 -0
- package/dist/vendor/purify.es.mjs.map +1 -0
- package/dist/widgets.mjs +197 -0
- package/dist/widgets.mjs.map +1 -0
- package/docs/implementation.md +42 -0
- package/package.json +25 -43
- package/src/accordion.lango +198 -0
- package/src/activities.lango +132 -0
- package/src/app.lango +508 -0
- package/src/boot.lango +12 -0
- package/src/button.lango +49 -0
- package/src/chip.lango +94 -0
- package/src/collections.lango +46 -0
- package/src/combo_box.lango +298 -0
- package/src/content.lango +75 -0
- package/src/control.lango +100 -0
- package/src/create.lango +42 -0
- package/src/date_input.lango +215 -0
- package/src/error_reporter.lango +95 -0
- package/src/fields.lango +327 -0
- package/src/file_input.lango +175 -0
- package/src/form.lango +195 -0
- package/src/heartbeat.lango +136 -199
- package/src/indicators.lango +94 -0
- package/src/input_changes.lango +33 -0
- package/src/input_group.lango +22 -0
- package/src/layouts.lango +137 -0
- package/src/library.lango +194 -599
- package/src/longpoll.lango +187 -0
- package/src/main.lango +109 -0
- package/src/markdown.lango +48 -0
- package/src/menus.lango +336 -0
- package/src/navigation.lango +209 -299
- package/src/numeric_input.lango +131 -0
- package/src/otp_input.lango +83 -0
- package/src/presentations.lango +617 -0
- package/src/renderer.lango +288 -0
- package/src/rich_content.lango +66 -0
- package/src/tables.lango +271 -0
- package/src/tabs.lango +144 -0
- package/src/templates.lango +29 -0
- package/src/widgets.lango +141 -0
- package/web/client.css +95 -0
- package/web/index.html +18 -0
- package/dist/application.mjs +0 -429
- package/dist/application.mjs.map +0 -1
- package/dist/coordinator.mjs +0 -91
- package/dist/coordinator.mjs.map +0 -1
- package/dist/demo.mjs +0 -110
- package/dist/demo.mjs.map +0 -1
- package/dist/demo_controls.mjs +0 -59
- package/dist/demo_controls.mjs.map +0 -1
- package/dist/errors.mjs +0 -201
- package/dist/errors.mjs.map +0 -1
- package/dist/form_state.mjs +0 -266
- package/dist/form_state.mjs.map +0 -1
- package/dist/inheritance.mjs +0 -240
- package/dist/inheritance.mjs.map +0 -1
- package/dist/input_values.mjs +0 -65
- package/dist/input_values.mjs.map +0 -1
- package/dist/node/.lango/xmldom/conventions.js +0 -429
- package/dist/node/.lango/xmldom/dom-parser.js +0 -591
- package/dist/node/.lango/xmldom/dom.js +0 -3759
- package/dist/node/.lango/xmldom/entities.js +0 -2171
- package/dist/node/.lango/xmldom/errors.js +0 -205
- package/dist/node/.lango/xmldom/grammar.js +0 -559
- package/dist/node/.lango/xmldom/index.js +0 -41
- package/dist/node/.lango/xmldom/package.json +0 -1
- package/dist/node/.lango/xmldom/sax.js +0 -983
- package/dist/node/.lango/xmldom.LICENSE.md +0 -8
- package/dist/node/browser_host.mjs +0 -351
- package/dist/node/browser_host.mjs.map +0 -1
- package/dist/node/create_app.mjs +0 -118
- package/dist/node/create_app.mjs.map +0 -1
- package/dist/presentation.mjs +0 -89
- package/dist/presentation.mjs.map +0 -1
- package/dist/protocol.mjs +0 -706
- package/dist/protocol.mjs.map +0 -1
- package/dist/session.mjs +0 -471
- package/dist/session.mjs.map +0 -1
- package/dist/tokens.mjs +0 -298
- package/dist/tokens.mjs.map +0 -1
- package/examples/contacts.lango +0 -293
- package/examples/contacts_flow.lango +0 -174
- package/examples/contacts_store.lango +0 -109
- package/examples/contacts_store_test.lango +0 -65
- package/examples/demo.css +0 -87
- package/examples/demo_test.lango +0 -356
- package/examples/index.html +0 -32
- package/examples/pages.lango +0 -174
- package/examples/server.lango +0 -189
- package/examples/worker.lango +0 -142
- package/src/application.lango +0 -327
- package/src/browser_host.lango +0 -276
- package/src/coordinator.lango +0 -57
- package/src/demo.lango +0 -110
- package/src/demo_controls.lango +0 -53
- package/src/errors.lango +0 -149
- package/src/errors_test.lango +0 -157
- package/src/form_state.lango +0 -168
- package/src/heartbeat_test.lango +0 -479
- package/src/inheritance.lango +0 -167
- package/src/input_values.lango +0 -37
- package/src/logout_test.lango +0 -564
- package/src/navigation_test.lango +0 -556
- package/src/presentation.lango +0 -55
- package/src/protocol.lango +0 -787
- package/src/renderer_test.lango +0 -2047
- package/src/session.lango +0 -343
- package/src/session_test.lango +0 -455
- package/src/tabs_test.lango +0 -216
- package/src/tokens.lango +0 -215
- package/template/.vscode/extensions.json +0 -3
- package/template/.vscode/settings.json +0 -9
- package/template/README.md +0 -44
- package/template/gitignore +0 -4
- package/template/package.json +0 -22
- package/template/public/app.css +0 -10
- package/template/public/index.html +0 -24
- package/template/src/client.lango +0 -78
- package/template/src/pages.lango +0 -55
- package/template/src/server.lango +0 -24
- package/template/src/worker.lango +0 -77
- package/template/test/app.lango +0 -9
- package/tools/browser_runner.lango +0 -32
- package/tools/browser_test.lango +0 -343
- package/tools/create_app.lango +0 -88
- package/tools/create_app_test.lango +0 -43
- package/tools/starter_test.lango +0 -227
- /package/{dist/node → cli}/.lango/bignumber.mjs +0 -0
- /package/{dist → cli}/.lango/xmldom/conventions.js +0 -0
- /package/{dist → cli}/.lango/xmldom/dom-parser.js +0 -0
- /package/{dist → cli}/.lango/xmldom/dom.js +0 -0
- /package/{dist → cli}/.lango/xmldom/entities.js +0 -0
- /package/{dist → cli}/.lango/xmldom/errors.js +0 -0
- /package/{dist → cli}/.lango/xmldom/grammar.js +0 -0
- /package/{dist → cli}/.lango/xmldom/index.js +0 -0
- /package/{dist → cli}/.lango/xmldom/package.json +0 -0
- /package/{dist → cli}/.lango/xmldom/sax.js +0 -0
- /package/{dist → cli}/.lango/xmldom.LICENSE.md +0 -0
package/README.md
CHANGED
|
@@ -1,930 +1,594 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Lango Client
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
and applies responses
|
|
3
|
+
A browser runtime for applications built with Lango UI. Application handlers run
|
|
4
|
+
on the server. The client renders control definitions, collects form values, sends
|
|
5
|
+
requests, and applies responses. Runtime, build tools, and tests are written in
|
|
6
|
+
Lango. `dist/` contains compiled application modules and separately licensed
|
|
7
|
+
third-party browser modules under `vendor/`.
|
|
6
8
|
|
|
7
|
-
|
|
9
|
+
This is the first implementation of the new client contract. It is not yet a
|
|
10
|
+
complete renderer for the Lango UI control catalog.
|
|
8
11
|
|
|
9
|
-
|
|
12
|
+
## Build and test
|
|
13
|
+
|
|
14
|
+
Node.js 24 or newer is required.
|
|
10
15
|
|
|
11
16
|
```sh
|
|
12
17
|
npm install
|
|
13
18
|
npm test
|
|
14
|
-
npm run
|
|
19
|
+
npm run browser:install
|
|
20
|
+
npm run test:browser
|
|
15
21
|
```
|
|
16
22
|
|
|
17
|
-
|
|
18
|
-
start
|
|
23
|
+
Browser installation uses `.test-output/browsers` inside this project. Browser
|
|
24
|
+
tests start a temporary local HTTP server and launch headless Chromium. They do
|
|
25
|
+
not use any other Lango Client checkout.
|
|
26
|
+
|
|
27
|
+
`npm run build` writes a static application to `dist/`, including the module
|
|
28
|
+
runtime, Bootstrap 5 CSS, Markdown/date-picker dependencies and their licenses, the HTML shell,
|
|
29
|
+
and the entry module.
|
|
30
|
+
Configure the application's static server to serve this directory at `/`, or
|
|
31
|
+
copy its **entire contents**, including `.lango/` and `vendor/`, into the public
|
|
32
|
+
directory. The static shell includes an import map for `marked`, `dompurify` and `flatpickr`;
|
|
33
|
+
keep it when embedding this build in a custom HTML shell. Bundlers may instead
|
|
34
|
+
resolve these npm dependencies directly. No CDN is used.
|
|
35
|
+
Keep POST `/` available for Lango UI startup and provide a UI endpoint at
|
|
36
|
+
`/index`. Build output must be served over HTTP rather than opened as a file.
|
|
37
|
+
|
|
38
|
+
GET `/` serves the unchanged HTML shell. Its entry module sends POST `/`, saves
|
|
39
|
+
the opaque response token, and requests POST `/index`. On a deep link, the client
|
|
40
|
+
requests the initial pathname instead. A host must explicitly serve the HTML
|
|
41
|
+
shell for those deep-link GETs. Lango Server 0.2.0 supports the explicit
|
|
42
|
+
`fallback="index.html" runtime="true"` static settings used by the generated
|
|
43
|
+
application. Without fallback configuration, missing paths still return 404.
|
|
44
|
+
|
|
45
|
+
## Create an application
|
|
46
|
+
|
|
47
|
+
To create a server-side Lango UI application with this browser runtime, use the
|
|
48
|
+
UI package's generator after the delivery releases are published:
|
|
19
49
|
|
|
20
50
|
```sh
|
|
21
|
-
npm --
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
node .demo-server/server.mjs
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
Open `http://localhost:8080/`. Stop any previous static server
|
|
30
|
-
on port 8080 first. The example uses the synchronous worker API on port 8081 and port 8080 for
|
|
31
|
-
static files and a same-origin proxy. The initial GET serves a fixed HTML shell. The browser sends a form-scoped
|
|
32
|
-
`url` event. A shared `lango-ui/Pages` registry selects the exact page and longest
|
|
33
|
-
matching template prefix. The first response replaces `content` with a template
|
|
34
|
-
Container holding the page Form in `__content__`. Profile/Details navigation
|
|
35
|
-
replaces only that page Form; the Admin layout link switches the whole template.
|
|
36
|
-
Back/Forward sends another URL event; refreshing a registered URL returns the shell again. The page root keeps its session/sequence, while
|
|
37
|
-
replaced content Forms receive fresh instances. The legacy `/examples/index.html`
|
|
38
|
-
address redirects to `/`. Save sends a real form request through `lango-api` and
|
|
39
|
-
`lango-ui`; the response updates the email and disables the button. Log out ends the current session, starts a new anonymous one, clears the template marker and reloads the current URL;
|
|
40
|
-
the status text reports completion or failure. Its signing key is retained in the ignored `.demo-server/jwt.key` so
|
|
41
|
-
client identity survives demo server restarts. Both servers stop with Ctrl+C. This server is a local example, not a
|
|
42
|
-
production static-file or reverse-proxy implementation.
|
|
43
|
-
The example also retains revocations and UI sequence reservations in
|
|
44
|
-
`.demo-server/runtime.sqlite`. Restarting it preserves consumed sequences and
|
|
45
|
-
logout invalidation; reservations interrupted during execution stay pending
|
|
46
|
-
until session expiry.
|
|
47
|
-
|
|
48
|
-
`npm run build` builds the browser demo and library dependencies.
|
|
49
|
-
|
|
50
|
-
## Browser adapter
|
|
51
|
-
|
|
52
|
-
`mount(document, root, definition)` returns a control with `element`, `name`,
|
|
53
|
-
`controls`, `getValue()`, `setValue(value)` and `applyProperty(name, value)`.
|
|
54
|
-
The built-in control types are `Text`, `Select`, `Checkbox`, `Button`, `Value`,
|
|
55
|
-
`Panel`, `Container`, and `Form`. Text uses an input element; Value stores data without displaying it.
|
|
56
|
-
Container values are nested maps. Text content is assigned as text, not HTML.
|
|
57
|
-
|
|
58
|
-
The protocol entry exports `collectValues(controls)` and
|
|
59
|
-
`applyResponse(controls, response, formId, seqno, effects)`. It validates the
|
|
60
|
-
response identity and all targets before changing values. Supported commands
|
|
61
|
-
are enabled/visible and classes/style updates plus focus/toast effects supplied by
|
|
62
|
-
the host adapter. Nested targets use path arrays; strings address top-level controls.
|
|
63
|
-
|
|
64
|
-
Token persistence, bootstrap, idle renewal, logout, event replay protection and
|
|
65
|
-
form inheritance are implemented. Scoped theme/control selection and CSS presentation are available; business idempotency remains pending. Form values
|
|
66
|
-
retain their nested container structure; managed forms have independent request
|
|
67
|
-
queues and sequence counters.
|
|
68
|
-
|
|
69
|
-
## Structural responses
|
|
70
|
-
|
|
71
|
-
Pass `new Renderer(document)` as the session's `effects` adapter to create,
|
|
72
|
-
replace and remove DOM controls. Replacements are prepared off-DOM and all
|
|
73
|
-
value/command targets are validated against the projected tree before commit.
|
|
74
|
-
Replacements preserve the target name (inferred from the map key if omitted).
|
|
75
|
-
Example:
|
|
76
|
-
|
|
77
|
-
```json
|
|
78
|
-
{
|
|
79
|
-
"replace": { "address": { "city": { "type": "Text", "value": "Ankara" } } },
|
|
80
|
-
"remove": [["address", "warning"]]
|
|
81
|
-
}
|
|
82
|
-
```
|
|
83
|
-
|
|
84
|
-
This is the `ui` field of a response. A top-level remove target may also be a
|
|
85
|
-
string. Overlapping ancestor/descendant targets in one structural patch are
|
|
86
|
-
rejected. Removing a missing target is a no-op. Replacing a missing target is
|
|
87
|
-
an error. Values and commands may address controls introduced by replacements.
|
|
88
|
-
Unknown control types or invalid follow-up targets leave the mounted tree
|
|
89
|
-
unchanged. The structural and value phase is transactional: failures restore
|
|
90
|
-
the original node identities, sibling order, control arrays, and values.
|
|
91
|
-
|
|
92
|
-
Custom structural adapters must implement `capture(control)` and
|
|
93
|
-
`restore(snapshot, operation)` alongside create/replace/remove. An operation
|
|
94
|
-
contains `type`, `old`, optional `new`, and `owner`. Capture must not mutate the
|
|
95
|
-
mounted tree; restore must recover even when the failed operation partially
|
|
96
|
-
modified it. Controls with custom `applyProperty` must supply
|
|
97
|
-
`snapshotState()` and `restoreState(snapshot)`. Simple value controls without
|
|
98
|
-
custom property handling use getValue/setValue and enabled/visible snapshots.
|
|
99
|
-
|
|
100
|
-
Commands execute in their original order after the structural/value commit.
|
|
101
|
-
Each state command restores its own pre-command state on failure and stops the
|
|
102
|
-
remaining commands; already committed values and earlier commands remain.
|
|
103
|
-
Focus and toast are effects and cannot be rolled back. If an adapter's restore
|
|
104
|
-
hook itself fails, remaining rollback steps are attempted and the caller
|
|
105
|
-
receives `UiClientRollbackFailed`.
|
|
106
|
-
|
|
107
|
-
## Form requests
|
|
108
|
-
|
|
109
|
-
The `./session` entry exports `Session(options)` with `formId`, `controls`,
|
|
110
|
-
optional DOM `root`, and `effects`. `session.send(path, event, name)` returns a
|
|
111
|
-
Promise. Each session serializes requests, allocates sequence numbers when
|
|
112
|
-
sending, and collects current values after the previous response was applied.
|
|
113
|
-
Paths must be same-origin absolute paths. Requests use JSON POST.
|
|
114
|
-
Each Session generates an opaque `formInstanceId`, stable across its requests
|
|
115
|
-
and never persisted. It changes for a replacement Session even when its form
|
|
116
|
-
name is reused. UI dispatch combines it with the verified session identity and
|
|
117
|
-
sequence to reject repeated events without blocking replacements.
|
|
118
|
-
|
|
119
|
-
The root is inert and marked `aria-busy` while requests remain pending. Errors
|
|
120
|
-
reject the caller's Promise and release the UI; the queue accepts subsequent
|
|
121
|
-
requests. There are no automatic retries: a failed HTTP request may already
|
|
122
|
-
have executed its server handler. UI Dispatcher returns 409 `UiReplayConflict`
|
|
123
|
-
for consumed sequences or higher sequences arriving while the same instance is
|
|
124
|
-
busy. The client reports the error and releases its queue; it does not replay
|
|
125
|
-
the event or apply a cached response. A later user action gets a new sequence.
|
|
126
|
-
Gaps remain valid because failed requests may not have reached the dispatcher.
|
|
127
|
-
Business idempotency and recovery of lost responses remain separate work.
|
|
128
|
-
|
|
129
|
-
For testing, `transport: { send(path, input, token) }` can replace fetch and
|
|
130
|
-
return a Promise of either a protocol response or `{ body, token }` when a
|
|
131
|
-
token was renewed. Run the asynchronous queue tests with
|
|
132
|
-
`node ../lango-js/src/cli.mjs run src/session_test.lango`.
|
|
133
|
-
|
|
134
|
-
## Token persistence
|
|
135
|
-
|
|
136
|
-
Each Session owns its in-memory token. Every received token also updates the
|
|
137
|
-
shared latest-token store and localStorage, under `lango:last-token` by default.
|
|
138
|
-
Application accepts a custom `storageKey` to separate applications sharing an
|
|
139
|
-
origin, or a `tokens` TokenStore adapter. Standalone sessions accept the same
|
|
140
|
-
`tokens` option. The `./tokens` entry exports `TokenStore(storage, key)` for
|
|
141
|
-
custom storage and testing.
|
|
142
|
-
|
|
143
|
-
At startup or when creating a new form, the last stored token is used as the
|
|
144
|
-
initial token. Existing forms keep their own tokens. Sequence numbers are not
|
|
145
|
-
persisted and start from one for a new Session. The client treats token contents
|
|
146
|
-
as opaque; the server must verify identity such as clientId and establish the
|
|
147
|
-
new session/form context rather than restoring old sequence state.
|
|
148
|
-
|
|
149
|
-
Fetch sends `Authorization: Bearer <token>` and reads renewals from
|
|
150
|
-
`X-Lango-Token`. Renewal headers are saved before parsing/applying the response,
|
|
151
|
-
including HTTP errors; disposed sessions ignore late renewals. If localStorage
|
|
152
|
-
is inaccessible, the client logs a warning and continues in memory.
|
|
153
|
-
Set `Application` option `bootstrapPath: "/_lango/start"` when the server has a
|
|
154
|
-
TokenService. Bootstrap exchanges the persisted token for a new session token;
|
|
155
|
-
all initial forms wait for it before sending. ClientId is retained when the
|
|
156
|
-
old signature can be verified, including an expired token; sessionId and auth
|
|
157
|
-
state restart. The API still rejects expired tokens on ordinary endpoints.
|
|
158
|
-
Bootstrap failure rejects queued form requests rather than sending the old
|
|
159
|
-
session token. Later-created forms start from the latest token as usual.
|
|
160
|
-
Bootstrap commits a token only after a successful HTTP response and JSON parse;
|
|
161
|
-
superseded or cancelled initialization responses cannot replace a newer token.
|
|
162
|
-
|
|
163
|
-
## Tabs, browser profiles, and devices
|
|
164
|
-
|
|
165
|
-
Configure `bootstrapPath` for every JWT-backed Application. Each page instance
|
|
166
|
-
bootstraps a new `sessionId`, anonymous by default, while recovering only
|
|
167
|
-
`clientId` from a valid stored seed. Reload also creates a new session. Starting
|
|
168
|
-
another tab does not revoke or authenticate an already-running tab. Without
|
|
169
|
-
bootstrap, manually sharing the same token also shares its session and logout
|
|
170
|
-
scope; separate tab sessions cannot be assumed.
|
|
171
|
-
|
|
172
|
-
The localStorage entry is a shared, best-effort seed for future bootstrap, not
|
|
173
|
-
the active credential for every tab. Initialization rereads the current entry
|
|
174
|
-
rather than relying on its constructor-time copy. An explicitly supplied
|
|
175
|
-
previous token takes precedence, including after logout. Ordinary requests,
|
|
176
|
-
ping and logout use the tab's own in-memory tokens; storage writes from another
|
|
177
|
-
tab do not replace them. No login/logout state is broadcast to other sessions.
|
|
178
|
-
|
|
179
|
-
Clearing a store always clears its local credential. It removes the shared entry
|
|
180
|
-
only when the value still matches that local credential, so a newer token from
|
|
181
|
-
another tab is normally retained. Storage read/remove is not a cross-tab atomic
|
|
182
|
-
transaction; the seed may still race with concurrent writes. Session isolation
|
|
183
|
-
and authorization do not depend on which seed wins. With no stored seed,
|
|
184
|
-
simultaneous first launches can register separate client identities.
|
|
185
|
-
|
|
186
|
-
Separate browser profiles/devices without a transferred seed receive independent
|
|
187
|
-
client identities. `clientId` identifies recoverable client state, not hardware,
|
|
188
|
-
an account, or authority to terminate other sessions. Logout revokes only its
|
|
189
|
-
current `sessionId`, including that session's forms. All-session or all-device
|
|
190
|
-
logout needs an application account/session registry and authorization policy.
|
|
191
|
-
Applications sharing an origin should use distinct `storageKey` values unless
|
|
192
|
-
they deliberately share the same server identity namespace.
|
|
193
|
-
|
|
194
|
-
## Logout
|
|
195
|
-
|
|
196
|
-
Call `application.logout()` to end the current server session and start a new
|
|
197
|
-
anonymous session. It returns a Promise of the new opaque token. Concurrent
|
|
198
|
-
calls share one operation. Options `logoutPath` and `bootstrapPath` select the
|
|
199
|
-
same-origin endpoints, defaulting to `/_lango/logout` and `/_lango/start` for
|
|
200
|
-
this operation. Initial automatic bootstrap still requires `bootstrapPath`.
|
|
201
|
-
|
|
202
|
-
```lango
|
|
203
|
-
logout(application)
|
|
204
|
-
return application.logout().then((token)
|
|
205
|
-
context log
|
|
206
|
-
log.info("Anonymous session is ready")
|
|
207
|
-
)
|
|
208
|
-
```
|
|
209
|
-
|
|
210
|
-
The application immediately detaches all form bindings, disposes their sessions
|
|
211
|
-
and heartbeat, and marks its root inert and busy. Queued requests do not send;
|
|
212
|
-
late form and ping responses cannot update controls or tokens. An initial
|
|
213
|
-
bootstrap already in progress is awaited so logout revokes the session that was
|
|
214
|
-
actually issued. If bootstrap failed, logout can still revoke the previously
|
|
215
|
-
stored credential. Sent requests may still have server side effects.
|
|
216
|
-
|
|
217
|
-
After the API confirms `{ "loggedOut": true }`, the TokenStore clears its local
|
|
218
|
-
credential and removes the persisted entry if it still matches. Another tab's
|
|
219
|
-
newer seed is retained. The previous token is used only for the
|
|
220
|
-
following bootstrap's identity recovery. A successful bootstrap persists the
|
|
221
|
-
new anonymous token, creates fresh form sessions with `seqno` starting from
|
|
222
|
-
one, reattaches bindings, and restarts idle renewal if enabled. The control tree,
|
|
223
|
-
values, and enabled/visible properties are retained; applications must clear
|
|
224
|
-
or replace private screen content according to their own UI policy.
|
|
225
|
-
|
|
226
|
-
Logout errors reject the Promise and leave forms paused. No bootstrap follows
|
|
227
|
-
an unconfirmed logout, and response token headers are ignored. Retrying
|
|
228
|
-
`application.logout()` repeats the failed revocation. If revocation succeeded
|
|
229
|
-
but anonymous bootstrap failed, retry performs only bootstrap. A network error
|
|
230
|
-
can hide a successful server revocation; a later 401 does not prove logout
|
|
231
|
-
success, so automatic recovery stops. Reload to start an anonymous session;
|
|
232
|
-
revocation confirmation and account-wide coordination remain separate concerns.
|
|
233
|
-
Disposing the application during logout prevents form recreation and cancels
|
|
234
|
-
any pending bootstrap commit.
|
|
235
|
-
|
|
236
|
-
For standalone sessions, `TokenStore.logout(path)` confirms server revocation,
|
|
237
|
-
clears its local credential and matching persisted seed, and resolves with the previous token for an
|
|
238
|
-
explicit `initialize(bootstrapPath, previousToken)` call. It does not manage or
|
|
239
|
-
dispose standalone sessions; their owner must stop them before logout. Storage
|
|
240
|
-
adapters must implement `getItem`, `setItem`, and `removeItem`. Custom TokenStore
|
|
241
|
-
adapters used with Application logout must also implement `logout`, `initialize`,
|
|
242
|
-
and `cancelInitialization`. Sharing one store between independently managed
|
|
243
|
-
applications requires external lifecycle coordination.
|
|
244
|
-
|
|
245
|
-
## Idle token renewal
|
|
246
|
-
|
|
247
|
-
Application enables a Heartbeat when `bootstrapPath` or `pingPath` is supplied.
|
|
248
|
-
After 60 seconds without form request activity it sends one JSON POST to
|
|
249
|
-
`/_lango/ping` for a snapshot of the managed forms. Bootstrap completion also
|
|
250
|
-
resets the idle period. Configure it through Application options:
|
|
251
|
-
|
|
252
|
-
```lango
|
|
253
|
-
{
|
|
254
|
-
bootstrapPath: "/_lango/start"
|
|
255
|
-
pingPath: "/_lango/ping"
|
|
256
|
-
pingIdleMs: 60000
|
|
257
|
-
pingEnabled: true
|
|
258
|
-
}
|
|
259
|
-
```
|
|
260
|
-
|
|
261
|
-
Set `pingEnabled: false` to disable automatic renewal, or explicitly enable
|
|
262
|
-
it when using a preinitialized custom token store. Choose an idle interval
|
|
263
|
-
shorter than the server's token lifetime. Ping paths must remain same-origin;
|
|
264
|
-
a custom path can be mapped to the API's reserved endpoint by a proxy.
|
|
265
|
-
|
|
266
|
-
The batch waits for already-queued requests in every participating form.
|
|
267
|
-
Requests queued afterward wait behind the ping barrier, then use their form's
|
|
268
|
-
renewed token. Ping does not advance `seqno`, collect values, apply UI commands,
|
|
269
|
-
or mark forms busy by itself. Forms created after the participant snapshot join
|
|
270
|
-
the next ping. Disposed sessions ignore late renewals, including when a new
|
|
271
|
-
form reuses the same name.
|
|
272
|
-
|
|
273
|
-
All returned form IDs and token strings are validated before applying any
|
|
274
|
-
renewal. Each received token updates its Session and the shared latest-token
|
|
275
|
-
localStorage record. A failed ping leaves tokens unchanged and releases the
|
|
276
|
-
normal queues; automatic scheduling retries after another idle interval.
|
|
277
|
-
Expired credentials still require a new bootstrap/authentication flow: ping
|
|
278
|
-
does not silently reset a session or restore login state.
|
|
279
|
-
The API also enforces an absolute session lifetime (eight hours by default).
|
|
280
|
-
Renewals and login within that session do not reset its deadline. Once it
|
|
281
|
-
expires, ordinary requests and ping return 401; reload for a new anonymous
|
|
282
|
-
bootstrap and authenticate again if needed.
|
|
283
|
-
|
|
284
|
-
`application.dispose()` cancels scheduling and releases queued work; a late
|
|
285
|
-
response cannot update disposed forms. Requests disable HTTP caching and
|
|
286
|
-
redirect following. `pingTransport` may supply `send(path, input)`, returning
|
|
287
|
-
a Promise of the batch response, for custom transports. The `./heartbeat`
|
|
288
|
-
entry exports `Heartbeat` for standalone session management; use `sessions`,
|
|
289
|
-
`start`, `activity`, `ping`, and `dispose` to manage its lifecycle.
|
|
290
|
-
|
|
291
|
-
## Event binding
|
|
292
|
-
|
|
293
|
-
Create `new Binding(form, session)` once after mounting the form. Event
|
|
294
|
-
listeners live on the form root and resolve controls against the current
|
|
295
|
-
tree, so replacement controls require no individual listener setup. Calling
|
|
296
|
-
`binding.dispose()` removes the listeners. Duplicate bindings on a root are
|
|
297
|
-
rejected.
|
|
298
|
-
|
|
299
|
-
`event: "/app/save"` means click for a Button and change for other controls.
|
|
300
|
-
Use `events: { click: "/app/save", change: "/app/edit", input: "/app/search" }`
|
|
301
|
-
for explicit event mappings; supported types are click, change, and input.
|
|
302
|
-
Mappings must use same-origin paths. An explicit mapping overrides the shorthand
|
|
303
|
-
for that event type. The request's `name` is a string for a top-level named
|
|
304
|
-
control, an array for a nested named path, and null for an unnamed source.
|
|
305
|
-
|
|
306
|
-
Disabled, hidden, or inert controls and their descendants do not send events.
|
|
307
|
-
An outer form ignores events bubbling from an inner Form. `Application` manages
|
|
308
|
-
the inner forms' bindings and sessions automatically.
|
|
309
|
-
Errors go to `context log` by default; a third constructor argument implementing
|
|
310
|
-
`error(error)` may override error reporting.
|
|
311
|
-
|
|
312
|
-
## Managed form lifecycle
|
|
313
|
-
|
|
314
|
-
The `./application` entry exports `Application(document, root, definition,
|
|
315
|
-
options = {})`. It mounts the control tree and creates a Session/Binding pair
|
|
316
|
-
for every named Form. It reconciles the registry after each response, retaining
|
|
317
|
-
unchanged forms and disposing removed or replaced forms. New form instances
|
|
318
|
-
start with a fresh sequence counter even when their names are unchanged.
|
|
319
|
-
|
|
320
|
-
`application.control` exposes the mounted root control. Use
|
|
321
|
-
`application.session("profile")` or
|
|
322
|
-
`application.session(["profile", "address"])` to access a managed session.
|
|
323
|
-
Top-level form ids are their names; nested wire ids are JSON-encoded name
|
|
324
|
-
paths. Controls continue to use paths relative to the active form in requests.
|
|
325
|
-
Unnamed managed forms and duplicate form paths are rejected.
|
|
326
|
-
|
|
327
|
-
`application.dispose()` closes all bindings and sessions without removing the
|
|
328
|
-
DOM. `options.transport` and `options.errors` configure the shared transport
|
|
329
|
-
and error reporting adapters. Each form still owns its own queue.
|
|
330
|
-
|
|
331
|
-
Disposal blocks future and queued sends and ignores late responses. An HTTP
|
|
332
|
-
request already sent may still execute on the server. Parent forms continue
|
|
333
|
-
collecting nested physical values as before.
|
|
334
|
-
|
|
335
|
-
## Inherited form values
|
|
336
|
-
|
|
337
|
-
A nested Form can declare an `inherit` map. Keys are aliases in that form's
|
|
338
|
-
request `values`; paths refer to concrete controls in the nearest ancestor Form:
|
|
339
|
-
|
|
340
|
-
```lango
|
|
341
|
-
{
|
|
342
|
-
type: "Form"
|
|
343
|
-
name: "details"
|
|
344
|
-
inherit: {
|
|
345
|
-
customerId: "customerId"
|
|
346
|
-
city: {
|
|
347
|
-
path: ["address", "city"]
|
|
348
|
-
writable: true
|
|
349
|
-
}
|
|
350
|
-
}
|
|
351
|
-
controls: []
|
|
352
|
-
}
|
|
353
|
-
```
|
|
354
|
-
|
|
355
|
-
String and path-array entries are read-only. Descriptors use `path` and optional
|
|
356
|
-
Boolean `writable`, default false. Aliases must not collide with the child's
|
|
357
|
-
own controls or reserved value-tree names. Paths cannot cross another Form or
|
|
358
|
-
re-export the parent's virtual aliases. A root Form cannot inherit.
|
|
359
|
-
|
|
360
|
-
The client resolves sources and collects their current values when sending,
|
|
361
|
-
after earlier conflicting requests complete. A missing or removed source fails
|
|
362
|
-
the send before HTTP; replacing a source makes the next send use its replacement.
|
|
363
|
-
Inherited aliases are virtual values, not DOM controls or event targets. They
|
|
364
|
-
are not copied into the physical control tree or the parent's nested collection.
|
|
365
|
-
|
|
366
|
-
Response `vals` can write through a writable alias to the original source,
|
|
367
|
-
including its nested value paths. These writes participate in value rollback.
|
|
368
|
-
Writes to a read-only alias fail before applying the response. Writable aliases also accept saved-value
|
|
369
|
-
acknowledgements and field errors;
|
|
370
|
-
other state commands and structural replacement/removal cannot target inherited
|
|
371
|
-
aliases. This is a UI editing contract; the server must independently validate
|
|
372
|
-
authorization and all incoming values.
|
|
373
|
-
|
|
374
|
-
Managed requests reserve their own form subtree and declared inherited reads
|
|
375
|
-
or writes. Parent/descendant requests serialize, as do overlapping inherited
|
|
376
|
-
writes or read/write pairs. Unrelated siblings remain parallel; sharing a
|
|
377
|
-
read-only source alone does not serialize them. Requests retain their own
|
|
378
|
-
`seqno` and token. Disposal releases reservations and prevents a late inherited
|
|
379
|
-
write from changing a retained parent. This coordination covers managed
|
|
380
|
-
requests within one Application, not other tabs or application databases.
|
|
381
|
-
Direct edits to controls while an inherited request is pending follow the
|
|
382
|
-
normal response update rules; the coordinator does not version user edits.
|
|
383
|
-
|
|
384
|
-
New managed forms seed their token from the page's bootstrap snapshot, rather
|
|
385
|
-
than the latest token persisted by another form. Parent login, private claims,
|
|
386
|
-
and later renewals do not automatically propagate to children or siblings.
|
|
387
|
-
Logout creates a new page snapshot. The server decides any deliberate claim
|
|
388
|
-
inheritance or authentication policy; the browser treats tokens as opaque.
|
|
389
|
-
Standalone Sessions retain their existing token initialization behavior.
|
|
390
|
-
|
|
391
|
-
## URL navigation
|
|
392
|
-
|
|
393
|
-
The `./navigation` entry exports `Navigation(window, options)`:
|
|
394
|
-
|
|
395
|
-
```lango
|
|
396
|
-
import js global window
|
|
397
|
-
import js "@lango-project/lango-client/navigation" as routing
|
|
398
|
-
|
|
399
|
-
navigation = new routing/Navigation(window, {
|
|
400
|
-
rootRedirect: "/profile"
|
|
401
|
-
onUrl: handleUrl
|
|
402
|
-
})
|
|
403
|
-
return navigation.start()
|
|
404
|
-
```
|
|
405
|
-
|
|
406
|
-
`onUrl` receives `{ url, source }`, where `url` is pathname + query + fragment,
|
|
407
|
-
including the initial page. Sources are `start`, `navigate`, `history`, `hash`, and `refresh`.
|
|
408
|
-
The optional root redirect uses replaceState rather than adding a history entry;
|
|
409
|
-
its explicit query/fragment wins, otherwise the incoming ones are retained.
|
|
410
|
-
`navigate(url, replace = false)` validates same-origin HTTP(S) URLs, updates browser
|
|
411
|
-
history and returns the consumer result as a Promise. Back/Forward reruns the URL
|
|
412
|
-
consumer; there is no form/screen cache in this milestone. Refresh starts a new
|
|
413
|
-
page/session through the existing bootstrap contract.
|
|
414
|
-
|
|
415
|
-
URL consumers run in order with captured URL snapshots. Duplicate notifications
|
|
416
|
-
from popstate/hashchange are coalesced. Errors do not block later navigation;
|
|
417
|
-
`options.errors.error(error)` receives event-listener failures, or the standard
|
|
418
|
-
log reports them. A failed current URL can be retried with `navigate(currentUrl)`
|
|
419
|
-
without adding another history entry. `refresh()` explicitly reruns the current
|
|
420
|
-
URL without changing history, for example after logout. `start()` is idempotent, `idle()` waits for
|
|
421
|
-
the notification queue, and `dispose()` removes listeners and skips queued work.
|
|
422
|
-
An already-running consumer owns its cancellation; dispose its Application/Session
|
|
423
|
-
when removing the page.
|
|
424
|
-
|
|
425
|
-
Document-level delegation intercepts ordinary internal anchor clicks, including
|
|
426
|
-
anchors inserted after startup. Modified/middle clicks, downloads, explicit
|
|
427
|
-
browsing targets, prevented events, and disabled/hidden/inert ancestors retain
|
|
428
|
-
native behavior. Same-document fragments retain browser scrolling and are
|
|
429
|
-
observed through hashchange. External HTTP(S) links without a target receive
|
|
430
|
-
`target="_blank"` and `rel="noopener"`; mail/tel and other native schemes are left
|
|
431
|
-
to the browser. Script/credential-bearing/external programmatic destinations are
|
|
432
|
-
rejected.
|
|
433
|
-
|
|
434
|
-
`Navigation` does not bypass form requests. In the demo, the root Form owns a
|
|
435
|
-
hidden `Value` named `url`. Its consumer updates that value and sends
|
|
436
|
-
`session.send("/app/url", "url", null)` through the normal form/JWT/sequence queue.
|
|
437
|
-
The server reads `context form` and calls `pages.render()` with its `url` and
|
|
438
|
-
`template` Values. It applies the returned structural replacement and template
|
|
439
|
-
marker in the same response. `examples/pages.lango` defines the shared registry
|
|
440
|
-
used by both GET shell selection and the worker URL handler. Unknown page and
|
|
441
|
-
asset paths remain 404s. A new template is created before its page; within the
|
|
442
|
-
same prefix only `content.__content__` is replaced, retaining the template DOM
|
|
443
|
-
and values. Leaving a prefix discards its template; returning recreates it.
|
|
444
|
-
There is no cache of templates for previously visited prefixes. Refresh starts a
|
|
445
|
-
new root form; logout clears the marker and calls `navigation.refresh()` so the
|
|
446
|
-
new anonymous session receives a fresh template and page.
|
|
447
|
-
|
|
448
|
-
## Custom controls and themes
|
|
449
|
-
|
|
450
|
-
Use one `Types` registry per application to select browser control classes. A
|
|
451
|
-
registry may also override standard types, for example `Text`, for a theme:
|
|
452
|
-
|
|
453
|
-
```lango
|
|
454
|
-
import "./library"
|
|
455
|
-
class Control
|
|
456
|
-
class Types
|
|
457
|
-
|
|
458
|
-
class Label : Control
|
|
459
|
-
methods
|
|
460
|
-
setValue(value)
|
|
461
|
-
|
|
462
|
-
Label(document, definition, types)
|
|
463
|
-
super(document, definition, types, {
|
|
464
|
-
tag: "p"
|
|
465
|
-
})
|
|
466
|
-
|
|
467
|
-
Label:setValue(value)
|
|
468
|
-
super.setValue(value)
|
|
469
|
-
@element.textContent = value
|
|
470
|
-
return null
|
|
471
|
-
|
|
472
|
-
createTypes()
|
|
473
|
-
types = new Types({
|
|
474
|
-
classes: {
|
|
475
|
-
Label: ["theme-label"]
|
|
476
|
-
Button: ["theme-button"]
|
|
477
|
-
}
|
|
478
|
-
})
|
|
479
|
-
types.registerType("Label", Label)
|
|
480
|
-
return types
|
|
481
|
-
```
|
|
482
|
-
|
|
483
|
-
Pass that registry as `options.types` to `Application`, or to
|
|
484
|
-
`mount(document, root, definition, types)` and `Renderer(document, types)` when
|
|
485
|
-
using those adapters directly. All descendants and structural replacements use
|
|
486
|
-
the same registry. Registration is sealed at first creation; duplicate names and
|
|
487
|
-
unknown wire types fail explicitly. Registries are independent; there is no
|
|
488
|
-
process-wide control registration.
|
|
489
|
-
|
|
490
|
-
Custom classes extend `Control` and accept `(document, definition, types)`.
|
|
491
|
-
`super` accepts trusted element options `{ tag, container }`; `container: true`
|
|
492
|
-
builds children through the registry and preserves normal value paths. `Form`
|
|
493
|
-
remains the wire type for a managed form boundary. An overridden standard type
|
|
494
|
-
keeps its normal wire type. Custom controls use normal delegated click/change/input
|
|
495
|
-
events and `getValue`/`setValue`. Base construction calls `setValue` and state
|
|
496
|
-
setters, so overrides must work before any fields initialized after `super`. Keep constructors synchronous and clean up any
|
|
497
|
-
resources acquired before a constructor throws.
|
|
498
|
-
|
|
499
|
-
Override `dispose()` to release listeners, timers or third-party widget resources.
|
|
500
|
-
It runs on committed removal/replacement and Application disposal; discarded
|
|
501
|
-
prepared replacements also release resources. Rollback retains the old controls
|
|
502
|
-
and disposes the abandoned new ones. Cleanup walks children before their parent
|
|
503
|
-
and reports individual disposal failures through the standard log. A subclass's
|
|
504
|
-
own `dispose()` need not traverse children. Value rollback calls `setValue` again;
|
|
505
|
-
if a custom widget has additional state, extend `snapshotState`/`restoreState`
|
|
506
|
-
using `super` to preserve it along with the base state. Constructors and rollback
|
|
507
|
-
hooks must not send requests or perform unrelated application effects.
|
|
508
|
-
|
|
509
|
-
Definitions support `classes` as an array of CSS class tokens and `style` as a
|
|
510
|
-
map of CSS property names to string values:
|
|
511
|
-
|
|
512
|
-
```lango
|
|
513
|
-
{
|
|
514
|
-
type: "Label"
|
|
515
|
-
name: "heading"
|
|
516
|
-
value: "Profile"
|
|
517
|
-
classes: ["heading", "accent"]
|
|
518
|
-
style: {
|
|
519
|
-
"margin-block": "1rem"
|
|
520
|
-
"--accent-color": "#0f766e"
|
|
521
|
-
}
|
|
522
|
-
}
|
|
523
|
-
```
|
|
524
|
-
|
|
525
|
-
Theme classes from `Types({ classes })` are initial defaults, combined with the
|
|
526
|
-
control's explicit classes. Subsequent `setProperty` commands for `classes`
|
|
527
|
-
replace the complete class list. Commands for `style` replace the server-managed
|
|
528
|
-
inline properties; unrelated inline properties are retained. Null clears either
|
|
529
|
-
setting. Invalid classes/styles are rejected during response planning, before
|
|
530
|
-
structural or value changes. A failed DOM style update restores that command's
|
|
531
|
-
previous CSS state. Earlier successful commands stay committed as in the normal
|
|
532
|
-
command contract. CSS is applied through `className` and `style.setProperty`;
|
|
533
|
-
control definitions do not load scripts or stylesheets.
|
|
534
|
-
|
|
535
|
-
Load theme CSS explicitly from the HTML shell with a normal stylesheet link. The
|
|
536
|
-
demo uses `/assets/demo.css`, theme classes, a CSS custom property and the Lango
|
|
537
|
-
`Label` class in `src/demo_controls.lango`. Its fixed CSS endpoint serves
|
|
538
|
-
`text/css`, a content-based ETag, `public, max-age=0, must-revalidate`, and 304 on
|
|
539
|
-
an exact matching `If-None-Match`. Unknown assets remain 404s; the HTML shell is
|
|
540
|
-
still `no-store`. Versioned immutable asset manifests and on-demand theme/package
|
|
541
|
-
loading are future additions.
|
|
542
|
-
|
|
543
|
-
With adjacent API/UI builds available, `npm run test:demo` rebuilds the demo and
|
|
544
|
-
checks its real HTTP flow, including CSS caching, custom-control module assets,
|
|
545
|
-
deep links, template switches, replay, save and logout. It needs free local ports
|
|
546
|
-
8080 and 8081 and stops the server it starts. It does not launch a browser; DOM
|
|
547
|
-
and custom-control behavior are covered by the renderer tests in `npm test`.
|
|
548
|
-
|
|
549
|
-
## Select and Checkbox inputs
|
|
550
|
-
|
|
551
|
-
`Select` is a native single-select control. Its `options` list contains maps with
|
|
552
|
-
string `value` and `text`, plus an optional Boolean `disabled` (default false):
|
|
553
|
-
|
|
554
|
-
```lango
|
|
555
|
-
{
|
|
556
|
-
type: "Select"
|
|
557
|
-
name: "country"
|
|
558
|
-
label: "Country"
|
|
559
|
-
value: "tr"
|
|
560
|
-
event: "/preferences/change"
|
|
561
|
-
options: [{
|
|
562
|
-
value: "tr"
|
|
563
|
-
text: "Türkiye"
|
|
564
|
-
}, {
|
|
565
|
-
value: "gb"
|
|
566
|
-
text: "United Kingdom"
|
|
567
|
-
}]
|
|
568
|
-
}
|
|
569
|
-
```
|
|
570
|
-
|
|
571
|
-
Values are strings or null. Null means no selection (`selectedIndex = -1`);
|
|
572
|
-
`""` can be a separate, real option value. Omitted initial values stay unselected;
|
|
573
|
-
the first option is not implicitly chosen. Non-string or duplicate option values,
|
|
574
|
-
missing/non-string text, invalid disabled flags and values absent from the option
|
|
575
|
-
list are rejected. Option text is assigned as text. A disabled option may still
|
|
576
|
-
be selected by the server to display an existing value. Replace the Select
|
|
577
|
-
structurally to change its option list. Multiple selection is not supported.
|
|
578
|
-
|
|
579
|
-
`Checkbox` uses a native checkbox and carries a Boolean value:
|
|
580
|
-
|
|
581
|
-
```lango
|
|
582
|
-
{
|
|
583
|
-
type: "Checkbox"
|
|
584
|
-
name: "subscribed"
|
|
585
|
-
label: "Receive updates"
|
|
586
|
-
value: false
|
|
587
|
-
event: "/preferences/change"
|
|
588
|
-
}
|
|
589
|
-
```
|
|
590
|
-
|
|
591
|
-
An omitted/null initial Checkbox value defaults to false. Subsequent `setValue`
|
|
592
|
-
or `vals` writes require true or false; null, numbers and strings are rejected.
|
|
593
|
-
There is no tri-state value. Collection reads the live native checked/selection
|
|
594
|
-
state, including edits since the last server response. Rollback restores those
|
|
595
|
-
unsent edits if another setter fails.
|
|
596
|
-
|
|
597
|
-
The optional `label` string sets an accessible name through `aria-label`; it does
|
|
598
|
-
not draw a caption. Provide a visible label with the application's layout or a
|
|
599
|
-
custom control. `event` defaults to `change` for both inputs; explicit `events`
|
|
600
|
-
entries take precedence. Normal enabled/visible commands, inheritance, theme
|
|
601
|
-
classes, replacement, and form-scoped requests apply. Only the selected scalar
|
|
602
|
-
and checked Boolean go into `values`; option definitions stay in the UI tree.
|
|
603
|
-
The server must validate the submitted values against its own rules. The demo
|
|
604
|
-
shows preference changes, typed save responses, server-side 400 validation and
|
|
605
|
-
Save re-enabling after a change.
|
|
606
|
-
|
|
607
|
-
## Validation and unsaved changes
|
|
608
|
-
|
|
609
|
-
A value control can declare local validation rules. Event sources opt into a
|
|
610
|
-
whole-form check with `validate: true`, for example on a Save button:
|
|
611
|
-
|
|
612
|
-
```lango
|
|
613
|
-
{
|
|
614
|
-
type: "Text"
|
|
615
|
-
name: "email"
|
|
616
|
-
value: ""
|
|
617
|
-
validation: {
|
|
618
|
-
required: true
|
|
619
|
-
maxLength: 254
|
|
620
|
-
pattern: "[^ @]+@[^ @]+[.][^ @]+"
|
|
621
|
-
message: "Enter a valid email address."
|
|
622
|
-
}
|
|
623
|
-
}
|
|
624
|
-
```
|
|
625
|
-
|
|
626
|
-
Supported rules are `required`, `minLength`, `maxLength`, `pattern`, and an optional
|
|
627
|
-
shared `message`. Lengths are nonnegative integers (JavaScript string lengths);
|
|
628
|
-
patterns match the entire value and use JavaScript RegExp syntax. Unknown rules,
|
|
629
|
-
invalid patterns and inconsistent length ranges fail when constructing a control.
|
|
630
|
-
Required text rejects blank/whitespace, required Select rejects null/empty string,
|
|
631
|
-
and required Checkbox requires true. Optional empty values skip length/pattern
|
|
632
|
-
checks. This first contract has no cross-field or asynchronous validators.
|
|
633
|
-
|
|
634
|
-
`session.validate(report = true)` returns `{ path, message, control }` entries
|
|
635
|
-
and normally reports the first error using native browser validity UI. It checks
|
|
636
|
-
owned fields and writable inherited aliases, skipping disabled/hidden/inert
|
|
637
|
-
subtrees and child Form boundaries. Child forms validate through their own
|
|
638
|
-
sessions. Input/change events update local validity even when they have no
|
|
639
|
-
server event mapping. Controls set `aria-invalid` and `data-lango-error` and use
|
|
640
|
-
`setCustomValidity`/`reportValidity` when available. Custom widgets can override
|
|
641
|
-
`validate()`/`reportValidity()` to use their own presentation.
|
|
642
|
-
|
|
643
|
-
For a request whose named source has `validate: true`, Session validates again
|
|
644
|
-
when its queue reaches the request. Failure rejects with `UiValidationFailed`
|
|
645
|
-
without sending HTTP or consuming a sequence number; busy state is released
|
|
646
|
-
before native error reporting. Ordinary change events remain available for
|
|
647
|
-
server-side interaction with an incomplete form. Programmatic `session.send`
|
|
648
|
-
uses the same named-source check. A server must still validate client input.
|
|
649
|
-
|
|
650
|
-
`control.isDirty()` compares live values against the initial/saved baseline.
|
|
651
|
-
Text, Select and Checkbox track changes by default; hidden Value, labels and
|
|
652
|
-
other custom types default to no tracking. `trackChanges: true/false` overrides
|
|
653
|
-
that choice. Object/array baselines are copied, and object key order does not
|
|
654
|
-
create a difference. A control tree aggregates its descendants; `session.isDirty()`
|
|
655
|
-
uses its own form scope plus writable inherited sources. `application.isDirty()`
|
|
656
|
-
aggregates all managed sessions. `control.markClean()` explicitly establishes a
|
|
657
|
-
new local baseline for that control/subtree.
|
|
658
|
-
|
|
659
|
-
Normal responses and change events do not automatically mark data saved. The
|
|
660
|
-
server acknowledges an accepted field value with a `setProperty` command named
|
|
661
|
-
`savedValue`. That command changes only the baseline. If the current value has
|
|
662
|
-
changed again since the acknowledged value, the field stays dirty. `vals` still
|
|
663
|
-
performs its normal value updates before commands; acknowledge the canonical
|
|
664
|
-
value used in those updates. Replacement controls start clean; removed controls
|
|
665
|
-
leave dirty tracking. Failed requests/patches do not create a save acknowledgement.
|
|
666
|
-
|
|
667
|
-
The server can show a field error with `setProperty("error", message)`; null
|
|
668
|
-
clears it. This reports native validity without changing the value or dirty
|
|
669
|
-
baseline. Session reports server errors after releasing its busy state so the
|
|
670
|
-
input can receive browser focus. Editing/revalidating the field clears that server message and applies
|
|
671
|
-
local rules. Writable inherited aliases accept `savedValue` and `error` commands
|
|
672
|
-
for their physical source; other inherited state commands remain forbidden.
|
|
673
|
-
Read-only aliases accept neither command. Custom `applyProperty` overrides should
|
|
674
|
-
forward these base properties through `super`.
|
|
675
|
-
|
|
676
|
-
Pass `options.window` to Application for a `beforeunload` warning while dirty;
|
|
677
|
-
disposal removes the listener. The browser controls the actual unload dialog.
|
|
678
|
-
For SPA navigation, use a synchronous Boolean guard:
|
|
679
|
-
|
|
680
|
-
```lango
|
|
681
|
-
canLeave = (event)
|
|
682
|
-
capture application
|
|
683
|
-
return application.confirmDiscard(window)
|
|
684
|
-
navigation = new routing/Navigation(window, {
|
|
685
|
-
onUrl: handleUrl
|
|
686
|
-
beforeNavigate: canLeave
|
|
687
|
-
})
|
|
51
|
+
npm exec --package=@lango-project/lango-ui@0.4.0 -- create-lango-ui my-app
|
|
52
|
+
cd my-app
|
|
53
|
+
npm install
|
|
54
|
+
npm test
|
|
55
|
+
npm run dev
|
|
688
56
|
```
|
|
689
57
|
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
keys. Use Navigation to make same-document history changes; unrelated routers
|
|
695
|
-
must not rewrite its marker or history. Requests during asynchronous history
|
|
696
|
-
restoration fail with `UiNavigationRestoringHistory` until the restoration event
|
|
697
|
-
arrives. `start` does not ask the guard. Confirmation does not clear dirty state;
|
|
698
|
-
a failed page load therefore retains its unsaved baseline.
|
|
699
|
-
|
|
700
|
-
The demo guards navigation and logout, and allows its explicit post-logout
|
|
701
|
-
refresh after the user has already accepted discard. It shows a brief validation/
|
|
702
|
-
request error summary; `blocked@example.com` demonstrates a server field error.
|
|
703
|
-
A successful save acknowledges the accepted values, so leaving afterwards does
|
|
704
|
-
not ask to discard unchanged data.
|
|
705
|
-
|
|
706
|
-
## Persistent contact-book example
|
|
58
|
+
Open `http://127.0.0.1:3000/` or `/profile`. Application handlers live in
|
|
59
|
+
`src/handlers.lango`, with `routes.xml` and `deploy.xml` selecting the npm exports
|
|
60
|
+
and hosting settings. The browser remains a consumer of server control
|
|
61
|
+
instructions. Rebuild/restart after changing the application source.
|
|
707
62
|
|
|
708
|
-
|
|
709
|
-
`http://localhost:8080/contacts`. After the adjacent API/UI projects are built,
|
|
710
|
-
run from this project directory:
|
|
63
|
+
For an existing application that only needs the static browser assets:
|
|
711
64
|
|
|
712
65
|
```sh
|
|
713
|
-
npm
|
|
714
|
-
npm run build:demo-server
|
|
715
|
-
npm run demo
|
|
66
|
+
npm exec --package=@lango-project/lango-client@0.4.0 -- lango-client ./public
|
|
716
67
|
```
|
|
717
68
|
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
A
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
`
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
69
|
+
The first phase supports same-origin Web/Bootstrap. The destination must be
|
|
70
|
+
empty. `--update` explicitly refreshes generated assets in an existing directory;
|
|
71
|
+
use a dedicated output directory when maintaining a custom HTML shell. The
|
|
72
|
+
command preserves the complete runtime and vendor trees; it does not generate
|
|
73
|
+
business handlers or install dependencies. Keep private keys outside this output.
|
|
74
|
+
|
|
75
|
+
`npm run test:starter` in this checkout tests delivery using sibling lango-ui,
|
|
76
|
+
lango-server and lango-js checkouts (or `LANGO_STARTER_UI`,
|
|
77
|
+
`LANGO_STARTER_SERVER`, `LANGO_STARTER_COMPILER` paths). It builds and packs them,
|
|
78
|
+
installs the packed generator without a compiler, generates an app, installs and
|
|
79
|
+
tests/builds it, verifies a stable local key, removes development dependencies,
|
|
80
|
+
and exercises the actual server/UI/browser pipeline in Chromium. Offline installs
|
|
81
|
+
use the dependency cache populated by installing the source repositories. No
|
|
82
|
+
registry publish or existing user application is involved.
|
|
83
|
+
|
|
84
|
+
## Implemented behavior
|
|
85
|
+
|
|
86
|
+
- Startup restores the most recently saved token and sends it unchanged.
|
|
87
|
+
- Every form owns its current token. New child forms inherit the creating
|
|
88
|
+
form's token; later responses update only the receiving form. Tokens are never
|
|
89
|
+
decoded in the client. Storage errors do not prevent in-memory operation.
|
|
90
|
+
- Named controls contribute values, including `null` for buttons and other
|
|
91
|
+
controls without values. Named child forms contribute nested maps.
|
|
92
|
+
`inheritedNames` reads and writes through to the parent form.
|
|
93
|
+
- A form and its ancestors/descendants serialize sends. Unrelated forms may send
|
|
94
|
+
concurrently. Queued sends collect values and read the current token when
|
|
95
|
+
they actually start. Failed requests are not automatically repeated.
|
|
96
|
+
- Responses update the token first, then replace the view, then execute ordered
|
|
97
|
+
commands. Partial value updates preserve unspecified controls and do not emit
|
|
98
|
+
DOM change events.
|
|
99
|
+
- Ordinary same-origin links use client navigation. Modified clicks, downloads,
|
|
100
|
+
external links, and links targeting another browsing context keep browser
|
|
101
|
+
behavior. Back and forward request the page again.
|
|
102
|
+
- `values`, `invalid`, `set`, `disable`, `enable`, `changeCaption`, `redirect`, and `setUrl`
|
|
103
|
+
commands are implemented. `setUrl` changes history without fetching a view;
|
|
104
|
+
`redirect` requests the target after the current response finishes.
|
|
105
|
+
- A sending form has a waiting indicator, blur, and `aria-busy` state.
|
|
106
|
+
- Forms dispose child controls and registered resources when removed. Failed
|
|
107
|
+
control construction preserves the previous view and its control registry.
|
|
108
|
+
|
|
109
|
+
The Bootstrap renderer supports `form`, `container`, `row`, `col`, `text`,
|
|
110
|
+
`button`, `value`, `input`, `checkbox`, `switch`, `select`, `radio`, `range`,
|
|
111
|
+
`alert`, `progress`, `toast`, and `toastStack`. Dialog definitions are opened
|
|
112
|
+
through `showDialog`.
|
|
113
|
+
Fields use separate Lango classes and have visible associated labels and
|
|
114
|
+
descriptions. Supported value semantics:
|
|
115
|
+
|
|
116
|
+
| Control | Value |
|
|
117
|
+
| --- | --- |
|
|
118
|
+
| Input, text-like variants | String; empty input returns an empty string |
|
|
119
|
+
| Input `String` | Alias for the text variant; `lines > 1` creates a textarea |
|
|
120
|
+
| Input `Number` | JavaScript number, or null when empty/invalid |
|
|
121
|
+
| Input `Decimal` / `Money` | Exact text, with a decimal input hint; no float conversion |
|
|
122
|
+
| Checkbox | Boolean, or null while indeterminate |
|
|
123
|
+
| Switch | Boolean; an unset/null value becomes false |
|
|
124
|
+
| Range | Native numeric slider value, with min/max/steps |
|
|
125
|
+
| Select / Radio | The option's original JSON value, or null when unselected |
|
|
126
|
+
|
|
127
|
+
Select and Radio support structured JSON option values, compared by structure
|
|
128
|
+
and primitive type. Radio also supports `selectedIndex` when no `value` is
|
|
129
|
+
supplied, and respects each option's `enabled` flag. Readonly controls that have
|
|
130
|
+
no native readonly mode stay disabled even after an `enable` command.
|
|
131
|
+
|
|
132
|
+
Input `url` sends its owning form after 500 ms without another input event.
|
|
133
|
+
Programmatic `values` updates emit no events and create no request. Disposing
|
|
134
|
+
the input cancels its pending debounce and removes its listeners.
|
|
135
|
+
|
|
136
|
+
Date ranges, single-file JSON uploads, OTP and explicit numeric format settings
|
|
137
|
+
are implemented as described below. Advanced decorative options remain open.
|
|
138
|
+
Unsupported control types and input variants fail explicitly. Decimal/Money
|
|
139
|
+
without a format map retain their existing plain-text behavior.
|
|
140
|
+
|
|
141
|
+
## Validation and form content replacement
|
|
142
|
+
|
|
143
|
+
`invalid(name, message)` resolves slash-separated names and presents plain-text
|
|
144
|
+
feedback. Fields receive an invalid style, `aria-invalid`, and an additional
|
|
145
|
+
`aria-describedby` reference while retaining their description. Before a queued
|
|
146
|
+
send actually starts, the sending form clears errors on the named controls
|
|
147
|
+
included in its value tree, child forms and inherited value sources. Unrelated errors remain visible.
|
|
148
|
+
|
|
149
|
+
`set(name, control)` replaces the **contents of a named Form**, preserving that
|
|
150
|
+
Form's identity and token. A Form definition replaces its content directly; any
|
|
151
|
+
other control becomes its new content. Remaining commands, including the final
|
|
152
|
+
`values` command, address the new controls. Successful replacement disposes old
|
|
153
|
+
controls and form resources. Failed construction preserves the previous DOM,
|
|
154
|
+
registry, inherited names and resources, and disposes the failed candidate.
|
|
155
|
+
App-wide navigation listeners survive form content changes and are released
|
|
156
|
+
only when the application is disposed.
|
|
157
|
+
|
|
158
|
+
## Alerts, Toasts, Dialogs and Progress
|
|
159
|
+
|
|
160
|
+
`showAlert({ name?, message, theme?, place?, closeButton? })` accepts literal
|
|
161
|
+
text, a control definition or an array of text/control definitions.
|
|
162
|
+
The default is a dismissible alert at the start of the sending form. A placement
|
|
163
|
+
map uses `{ name: "email", position: "before" }`; position may also be `after`
|
|
164
|
+
or `inside`. Paths resolve against the sending form. A named alert replaces the
|
|
165
|
+
existing alert with that name; malformed replacements preserve the old alert.
|
|
166
|
+
`dismissAlert(name)` is idempotent for an absent alert. Closing unregisters the
|
|
167
|
+
control and all controls owned by its message. Named message controls belong
|
|
168
|
+
to the sending Form, while explicit nested Forms keep their own value/token
|
|
169
|
+
scopes. Replacing an alert may reuse its previous content names; collisions
|
|
170
|
+
with unrelated controls are rejected. A replacement cannot be anchored inside
|
|
171
|
+
the content it will remove. Alerts positioned in another form's subtree also close when that
|
|
172
|
+
subtree is replaced, without leaving a stale name in the originating form.
|
|
173
|
+
|
|
174
|
+
`showToast(toast, stack = null)` displays a Toast definition. A named ToastStack
|
|
175
|
+
is resolved by path; otherwise a form-owned corner region is created. Toast
|
|
176
|
+
header/body accept text or control definitions, including explicit Forms. A
|
|
177
|
+
named Toast can be addressed through its stack and content names, for example
|
|
178
|
+
`notifications/saved/editor/value`. Toasts themselves contribute null rather
|
|
179
|
+
than their internal Form values to the owner's payload. Explicit Forms inside
|
|
180
|
+
Toast content send their own values and may use inherited names from the owning
|
|
181
|
+
application form; internal presentation scopes are skipped for inheritance.
|
|
182
|
+
|
|
183
|
+
`instant: true` closes the Toast after five seconds. False or omitted leaves it
|
|
184
|
+
open until dismissal or owner replacement. Default position is `bottom-right`;
|
|
185
|
+
positions combine `top`/`middle`/`bottom` with `left`/`center`/`right`. Header/body
|
|
186
|
+
text is never treated as HTML. Close listeners, nested Forms and the auto-close
|
|
187
|
+
timer are disposed together. `Button.dismiss` closes its containing Toast or
|
|
188
|
+
Dialog; with a URL it dismisses only after that form send succeeds.
|
|
189
|
+
|
|
190
|
+
`showDialog(dialog, keepPrev = false)` uses a native HTML dialog with Bootstrap
|
|
191
|
+
content styling. Each Dialog has its own Form/token scope inherited from the
|
|
192
|
+
request that creates it. A root body Form supplies its controls and inherited
|
|
193
|
+
names; footer controls share that scope. The namespace is the Dialog's `name`,
|
|
194
|
+
or the root body Form's `name` when omitted, allowing a following values command
|
|
195
|
+
such as `editor/name`. Titles accept text or a Text definition; body/footer may
|
|
196
|
+
contain controls. Supported sizes are `sm`, `lg`, `xl` and `fullscreen`, with
|
|
197
|
+
optional dark, scrollable and backdrop-blur flags.
|
|
198
|
+
|
|
199
|
+
With `keepPrev: true`, the previous Dialog remains alive with its values,
|
|
200
|
+
validation, focus, resources and token. Only the active Dialog appears in the
|
|
201
|
+
owner's named value tree. At most the current and one previous Dialog are kept;
|
|
202
|
+
a subsequent retained Dialog disposes the older saved one. `swapDialog()`
|
|
203
|
+
exchanges those two without reconstruction. Native modality handles focus
|
|
204
|
+
trapping and Escape; a saved focus is restored when possible.
|
|
205
|
+
|
|
206
|
+
`showDialog(null)` closes the addressed/current Dialog and restores the saved
|
|
207
|
+
one when present. Programmatic closure and owner replacement do not invoke
|
|
208
|
+
`closeUrl`. User dismissal invokes that optional URL once using the Dialog's
|
|
209
|
+
values and current token, then closes after success. Repeated dismissal while
|
|
210
|
+
the request is pending is ignored. Failure keeps the Dialog open for an explicit
|
|
211
|
+
retry. New Dialog construction failures leave the active Dialog intact. Parent
|
|
212
|
+
view replacement or disposal closes both active and saved windows and resources.
|
|
213
|
+
|
|
214
|
+
`setProgress(name, min, max, value = null)` requires a numeric range with max
|
|
215
|
+
greater than min. Values are visually clamped; null is indeterminate and omits
|
|
216
|
+
`aria-valuenow`. `updateProgress(name, value, label = null)` preserves the range
|
|
217
|
+
and changes an optional application-supplied text label. The label stays visible
|
|
218
|
+
at zero and is exposed through `aria-valuetext`. Min/max/now ARIA values,
|
|
219
|
+
bar width, theme and stripe flags are updated without adding a form value. An
|
|
220
|
+
invalid range fails before changing the existing bar.
|
|
221
|
+
|
|
222
|
+
## Per-token keepalive
|
|
223
|
+
|
|
224
|
+
The client tracks successful response times per opaque token string. An active
|
|
225
|
+
form cannot postpone another form's renewal. One app timer follows the earliest
|
|
226
|
+
60-second deadline; equal token strings are sent once and their replacements
|
|
227
|
+
update every live form still holding that string. Disposed forms do not
|
|
228
|
+
participate, and stale results cannot overwrite a subsequently changed token.
|
|
229
|
+
|
|
230
|
+
Before Ping, current sends finish and new sends remain queued. Due tokens are
|
|
231
|
+
recomputed after those sends finish. Batches contain at most 64 tokens and use
|
|
232
|
+
the most recently refreshed live token as the Bearer credential. A batch returns
|
|
233
|
+
individual replacement tokens and statuses; JWT contents are never decoded.
|
|
234
|
+
Failed entries retain their tokens and wait until the next scheduled minute.
|
|
235
|
+
Business requests are never automatically replayed. Application disposal
|
|
236
|
+
cancels the timer.
|
|
237
|
+
|
|
238
|
+
## Timers and longpoll subscriptions
|
|
239
|
+
|
|
240
|
+
`setTimer(url, interval)` schedules one form send; `setInterval(url, interval)`
|
|
241
|
+
schedules repeated form sends. Delays are positive milliseconds within the
|
|
242
|
+
native timer range. A new command replaces the timer of the same kind and URL
|
|
243
|
+
in that form. Timer and interval registries are separate. `clearTimer` and
|
|
244
|
+
`clearInterval` are idempotent. Intervals schedule their next tick after the
|
|
245
|
+
previous request settles, avoiding overlapping sends and queued tick backlogs.
|
|
246
|
+
Each tick collects current form values and uses the current token.
|
|
247
|
+
|
|
248
|
+
Form replacement/disposal cancels timers, queued resource sends and pending
|
|
249
|
+
longpoll HTTP requests. Replies from stopped resources cannot modify the form.
|
|
250
|
+
An ordinary resource request that already reached the server may finish there;
|
|
251
|
+
the client cannot undo application side effects and never automatically retries
|
|
252
|
+
that business operation.
|
|
253
|
+
|
|
254
|
+
`startLongPoll(url, key, cursor = null)` starts one subscription per URL/key pair
|
|
255
|
+
in the form. Repeating a start without a cursor keeps a live subscription; an
|
|
256
|
+
explicit cursor replaces it. `stopLongPoll(url, key)` is idempotent. Poll requests
|
|
257
|
+
send only `{ key, cursor }`, not form values, with the form's Bearer token.
|
|
258
|
+
|
|
259
|
+
Held HTTP polls run outside the form send queue. Before a related ordinary send
|
|
260
|
+
or report, the client aborts the pending poll; Ping aborts all held polls. Polls
|
|
261
|
+
resume after those operations with the latest token and successfully applied
|
|
262
|
+
cursor. Responses from an aborted generation are discarded. Successful poll
|
|
263
|
+
responses enter the normal form queue, so message application cannot race form
|
|
264
|
+
sends or Ping. Each message's `data` is a UI response map (`view` and/or `cmds`).
|
|
265
|
+
Messages apply in order. The cursor advances only after successful application;
|
|
266
|
+
the last 256 applied message IDs also suppress recent duplicate deliveries.
|
|
267
|
+
A bad message stops the subscription and reports a technical failure.
|
|
268
|
+
|
|
269
|
+
Empty successful responses immediately start the next poll. Network/503/429
|
|
270
|
+
failures reconnect with 1–30 second exponential backoff; a numeric Retry-After
|
|
271
|
+
can extend the delay up to 60 seconds. Authentication and other terminal HTTP
|
|
272
|
+
failures stop the subscription. These reconnects repeat transport reads, not
|
|
273
|
+
application form operations.
|
|
274
|
+
|
|
275
|
+
On HTTP 409, the current poll stops normal reads and calls the same-origin
|
|
276
|
+
`fallback` URL as a normal authenticated form send. The fallback must provide
|
|
277
|
+
the fresh UI state and explicitly emit `startLongPoll` with its snapshot cursor.
|
|
278
|
+
Without that command, the subscription remains stopped. Snapshot/cursor
|
|
279
|
+
consistency belongs to the application. No fallback or an invalid/cross-origin
|
|
280
|
+
fallback stops the subscription and reports `LongPollResyncRequired` or
|
|
281
|
+
`LongPollResyncFailed`; a new cursor is never invented locally.
|
|
282
|
+
|
|
283
|
+
## Client error reporting
|
|
284
|
+
|
|
285
|
+
When bootstrap supplies `clientErrorUrl`, unexpected UI errors, window `error`
|
|
286
|
+
events and `unhandledrejection` events produce bounded technical reports:
|
|
287
|
+
`{ source, code, count, name? }`. Source is `ui`, `window` or `promise`. Raw
|
|
288
|
+
messages, stack traces, filenames, form values, channel keys and tokens are not
|
|
289
|
+
included. Validation feedback is not reported as an unexpected error.
|
|
290
|
+
|
|
291
|
+
Pending identical reports for the same form are coalesced up to count 100. The
|
|
292
|
+
app permits at most 20 queued report entries and 10 attempted reports per minute.
|
|
293
|
+
Reports use the ordinary form serialization/Ping gate but do not collect values,
|
|
294
|
+
clear validation, show a waiting indicator, or apply response views/commands.
|
|
295
|
+
Only their token header is accepted. Failed reports are discarded without a
|
|
296
|
+
Toast, recursive reporting or retry. Optional absent channels do nothing.
|
|
297
|
+
Global listeners survive form content replacement and close with the app.
|
|
298
|
+
|
|
299
|
+
## Cards, tables and navigation
|
|
300
|
+
|
|
301
|
+
The Bootstrap renderer supports `card`, `cardGroup`, `image`, `badge`,
|
|
302
|
+
`toolbar`, `table`, `tab`, `nav`, `navBar` and `breadcrumb`, with their structural
|
|
303
|
+
item types. Text in rich slots is rendered literally; slots can also contain
|
|
304
|
+
control definitions or arrays of definitions. Image accepts an HTTP(S) or image
|
|
305
|
+
data URL, or base64 `content` with an image `mimeType` (default `image/png`).
|
|
306
|
+
|
|
307
|
+
Cards, tables, tabs and navigation do not introduce implicit Form scopes.
|
|
308
|
+
Controls inside them belong to the containing Form; explicit nested Forms keep
|
|
309
|
+
their independent values and tokens. Named non-field controls contribute null.
|
|
310
|
+
|
|
311
|
+
Tables consume `tableCol`, one optional `tableHeader`, `tableRow`, `tableCell`
|
|
312
|
+
and `tableDivider` definitions. Header rows contain native column headings.
|
|
313
|
+
`rowSpan` and `colSpan` are Cell properties; spans must be integers from 1 to
|
|
314
|
+
1000. Column `colSpan` uses the native column span. Numeric column widths are
|
|
315
|
+
pixels; strings are CSS widths. Resizable columns support pointer dragging and
|
|
316
|
+
Left/Right keys in 10-pixel steps, with a minimum width of 24 pixels per column.
|
|
317
|
+
A resizable column must end at a first-row cell boundary. Row/Cell `url` sends
|
|
318
|
+
the owning Form with its current token. Inner buttons, links and fields do not
|
|
319
|
+
also trigger a surrounding row/cell action; Enter/Space activate a focused
|
|
320
|
+
row/cell. All listeners are removed when the Form is replaced or disposed.
|
|
321
|
+
|
|
322
|
+
Tabs use `items` containing `tabItem` definitions. `active` selects an item by
|
|
323
|
+
name; omission selects the first. `variant` is `default`, `pills` or
|
|
324
|
+
`listGroup`. `vertical` changes both layout and arrow-key direction. Home/End
|
|
325
|
+
select the first/last item. `activateTabItem(name)` changes the selected panel.
|
|
326
|
+
Switching panels preserves their DOM, field values, token scopes and resources.
|
|
327
|
+
Tab and panel IDs are generated independently of application names.
|
|
328
|
+
|
|
329
|
+
NavItem/NavBarItem `url` creates a native link. Internal ordinary clicks use the
|
|
330
|
+
application navigation flow; external and modified clicks retain native browser
|
|
331
|
+
behavior. Links accept HTTP(S) URLs. A linked item cannot contain another
|
|
332
|
+
interactive control. Active navigation follows the longest same-origin pathname
|
|
333
|
+
match at a segment boundary and updates after navigation, history changes and
|
|
334
|
+
`setUrl`. Items without a URL use their explicit `active` flag.
|
|
335
|
+
When `overflow` is supplied, icon/image items can hide their text while retaining
|
|
336
|
+
an accessible label; `keepVisible` prevents this. Text-only items remain visible,
|
|
337
|
+
with scrolling when needed. Observers are disconnected on disposal. Navbar item
|
|
338
|
+
placement applies to its containing bar. Breadcrumbs render native links and
|
|
339
|
+
mark the final item as the current page.
|
|
340
|
+
|
|
341
|
+
## Menus, lists and accordion
|
|
342
|
+
|
|
343
|
+
`menu` renders a dropdown with recursive `menuItem` children. Items use `variant`
|
|
344
|
+
`header` or `divider`, or omit it for an action/submenu. `label`, `description`
|
|
345
|
+
and icons are rendered as literal text or controls; interactive controls are
|
|
346
|
+
not allowed inside action labels/icons. A string icon names CSS classes supplied
|
|
347
|
+
by the application; the runtime does not load an icon library. Description text
|
|
348
|
+
is exposed separately from the accessible action name.
|
|
349
|
+
|
|
350
|
+
Item `url` sends the owning Form and closes the menu. Opening a submenu never
|
|
351
|
+
sends a request. An item with both a URL and `subItems` gets separate action and
|
|
352
|
+
submenu buttons. Down/Up and Home/End move focus; Right opens a submenu, Left
|
|
353
|
+
returns to its parent, and Escape closes the root and restores trigger focus.
|
|
354
|
+
Outside pointer/focus changes close the menu. Disabling a menu closes it;
|
|
355
|
+
listeners on controls and the document are released with the Form.
|
|
356
|
+
|
|
357
|
+
`listGroup` wraps arbitrary control definitions from `items` in list items.
|
|
358
|
+
`activeIndex` is zero-based presentation metadata; null or -1 means no active
|
|
359
|
+
item. It does not turn the list into a field or send a selection event.
|
|
360
|
+
`numbered`, `flush` and `horizontal` use Bootstrap list presentation. Named
|
|
361
|
+
controls and explicit child Forms retain their normal value scopes.
|
|
362
|
+
|
|
363
|
+
`accordion` contains `accordionItem` definitions with `summary`, `body`,
|
|
364
|
+
`opened` and arbitrary JSON `value`. One item can be open by default; `multi`
|
|
365
|
+
allows several. More than one initially open item in a single-selection
|
|
366
|
+
Accordion is rejected. The named Accordion returns the open item's value or
|
|
367
|
+
null; in multi mode it returns an array of open item values in display order,
|
|
368
|
+
or an empty array. Named AccordionItems return null and remain available to
|
|
369
|
+
commands such as enable/disable/changeCaption.
|
|
370
|
+
|
|
371
|
+
Toggling never rebuilds bodies: fields and nested Forms retain values, tokens
|
|
372
|
+
and resources, including while hidden. Optional Accordion `url` sends the owning
|
|
373
|
+
Form once per user toggle, after the new state is applied. Setting its value
|
|
374
|
+
through a `values` command does not emit a toggle request. Values match by JSON
|
|
375
|
+
structure; invalid selections leave the previous selection intact. In single
|
|
376
|
+
mode null clears selection; in multi mode an array is required. Duplicate
|
|
377
|
+
requested values select their item once. Arrow/Home/End keys move header focus.
|
|
378
|
+
Summary controls must be noninteractive. `small` compacts padding and `gap`
|
|
379
|
+
accepts true for the default spacing, a pixel number or a CSS length.
|
|
380
|
+
|
|
381
|
+
## InputGroup and Markdown
|
|
382
|
+
|
|
383
|
+
`inputGroup` uses `controls` to place adjacent inputs/selects, text add-ons and
|
|
384
|
+
buttons. It is a layout control: named fields remain in their owning Form, and
|
|
385
|
+
explicit nested Forms keep their separate scope. A named InputGroup returns null.
|
|
386
|
+
Labels, descriptions and validation feedback stay attached to the original field
|
|
387
|
+
wrapper. CSS Grid/subgrid aligns the input row with adjacent buttons without
|
|
388
|
+
moving field DOM or changing event/disposal behavior.
|
|
389
|
+
|
|
390
|
+
`markdown` renders its `text` using [Marked](https://marked.js.org/) and
|
|
391
|
+
[DOMPurify](https://github.com/cure53/DOMPurify). Common Markdown and GFM tables,
|
|
392
|
+
task lists, strikethrough, links and fenced code blocks are supported. Raw HTML
|
|
393
|
+
is displayed literally, including inside otherwise valid Markdown. Generated
|
|
394
|
+
HTML passes through an explicit tag/attribute allowlist before insertion as a
|
|
395
|
+
sanitized DOM fragment. Script URLs, event handlers, embedded frames, forms,
|
|
396
|
+
SVG/MathML and application data attributes are not admitted. Code blocks remain
|
|
397
|
+
literal text and do not execute or load a syntax-highlighting service.
|
|
398
|
+
|
|
399
|
+
A named Markdown contributes null. `changeCaption(name, source)` updates its
|
|
400
|
+
Markdown source; null clears it. Invalid non-string source leaves the previous
|
|
401
|
+
content intact. Markdown is never used to evaluate Lango expressions or create
|
|
402
|
+
named Lango controls. Dependency modules and their licenses are copied to
|
|
403
|
+
`dist/vendor/` by the build and loaded locally through the static import map.
|
|
404
|
+
|
|
405
|
+
## Rich button captions and alert messages
|
|
406
|
+
|
|
407
|
+
Button `caption` accepts literal text, a noninteractive control definition or an
|
|
408
|
+
array of text/control definitions. `changeCaption(name, content)` uses the same
|
|
409
|
+
contract and preserves the button's action, disabled state and attributes.
|
|
410
|
+
Badge/Text/Image content can be used; buttons, links, fields and focusable
|
|
411
|
+
controls are rejected inside a button caption. Clicking caption content triggers
|
|
412
|
+
the containing button's action once.
|
|
413
|
+
|
|
414
|
+
Alert `message` supports interactive controls, including Buttons and explicit
|
|
415
|
+
Forms. Its content belongs to the sending Form; positioning the Alert in another
|
|
416
|
+
Form changes its lifetime rather than its request/value scope. The Alert itself
|
|
417
|
+
still contributes null. `changeCaption` can replace its message without removing
|
|
418
|
+
the close button.
|
|
419
|
+
|
|
420
|
+
Replacing either slot constructs and checks new content before committing its
|
|
421
|
+
DOM and name registrations. A failed definition or unrelated name collision
|
|
422
|
+
leaves the old slot intact and disposes partially created controls. Successful
|
|
423
|
+
replacement, Alert dismissal and parent disposal release old names, listeners
|
|
424
|
+
and child Forms. Plain strings remain literal text and avoid registry staging.
|
|
425
|
+
`Button` is exported as a built-in control class. The existing two-argument
|
|
426
|
+
`Alert(form, props)` constructor remains supported for literal text; pass the
|
|
427
|
+
renderer as its optional third argument when constructing rich content directly.
|
|
428
|
+
|
|
429
|
+
## ComboBox, Chip, Avatar and FormSpinner
|
|
430
|
+
|
|
431
|
+
`comboBox` is a select-only dropdown with `options` containing `value`, `control`
|
|
432
|
+
and optional `url`. Option content supports passive rich controls such as Card,
|
|
433
|
+
Text, Badge and Image; interactive/focusable controls are rejected. Content must
|
|
434
|
+
provide text, an explicit accessible label or image alt text. Selected values
|
|
435
|
+
are summarized as text on the trigger. Null-valued options introduce named
|
|
436
|
+
nonselectable groups. Values retain JSON types and are compared structurally.
|
|
437
|
+
|
|
438
|
+
Single selection returns its value or null. `multi = true` returns an array;
|
|
439
|
+
null or an empty array clears it. Duplicate requested values select their option
|
|
440
|
+
once. Invalid values leave the current selection intact. Down/Up and Home/End
|
|
441
|
+
move through options, Enter/Space select, and Escape returns to the trigger.
|
|
442
|
+
Outside pointer/focus changes close the popup. Readonly controls remain disabled
|
|
443
|
+
through `enable` commands. Popup document listeners are released on disposal.
|
|
444
|
+
|
|
445
|
+
Selecting an option sends the owning Form only when `option.url` is explicitly
|
|
446
|
+
present. A string value, including one that looks like a URL, remains ordinary
|
|
447
|
+
data. The new selection is applied before the request. Programmatic `values`
|
|
448
|
+
updates never invoke option actions. Multi-selection leaves the popup open.
|
|
449
|
+
|
|
450
|
+
`chip` has a fixed JSON `value` and an initial `active` Boolean. Its selection
|
|
451
|
+
button toggles active state and exposes `aria-pressed`. Active chips return their
|
|
452
|
+
configured value; inactive chips return null. Setting that value through `values`
|
|
453
|
+
activates it; null deactivates it. A different value is rejected. The visible
|
|
454
|
+
caption uses `label`, falling back to a string value. `icon` accepts CSS classes
|
|
455
|
+
or a passive control. Optional `button` is a separate Button definition with its
|
|
456
|
+
own action/disabled state, outside the selection button. Readonly/disabled apply
|
|
457
|
+
to selection. Neither a user toggle nor a programmatic value update sends an
|
|
458
|
+
implicit request; the separate Button may send one.
|
|
459
|
+
|
|
460
|
+
`avatar` displays literal text or passive controls from `content`, with optional
|
|
461
|
+
`online`, `offline`, `busy` or `away` status. Use an Image control for image
|
|
462
|
+
content. The status dot is decorative; application-supplied `aria.label` can
|
|
463
|
+
describe the avatar and status in the selected language. Default size is 2.5rem; `small`, `medium`, `large`, positive pixel numbers
|
|
464
|
+
and CSS sizes are accepted. `changeCaption` replaces content and releases its
|
|
465
|
+
old controls, keeping size and status. The Avatar itself returns null.
|
|
466
|
+
|
|
467
|
+
Form `spinner` accepts the name of a FormSpinner owned by that Form, or an inline
|
|
468
|
+
FormSpinner definition. Inline definitions can be named for later commands.
|
|
469
|
+
An absent setting keeps the default waiting indicator. FormSpinner `status`
|
|
470
|
+
is application-provided loading text; `variant` is `border` (default) or
|
|
471
|
+
`rotate`. `changeCaption` updates status text. It returns null and is hidden
|
|
472
|
+
until its Form sends an ordinary request. Ping and longpoll reads do not show it.
|
|
473
|
+
|
|
474
|
+
The spinner mounts as an overlay of its own Form, with the existing blur and
|
|
475
|
+
`aria-busy` behavior. It hides on success and failure; a replacement view can
|
|
476
|
+
supply a new spinner. Malformed spinner configuration preserves the previous
|
|
477
|
+
view and spinner. A Form cannot use another Form's spinner, so sibling Forms
|
|
478
|
+
retain independent waiting indicators. Removed controls and overlays are
|
|
479
|
+
released with the Form.
|
|
480
|
+
|
|
481
|
+
## Date, File, OTP and numeric formats
|
|
482
|
+
|
|
483
|
+
Input `variant: "Date"` returns a calendar range map:
|
|
484
|
+
`{ start: "2024-02-29", end: "2024-03-01" }`. Empty endpoints are null. `value:
|
|
485
|
+
null` clears both. A start without an end represents a partial range. Dates are
|
|
486
|
+
validated as real `YYYY-MM-DD` calendar dates without a time-zone conversion;
|
|
487
|
+
end cannot precede start. Invalid programmatic values preserve the previous
|
|
488
|
+
range. `min`/`max` use the same calendar format.
|
|
489
|
+
|
|
490
|
+
The [Flatpickr](https://flatpickr.js.org/options/) range picker supports
|
|
491
|
+
`multiMonth` (1–12, default 1), `firstWeekDay` (0–6, default Monday), `inline` and
|
|
492
|
+
button-like styling via `button`. `format` may be a Flatpickr display-format
|
|
493
|
+
string or a map with `display`, `locale` and optional `calendar` locale overrides.
|
|
494
|
+
Calendar month/day names come from Intl in the selected locale; application
|
|
495
|
+
strings such as month/year labels can be supplied through `calendar`.
|
|
496
|
+
Display formatting never changes the wire dates. Readonly/disabled blocks both
|
|
497
|
+
the input and calendar. Disposal destroys the picker and its event listeners.
|
|
498
|
+
|
|
499
|
+
Input `variant: "OTP"` keeps a string value, including leading zeroes.
|
|
500
|
+
`characters` is `numeric` (default), `alpha` or `alphanumeric`, using ASCII digits
|
|
501
|
+
and letters; case is preserved. `length` is 1–64, default 6. User input filters
|
|
502
|
+
unsupported characters before applying the logical length limit, so pasted
|
|
503
|
+
separators do not truncate a valid final digit. Programmatic invalid values are
|
|
504
|
+
rejected before mutation. Partial codes are allowed for application validation.
|
|
505
|
+
Unless autocomplete is disabled, the input uses `one-time-code`.
|
|
506
|
+
|
|
507
|
+
Input `variant: "File"` selects one local file and returns either null or:
|
|
787
508
|
|
|
788
|
-
```
|
|
789
|
-
|
|
790
|
-
cd my-app
|
|
791
|
-
npm install
|
|
792
|
-
npm test
|
|
793
|
-
npm run build
|
|
794
|
-
npm start
|
|
509
|
+
```json
|
|
510
|
+
{ "name": "bytes.bin", "mimeType": "application/octet-stream", "size": 6, "content": "AAECA//+" }
|
|
795
511
|
```
|
|
796
512
|
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
(default 30000 ms). The same limits apply at the browser-facing proxy and its
|
|
819
|
-
worker API. Oversized uploads receive 413 `RequestTooLarge`; an unfinished body
|
|
820
|
-
receives 408 `RequestTimeout`. Rejected/disconnected uploads do not reach a
|
|
821
|
-
handler, and rejection closes the upload connection after sending its response.
|
|
822
|
-
Limits count bytes and preserve UTF-8 characters split between network chunks.
|
|
823
|
-
The deadline covers body reception after headers; header limits remain Node's
|
|
824
|
-
HTTP server policy. The worker API exposes `/health` and `/ready` on its separate
|
|
825
|
-
loopback port; BrowserHost does not expose those paths on the browser port.
|
|
826
|
-
|
|
827
|
-
BrowserHost also accepts `rateLimit` (requests per IP per fixed window, default
|
|
828
|
-
0/disabled), `rateWindowMs` (60000) and `rateMaxClients` (10000). These apply to
|
|
829
|
-
proxied POST requests before buffering, using the actual frontend socket address;
|
|
830
|
-
forwarded headers cannot change identity. Its private loopback API keeps the
|
|
831
|
-
general limiter disabled so users are not combined into one proxy-IP quota.
|
|
832
|
-
The API's separate telemetry quota still applies. Rejections return
|
|
833
|
-
429/Retry-After and close the connection. Counts are bounded, process-local and
|
|
834
|
-
reset on restart; a distributed ingress policy remains separate.
|
|
835
|
-
|
|
836
|
-
## Labels, errors and keyboard focus
|
|
837
|
-
|
|
838
|
-
Built-in Text, Select and Checkbox controls with a `label` render a visible,
|
|
839
|
-
implicitly associated HTML label as well as their accessible name. Inline errors
|
|
840
|
-
are visible text connected through `aria-describedby`; required fields expose
|
|
841
|
-
`aria-required`. Hiding or replacing a control includes its label and error text,
|
|
842
|
-
and structural rollback restores the complete wrapper.
|
|
843
|
-
|
|
844
|
-
`control.element` remains the native input/select for value access and focus.
|
|
845
|
-
`control.node` is its structural DOM root (the label wrapper for labeled fields,
|
|
846
|
-
otherwise the element itself). Custom renderers should replace/remove/capture
|
|
847
|
-
node and focus element. Native input classes/styles remain on element; style
|
|
848
|
-
`.lango-field`, `.lango-caption` and `.lango-field-error` for the surrounding UI.
|
|
849
|
-
Label content uses textContent, including when supplied text contains markup.
|
|
850
|
-
|
|
851
|
-
A queued request temporarily makes its form inert. When work finishes, the
|
|
852
|
-
previous focus is restored if the element is still attached and enabled and the
|
|
853
|
-
user has not focused something elsewhere. Removed/disabled/hidden targets are
|
|
854
|
-
not focused. Server field errors and client validation then focus/report the
|
|
855
|
-
invalid input using the existing native validity behavior.
|
|
856
|
-
|
|
857
|
-
## Chromium and accessibility checks
|
|
858
|
-
|
|
859
|
-
Browser checks are Lango programs using Playwright and axe. They are separate
|
|
860
|
-
from `npm test`, so ordinary tests do not require a browser download:
|
|
513
|
+
`content` is base64; `size` counts the original bytes. Empty browser MIME types
|
|
514
|
+
use `application/octet-stream`. `maxBytes` defaults to 1 MiB (1048576 bytes) and
|
|
515
|
+
must be a positive safe integer. `accept` supplies the native file-chooser hint;
|
|
516
|
+
applications remain responsible for server-side validation. Oversized files
|
|
517
|
+
prevent sending. A form waits for pending file reads before collecting values,
|
|
518
|
+
including nested/inherited asynchronous fields. Changing/clearing/disposal
|
|
519
|
+
invalidates old reads and cancels their reader. Only null may be assigned through
|
|
520
|
+
`values`, clearing the selection; the browser never accepts a server-supplied
|
|
521
|
+
local file. Optional `url` is debounced after successful reading.
|
|
522
|
+
|
|
523
|
+
Base64 increases request size. Lango Server now defaults to a 2 MiB `bodyLimit`
|
|
524
|
+
(2097152 bytes), sufficient for one 1 MiB file encoded in JSON with ordinary form
|
|
525
|
+
metadata. Older server releases still default to 1 MiB and need an explicit
|
|
526
|
+
`bodyLimit: 2097152`. Larger combined form payloads require a higher server limit.
|
|
527
|
+
Large-file streaming and a separate upload protocol remain outside this
|
|
528
|
+
implementation.
|
|
529
|
+
|
|
530
|
+
For Number/Decimal/Money, supplying `format` enables a formatted text input.
|
|
531
|
+
The map contains optional `locale` plus Intl.NumberFormat options; Money with
|
|
532
|
+
an explicit `currency` defaults to currency style. The client never guesses a
|
|
533
|
+
currency. For example:
|
|
861
534
|
|
|
862
|
-
```
|
|
863
|
-
|
|
864
|
-
npm run browser:install
|
|
865
|
-
npm run build
|
|
866
|
-
npm run build:demo-server
|
|
867
|
-
npm run test:browser
|
|
535
|
+
```json
|
|
536
|
+
{ "locale": "tr-TR", "currency": "TRY", "maximumFractionDigits": 4 }
|
|
868
537
|
```
|
|
869
538
|
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
form
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
`
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
ordinary client suite includes generator overwrite/.git/version-pin checks.
|
|
927
|
-
The smoke also checks anonymous category-only telemetry through the proxy.
|
|
928
|
-
For the frontend quota variant, set the fixture's BrowserHost `rateLimit` to 6,
|
|
929
|
-
rebuild it, and append `--rate-limit` to the smoke command; the next POST must
|
|
930
|
-
return 429/Retry-After after the six expected POST attempts.
|
|
539
|
+
While focused, the field shows its ungrouped raw value. Outside focus it shows
|
|
540
|
+
the formatted value. Decimal/Money return dot-separated decimal text (empty is
|
|
541
|
+
an empty string); Number returns a JavaScript number or null. The editing locale's
|
|
542
|
+
decimal separator is accepted and normalized. Grouping/currency symbols are not
|
|
543
|
+
accepted as editable source text. Display rounding never changes the raw value.
|
|
544
|
+
Intl receives decimal strings directly, preserving large exact inputs rather
|
|
545
|
+
than first converting them to a JavaScript Number. Scientific decimal text is
|
|
546
|
+
accepted within Intl's formatting range. Programmatic invalid values preserve
|
|
547
|
+
the old value. No format map retains the original input behavior.
|
|
548
|
+
|
|
549
|
+
New input variants honor existing `url` debounce and programmatic-no-event
|
|
550
|
+
rules. Plain synchronous forms keep their original send path. Custom controls
|
|
551
|
+
may implement `prepareValue()` returning a Promise when value collection must
|
|
552
|
+
wait for asynchronous preparation.
|
|
553
|
+
|
|
554
|
+
## Custom controls
|
|
555
|
+
|
|
556
|
+
The package exports `App`, `Form`, `BootstrapRenderer`, `Control`, `Value`, `Button`,
|
|
557
|
+
`Field`, `Input`, `Checkbox`, `Switch`, `Range`, `Select`, `Radio`,
|
|
558
|
+
`ComboBox`, `Chip`, `Avatar`, `FormSpinner`, `DateInput`, `FileInput`,
|
|
559
|
+
`OTPInput`, `NumericInput`,
|
|
560
|
+
`Alert`, `Progress`, `Toast`, `ToastStack`, `Dialog`, `Menu`, `MenuItem`,
|
|
561
|
+
`ListGroup`, `Accordion`, `AccordionItem`, `InputGroup`, `Markdown`,
|
|
562
|
+
the card/table/tab/navigation
|
|
563
|
+
classes described above, `createTemplate`, and `cloneTemplate`. The browser entry module exports
|
|
564
|
+
`start()` and uses the current origin, Web platform, and Bootstrap renderer.
|
|
565
|
+
|
|
566
|
+
`renderer.registerControlType(type, factory)` registers a factory called with
|
|
567
|
+
`(form, props)`. It returns a control with `element`, `getValue()`,
|
|
568
|
+
`setValue(value)`, and `dispose()`. Commands affecting that control may also
|
|
569
|
+
require `setDisabled(value)` or `setCaption(value)`. Validation-aware controls
|
|
570
|
+
provide `setInvalid(message)` and `clearValidation()`; the exported `Control`
|
|
571
|
+
base supplies both and supports selecting an inner validation target. It also
|
|
572
|
+
records the owning `form` so positioned presentations follow its lifetime.
|
|
573
|
+
Factories must release
|
|
574
|
+
their event listeners and other resources in `dispose()`.
|
|
575
|
+
|
|
576
|
+
Built-in DOM templates are cloned for each control. Literal text uses
|
|
577
|
+
`textContent` or text nodes, rich slots build control definitions, and field
|
|
578
|
+
values use DOM properties. Markdown uses its separate sanitization path.
|
|
579
|
+
|
|
580
|
+
## Integration still required
|
|
581
|
+
|
|
582
|
+
- Template metadata is now supplied by Lango UI: `templates` contains reserved
|
|
583
|
+
scope URLs and `defaultTemplate` optionally names the reserved default layout
|
|
584
|
+
endpoint. Templates contain a named `__content__` Form. Scope matching uses
|
|
585
|
+
segment boundaries and the longest matching prefix; the default handles
|
|
586
|
+
unmatched pages. Template addresses themselves are not page URLs.
|
|
587
|
+
- The lifecycle implementation requires the updated Lango UI batch Ping and
|
|
588
|
+
Lango Server token-refresh support. Publish/deploy the server first, then UI,
|
|
589
|
+
and rebuild the client. Optional absent lifecycle channels remain disabled.
|
|
590
|
+
- Remaining work includes other pending controls and advanced field presentation. Unexpected send/navigation
|
|
591
|
+
errors use a technical Toast; application messages remain application-owned.
|
|
592
|
+
- Query/hash history policy and additional platforms remain open. The delivery
|
|
593
|
+
generator currently targets same-origin Web/Bootstrap; deep-link static hosting
|
|
594
|
+
and a packed generated-application browser test are implemented.
|