API Reference
Ambient layer lifecycle: live, throttled, or frozen.
fields
- covered: Bool
- frozen: Bool
- rate: Float
- visible: Bool
fn advance(dt: Float): FloatAdvance the layer clock. Returns the effective delta.
fn freeze(on: Bool)fn setCovered(on: Bool)fn setVisible(on: Bool)fn state(): Stringinit(tree: Tree)
fields
- clock: FrameClock
- tree: Tree
- wantsFrames: Bool
fn animate(on: Bool)Declare whether this view needs continuous frames. A paused view draws once per input event; a running animation draws every frame. The app reads this after the view returns.
fn animating(): Boolfn button(s: String, onTap: fn(): Void): Nodefn buttonInert(s: String): Nodefn canvas(s: String, w: Int, h: Int, paint: fn(Canvas): Void): Nodefn checkbox(s: String, on: Bool, onToggle: fn(): Void): Nodefn column(): Nodefn dialog(title: String): Nodefn divider(): Nodefn frameClock(): FrameClockThe clock the app ticks before it runs the view.
fn grid(columns: Int): Nodefn handle(): Treefn heading(s: String): Nodefn icon(name: String, size: Int): NodeA square glyph from the built-in set: plus, close, check, chevron.
fn image(png: ByteBuffer, w: Int, h: Int): NodeA bitmap control. Bytes are an encoded image; width and height are logical units.
fn item(label: String, onTap: fn(): Void): Nodefn key(k: String)Key the next node created by a factory.
fn list(): Nodefn listItem(label: String, onTap: fn(): Void): Nodefn menu(labels: Array<String>, onSelect: fn(Int): Void): NodeA vertical menu of actions.
fn menuBar(labels: Array<String>, onSelect: fn(Int): Void): NodeA menu bar: one action per label, reporting its index.
fn menuItem(s: String, onTap: fn(): Void): Nodefn panel(): NodeA surface with padding, without a heading.
fn popover(width: Int): NodeA floating panel; set its edges with left, top, right, or bottom.
fn progress(v: Float): Nodefn radio(s: String, selected: Bool, onTap: fn(): Void): Nodefn row(): Nodefn scroll(): Nodefn searchField(v: String, onChange: fn(String): Void): NodeA text field with a search placeholder.
fn section(title: String): Nodefn segmented(options: Array<String>, selected: Int, onSelect: fn(Int): Void): NodeA radio group laid out as one row.
fn setClock(c: FrameClock)fn setTextEngine(e: TextEngine)Replace the text backend before the view runs.
fn slider(s: String): Nodefn sliderValue(s: String, v: Float, onChange: fn(Float): Void): Nodefn spacer(): NodeEmpty space that grows in a row or a column.
fn stack(): Nodefn tab(s: String, selected: Bool, onTap: fn(): Void): Nodefn tabs(labels: Array<String>, selected: Int, onSelect: fn(Int): Void): NodeA horizontal tab strip; the selected tab is underlined.
fn text(s: String): Nodefn textField(v: String, placeholder: String, onChange: fn(String): Void): Nodefn toast(message: String): NodeA transient message pinned to the bottom right of its parent.
fn toggle(s: String): Nodefn toggleWith(s: String, onToggle: fn(): Void): Nodefn virtualList(label: String, k: String, total: Int, rowH: Int, viewport: Int): VirtualRangeA fixed-row list viewport. The scroll offset lives on the keyed list
node, so the caller only builds count rows starting at first.
fn wrap(): NodeA scene camera. Layout stays logical; the camera transforms presentation.
init(scale: Float, x: Float, y: Float)
fields
- scaleV: Float
- xV: Float
- yV: Float
fn copy(): Camerafn panBy(dx: Float, dy: Float)fn scale(): Floatfn screenX(worldX: Float): Floatfn screenY(worldY: Float): Floatfn set(scale: Float, x: Float, y: Float)fn worldX(screenX: Float): Floatfn worldY(screenY: Float): Floatfn x(): Floatfn y(): Floatfn zoomAt(screenX: Float, screenY: Float, factor: Float)Zoom around a screen point, which stays fixed.
A drawing surface for one canvas node, in local coordinates.
The painter adds the node's origin, so a paint function works in its own space and never sees screen coordinates. Every call appends to the frame's display list.
init(list: DisplayList, ox: Float, oy: Float, width: Float, height: Float, th: Theme)
fields
- height: Float
- list: DisplayList
- ox: Float
- oy: Float
- themeRef: Theme
- width: Float
fn clip(x: Float, y: Float, w: Float, h: Float)fn clipRound(x: Float, y: Float, w: Float, h: Float, radius: Float)fn fill(color: Int)fn h(): Floatfn image(x: Float, y: Float, w: Float, h: Float, png: ByteBuffer)fn line(color: Int, x0: Float, y0: Float, x1: Float, y1: Float, thickness: Float)A thick line, drawn as a quad.
fn linearGradient(g: LinearGradient, x: Float, y: Float, w: Float, h: Float)Fill a rect with a multi-stop linear gradient.
fn pathFill(path: Path, color: Int, evenOdd: Bool)fn pathStroke(path: Path, color: Int, width: Float, cap: StrokeCap, join: StrokeJoin)fn polygon(color: Int, points: Array<Float>)A filled polygon. points is [x0, y0, x1, y1, ...] in local space.
fn popBlur()fn popLayer()fn popMask()fn popTransform()fn pushBlur(x: Float, y: Float, w: Float, h: Float, sigma: Float)Start a blur group covering this canvas.
fn pushLayer(alpha: Float)Start an opacity group covering this canvas.
fn pushLayerBlend(alpha: Float, blend: BlendMode)Start a group covering this canvas with opacity and a blend mode.
fn pushMask(x: Float, y: Float, w: Float, h: Float, radius: Float)Start an alpha mask covering this canvas. Not a clip.
fn pushTransform(a: Float, b: Float, c: Float, d: Float, e: Float, f: Float)fn radialGradient(g: RadialGradient, x: Float, y: Float, w: Float, h: Float)Fill a rect with a multi-stop radial gradient.
fn rect(color: Int, x: Float, y: Float, w: Float, h: Float)fn roundRect(color: Int, x: Float, y: Float, w: Float, h: Float, radius: Float)fn roundRectShadow(color: Int, x: Float, y: Float, w: Float, h: Float, radius: Float, stdDev: Float)fn roundRectStroke(color: Int, x: Float, y: Float, w: Float, h: Float, radius: Float, width: Float)fn text(color: Int, x: Float, y: Float, size: Float, s: String)fn textStyled(color: Int, x: Float, y: Float, size: Float, s: String, weight: Int, italic: Bool, tracking: Float, family: FontFamily, font: FontFace?)A text run with an explicit weight, italic face, tracking, family, and named face.
fn theme(): Themefn unclip()fn w(): FloatA lazily pulled value. Construction does not run the closure; the first
get does, and later reads reuse the cache until a dependency version
changes. The dependency list and its version vector are both sorted.
init(rx: Reactive, node: Int, comp: Int, f: fn(): T)
fields
- comp: Int
- disposed: Bool
- f: fn(): T
- node: Int
- rx: GenRef<Reactive>
- value: T
fn dispose()fn get(): Tfn id(): Intfn version(): IntRectangles a frame touched, in surface space.
fields
- hs: Array<Int>
- ws: Array<Int>
- xs: Array<Int>
- ys: Array<Int>
fn add(x: Int, y: Int, w: Int, h: Int)fn clear()fn count(): Intfn hAt(i: Int): Intfn wAt(i: Int): Intfn xAt(i: Int): Intfn yAt(i: Int): IntExponential friction. rate is the velocity retained per millisecond, so
the analytic position needs no accumulated substeps.
init(rate: Float, value: Float, velocity: Float)
fields
- elapsed: Float
- rateV: Float
- stopSpeedV: Float
- v0: Float
- valueV: Float
- velocityV: Float
- x0: Float
fn projection(): FloatWhere the motion comes to rest.
fn rate(): Floatfn rebase(value: Float, velocity: Float)Rebase at a value and velocity; the clock starts over.
fn setStopSpeed(s: Float)fn settled(): Boolfn step(dt: Float): Floatfn stopSpeed(): FloatSpeed below which the animator may stop calling step.
fn value(): Floatfn velocity(): FloatReads a finished display list, for snapshots and the inspector.
A display list, version 3.
The format is little-endian. The 32-byte header is magic, version, records, recordBytes, blobOffset, blobBytes, width, height, all u32. magic is
0x44584E52 (RNXD in byte order). Every record is 64 bytes:
kind, color, a, b as u32, then six little-endian f64 lanes named
x, y, w, h, e, f. color is 0xRRGGBBAA.
Kinds: 1 fill, 2 text, 3 clip push, 4 clip pop, 5 rounded rect, 6 image,
7 transform push, 8 transform pop, 9 polygon, 10 gradient, 11 path fill,
12 path stroke, 13 layer push, 14 layer pop, 15 rounded rect stroke,
17 blurred rounded shadow, 18 rounded clip push, 19 alpha mask push,
20 mask pop, 21 group blur push, 22 blur pop, 25 multi-stop gradient rect.
Text and image records read
a and b as a byte range into the blob table that starts at
blobOffset; a text record puts the weight plus 10000 for italic in e and
the tracking in f. A polygon reads a as the blob offset and b as the point
count; each point is two f64 values. A transform uses all six lanes as
[a b c d e f]. A rounded rect puts the radius in e. A path reads a
as the blob offset and b as the verb count; the blob is the verb bytes
followed by the f64 payload. Path fill puts the rule in e; path stroke
puts the width in e and the cap/join bits in f. A layer push puts the
opacity in e and the blend id in f. A shadow puts the radius in e and
the standard deviation in f. A rounded clip puts the radius in e. A mask
push puts the corner radius in e; a blur push puts the standard deviation
in e. A gradient rect reads a as the blob offset and b as the stop
count; each stop is a u32 color then an f32 offset. Its e lane is the
kind (0 vertical linear, 1 horizontal linear, 2 radial) and f is the
radial radius, where 0 means half the shorter side.
When a frame uses a named font face, the blob starts with a font table:
magic 0x464E5432, tableBytes, count, then per face id, nameBytes, name.
tableBytes counts from the blob start. Font bytes never enter the list; the
renderers receive them once through register_font. Every record a lane
that holds a blob offset is shifted by that length before the frame is
encoded. Frames that only use generic families carry no table.
The builder owns a fixed record buffer; a command past the limit increments
dropped() instead of growing or aborting mid-frame.
init(limit: Int)
fields
- blob: Array<Int>
- count: Int
- damageRects: Damage
- droppedCount: Int
- fontIds: Array<Int>
- fontNames: Array<String>
- limit: Int
- records: ByteBuffer
- scratch: ByteBuffer
fn aAt(i: Int): Intfn appendPath(path: Path): IntAppend a path blob: the verb bytes first, then the f64 payload.
fn bAt(i: Int): Intfn blobLength(): IntBytes in the unshifted blob table, before a font table is prepended.
fn colorAt(i: Int): Intfn damage(): DamageConservative damage for this frame. Still names the whole surface.
fn describe(i: Int): StringOne line per record, for snapshots and the inspector.
fn dropped(): Intfn eAt(i: Int): Floatfn fAt(i: Int): Floatfn fillRect(color: Int, x: Float, y: Float, w: Float, h: Float)fn finish(width: Int, height: Int): ByteBufferEncode the header, records, and blob table into one buffer. When the
frame uses named faces, a font table is prepended to the blob and every
record a lane that holds a blob offset is shifted past it.
fn fontCount(): IntFaces used by this frame, in first-use order.
fn fontTable(): ByteBufferEncode the font table: magic, total length, count, then id/name per face.
fn fontTableLength(): IntBytes the font table occupies at the start of the blob. Zero when no named face is used.
fn gradientKindAt(i: Int): IntGradient kind lane: 0 vertical linear, 1 horizontal linear, 2 radial.
fn gradientRect(stops: Array<GradientStop>, kind: Int, radialRadius: Float, x: Float, y: Float, w: Float, h: Float)A rect filled by a multi-stop gradient. Stops are sorted by offset and clamped to 0..1 before they reach the blob. Fewer than two stops or a non-positive rect emits nothing.
fn hAt(i: Int): Floatfn image(x: Float, y: Float, w: Float, h: Float, png: ByteBuffer)Draw a PNG into the given rectangle.
fn kindAt(i: Int): Intfn pathFill(path: Path, color: Int, evenOdd: Bool)Fill a path with the nonzero or even-odd rule.
fn pathStroke(path: Path, color: Int, width: Float, cap: StrokeCap, join: StrokeJoin)Stroke a path. f packs the cap in bits 0..1 and the join in 2..3.
fn polygon(color: Int, points: Array<Float>)A filled polygon. points is [x0, y0, x1, y1, ...].
fn polygonAt(color: Int, points: Array<Float>, dx: Float, dy: Float)A filled polygon shifted by dx, dy. The shift happens while the
points are copied into the blob, so a canvas does not allocate a
temporary array on every frame.
fn popBlur()fn popClip()fn popLayer()fn popMask()fn popTransform()fn pushBlur(x: Float, y: Float, w: Float, h: Float, sigma: Float)Push a group blur. sigma is the standard deviation. Kind 22 pops it.
fn pushClip(x: Float, y: Float, w: Float, h: Float)fn pushClipRound(x: Float, y: Float, w: Float, h: Float, radius: Float)Push a clip with rounded corners. Kind 4 pops it, like a rect clip.
fn pushLayer(x: Float, y: Float, w: Float, h: Float, alpha: Float, blend: Int)Start an offscreen group with group opacity and an encoded blend id.
fn pushMask(x: Float, y: Float, w: Float, h: Float, radius: Float)Push an alpha mask over the group. radius rounds the mask rectangle;
this is an alpha mask, not a clip. Kind 20 pops it.
fn pushTransform(a: Float, b: Float, c: Float, d: Float, e: Float, f: Float)Push a 2D affine transform: [a b c d e f].
fn recordCount(): Intfn roundRect(color: Int, x: Float, y: Float, w: Float, h: Float, radius: Float)fn roundRectGradient(top: Int, bottom: Int, x: Float, y: Float, w: Float, h: Float, radius: Float)A rounded rect filled by a vertical gradient from top to bottom.
fn roundRectShadow(color: Int, x: Float, y: Float, w: Float, h: Float, radius: Float, stdDev: Float)A blurred rounded rect behind a node. e is the radius, f the blur.
fn roundRectStroke(color: Int, x: Float, y: Float, w: Float, h: Float, radius: Float, width: Float)A rounded rect outline. e is the radius and f the stroke width.
fn stopCountAt(i: Int): IntStop count for a gradient rect record.
fn textAt(i: Int): Stringfn textRun(color: Int, x: Float, y: Float, size: Float, s: String, weight: Int, italic: Bool, tracking: Float, family: FontFamily, font: FontFace?)A text run. e carries the font weight plus 10000 when the face is
italic and 1000000 per family tag, and f carries extra tracking
in logical pixels. A named font packs its registry id (100 and up) in
place of the generic family id.
fn toString(): Stringfn wAt(i: Int): Floatfn xAt(i: Int): Floatfn yAt(i: Int): FloatThe arena. Ids are creation order until keyed reconciliation lands.
A typed drag payload. kind selects which drop targets accept it.
init(kind: String, text: String)
fields
- kind: String
- text: String
fn accepts(kinds: String): BoolTrue when a comma-separated accept list contains this kind or *.
A side effect queued by the graph. It never runs during construction or from
set; drain runs it once per frame. run only schedules it again.
init(rx: Reactive, comp: Int)
fields
- comp: Int
- disposed: Bool
- rx: GenRef<Reactive>
fn dispose()fn id(): Intfn run()Shadow offset, blur, and alpha for one elevation level.
init(dx: Float, dy: Float, blur: Float, alpha: Float)
fields
- alpha: Float
- blur: Float
- dx: Float
- dy: Float
Six shadow steps. Level 0 is flat, so cards keep their old look by default.
init(level0: Elevation, level1: Elevation, level2: Elevation, level3: Elevation, level4: Elevation, level5: Elevation)
fields
- level0V: Elevation
- level1V: Elevation
- level2V: Elevation
- level3V: Elevation
- level4V: Elevation
- level5V: Elevation
fn at(level: Int): ElevationResolve the integer lane stored on a node; 0 is flat.
fn elevation(t: ElevationToken): Elevationfn replace(t: ElevationToken, e: Elevation): ElevationScaleA named font face. id is the family tag packed into text records; the
registry assigns ids from 100 so they cannot collide with FontFamily.
init(id: Int, name: String, data: ByteBuffer)
fields
- data: ByteBuffer
- id: Int
- name: String
Named font faces for one app. The registry is bounded: at most 16 faces and 8 MB of font data. Ids are dense from 100 in registration order.
fields
- bytesV: Int
- faces: Array<FontFace>
fn at(i: Int): FontFace?fn bytes(): Intfn find(name: String): FontFace?fn len(): Intfn register(name: String, data: ByteBuffer): FontFace?Register one face, or return null when the name/data is empty or a cap is hit.
Frame timing for animation.
tick takes a monotonic nanosecond reading and exposes the time since the
last frame plus the total running time. While paused, a tick keeps the
baseline current but does not advance time, so animations freeze rather
than jump when they resume.
fields
- deltaNs: Int
- elapsedNs: Int
- last: Int
- pausedFlag: Bool
- ticks: Int
fn dt(): FloatSeconds since the previous tick, zero while paused.
fn elapsed(): FloatSeconds of animation time since the clock started.
fn frames(): Intfn paused(): Boolfn reset()fn setPaused(p: Bool)fn tick(nowNs: Int)One buffer carrying each live node's layout and semantics.
init(packetWidth: Int, packetHeight: Int, packetScale: Int, packetColor: Int, packetFlags: Int)
fields
- actionsV: Array<Int>
- color: Int
- flags: Int
- flagsV: Array<Int>
- height: Int
- hs: Array<Int>
- ids: Array<Int>
- names: Array<String>
- parents: Array<Int>
- roles: Array<Int>
- scale: Int
- values: Array<String>
- width: Int
- ws: Array<Int>
- xs: Array<Int>
- ys: Array<Int>
fn at(i: Int): FrameNodefn count(): Intfn describe(): StringOne arena per stage. A claim holds until release.
fields
- active: Int
- axes: Array<Int>
- depths: Array<Int>
- owners: Array<Int>
- priorities: Array<Int>
- trace: Array<String>
fn activeNode(): Intfn add(axis: GestureAxis, priority: Int, depth: Int, node: Int): Intfn begin(axis: GestureAxis): IntResolve a gesture start on an axis. Returns the winning node id.
fn beginAxis(axis: Int): Intfn clear()fn lastDecision(): StringLast few decisions, for dev builds and tests.
fn release()fn size(): IntOne stop in a multi-stop gradient. offset runs from 0 to 1.
init(offset: Float, color: Int)
fields
- color: Int
- offset: Float
A bitmap's intrinsic dimensions, read from its format header.
init(width: Int, height: Int)
fields
- height: Int
- width: Int
One hold point in a KeyframeTrack: a time, a value, and the curve out.
init(at: Float, value: Float, curve: Curve)
fields
- at: Float
- curve: Curve
- value: Float
A sorted keyframe track sampled at an absolute elapsed time.
Frames are stored in ascending at order regardless of input order; a
negative time is clamped to zero. When two frames share a timestamp the
later one in the input wins, so a caller can override a hold point by
appending it. Sampling is pure: the track has no clock and no accumulated
state, so the same t always yields the same value.
A looping track wraps t beyond duration() back through zero. A
non-looping track clamps before the first frame and after the last one.
Between frames, the outgoing frame's curve shapes the local progress, and a
zero-length segment returns the later value.
init(frames: Array<Keyframe>, loop: Bool)
fields
- frames: Array<Keyframe>
- loopV: Bool
fn duration(): FloatTime of the last frame, or zero for an empty track.
fn frameCount(): Intfn loopOn(): Boolfn setLoop(on: Bool)Toggle the loop wrap in place.
fn valueAt(t: Float): FloatSample at an absolute elapsed time in seconds.
fn withLoop(on: Bool): KeyframeTrackA copy that keeps or drops the loop wrap.
A linear gradient, vertical by default.
init(stops: Array<GradientStop>, horizontal: Bool)
fields
- horizontal: Bool
- stops: Array<GradientStop>
One screen-space link rectangle on a text node.
init(url: String, text: String, x: Int, y: Int, w: Int, h: Int)
fields
- h: Int
- text: String
- url: String
- w: Int
- x: Int
- y: Int
Interpolate between two rectangles with a spring.
init(fx: Float, fy: Float, fw: Float, fh: Float, tx: Float, ty: Float, tw: Float, th: Float)
fields
- fromH: Float
- fromW: Float
- fromX: Float
- fromY: Float
- spring: Spring
- toH: Float
- toW: Float
- toX: Float
- toY: Float
fn close()fn done(): Boolfn h(): Floatfn open()fn progress(): Floatfn setTargets(tx: Float, ty: Float, tw: Float, th: Float)fn step(dt: Float): Floatfn w(): Floatfn x(): Floatfn y(): FloatOne scalar slot driven by a curve, a spring, or a decay.
init(kind: MotionKind, duration: Float, curve: Curve, spring: Spring, decay: Decay)
fields
- curveV: Curve
- decayV: Decay
- doneV: Bool
- durationV: Float
- fromV: Float
- kindV: MotionKind
- springV: Spring
- time: Float
- toV: Float
- valueV: Float
- velocityV: Float
fn done(): Boolfn fling(velocity: Float)Start a friction fling from the present value. Only decay tracks.
fn kind(): MotionKindfn setTarget(target: Float)fn setValue(v: Float)Place the track at v without animating.
fn step(dt: Float): Floatfn to(target: Float)Animate from the present value to target. Decay ignores this.
fn value(): Floatfn velocity(): FloatThe motion steps. Fast, normal, and slow carry the same duration and curve
pairs Transition shipped with; spring carries the defaults of Spring.
init(fast: MotionSpec, normal: MotionSpec, slow: MotionSpec, spring: MotionSpec)
fields
- fastV: MotionSpec
- normalV: MotionSpec
- slowV: MotionSpec
- springV: MotionSpec
fn motion(t: MotionToken): MotionSpecfn replace(t: MotionToken, m: MotionSpec): MotionScaleDuration and curve, plus the spring constants for the spring token.
init(duration: Float, curve: Curve, stiffness: Float, damping: Float)
fields
- curve: Curve
- damping: Float
- duration: Float
- stiffness: Float
fn spring(): Springfn transition(): TransitionOverview camera: fits a set of window rectangles into the viewport.
init(viewW: Int, viewH: Int, padding: Int)
fields
- camera: Camera
- hs: Array<Int>
- ids: Array<Int>
- openV: Bool
- padding: Int
- saved: Camera
- titles: Array<String>
- viewH: Int
- viewW: Int
- ws: Array<Int>
- xs: Array<Int>
- ys: Array<Int>
fn add(id: Int, x: Int, y: Int, w: Int, h: Int, title: String)fn card(i: Int): WindowCardfn count(): Intfn enter()Enter the overview, remembering the current camera.
fn exit()Leave the overview and restore the previous camera in place.
fn fit(): CameraFit every card into the viewport with padding and return the camera.
fn fits(i: Int): BoolTrue when a card lies inside the viewport after fitting.
fn isOpen(): Boolfn screenH(i: Int): Floatfn screenW(i: Int): Floatfn screenX(i: Int): FloatScreen rectangle of a card under the overview camera.
fn screenY(i: Int): FloatA path in device coordinates.
The verb bytes and the little-endian f64 payload live in two growable
buffers, so a display list appends them as one blob without re-encoding.
init()
fields
- bytes: Int
- coordBytes: Int
- data: ByteBuffer
- scratch: ByteBuffer
- verbCount: Int
fn close()fn cubicTo(c1x: Float, c1y: Float, c2x: Float, c2y: Float, x: Float, y: Float)fn lineTo(x: Float, y: Float)fn moveTo(x: Float, y: Float)fn quadTo(cx: Float, cy: Float, x: Float, y: Float)fn rect(x: Float, y: Float, w: Float, h: Float)fn translated(dx: Float, dy: Float): PathA copy with every point shifted by dx, dy.
A radial gradient. A zero radius means half the shorter side.
init(stops: Array<GradientStop>, radius: Float)
fields
- radius: Float
- stops: Array<GradientStop>
Corner radii. md is the 6 px control radius, lg the 10 px section and
dialog radius, sm the 4 px accent radius. pill returns -1, meaning half
the short side; callers that paint pill shapes use that sentinel.
list is the 8 px radius the list role already used.
init(none: Float, sm: Float, md: Float, lg: Float, pill: Float, list: Float)
fields
- lgV: Float
- listV: Float
- mdV: Float
- noneV: Float
- pillV: Float
- smV: Float
fn chrome(role: Int): FloatRole mapping shared by paint and component defaults.
fn radius(t: RadiusToken): Floatfn replace(t: RadiusToken, v: Float): RadiusScaleOne reactive graph. Signals and computeds are nodes in dense arrays; the
computations that read them are tracked on an explicit stack owned by this
instance. Nothing here is shared between contexts, so two Reactive values
never see each other's dependencies.
init()
fields
- batchDepth: Int
- cDepVer: Array<Array<Int>>
- cDeps: Array<Array<Int>>
- cDirty: Array<Bool>
- cKind: Array<Int>
- cLive: Array<Bool>
- cNode: Array<Int>
- cQueued: Array<Bool>
- cReady: Array<Bool>
- cRun: Array<fn(): Void>
- cRunning: Array<Bool>
- compFace: Array<View>
- compFrame: Array<Int>
- compKeys: Array<String>
- compRuns: Array<Int>
- compView: Array<View>
- cycleAt: Int
- cycled: Bool
- draining: Bool
- frame: Int
- nComputed: Array<Int>
- nLive: Array<Bool>
- nSubs: Array<Array<Int>>
- nVersion: Array<Int>
- queue: Array<Int>
- stack: Array<Int>
- trace: Array<Array<Int>>
fn alive(kind: String, id: Int): Boolkind is "signal", "computed", or "effect"; id comes from the handle.
fn batch(f: fn(): Void)Coalesce writes; the outermost batch drains once at the end.
fn beginCompute(comp: Int): BoolStart a computation when it is new or a dependency changed.
fn beginFrame()Start a frame so endFrame can prune components that were not used.
fn bump(node: Int)Bump a node and mark everything downstream.
fn clearCycle()fn component(key: String, build: fn(): View): ViewA keyed subtree boundary. The builder runs inside the component's computation scope, so a signal read in the builder subscribes the component. A clean component returns the same face view and does not run the builder. An empty key mounts the builder directly with no caching.
Component state outlives ordinary view rebuilds because the cached view
and dependency set live in this graph. A key the view stops asking for is
detached by endFrame; without a frame call it is retained, because the
graph has no process-global observer to learn that the key disappeared.
A detached slot stays dead so the ids of surviving components remain
stable.
fn componentDirty(key: String): Boolfn componentRebuilds(key: String): Intfn componentViewAt(comp: Int): View?The cached view of a component, or null when the id is not live.
fn computed(f: fn(): T): Computed<T>fn cycleDetected(): BoolTrue when a dependency cycle was cut instead of recursing.
fn cycleId(): Intfn drain(): IntRun queued effects once in id order. Inside a batch this waits.
fn effect(f: fn(): Void): Effectfn endCompute(comp: Int, node: Int)Commit the read set and clear the dirty flag.
fn endFrame()Detach components that were not asked for during the frame. Ids and dependency arrays are dropped; the slot stays dead so other ids remain stable. Iteration is ascending by id.
fn frameNeeded(): BoolTrue when a queued effect or a dirty component wants another frame.
fn freeComputed(node: Int, comp: Int)fn freeEffect(comp: Int)fn freeNode(node: Int)fn nodeAlive(node: Int): Boolfn scheduleEffect(comp: Int)fn signal(value: T): Signal<T>fn trackRead(node: Int)Record a read edge into the computation on top of the stack.
fn versionOf(node: Int): IntRows plus the shaped runs that paint them.
init(rows: Array<TextRow>, runs: Array<TextRun>)
fields
- rows: Array<TextRow>
- runs: Array<TextRun>
A detented sheet driven by a spring.
init(detents: Array<Float>)
fields
- detents: Array<Float>
- indexV: Int
- spring: Spring
fn dragBy(dy: Float)Drag the sheet by dy logical units, clamped to the detent range.
fn go(i: Int)fn height(): Floatfn index(): Intfn release(velocity: Float)Settle to the next detent, or the previous one on a fast fling.
fn settled(): Boolfn step(dt: Float): FloatNamed keyboard chords. A chord is normalized to lower case, so Ctrl+S and
ctrl+s are the same binding. The last bind for a chord replaces the
previous handler; the return value says whether it replaced one.
fields
- counter: Int
- current: Int
- handlers: Array<fn(): Void>
- keys: Array<String>
- nextScope: Array<Int>
- scopes: Array<Int>
fn bind(chord: String, run: fn(): Void): Boolfn bindScoped(scope: Int, chord: String, run: fn(): Void): Boolfn clear()fn len(): Intfn popScope()fn pushScope(): IntPush a scope that shadows global chords until it is popped.
fn run(chord: String): Boolfn scope(): IntOne value in a reactive graph. Reads inside a computation record an edge; writes bump the node and schedule its subscribers. A disposed signal keeps its last value and ignores writes.
init(rx: Reactive, node: Int, tag: Int, value: T)
fields
- node: Int
- rx: GenRef<Reactive>
- tag: Int
- value: T
fn dispose()fn get(): Tfn id(): Intfn set(value: T): Boolfn update(f: fn(T): T): Boolfn version(): IntSpacing steps in logical pixels. Standard matches the shipped defaults: 12 is the page gap, 16 the default container inset and card padding, 24 the page padding. Compact scales spacing without touching type.
init(xs: Int, sm: Int, md: Int, lg: Int, xl: Int, xxl: Int)
fields
- lgV: Int
- mdV: Int
- smV: Int
- xlV: Int
- xsV: Int
- xxlV: Int
fn replace(t: SpaceToken, v: Int): SpaceScalefn space(t: SpaceToken): IntA damped spring solved in closed form. step advances an analytic clock, so
the result does not depend on the frame rate. Retargeting keeps the present
value and velocity; interrupting holds the present value and stops.
init(stiffness: Float, damping: Float, value: Float)
fields
- damping: Float
- elapsed: Float
- fromV: Float
- stiffness: Float
- targetV: Float
- valueV: Float
- vel0: Float
- velocityV: Float
fn interrupt()Hold the present value with no velocity.
fn retarget(t: Float)fn setTarget(t: Float)Move to a new target while keeping value and velocity.
fn setValue(v: Float)Place the present value and cancel any motion.
fn settled(): Boolfn step(dt: Float): Floatfn target(): Floatfn value(): Floatfn velocity(): FloatA stage: content, overlay, sheet, ambient, and gesture arbitration.
init(tree: Tree, content: Int, overlay: Int, ambient: Ambient, sheet: Sheet)
fields
- ambient: Ambient
- arena: GestureArena
- content: Int
- openV: Bool
- overlay: Int
- sheet: Sheet
- tree: Tree
fn dismiss()Lower the sheet: restore content, focus, and the ambient rate.
fn isOpen(): Boolfn occludes(): BoolThe stage occludes the ambient layer while a sheet is up.
fn present(first: Node)Raise the sheet: inert content, focus into the overlay, ambient throttled.
fn sync()Re-apply the layer state after a tree rebuild. Node flags reset every
frame, so onMount calls this while the stage is open.
A text measurement and line-breaking backend.
@std/ui is headless, so it never shapes text itself. The app supplies an
engine backed by the platform shaper; the default engine measures a fixed
advance per character, which keeps tests and headless runs deterministic.
init(m: fn(String, Float): Float, r: fn(String, Float, Float, Bool, Int, Bool): Array<TextRow>, n: fn(String, Int): Int, p: fn(String, Int): Int)
fields
- measureFn: fn(String, Float): Float
- nextFn: fn(String, Int): Int
- prevFn: fn(String, Int): Int
- richRowsFn: fn(String, Float, Float, Bool, Int, Bool, Array<TextSpan>, Float): RichRows
- rowsFn: fn(String, Float, Float, Bool, Int, Bool): Array<TextRow>
- styledMeasureFn: fn(String, Float, Int, Bool, Float): Float
- styledRowsFn: fn(String, Float, Float, Bool, Int, Bool, Int, Bool, Float, Float): Array<TextRow>
fn measure(s: String, size: Float): FloatWidth of one unwrapped line.
fn measureStyled(s: String, size: Float, weight: Int, italic: Bool, tracking: Float): FloatWidth of one unwrapped line with an explicit weight, italic, and tracking.
fn nextGrapheme(s: String, at: Int): IntCharacter index after the grapheme that starts at at.
fn prevGrapheme(s: String, at: Int): IntCharacter index of the grapheme boundary before at.
fn richRows(s: String, size: Float, maxWidth: Float, wrap: Bool, maxLines: Int, ellipsis: Bool, spans: Array<TextSpan>, lineHeight: Float): RichRowsBreak s into rows and shaped runs with inline spans.
fn rows(s: String, size: Float, maxWidth: Float, wrap: Bool, maxLines: Int, ellipsis: Bool): Array<TextRow>Break s into rows. maxWidth <= 0 disables wrapping and ellipsis.
fn rowsStyled(s: String, size: Float, maxWidth: Float, wrap: Bool, maxLines: Int, ellipsis: Bool, weight: Int, italic: Bool, lineHeight: Float, tracking: Float): Array<TextRow>Break s into rows with an explicit style. lineHeight is 0.0 for the
normal spacing or a multiplier of the font size.
fn setRich(r: fn(String, Float, Float, Bool, Int, Bool, Array<TextSpan>, Float): RichRows)Install a shaper that also returns the shaped runs for inline spans.
fn setStyled(m: fn(String, Float, Int, Bool, Float): Float, r: fn(String, Float, Float, Bool, Int, Bool, Int, Bool, Float, Float): Array<TextRow>)Install a styled shaper. Until this is called, the styled methods delegate to the plain functions and ignore the style lanes.
One shaped run inside a row. x is the offset from the row origin.
init(row: Int, start: Int, end: Int, x: Float, advance: Float, flags: Int)
fields
- advance: Float
- end: Int
- flags: Int
- row: Int
- start: Int
- x: Float
One inline style range. Offsets count characters, the same way s.slice
does. Overlapping spans resolve to the last span that covers the offset.
color < 0 keeps the role color the node already uses. A non-empty link
paints the run as a link and lets the tree hit-test it.
init(start: Int, end: Int, weight: Int, italic: Bool, tracking: Float, color: Int, family: FontFamily, decoration: TextDecoration, font: FontFace?, link: String)
fields
- color: Int
- decoration: TextDecoration
- end: Int
- family: FontFamily
- font: FontFace?
- italic: Bool
- link: String
- start: Int
- tracking: Float
- weight: Int
fn decorationBits(): IntWire decoration bits for the shaper's style word.
fn fontFamilyId(): IntWire family id for the shaper's style word. A named face wins over the generic family.
Colors used by the built-in painter. Brand kits pass their own.
init(background: Int, surface: Int, text: Int, accent: Int, muted: Int, border: Int, surfaceRaised: Int, surfaceSunken: Int, textMuted: Int, accentHover: Int, accentText: Int, focus: Int, danger: Int, success: Int, warning: Int, disabled: Int, typeScale: TypeScale?, spaceScale: SpaceScale?, radiusScale: RadiusScale?, elevationScale: ElevationScale?, motionScale: MotionScale?)
fields
- accent: Int
- accentHover: Int
- accentText: Int
- background: Int
- border: Int
- danger: Int
- disabled: Int
- elevationScale: ElevationScale
- focus: Int
- motionScale: MotionScale
- muted: Int
- radiusScale: RadiusScale
- spaceScale: SpaceScale
- success: Int
- surface: Int
- surfaceRaised: Int
- surfaceSunken: Int
- text: Int
- textMuted: Int
- typeScale: TypeScale
- warning: Int
fn elevation(token: ElevationToken): Elevationfn motion(token: MotionToken): MotionSpecfn radius(token: RadiusToken): Floatfn space(token: SpaceToken): Intfn type(token: TypeToken): TypeStyleResolve a type token to its size, weight, line height, and tracking.
fn withElevation(token: ElevationToken, e: Elevation): Themefn withElevationScale(s: ElevationScale): Themefn withMotion(token: MotionToken, m: MotionSpec): Themefn withMotionScale(s: MotionScale): Themefn withRadius(token: RadiusToken, v: Float): Themefn withRadiusScale(s: RadiusScale): Themefn withSpace(token: SpaceToken, v: Int): Themefn withSpaceScale(s: SpaceScale): Themefn withType(token: TypeToken, s: TypeStyle): Themefn withTypeScale(s: TypeScale): ThemeA declarative enter and leave transition for Presence.
init(duration: Float, curve: Curve, fade: Bool)
fields
- curve: Curve
- duration: Float
- fade: Bool
init(e: TextEngine)
fields
- absV: Array<Bool>
- accentV: Array<Bool>
- actions: Array<Int>
- alignSelfV: Array<Int>
- aligned: Bool
- autoV: Array<Bool>
- blendV: Array<Int>
- blurSigmaV: Array<Float>
- bottomV: Array<Int>
- busyV: Array<Bool>
- cacheAvail: Array<Int>
- cacheExact: Array<Bool>
- cacheH: Array<Int>
- cacheVer: Array<Int>
- cacheW: Array<Int>
- canvasHandler: Array<Int>
- canvasHandlers: Array<fn(Canvas): Void>
- caretV: Array<Int>
- checked: Array<Bool>
- claimed: Array<Bool>
- clipRadiusV: Array<Float>
- clipV: Array<Bool>
- columnsV: Array<Int>
- controlsIdV: Array<Int>
- count: Array<Int>
- crossAlignV: Array<Int>
- cursor: Int
- cursorHandler: fn(Int): Void
- cursorShapeV: Int
- densityV: Float
- describedByIdV: Array<Int>
- descriptionV: Array<String>
- disabledV: Array<Bool>
- dragDataV: DragData?
- dragDxV: Float
- dragDyV: Float
- dragKindV: Array<String>
- dragNodeV: Int
- dragPhaseV: Int
- dragPointerV: Int
- dragSourceV: Int
- dragTextV: Array<String>
- dragVelXV: Float
- dragVelYV: Float
- dropHandlerV: Array<Int>
- dropHandlers: Array<fn(DragData): Void>
- dropHoverV: Int
- dropKindsV: Array<String>
- elevationV: Array<Int>
- engine: TextEngine
- expandedV: Array<Int>
- first: Array<Int>
- fixedH: Array<Int>
- fixedW: Array<Int>
- focus: Int
- focusVisible: Bool
- fontWeightV: Array<Int>
- frameDtV: Float
- frameOpen: Bool
- gapPctV: Array<Float>
- gapPxV: Array<Int>
- gapV: Array<Int>
- gestureTimeV: Float
- gradientV: Array<Bool>
- growV: Array<Float>
- h: Array<Int>
- handler: Array<Int>
- handlers: Array<fn(): Void>
- hovered: Int
- idealHV: Array<Int>
- idealWV: Array<Int>
- imageFitV: Array<Int>
- imageIntrHV: Array<Int>
- imageIntrWV: Array<Int>
- imageV: Array<ByteBuffer>
- inertV: Array<Bool>
- invalidV: Array<Int>
- italicV: Array<Bool>
- key: Array<String>
- keyIndexIds: Array<Int>
- keyIndexKeys: Array<String>
- keyboardV: Int
- labelIdV: Array<Int>
- last: Array<Int>
- lastDropTargetV: Int
- lastDropV: DragData?
- lastScroller: Int
- lastTapXV: Float
- lastTapYV: Float
- leftV: Array<Int>
- letterSpacingV: Array<Float>
- levelV: Array<Int>
- lineHeightV: Array<Float>
- linkHandler: fn(String): Void
- live: Array<Bool>
- liveV: Array<Int>
- longPressLatched: Bool
- mainAlignV: Array<Int>
- marginV: Array<Int>
- maskRadiusV: Array<Float>
- maxHV: Array<Int>
- maxWV: Array<Int>
- measureHits: Int
- measureVer: Int
- minHV: Array<Int>
- minWV: Array<Int>
- name: Array<String>
- next: Array<Int>
- numberHandler: Array<Int>
- numberHandlers: Array<fn(Float): Void>
- numberV: Array<Float>
- offsetYV: Array<Float>
- opacityV: Array<Float>
- orderV: Array<Int>
- padV: Array<Int>
- parent: Array<Int>
- pendingKey: String
- pinchActiveV: Bool
- pinchRotationV: Float
- pinchScaleV: Float
- pinchSlotA: Int
- pinchSlotB: Int
- pinchStartAngleV: Float
- pinchStartDistV: Float
- pointerButtonV: Array<Int>
- pointerDownV: Array<Bool>
- pointerHoldV: Array<Float>
- pointerIds: Array<Int>
- pointerLastX: Array<Float>
- pointerLastY: Array<Float>
- pointerLinkV: Array<String>
- pointerLongFired: Array<Bool>
- pointerNodeV: Array<Int>
- pointerPhaseV: Array<Int>
- pointerSampleN: Array<Int>
- pointerSampleT: Array<Int>
- pointerSampleX: Array<Float>
- pointerSampleY: Array<Float>
- pointerStartX: Array<Float>
- pointerStartY: Array<Float>
- pointerTimed: Array<Bool>
- portalLayerV: Array<Int>
- portalV: Array<Bool>
- preeditV: Array<String>
- presenceCurves: Array<Curve>
- presenceDurations: Array<Float>
- presenceKeys: Array<String>
- presenceProgress: Array<Float>
- presenceRaw: Array<Float>
- presenceTarget: Array<Float>
- presenceTouched: Array<Bool>
- pressed: Int
- prevBlend: Array<Int>
- prevBlurSigma: Array<Float>
- prevCaret: Array<Int>
- prevChecked: Array<Bool>
- prevDisabled: Array<Bool>
- prevFocus: Int
- prevFocusVisible: Bool
- prevH: Array<Int>
- prevHovered: Int
- prevMaskRadius: Array<Float>
- prevName: Array<String>
- prevNumber: Array<Float>
- prevOpacity: Array<Float>
- prevPreedit: Array<String>
- prevPressed: Int
- prevRole: Array<Int>
- prevSelEnd: Array<Int>
- prevSelStart: Array<Int>
- prevValue: Array<String>
- prevW: Array<Int>
- prevX: Array<Int>
- prevY: Array<Int>
- raisedV: Array<Bool>
- rangeMaxV: Array<Float>
- rangeMinV: Array<Float>
- rangeStepV: Array<Float>
- ratioV: Array<Float>
- requiredV: Array<Bool>
- richHandler: Array<Int>
- richHandlers: Array<fn(String, Array<TextSpan>): Void>
- rightV: Array<Int>
- role: Array<Int>
- root: Int
- roundV: Array<Bool>
- rovingV: Array<Bool>
- rtlV: Bool
- safeB: Int
- safeL: Int
- safeR: Int
- safeT: Int
- scope: Int
- scopePrevFocus: Int
- scrollDecayV: Array<Decay>
- scrollFlingV: Array<Bool>
- scrollMax: Array<Float>
- scrollOverV: Array<Float>
- scrollSpringV: Array<Spring>
- scrollV: Array<Float>
- scrollVelV: Array<Float>
- selEndV: Array<Int>
- selStartV: Array<Int>
- selectedV: Array<Bool>
- seqNext: Int
- seqV: Array<Int>
- shadowBlurV: Array<Float>
- shadowColorV: Array<Int>
- shadowDxV: Array<Float>
- shadowDyV: Array<Float>
- shadowRadiusV: Array<Float>
- shrinkV: Array<Float>
- sizeV: Array<Int>
- tapCountV: Int
- tapPendingV: Bool
- tapTimeV: Float
- textAlignV: Array<Int>
- textCacheSigV: Array<Int>
- textCacheTextV: Array<String>
- textHandler: Array<Int>
- textHandlers: Array<fn(String): Void>
- textLayoutV: Array<TextLayout>
- textLines: Array<Int>
- textScaleV: Float
- textSizeV: Array<Int>
- textSpansV: Array<Array<TextSpan>>
- textWrapV: Array<Bool>
- themeV: Theme
- toneV: Array<Int>
- tooltipV: Array<String>
- topV: Array<Int>
- value: Array<String>
- verticalV: Bool
- w: Array<Int>
- x: Array<Int>
- y: Array<Int>
- zV: Array<Int>
fn actionsOf(id: Int): Intfn adjust(n: Node, delta: Float): BoolMove a slider by delta, using the same path as the arrow keys.
fn attach(p: Int, c: Int)Link a child under a parent, keeping child order.
fn beginFrame()Start a frame. Existing nodes become reusable and handlers are cleared.
fn blendOf(n: Node): IntEncoded blend id of a node, 0 for normal.
fn blurSigmaOf(n: Node): FloatGroup blur standard deviation of a node, 0 when it has no blur.
fn button(s: String, onTap: fn(): Void): Nodefn buttonInert(s: String): Nodefn can(n: Node, a: Action): Boolfn canvas(s: String, w: Int, h: Int, paint: fn(Canvas): Void): NodeA fixed-size node that draws itself. The paint function runs during painting with a {@link Canvas} clipped to the node's rectangle, so an animation is a pure function of the frame clock and draws every frame.
fn caretX(n: Node): IntCaret x offset inside a text box, in local coordinates.
fn checkbox(s: String, on: Bool, onToggle: fn(): Void): Nodefn checkedOf(id: Int): Boolfn childCount(n: Node): Intfn clearDropResult()Forget the last completed drop so the next one reports cleanly.
fn clearFocusScope()fn clearLongPress()Consume the latched long press so a view reports it once.
fn clearPreedit(n: Node)fn clipRadiusOf(n: Node): FloatRounded clip radius of a node, 0 when it clips to a rectangle.
fn commit()Close the frame and drop focus from nodes that were not rebuilt.
Snapshot the presented state. Call once after painting a frame, so input that arrives between frames is compared against what the screen shows rather than against a value that was already mutated by the event.
fn controlsIdOf(id: Int): Intfn cursorShape(): IntCurrent cursor shape id: 0 default, 1 text, 2 pointer.
fn damageOf(width: Int, height: Int, full: Bool): DamageRectangles that changed since the previous frame, in surface space.
full forces the whole surface, which the first frame and a resize need
because the target starts undefined.
fn deleteBackward(n: Node): Boolfn deleteForward(n: Node): Boolfn deleteSurrounding(n: Node, before: Int, after: Int): BoolDelete text around the caret, as an IME does for surrounding text.
fn density(): Floatfn describedByIdOf(id: Int): Intfn disabledAt(id: Int): Boolfn dp(n: Int): IntConvert logical units to device pixels at the current density.
fn dragDx(): Floatfn dragDy(): Floatfn dragNode(): IntThe node that owns the current drag.
fn dragPayload(): DragData?The active drag payload, or null when the drag is plain or finished.
fn dragPhase(): IntDrag lifecycle: 0 none, 1 began, 2 changed, 3 ended, 4 cancelled.
fn dragVelocityX(): Floatfn dragVelocityY(): Floatfn dragging(id: Int): BoolWhether this pointer id owns the active drag.
fn dropHover(): IntThe node currently accepting the active payload, or -1.
fn dropTargetAt(px: Int, py: Int, kind: String): IntThe nearest node at the point that accepts kind: the hit node first,
then its ancestors. Returns -1 when nothing accepts.
fn effectsChanged(): BoolTrue when any mask or blur lane differs from the committed frame.
fn endFrame()fn find(r: Role, n: String): Intfn firstRole(r: Role): Intfn focusIsVisible(): BoolWhether the focus ring should be painted (keyboard or programmatic focus).
fn focusNext(): Intfn focusOn(n: Node)fn focusPrev(): Intfn focusScope(n: Node)Restrict focus traversal to a subtree, as a dialog does while open.
fn focused(): Intfn fontWeightOf(id: Int): Intfn frameDt(): FloatSeconds used by the most recent frame step.
fn hasEffects(): BoolTrue when a live attached node carries an alpha mask or group blur. The app repaints the whole surface for those frames so a style change cannot leave stale pixels behind.
fn hitPortal(px: Int, py: Int): IntPortals paint above the camera, so they hit in screen coordinates.
fn hitTest(px: Int, py: Int): Intfn hitTestCamera(px: Float, py: Float, cam: Camera): IntHit test through a camera: the caller passes screen coordinates.
fn hoverIn(id: Int): BoolTrue when the pointer is on this node or one of its descendants.
fn inPortal(id: Int): BoolTrue when this node is inside a portal subtree.
fn inertAt(id: Int): BoolTrue when this node or any ancestor is inert.
fn isChecked(n: Node): Boolfn isRTL(): Boolfn isVertical(): Boolfn italicOf(id: Int): Boolfn keyDown(n: Node, k: Key, shift: Bool): BoolActivation keys reach the same handler a tap does.
fn keyboardInset(): Intfn labelIdOf(id: Int): Intfn lastDrop(): DragData?The payload of the most recent completed drop, or null.
fn lastDropTarget(): IntThe node that handled the most recent completed drop, or -1.
fn lastTapX(): FloatX of the most recent tap.
fn lastTapY(): FloatY of the most recent tap.
fn layout(root: Node, width: Int)One measure pass and one place pass. Widths flow down, heights up.
fn layoutConstrained(root: Node, width: Int, height: Int, c: Constraints)Lay out inside a viewport with an explicit constraint object.
fn layoutIn(root: Node, width: Int, height: Int)Layout with a height budget, so a root can fill the window.
fn len(): Intfn letterSpacingOf(id: Int): Floatfn lineHeightOf(id: Int): Floatfn linkAt(x: Int, y: Int): StringThe URL under a screen point, or an empty string.
fn linkRects(id: Int): Array<LinkRect>One rectangle per link span on a text or textbox node.
fn listItem(s: String, onTap: fn(): Void): Nodefn longPressPending(): BoolTrue while a held pointer could still become a long press.
fn longPressed(): BoolTrue for the frame in which a long press fired.
fn maskRadiusOf(n: Node): FloatAlpha mask radius of a node, 0 when it has no mask.
fn measureHits(): Intfn menuItem(s: String, onTap: fn(): Void): Nodefn nameOf(id: Int): Stringfn newNode(r: Role, n: String): Nodefn numberOf(n: Node): Floatfn opacityOf(n: Node): FloatGroup opacity of a node.
fn paintPortals(d: DisplayList, th: Theme)Paint portal subtrees above the tree, clipped to their layer.
fn pinchActive(): BoolTrue while two pointers are tracked for pinch and rotate.
fn pinchRotation(): FloatAngle delta since the second pointer landed, in radians.
fn pinchScale(): FloatCurrent distance divided by the distance when the second pointer landed.
fn pointerCancelId(id: Int): BoolCancel one pointer id, restore its start point, and drop its samples.
fn pointerDown(x: Int, y: Int): BoolRoute a pointer press through the hit test to the same handler a key reaches.
fn pointerDownAt(x: Int, y: Int, id: Int): BoolDispatch a pointer press that already resolved to a node.
fn pointerDownCamera(px: Float, py: Float, cam: Camera): BoolPress through a camera; portals keep screen coordinates.
fn pointerDownId(id: Int, x: Int, y: Int, button: Int): BoolRecord a press for one pointer id. The node under the point becomes the drag owner; pointer zero keeps the legacy activation path.
fn pointerLeave(): BoolCancel every active pointer and clear hover.
fn pointerMove(x: Int, y: Int): BoolTrack hover and an active drag. Returns true when something visible changed.
fn pointerMoveAt(x: Int, y: Int, h: Int): BoolUpdate hover and drag state for a press that already resolved to a node.
fn pointerMoveCamera(px: Float, py: Float, cam: Camera): BoolMove through a camera; portals keep screen coordinates.
fn pointerMoveId(id: Int, x: Int, y: Int): BoolMove one pointer id with velocity disabled.
fn pointerMoveTimed(id: Int, x: Int, y: Int, timeNs: Int): BoolMove one pointer id and add a velocity sample at timeNs.
fn pointerUp(x: Int, y: Int): Boolfn pointerUpId(id: Int, x: Int, y: Int): BoolRelease one pointer id. A started drag ends; a tap keeps phase none.
fn preeditOf(n: Node): Stringfn presenceAnimating(): BoolTrue while any presence is still moving toward its target.
fn presenceProgressOf(k: String): FloatCurrent eased opacity for a keyed presence, or 1 when it is unknown.
fn presenceValue(k: String, show: Bool, duration: Float, curve: Curve): FloatRead or create the keyed presence state and report its current opacity. A new key starts at zero so the first shown frame fades in rather than jumping to full opacity.
fn radio(s: String, selected: Bool, onTap: fn(): Void): Nodefn replaceSelection(n: Node, s: String): BoolReplace the selection of a text box with s.
fn resetMeasureStats()fn roleNameOf(id: Int): Stringfn rootId(): Intfn safeBottom(): Intfn safeLeft(): Intfn safeRight(): Intfn safeTop(): Intfn scrollAt(x: Int, y: Int, dy: Float): BoolScroll the nearest scrollable ancestor of the node under the point. If the point is just outside the list, fall back to the last list that scrolled, then to any scrollable node containing the point.
fn scrollAtCamera(px: Float, py: Float, dy: Float, cam: Camera): BoolWheel through a camera; portals scroll in screen coordinates.
fn scrollFling(n: Node, velocity: Float): BoolStart a friction fling from the present offset.
fn scrollForKey(k: String): FloatScroll offset of a keyed node from the previous frame.
fn scrollMaxOf(n: Node): Floatfn scrollOf(n: Node): Floatfn scrollOverscrollOf(n: Node): FloatCompressed distance past a bound: negative above the top, positive below the end.
fn scrollVelocityOf(n: Node): FloatVelocity of an in-flight fling, in pixels per second.
fn selectAllText(n: Node): Boolfn selectedText(n: Node): StringThe selected text of a text box, or an empty string.
fn setAbsolute(id: Int, on: Bool)fn setAccent(id: Int, on: Bool)fn setAlignSelf(id: Int, a: Align)fn setAspectRatio(id: Int, r: Float)fn setAutoMargin(id: Int, on: Bool)fn setBlend(id: Int, m: Int)fn setBlurSigma(id: Int, sigma: Float)fn setBottom(id: Int, n: Int)fn setBusy(id: Int, on: Bool)fn setChecked(n: Node, v: Bool)The checked state of a toggle, radio, or checkbox.
fn setClip(id: Int, on: Bool)fn setClipRound(id: Int, radius: Float)fn setColumns(id: Int, n: Int)fn setConstraints(id: Int, c: Constraints)fn setControlsId(id: Int, n: Int)fn setCrossAlign(id: Int, a: Align)fn setCursorHandler(cb: fn(Int): Void)Handler called with the cursor shape id when it changes.
fn setDensity(d: Float)Device pixel ratio hint. Layout stays in logical units.
fn setDescribedById(id: Int, n: Int)fn setDescription(id: Int, s: String)fn setDisabled(id: Int, on: Bool)fn setDraggable(id: Int, kind: String, text: String)fn setDropTarget(id: Int, kinds: String, cb: fn(DragData): Void)fn setElevation(id: Int, e: ElevationToken)fn setExpanded(id: Int, n: Int)fn setFixedHeight(id: Int, h: Int)fn setFixedWidth(id: Int, w: Int)fn setFontWeight(id: Int, weight: Int)CSS weight for this node's text, 100 to 900.
fn setFrameDt(dt: Float)Store the frame delta that presence transitions use on the next frame.
fn setGap(id: Int, n: Int)fn setGapPercent(id: Int, p: Float)fn setGradient(id: Int, on: Bool)fn setGrow(id: Int, f: Float)fn setIdealHeight(id: Int, h: Int)fn setIdealWidth(id: Int, w: Int)fn setImage(id: Int, png: ByteBuffer)fn setImageFit(id: Int, f: ImageFit)fn setImageIntrinsic(id: Int, w: Int, h: Int)fn setInert(id: Int, on: Bool)fn setInvalid(id: Int, n: Int)fn setItalic(id: Int, on: Bool)fn setKey(id: Int, k: String)fn setKeyboardInset(bottom: Int)The soft-keyboard inset, added to the bottom safe area.
fn setLabelId(id: Int, n: Int)fn setLeft(id: Int, n: Int)fn setLetterSpacing(id: Int, f: Float)Extra advance per character, in logical pixels.
fn setLevel(id: Int, n: Int)fn setLineHeight(id: Int, f: Float)Row height as a multiplier of the font size; zero keeps normal spacing.
fn setLinkHandler(cb: fn(String): Void)Handler called once for a completed link click.
fn setLive(id: Int, n: Int)fn setMainAlign(id: Int, a: Align)fn setMargin(id: Int, n: Int)fn setMaskRadius(id: Int, radius: Float)fn setMaxHeight(id: Int, h: Int)fn setMaxWidth(id: Int, w: Int)fn setMinHeight(id: Int, h: Int)fn setMinWidth(id: Int, w: Int)fn setNumber(id: Int, v: Float)fn setOffsetY(id: Int, y: Float)fn setOpacity(id: Int, f: Float)fn setOrder(id: Int, n: Int)fn setPadding(id: Int, n: Int)fn setPendingKey(k: String)fn setPortal(id: Int, layer: Int)fn setPreedit(n: Node, s: String)Inline IME preedit for a text box. Kept out of the value until commit.
fn setRTL(on: Bool)Right-to-left rows and mirrored start/end alignment.
fn setRaised(id: Int, on: Bool)fn setRange(id: Int, min: Float, max: Float, step: Float)fn setRequired(id: Int, on: Bool)fn setRight(id: Int, n: Int)fn setRound(id: Int, on: Bool)fn setRoving(id: Int, on: Bool)fn setSafeArea(top: Int, right: Int, bottom: Int, left: Int)Screen edges owned by the system, in logical units.
fn setScroll(id: Int, v: Float, max: Float)Place the offset, clamped to 0..max. An exact scroll creates no overscroll.
fn setScrollTo(id: Int, v: Float)fn setSelected(id: Int, on: Bool)fn setShadow(id: Int, color: Int, dx: Float, dy: Float, blur: Float, radius: Float)fn setShrink(id: Int, f: Float)fn setSizeMode(id: Int, n: Int)fn setText(n: Node, v: String): BoolApply typed text and notify the field's handler.
fn setTextAlign(id: Int, a: Align)fn setTextEngine(e: TextEngine)Replace the text backend. Called once by the app before the first view.
fn setTextMaxLines(id: Int, n: Int)fn setTextScale(f: Float)Dynamic type multiplier for every text role.
fn setTextSize(id: Int, px: Int)fn setTextSpans(id: Int, spans: Array<TextSpan>)Inline style spans for this node's text.
fn setTextValue(n: Node, s: String): BoolReplace a text box value as a screen reader would.
fn setTextWrap(id: Int, on: Bool)fn setTheme(th: Theme)Point this tree at the theme that supplies its token tables. Type tokens are read during layout, so a theme swap bumps the measure version.
fn setTone(id: Int, t: ButtonTone)fn setTooltip(id: Int, s: String)fn setTop(id: Int, n: Int)fn setValue(n: Node, v: String)The current value of a text field or slider, for the semantic tree.
fn setWritingMode(m: WritingMode)fn setZIndex(id: Int, z: Int)fn shadowBlurOf(n: Node): Floatfn shadowColorOf(n: Node): IntShadow color lane of a node, 0 when it has no shadow.
fn shadowDxOf(n: Node): Floatfn shadowDyOf(n: Node): Floatfn shadowRadiusOf(n: Node): Floatfn slider(s: String): Nodefn sliderValue(s: String, v: Float, onChange: fn(Float): Void): Nodefn snapshot(): StringOne line per node in tree order, for snapshots and the inspector.
fn space(token: SpaceToken): Intfn stepGestures(dt: Float)Advance time-driven gestures by one frame. Long press accumulates while a pointer stays inside the slop and fires once at 500 ms. Pinch values are refreshed from the live pointer positions.
fn stepScroll(dt: Float): BoolAdvance every active fling and returning overscroll by dt. Returns true
while anything is still moving, so the app keeps requesting frames. A
fling clamps at a bound and stops; no overscroll is created by a fling.
fn stopScroll(n: Node)End a fling and hold the present offset.
fn tab(s: String, selected: Bool, onTap: fn(): Void): Nodefn tap(n: Node): Boolfn tapCount(): IntTaps seen in the latest single or double tap: 0, 1, or 2.
fn textField(v: String, placeholder: String, onChange: fn(String): Void): Nodefn textFieldRich(v: String, placeholder: String, spans: Array<TextSpan>, onChange: fn(String, Array<TextSpan>): Void): NodeA text box that keeps inline spans while editing.
fn textScale(): Floatfn textSpansOf(id: Int): Array<TextSpan>fn theme(): Themefn toggle(s: String): Nodefn toggleWith(s: String, onToggle: fn(): Void): Nodefn typeText(n: Node, s: String): BoolInsert text at the caret, replacing the selection.
fn unnamedInteractive(): Intfn valueOf(n: Node): StringThe seven text roles. The default sizes are the ones the roles used before the token scale existed: 56 display, 20 heading and dialog, 14 body, label and mono, 12 caption. Title has no built-in role yet, so its 28 is free to use.
init(display: TypeStyle, title: TypeStyle, heading: TypeStyle, body: TypeStyle, label: TypeStyle, caption: TypeStyle, mono: TypeStyle)
fields
- bodyV: TypeStyle
- captionV: TypeStyle
- displayV: TypeStyle
- headingV: TypeStyle
- labelV: TypeStyle
- monoV: TypeStyle
- titleV: TypeStyle
fn replace(t: TypeToken, s: TypeStyle): TypeScalefn styleFor(t: TypeToken): TypeStylefn styleForRole(role: Int): TypeStyleMap a paint role id to its type token. Buttons use the label style; headings and dialogs use heading; display uses display; the rest use body.
Size, weight, line height, and tracking for one text role.
init(size: Float, weight: Int, lineHeight: Float, tracking: Float)
fields
- lineHeight: Float
- size: Float
- tracking: Float
- weight: Int
A screen description. Construct one with Page, List, Text, and the
other component functions; the app mounts it into the retained tree.
init(kind: ViewKind)
fields
- absolutePos: Bool
- accent: Bool
- align: Align
- aspectRatio: Float
- blend: BlendMode
- blurSigma: Float
- bottom: Int
- buildComponent: fn(): View
- busy: Bool
- buttonSize: ButtonSize
- canvasH: Int
- canvasW: Int
- center: Bool
- checked: Bool
- children: Array<View>
- clip: Bool
- clipRadius: Float
- columns: Int
- component: Int
- controlsId: Int
- describedById: Int
- description: String
- dragKind: String
- dragText: String
- dropKinds: String
- elevation: ElevationToken
- expanded: Int
- fontWeight: Int
- gap: Int
- gradient: Bool
- grow: Float
- height: Int
- horizontal: Bool
- image: ByteBuffer
- imageFit: ImageFit
- imageH: Int
- imageLabel: String
- imageW: Int
- invalid: Int
- italic: Bool
- key: String
- kind: ViewKind
- labelId: Int
- left: Int
- letterSpacing: Float
- level: Int
- lineHeight: Float
- live: Int
- maskRadius: Float
- maxWidth: Int
- mountCb: fn(Tree, Node): Void
- name: String
- onChange: fn(Float): Void
- onDrop: fn(DragData): Void
- onRichText: fn(String, Array<TextSpan>): Void
- onTap: fn(): Void
- onText: fn(String): Void
- onToggle: fn(): Void
- opacity: Float
- owner: GenRef<Reactive>?
- padding: Int
- paint: fn(Canvas): Void
- placeholder: String
- portal: Bool
- raised: Bool
- required: Bool
- right: Int
- round: Bool
- selected: Bool
- shadowBlur: Float
- shadowColor: Int
- shadowDx: Float
- shadowDy: Float
- shadowRadius: Float
- show: Bool
- spans: Array<TextSpan>
- text: String
- textSize: Int
- title: String
- tone: ButtonTone
- top: Int
- transition: Transition
- value: Float
- valueMax: Float
- valueMin: Float
- valueStep: Float
- width: Int
- z: Int
fn at(x: Int, y: Int, w: Int, h: Int): Viewfn blend(m: BlendMode): ViewBlend this view's whole group against the backdrop.
fn clipped(): Viewfn draggable(kind: String, text: String): ViewMake this view a drag source carrying a typed payload.
fn dropTarget(kinds: String, cb: fn(DragData): Void): ViewAccept drops of the comma-separated kinds on this view.
fn inset(l: Int, t: Int, r: Int, b: Int): Viewfn keyed(k: String): ViewStable identity for keyed reconciliation.
fn named(n: String): Viewfn onMount(cb: fn(Tree, Node): Void): Viewfn opacity(f: Float): ViewGroup opacity for this view and everything under it.
fn portalToRoot(): Viewfn zIndex(n: Int): ViewThe visible window of a virtual list.
init(node: Node, first: Int, count: Int, offset: Float)
fields
- count: Int
- first: Int
- node: Node
- offset: Float
A window-to-thumbnail morph built on matched geometry.
init(windowX: Float, windowY: Float, windowW: Float, windowH: Float)
fields
- match: Match
- openV: Bool
fn done(): Boolfn enter(thumbX: Float, thumbY: Float, thumbW: Float, thumbH: Float)Morph from a window rectangle to an overview thumbnail.
fn h(): Floatfn leave(windowX: Float, windowY: Float, windowW: Float, windowH: Float)Morph back to the window rectangle.
fn progress(): Floatfn step(dt: Float): Floatfn swapped(): BoolTrue once the thumbnail content should replace the window content.
fn w(): Floatfn x(): Floatfn y(): Float- dismiss
- setValue
- tap
- toggle
- baseline
- center
- end
- start
- stretch
- darken
- difference
- exclusion
- lighten
- multiply
- normal
- overlay
- plus
- screen
- lg
- md
- sm
- accent
- danger
- ghost
- neutral
- displayP3
- linear
- srgb
- cubic
- linear
- steps
- level0
- level1
- level2
- level3
- level4
- level5
- cursive
- emoji
- fantasy
- math
- mono
- sans
- serif
- system
- uiMono
- uiRounded
- uiSans
- uiSerif
- both
- horizontal
- none
- vertical
- contain
- cover
- fill
- none
- scaleDown
- backspace
- delete
- down
- end
- enter
- escape
- home
- left
- pageDown
- pageUp
- right
- space
- tab
- up
- curve
- decay
- spring
- fast
- normal
- slow
- spring
- lg
- md
- none
- pill
- sm
- button
- canvas
- checkbox
- column
- dialog
- display
- divider
- grid
- heading
- icon
- image
- link
- list
- listitem
- menubar
- menuitem
- progress
- radio
- radiogroup
- root
- row
- scroll
- section
- slider
- stack
- tab
- text
- textbox
- toggle
- wrap
- lg
- md
- sm
- xl
- xs
- xxl
- both
- end
- none
- start
- butt
- round
- square
- bevel
- miter
- round
- both
- none
- strikethrough
- underline
- body
- caption
- display
- heading
- label
- mono
- title
- buttonKind
- canvasKind
- cardKind
- checkboxKind
- componentKind
- crossfadeKind
- displayKind
- dividerKind
- gridKind
- headerKind
- headingKind
- imageKind
- listKind
- listRowKind
- overlayKind
- pageKind
- presenceKind
- progressKind
- richFieldKind
- scrollKind
- sectionKind
- sliderKind
- spacerKind
- stackKind
- textFieldKind
- textKind
- toolbarKind
- horizontal
- vertical
Functions
fn rgba(r: Int, g: Int, b: Int, a: Int): Intfn rubberBand(offset: Float, dimension: Float, constant: Float): FloatDamp an overscroll offset past a bound. constant is usually 0.55.
fn rubberBandInverse(offset: Float, dimension: Float, constant: Float): FloatInvert rubberBand so dragging back through the bound stays continuous.