AtlatestRepositorysigil-web-client
1# sigil-web-client
2
3Client-side WASM UI framework for [Sigil](https://codeberg.org/sigil/sigil). A react-like rendering layer for browser applications compiled to WebAssembly: it renders Sigil SXML into the browser DOM and keeps application code independent of the underlying WASM DOM bridge.
4
5`(sigil web client)` is the browser-side counterpart to the server-side [sigil-web](https://codeberg.org/sigil/sigil-web) framework. The two are orthogonal: this library imports only `sigil-wasm-dom` and shares no code with the server-side modules.
6
7## Usage
8
9```scheme
10(import (sigil web client))
12;; Look up a DOM root by selector
13(define root (web-client-root "#app"))
15;; Mount a view: SXML, or a nullary procedure returning SXML
16(web-client-mount root (lambda () `(div "Hello, world!")))
18;; Update the mounted view in place
19(web-client-update root (lambda () `(div "Updated!")))
21;; Clear a root
22(web-client-clear root)
23```
25### Exports
27- `web-client-root` — look up a DOM root node by selector
28- `web-client-root?` — validate a root node handle
29- `web-client-render` — render a view (an SXML value, or a nullary procedure returning one)
30- `web-client-mount` — mount a view into a root
31- `web-client-update` — update a mounted view in place
32- `web-client-clear` — clear a root
33- `web-client-reset!` — reset retained client state
35## Building
37This is a browser/WASM library. Build it into a web application with the `web` config:
39```sh
40sigil deps install
41sigil build --config web
42```
44## License
46BSD-3-Clause