Language
State & logic
Accent
Scheme
Backdrop motion
Language

State & logic

A page is state, what is worked out from it, and the actions that change it. Everything on this page is that and nothing more: change a value and whatever reads it is drawn again.

Values that change

state holds a value, derive works one out, an action writes, a fn only computes.
stateA value the page shows. With persist it is kept in localStorage and is still there after a reload.
countforgotten on reload
0
keptstate kept = 0 persist
0
Press + on both, reload the page: count is 0 again, kept is not.
deriveWorked out from state, and again whenever that state changes. It cannot be assigned.
price12
qty3
36derive total
64 more for free delivery
actionThe only place state is written. Named as a handler it takes what the event hands it; a call passes more; a block is an action written in place.
input change=renameleave the field, or press Enter
input type=checkbox change=setLoud
state
score = 0 · nick = "Ada" · loud = false last call: nothing yet
fnPure: it takes values and gives one back. Writing state in a fn is refused by the compiler.
initials(who)
GBH
clamp(raw, 0, 100)raw = 140
100
A fn's parameters need types; what it returns is inferred, or said after the bracket.

Types

Inferred everywhere except parameters, shape fields, and an empty or none first value.
shapeTypes are structural: a literal fits a shape when its fields do. A misspelt or missing field is named at compile time.
Mercurymercury0 moons
Earthearth1 moons
Marsmars2 moons
Jupiterjupiter95 moons
4 of type Planet[]
{x: number, y: number}a record type with no name
(3, 4) is 5.00 from 0, 0
T?The one "or": a value or none. find(), pop(), shift() and at() give T?, and it must be settled before a dot or arithmetic.
wantedone of them is not a planet
hit?.name ?? "nobody"Mars(hit?.moons ?? 0) + 13hit == nonefalseif hit … else …
Mars has 2 moons

Lists and records

State is assigned, or changed in place. Either way the page follows.
A list, changed in placepush, pop, shift, unshift, splice, sort, reverse, fill and remove(x) write the list itself. Only an action or a {…} handler may.
5281
length 4sum 16nums[0] 5pop() / shift() gave none
A record: a field write, and spreadt.done = true changes it where it is. {...o, k} makes a new one; a bare name is a field of that name.
Glue the frame
shop
{"id":"j1","title":"Glue the frame","done":false,"tag":"shop"}
ExpressionsTemplates, lambdas, c ? a : b, list spread, and == that is always strict.
first
age36
`${first} is ${age}`Ada is 36age >= 18 ? … : …an adult[first, ...others]Ada, Grace, Edsger[1, 2, 3].map(n => n * age)36, 72, 108

Logic

The same words in an action, a fn and in markup.
matchArms are values, several to an arm, or else. In logic an arm is a statement; in markup, what to show.
grade(n)n = 2
few
OneTwoThree
if, for, while, break, continueAn action that sieves primes with all of them; the markup has its own if / else if / else and for.
up to30
Nothing yet: press Sieve.
let in markupA derived value for the nodes after it. if p then narrows it.
Earth1 moons
Writing into what a derive foundA derive that finds a record still is that record: an input bound to its field writes the state.
notes
[ ] Order hinges [x] Sand the doors [ ] Call the painter
Bindingsvalue= and checked= write back when the value is state or reaches into it. Anything computed is one-way.
input value=draft
value=draft.toUpperCase()one-way: typing here writes nothing
checked=agree
type=range value=level
state
draft = "hello" · agree = false · level = 40
FailuresA call that can fail is met at once: ? passes it on (the action stops and failure(action) has the words), else gives a fallback.
bill90
people3: try 0
split: press Split splitSafe: safe = 0
task, every, afterAmong markup they start when that part is built and stop when it is removed. Here every lives under an if.
0.0 s
The task above this card's markup has run 1 time since the page was built.
uid(), now(), log()An id nothing else has, the time in milliseconds, and a line in the browser's console.
uid()
Press the button.
A lone word as a bool prop; a derive with a typeA component's bool prop may be written as the word alone, as HTML's own attributes are (input autofocus). A derive may say its type, where what it reads does not settle one (json).
plainloudroundboth
derive picked: json = JSON.parse(raw)
picked.n is 3, picked.tags is ["oak","ash"]

All of it

A todo listA shape, a persisted list, two derives, six actions, bindings into the rows, match for the empty states.
learn
build
build
2 left of 3Kept with persist: reload and it is still here.
esc
Pages
StartStart
Buttons & badgesComponents
Cards & disclosureComponents
Dialogs & drawersComponents
Menus & commandsComponents
Dates & tablesComponents
ChartsComponents
Chart galleryComponents
FieldsComponents
ChoicesComponents
DisplayComponents
NavigationComponents
Popovers & sheetsComponents
MessagesChat & AI
Prompt inputChat & AI
Reasoning & toolsChat & AI
Developer partsChat & AI
ConversationChat & AI
Code artifactsChat & AI
VoiceChat & AI
Code blocksChat & AI
MarkdownChat & AI
EditorElements
TerminalElements
FlowElements
3D boxesElements
PaintElements
SurfaceElements
MediaElements
IconsElements
PrimitivesElements
SQLBatteries
StorageBatteries
Net & resourcesBatteries
Crypto & bytesBatteries
ZipBatteries
TablesBatteries
PDFBatteries
TimeBatteries
ImagesBatteries
ScanBatteries
Video & audioBatteries
SearchBatteries
SyntaxBatteries
PatternsBatteries
NotifyBatteries
ShareBatteries
State & logicLanguage
WorkersLanguage
Events & elementsLanguage
StylingLanguage
RoutesLanguage
ShortcutsLanguage
Long listsLanguage
Failures & tryLanguage
Back endBack end
Models & writesBack end
Rules & failuresBack end
Jobs & schedulesBack end
Running itBack end
ExtensionsBack end
AIBack end
AnalyticsBack end
AboutAbout
↑↓move
↵open
676 places · ranked by BM25