NUCLO / 12

Language

Practical examples. Live demos.

Pick an example to open it full screen, with the live preview and its source side by side.

API

13

One small demo per building block, the same ones the docs embed.

09

Tag Builders

A builder takes attributes, static children and dynamic text. Rename changes the state, then calls update().

API
10

Components

A component is a plain function. Each Counter() call keeps its own count.

API
11

Attributes

Attribute values can be functions. The second button flips busy and calls update(); Save's disabled and aria-busy follow.

API
12

Events

onInput and onKeyDown are plain attributes. Type, then press Escape to clear.

API
13

Lifecycle

onMount starts an interval and returns its cleanup. Unmount runs the cleanup, so the count pauses until the timer mounts again.

API
14

Explicit Updates

count++ only changes the variable. The text catches up on the next update(), from the button or anything else on this page.

API
15

Dynamic Values

Edit the name. The static text was fixed when the element was built; the dynamic one runs again on every update(). forceUpdate() rebuilds the tree, so the static text catches up too.

API
16

update()

Every update() runs every dynamic value, even when its data did not change. Other demos on this page push the count up too.

API
17

scope()

Both buttons add an item and rename the user. update('cart') refreshes only the scoped panel.

API
18

when()

The first true condition wins; otherwise .else() renders. A new branch is built from scratch.

API
19

list()

Rows are matched by identity. Check a row, then Reverse: the same <li> moves, checkbox and all.

API
20

region() & into()

A layout with a stacked main region and a side region, filled from outside it. Type into Home, open the dialog and close it: the text stays. Article fills both regions with one into().

API
21

forceUpdate()

update() refreshes only the dynamic lang line. forceUpdate() calls App again and patches the same <h1>. The explicit form rebuilds only this tree, not the whole page.

API

SVG

27

Charts, animations, tools and games from the SVG tag builders, driven by plain data, pointer events and update().

28

Bar Chart

Rects from an array. Their y and height are functions of the data, so update() moves the bars.

SVG
29

Line Chart

A path whose d is built from the points, with a gradient area and one circle per point.

SVG
30

Donut Chart

One circle per slice. stroke-dasharray gives each its share of the ring and stroke-dashoffset its start.

SVG
31

SVG Animation

SMIL as builders: animateSvg pulses the sun, animateTransformSvg orbits the planet. A dynamic dur sets the speed.

SVG
32

Gauge

An arc that fills with stroke-dashoffset and a needle that turns with a CSS transform. Both are functions of one number.

SVG
33

Radar Chart

Five values on five axes. The shape is one path whose d is computed from the data, so update() morphs it.

SVG
34

Heatmap

A grid of rects whose fill-opacity follows a level. Click a cell to bump it; a titleSvg child is its tooltip.

SVG
35

Hover Tooltip

Pointer events on SVG elements. onPointerEnter picks the active point and a tooltip group slides to it.

SVG
36

Curve Editor

Drag the handles of a cubic Bézier. onPointerDown picks a point, onPointerMove on the svg moves it and the path follows.

SVG
37

Clock

Hands are lines whose transform is a function of the time. onMount starts the ticking and returns the cleanup.

SVG
38

Icon Toggles

A menu icon that morphs into a cross with CSS transitions, and a heart that pops with a SMIL animation that begins on click.

SVG
39

Live Stream

Two series scroll left on a timer. A CSS transition as long as one tick makes the slide smooth, and hovering reads any sample.

SVG
40

Candlestick Chart

Forty slots read their own candle. Change the timeframe, toggle the average, hover for the numbers, or let the live candle tick.

SVG
41

Bar Chart Race

Ten bars never leave the DOM. Their rank sets a translateY, so a transition slides each one to its row as the values change.

SVG
42

Stacked Area Chart

Four bands morph between stacked, stream and percent layouts. Hiding a series only gives its band zero thickness, so every path keeps its shape.

SVG
43

Treemap

A squarified layout you drill into. Switching the metric slides every cell to its new box, and clicking a group swaps in its children.

SVG
44

Live Histogram

Samples pour in from four distributions. The bins re-count on every change, a fitted bell follows the mean, and a slider sets the bin count.

SVG
45

Drawing Pad

Pointer events draw polylines. list() renders one per stroke, and the stroke in progress grows on every update().

SVG
46

Rotary Knob

A custom slider: the pointer's angle sets the value, the arrow keys step it, and pathLength="100" turns the value into a dash.

SVG
47

Color Wheel

Pick a hue by angle and a saturation by distance. Ninety wedges, a radial gradient and a dark disc make the wheel.

SVG
48

Spirograph

A wheel rolls inside a ring and a pen traces it. Each frame lengthens one dash and updates only its scope().

SVG
49

Bouncing Balls

Gravity, walls and collisions in a requestAnimationFrame loop. Pull back and let go to launch a ball.

SVG
50

Gooey Blobs

A blur and a color matrix filter melt blobs together. A trail of circles follows the pointer.

SVG
51

Force Graph

Nodes repel, links pull, and the layout cools until it rests. Drag a node, or click one to grow a child.

SVG
52

Brush & Zoom

Brush a range on the overview to zoom the chart above. A clipPath that follows the brush colors the selection.

SVG
53

Tic-Tac-Toe

Play the computer. when() adds each mark, and a CSS animation on its dash draws it in.

SVG
54

Circular Text

Type a badge. textPath bends the text around a circle and textLength fits it to exactly one lap.

SVG

Apps

15

Bigger programs, full screen, with their real source behind tabs: a desktop with windows, a data grid, a chat, games, editors and libraries that own their own state.

61

Page Builder

Write directly on the page, drag grips to reorder blocks or move them into layouts, press / to insert, and right-click for actions. Style grid and flex layouts, undo edits, preview at phone size and export HTML.

Apps
62

Algorithm Stepper

The engine is plain JavaScript: generators that mutate an array and yield after every step. The player calls next() and update(); the bars are a list() over the same objects, so a swap moves two elements.

Apps
63

Kanban Board

A team board: add tasks, assign them to people, edit them in a dialog, filter by person or search, drag them between columns and undo a delete. Columns and cards are plain arrays of the same objects; every move is a splice(). Rows are matched by identity, so dragging, sorting, assigning or editing a card reuses its element. The mount count on screen proves it.

Apps
64

three.js Inspector

A library that owns its own state. The panel reads positions, colors and flags straight from the three.js objects and writes edits back to them. The render loop calls update() once per frame; nothing is mirrored.

Apps
65

Infinite Scroll

A feed with no end: a fast fake fetch() generates every page on the fly into one plain array. Only the rows near the viewport are in the DOM: the list() renders posts.slice(start, end) between two spacers, so the page stays light at a hundred thousand posts. A sentinel at the real end asks for the next page before it comes into view.

Apps
66

Desktop

A working desktop with Files, Notes, Terminal, Calculator, Timer, a Kanban board, Finance and a Calendar. Create and organize folders, edit notes, and use shell commands on one shared simulated disk saved in your browser. Type into the Calculator straight from the keyboard, click anywhere in the Terminal to focus its input line, drag cards between columns on the board, or keep a ledger in the Finance spreadsheet and watch its charts move — the ledger lives in IndexedDB. Windows keep their state as you move, resize and switch between apps; a running timer fills the taskbar tray with into().

Apps
67

Node Graph

Wire numbers, text and switches through math, comparisons and If nodes, and every value updates as you type. Functions are graphs too: their Input and Output nodes are the ports of every Call, and a Call can name its own function, so factorial and sum recurse with an If as the way out. The engine is plain JavaScript: each node is a generator that yields to ask for an input, and one loop drives them from its own stack, so sum(50000) nests fifty thousand calls deep in about a tenth of a second without touching the JavaScript call stack. Only a step budget stops a recursion with no way out. Dragging writes x and y and updates only the canvas scope; the run count shows the graph never runs for a move.

Apps
68

Data Grid

A work table over 10,000 plain row objects. Search, filter, sort and paging are plain functions over the array, and the table body is a list() over the current page. Rows are matched by identity, so sorting moves the rows that stay on the page, and an edited row is the same object everywhere. The rows-built count proves it.

Apps
69

Chat

A chat with three channels, each one plain object: its history, cursor, typing, draft and scroll position, so switching keeps every channel exactly as it was, and update("chat-sidebar") refreshes only the unread badges. History loads upward forever with unshift() and a scrollTop that grows by the height it added. Your message shows before the server has it, send() patches the same object, and Retry, Edit, Delete and reactions never rebuild its row. Messages render code, bold, links and @mentions.

Apps
70

Live Dashboard

Cards that refresh at different rates, from 20 times a second down to once a second. Each card is a scope(), and its timer calls update() with that card's id, so a tick evaluates only that card. Every dynamic value is counted on screen: switch to a plain update() and the clock is evaluated about a hundred times a second to change once.

Apps
71

Pixel Editor

The picture is one plain array of 1024 color strings, and each cell reads its color from it. A stroke writes into the array and calls update(); when it ends, the editor keeps a copy with slice(). Undo, redo and every step in the history list() put an older array back: no store, no immutable data.

Apps
72

Snake

A game loop is a timer that calls step() on plain objects, then update() once per tick. The snake is a list() of its cell objects, and each tick the tail object becomes the new head, so one element moves and none is built: the segments-built count only goes up when the snake eats. Food pops in with a keyframes() animation.

Apps
73

Step Sequencer

A library that owns its own clock. Web Audio books every note ahead on its own timeline, and the pattern is a plain 2D array of booleans that the grid flips and the scheduler reads, so a click is heard on the next pass. The playhead updates only its scope() when the audible step changes. Audio starts on the first Play and closes in the mount cleanup, so leaving the example stops the sound.

Apps
74

Locale Switcher

Every label is a static value, written as in a one-language app, so update() never reads it again: cart clicks refresh only quantities and totals. Switching the language calls forceUpdate() on this tree, which runs the component again and patches the same elements, lang and dir included. Money, plurals, dates and lists come from Intl, and the cart and a typed coupon survive the switch.

Apps
75

Theme Editor

A small component library: createCss() names the tokens and variants() builds buttons, badges, cards, inputs, alerts and switches from them. The tokens are CSS variables, so every class compiles once. Each control writes a plain theme object and calls update(), which rewrites the text of one style element.

Apps