Examples
Small examples of the published packages, each showing one thing, with its whole code. Most of the browser examples run on this site; the others run on your machine, and their guide gives the steps.
95 examples.
@awacloud/fw
Filter a list with dom and events
Live-filter a list as the user types: the smallest real fw page, with dom and events.
Apache-2.0Runs on this page
Two ways to register modules
Register the whole module registry or only what the page uses, then look modules up.
Apache-2.0Runs on this page
A sign-up form with accessible validation
A sign-up form with schema validation, errors announced and linked, focus on the first one.
Apache-2.0Runs on this page
Render cards from data through a template
Render cards from data through an HTML template; untrusted text stays inert, user HTML is sanitised.
Apache-2.0Runs on this page
A todo list with uiSession and a keyed list
A todo list whose keyed rows update in place: unchanged rows keep their DOM nodes.
Apache-2.0Runs on this page
A reusable counter component
A reusable counter component: two instances, reactive state, CSS scoped to the component.
Apache-2.0Runs on this page
Signals, an event bus and validation
Hold a field in a signal, validate it with a schema, broadcast its changes on an event bus.
Apache-2.0Runs on this page
Hash routes with keyboard shortcuts
Hash routes with a parameter, a keyboard shortcut per view, and the new view announced.
Apache-2.0Runs on this page
Save a note and keep its versions
Save a note in localStorage, keep its versions in IndexedDB, and report a refused write.
Apache-2.0Runs on this page
Fetch JSON, talk to other tabs, watch the connection
Fetch JSON with typed HTTP errors, message the other tabs, and show online or offline.
Apache-2.0Runs on this page
Call a JSON API with auth, timeouts and retries
POST JSON with a bearer token and a timeout, retry when the server is busy, and show its errors.
Apache-2.0Runs on this page
Follow live updates from the server
Stream server events into the page, reconnect after a drop, and resume without missing one.
Apache-2.0Runs on this page
Pick or drop files
Accept files from a picker or a drop zone through one callback, with a size limit.
Apache-2.0Runs on this page
Base64 and UTF-8 codecs
Show a text's UTF-8 bytes as Base64 and hex, and decode pasted Base64, refusing bad input.
Apache-2.0Runs on this page
Read and rebuild a URL
Split a URL into its parts, change one query parameter, rebuild it, and refuse a non-URL.
Apache-2.0Runs on this page
One record, four encodings
Encode one record as CBOR, MessagePack, CSV and XML, compare sizes with JSON, decode it back.
Apache-2.0Runs on this page
Write and read a binary header
Write a binary header with a CRC-32, read it back, and show the bytes as a hex dump.
Apache-2.0Runs on this page
Compress text with gzip and deflate
Compress text with gzip and deflate, compare the sizes, and check the round trip.
Apache-2.0Runs on this page
Build and read zip archives
Build a zip in the browser, and list the entries of a .zip the user picks.
Apache-2.0Runs on this page
Translate and pluralise with i18n
Translate a page into two locales: parameters, plurals, numbers, currency and dates.
Apache-2.0Runs on this page
Slugs, versions, entities and graphemes
Slugify a title, compare semantic versions, escape HTML entities, and count graphemes.
Apache-2.0Runs on this page
Dates, a monotonic clock, a scheduler and a throttle
Format dates, measure elapsed time, compute the next cron run, and throttle a button.
Apache-2.0Runs on this page
Describe a list of numbers
Describe a list of numbers: mean, median, standard deviation, histogram, interpolation.
Apache-2.0Runs on this page
LRU cache, priority queue and trie
An LRU cache, a priority queue and a trie, each working on live input.
Apache-2.0Runs on this page
Limit, rate-limit and cancel async jobs
Run async jobs with a concurrency limit and a rate limit, and cancel the rest.
Apache-2.0Runs on this page
Light and dark design tokens
Light and dark design tokens scoped to one panel, with a follow-the-system mode.
Apache-2.0Runs on this page
Chart a series, with its table
A line chart on canvas with round axes, plus the summary and table that make it accessible.
Apache-2.0Runs on this page
Ten thousand rows with a virtual scroller
Scroll ten thousand rows smoothly: only the visible window exists in the DOM.
Apache-2.0Runs on this page
Animate a panel and toggle fullscreen
Animate a panel with easing, and offer fullscreen, disabled with a reason where unsupported.
Apache-2.0Runs on this page
Drag cards between two lists
Drag cards between two lists with mouse, pen or touch, with a button for keyboard users.
Apache-2.0Runs on this page
Swipe and double-tap a card
Swipe and double-tap a card with mouse, pen or touch; buttons and keys do the same.
Apache-2.0Runs on this page
Copy and paste text
Copy a snippet and paste from the clipboard, with a clear message when the browser says no.
Apache-2.0Runs on this page
Is the user here? Visibility and idleness
Know when the tab is hidden and when the user goes idle.
Apache-2.0Runs on this page
Keep the screen awake
Keep the screen awake while the page needs it, and release it with the same button.
Apache-2.0Runs on this page
Send a reminder as a notification
Ask for permission on a click and send a reminder as a notification, or show it in the page.
Apache-2.0Opens in a new tab
Register and sign in with a passkey
Register and sign in with a passkey: the browser half of WebAuthn, its payloads shown.
Apache-2.0Runs locally
A page that works offline
Make a page work offline with a module service worker and a versioned precache.
Apache-2.0Opens in a new tab
The native WebCrypto tier
Hash, encrypt and sign with the browser's native WebCrypto through fw's async wrappers.
Apache-2.0Runs on this page
Three hashes of the same text
Hash text with SHA-256, SHA3-256 and BLAKE2b in pure JavaScript, live as you type.
Apache-2.0Runs on this page
An HMAC tag and an HKDF key
Authenticate a message with HMAC, check a tag in constant time, derive a key with HKDF.
Apache-2.0Runs on this page
Hash a password with Argon2id or PBKDF2
Store passwords safely: Argon2id or PBKDF2, the parameters kept with the hash, and verify.
Apache-2.0Runs on this page
Authenticated encryption with ChaCha20-Poly1305 and AES-GCM
Encrypt with ChaCha20-Poly1305 and AES-GCM; a tampered message or a wrong key is rejected.
Apache-2.0Runs on this page
Sign with Ed25519, agree on a secret with X25519
Sign and verify with Ed25519, and agree on a shared secret with X25519.
Apache-2.0Runs on this page
Sign with RSA and share the key as PEM
Sign with RSA-PSS in the browser and verify from the public key shared as PEM.
Apache-2.0Runs on this page
Move keys between JWK, PKCS#8 and SPKI
Export an Ed25519 key as PKCS#8, SPKI and JWK, re-import it anywhere, and check it still verifies.
Apache-2.0Runs on this page
JWS tokens, PEM blocks, TOTP codes and UUIDs
Sign a JWT, read a PEM block, compute a TOTP code and mint a UUID.
Apache-2.0Runs on this page
Set up two-factor codes (TOTP)
Enrol a user in two-factor codes: a base32 secret, an otpauth URI, codes checked with a time window.
Apache-2.0Runs on this page
Post-quantum key exchange and signatures
Post-quantum key exchange and signatures (ML-KEM, ML-DSA, hybrids), every size shown.
Apache-2.0Runs on this page
Hash in a worker pool, inline when there is none
Hash a batch in a worker pool with a progress bar, inline when workers are unavailable.
Apache-2.0Runs on this page
A worker that calls back into the page
A worker that calls back into the page to report its progress, through an RPC port.
Apache-2.0Runs on this page
A typed runtime for editors and type-checkers
Let your editor type-check module lookups: a runtime typed by module name.
Apache-2.0Runs on this page
Bundle an fw app into one file
Bundle an app and only the fw modules it uses into one minified file that needs no import map.
Apache-2.0Command line
Harden the realm before the app runs
Harden every production page: block eval and other injection sinks before any app code.
Apache-2.0Runs on this page
@awacloud/fw-wasm-crypto
Pick a WASM variant, validate provenance, load a module
Pick the SIMD or scalar WASM build for the engine, and check its provenance before loading it.
Apache-2.0Node
@awacloud/tool-fw-bundler
One self-contained ESM file for one fw module
Ship one fw module as a single self-contained ES module file, no import map needed.
Apache-2.0Command line
Your own fw build: only the modules your app uses
Build one minified fw file that holds only the modules your app uses.
Apache-2.0Command line
@awacloud/tool-fw-codegen
Generate the typed registry of an fw-shaped package
Generate the typed module registry of your fw package, and fail the check when it drifts.
Apache-2.0Command line
@awacloud/tool-wasm-crypto
Copy .wasm artifacts and gate them with a hash manifest
Pin .wasm artifacts with a SHA-256 manifest, and fail the check when one byte changes.
Apache-2.0Command line
@awacloud/pdf
Build a PDF and read it back
Build a one-page PDF in the browser, read it back, and download it.
AGPL-3.0-onlyRuns on this page
Change a PDF without rewriting it
Change a PDF's title by appending to it: the original bytes stay untouched.
AGPL-3.0-onlyRuns on this page
Password-protect a PDF with AES-256
Password-protect a PDF with AES-256, and open it again with the right password.
AGPL-3.0-onlyRuns on this page
Merge pages from two PDFs
Join two PDFs into one, choosing which pages of the second come and in what order.
AGPL-3.0-onlyRuns on this page
Fill a PDF form
Fill the fields of a PDF form in the browser, read them back, and download it.
AGPL-3.0-onlyRuns on this page
@awacloud/oconv
One Markdown source to .docx, .odt and .pdf
Turn one Markdown text into .docx, .odt and .pdf, with what each format lost listed.
AGPL-3.0-onlyRuns on this page
Convert .docx to .odt and .pdf, then back to Markdown
Convert a .docx to .odt and .pdf, then back to Markdown to see what survived.
AGPL-3.0-onlyNode
Read the text of a PDF
Pull the text out of a PDF the user picks, page by page, in the browser; nothing is uploaded.
AGPL-3.0-onlyRuns on this page
Convert in a Web Worker
Convert documents to and from Markdown in oconv's worker, off the page's thread.
AGPL-3.0-onlyRuns on this page
@awacloud/tool-convert
Convert every office file of a directory to Markdown
Convert every office file of a folder to Markdown; a corrupt file is reported, not fatal.
AGPL-3.0-onlyNode
@awacloud/md
Markdown live preview
Render Markdown to safe HTML as the user types; scripts and event handlers do not survive.
AGPL-3.0-onlyRuns on this page
A table of contents from the Markdown AST
Build a nested table of contents with GitHub-style ids from a Markdown file.
AGPL-3.0-onlyNode
@awacloud/ooxml
Write a .docx with the typed model, read it back
Write a Word document with formatting and a table, download it, and read it back.
AGPL-3.0-onlyRuns on this page
Write a workbook, read the cells back
Write an Excel workbook from rows and read its cells back; a broken file gives a typed error.
AGPL-3.0-onlyRuns on this page
Import a spreadsheet the user picks
Import an .xlsx the user picks: its sheets, typed cells and formulas, and a typed error if broken.
AGPL-3.0-onlyRuns on this page
An outline to a .pptx deck
Turn a plain-text outline into a PowerPoint deck, then read every slide back.
AGPL-3.0-onlyRuns on this page
@awacloud/odf
Write an .odt with typed runs and metadata, read it back
Write an OpenDocument text with formatting and metadata, download it, and read it back.
AGPL-3.0-onlyRuns on this page
Write an .ods from arrays, read the cells back
Write an OpenDocument spreadsheet from arrays, and read its typed cells back.
AGPL-3.0-onlyRuns on this page
@awacloud/fonts
Inspect a font file and draw one glyph
Open a .ttf or .otf: names, metrics and the outline of any character, without uploading it.
AGPL-3.0-onlyRuns on this page
Subset a font to the glyphs of a string, for PDF embedding
Shrink a font to the glyphs one text needs before embedding it in a PDF.
AGPL-3.0-onlyNode
@awacloud/oconv-fonts
Markdown to PDF with real faces instead of Standard 14
Make Markdown-to-PDF embed real fonts, so every script, Cyrillic included, renders.
AGPL-3.0-onlyNode
@awacloud/graphic-anim
An analog clock on the real time
A three-hand analog clock built from a scene template, its hands tweened at the true clock rate.
Apache-2.0Runs on this page
Tween, sequence and stagger SVG shapes
Tween a shape's position and colour, sequence three tweens, stagger five dots from one timeline.
Apache-2.0Runs on this page
Flip through a frame sequence
Play, pause and scrub eight polygon frames with graphic.frames: one is shown at a time.
Apache-2.0Runs on this page
A radial tree that refocuses on click
A 25-node radial tree: click a node to recentre it and fan its subtree over the circle.
Apache-2.0Runs on this page
A rail shooter in SVG
A one-minute rail shooter in SVG with an autopilot, key and drag steering, and pooled sprites.
Apache-2.0Runs on this page
A neon boot sequence in SVG
An 11-second SVG boot sequence in five acts on one timeline: scrub it, slow it, read each act.
Apache-2.0Runs on this page
A page-turning book
A six-page book with a page-curl turn: Previous and Next buttons, or drag the page corners.
Apache-2.0Runs on this page
A traffic light from a JSON scene
Build an SVG scene from a JSON spec and fire its named events from clicks on the lamps.
Apache-2.0Runs on this page
A 3D terrain in plain SVG
A software-3D heightmap terrain in SVG with an orbiting camera; drag to look around.
Apache-2.0Runs on this page
A 27-tween scene choreography
Choreograph 27 tweens on one timeline to assemble an illustrated desk, with a live clock.
Apache-2.0Runs on this page
Recipes
A routed contact form with accessible validation
A routed contact form with accessible validation and a confirmation page; nothing is sent.
Apache-2.0Runs on this page
Notes encrypted at rest with a passphrase
Keep notes encrypted in the browser with a passphrase; a wrong one fails cleanly.
Apache-2.0Runs on this page
Pick files, check them, download them as one zip
Let users pick files, check them, and download them as one zip.
Apache-2.0Runs on this page
Sign a PDF with PAdES in the browser (B-B)
Sign a PDF with a PAdES signature in the browser, verify it, and download it.
AGPL-3.0-onlyRuns on this page
Convert a .docx to Markdown in the browser
Convert a .docx to Markdown in the browser, with what was lost listed; nothing is uploaded.
AGPL-3.0-onlyRuns on this page
Markdown to one self-contained HTML page
Turn Markdown files into one self-contained, sanitised HTML page, previewed safely.
AGPL-3.0-onlyRuns on this page