API reference

Every public symbol, with the signature the compiler emitted.

Generated from packages/*/dist/**/*.d.ts — the type declarations npm run build writes and an adopter's editor reads — so a signature here is the one you will get, and the prose under it is the comment above it in the source.

544 exported names across 9 packages — 527 of them distinct, because VERSION is exported by every package — cross-checked against .lattice/kit.json: the build fails if the manifest and the built declarations disagree in either direction. An agent should read /api.json rather than this page.

The budgets it is held to
statements covered90% per package, 100% on everything in core
gzipped per package12 kB, with two declared overrides: input at 16 kB, draw at 12.5 kB
frame budget8 ms. The direct draw path spends 2.14 ms of it on 400 sprites of 42 ops — 27%, measured, with no sprite bitmap cache anywhere in drawdocs/PERFORMANCE.md:318 — 400 sprites x 42 ops, dpr 3: 2.14 ms mean, 2.24 ms p99, 27% of the budget

The nine packages

@latticekit/corelayer 0 Deterministic primitives. Seeded randomness, noise, math, easing, typed events, pools, formatting. 100 symbols · 12 modules · 7.40 kB @latticekit/audiolayer 1 Sound without assets: WebAudio synthesis from declarative sound definitions, with voice limiting, buses and a music sequencer. 35 symbols · 6 modules · 7.76 kB @latticekit/isolayer 1 Isometric space: the projection, the camera, depth sorting, tile maps, footprints, hit-testing, and grid pathfinding. 80 symbols · 10 modules · 11.47 kB @latticekit/looplayer 1 Time. A wall-clock game loop with fixed-step simulation and interpolated rendering, plus scheduling, tweens and frame statistics. 38 symbols · 9 modules · 6.57 kB @latticekit/persistlayer 1 Saves that survive: versioned state, an explicit migration chain, pluggable storage, debounced writes and integrity checks. 49 symbols · 7 modules · 5.79 kB @latticekit/simlayer 1 Idle-economy mathematics in closed form: cost curves, the flow integrator, offline accrual, and capacity gating. 50 symbols · 10 modules · 7.58 kB @latticekit/drawlayer 2 The rendering layer: a Surface interface with a Canvas2D backend, color derivation, and the isometric solid kit that makes procedural art read as designed. 100 symbols · 13 modules · 12.33 kB @latticekit/inputlayer 2 Normalized input: pointer, touch and keyboard into one per-tick sample stream, plus gestures, an action map, a camera controller, and the recorded log a replay is driven from. 44 symbols · 17 modules · 15.39 kB @latticekit/uilayer 3 DOM overlay primitives — a declarative element builder, panels, toasts, number rolls, and thumbnails rendered from the draw kit. Deliberately not a framework. 48 symbols · 10 modules · 8.72 kB

Find a symbol

Every exported name in the kit, in one list. / focuses the box, Enter opens the first match.

544/544

  • PoolOptionsinterfacecoreHow a pool builds, resets and bounds the instances it hands out.
  • TAUconstcoreFull turn in radians.
  • DisposertypecoreUndo one thing.
  • EasingtypecoreA curve from normalized time to normalized progress.
  • expectFinitefunctioncoreReject NaN and both infinities.
  • RngSnapshotinterfacecoreA serialisable capture of an Rng's full internal state.
  • EPSILONconstcoreThe kit's default comparison tolerance: 1e-9.
  • EasingNametypecoreThe name of a built-in curve.
  • COMPACT_SUFFIXESconstcoreThe magnitude ladder: ['', 'K', 'M', 'B', 'T', 'Qa', 'Qi', 'Sx', 'Sp', 'Oc'].
  • EmitterclasscoreA typed synchronous emitter.
  • clampfunctioncoreConstrain value to [min, max].
  • expectIntfunctioncoreReject anything that is not a whole number, including NaN and the infinities.
  • ScopeinterfacecoreA teardown tree.
  • noise2functioncore2D gradient noise in [-1, 1].
  • RngclasscoreOne deterministic random stream (mulberry32).
  • linearconstcoreIdentity.
  • mix32functioncoremurmurhash3's 32-bit finaliser (fmix32) — an avalanche bijection over uint32.
  • clamp01functioncoreclamp(value, 0, 1).
  • quadInconstcoreAccelerates from rest.
  • expectRangefunctioncoreInclusive on both ends: min <= value <= max.
  • EpochMillistypecoreMilliseconds since the Unix epoch — wall-clock calendar time, as Date.now() returns it.
  • quadOutconstcoreDecelerates into rest.
  • quadInOutconstcoreSymmetric ease-in-out.
  • noise3functioncore3D gradient noise in [-1, 1].
  • cubicInconstcoreAccelerates harder than quadIn.
  • PoolclasscoreA fixed-shape allocator for one type of object.
  • lerpfunctioncoreLinear interpolation, in the precise form (1 - t) a + t b.
  • cubicOutconstcoreDecelerates harder than quadOut, and the most-reached-for curve in the kit: most of the motion…
  • cubicInOutconstcoreSymmetric cubic ease-in-out.
  • fmtCompactfunctioncoreCompact magnitude: 12500 → '12.5K'.
  • expectIndexfunctioncoreAn integer index in [0, length) — the half-open interval arrays actually use.
  • hashStringfunctioncoreDeterministic 32-bit hash of a string (xmur3-style mixing, fmix32 finalise).
  • MonotonicMillistypecoreMilliseconds from an arbitrary origin — monotonic time, as performance.now() returns it.
  • quartOutconstcoreDecelerates harder still — the "expensive" feel for a panel that slides in.
  • inverseLerpfunctioncoreWhere value sits between a and b, as a fraction.
  • fmtSignedfunctioncoreCompact magnitude with an explicit sign on positives: '+12.5K'.
  • expectNonEmptyfunctioncoreReject an empty array, returning it otherwise.
  • NowtypecoreThe calendar: the game's single wall-clock reading, injected.
  • fbm2functioncoreFractal Brownian motion: octaves layers of noise2, each at twice the frequency and gain times t…
  • backInconstcorePulls back below 0 before moving.
  • remapfunctioncoreMove value from one range to another: inverseLerp then lerp, unclamped.
  • fmtIntegerfunctioncoreGrouped integer: 1234567 → '1,234,567'.
  • hashNumberfunctioncoreFold an arbitrary finite number into a uint32 without discarding its high bits.
  • Vec2interfacecoreA mutable 2D point — the storage, scratch and output type of the whole kit.
  • backOutconstcoreOvershoots past 1 and settles back.
  • MonotonicNowtypecoreThe stopwatch: a monotonic reading, injected.
  • fbm3functioncorefBm over noise3.
  • bounceOutconstcoreFour decaying bounces, piecewise quadratic.
  • smoothstepfunctioncoreHermite smoothstep, clamped to [0, 1].
  • expectSerializablefunctioncoreReject a number that will not survive JSON.stringify — the save-path guard.
  • smoothconstcoresmoothstep(0, 1, t): symmetric, zero derivative at both ends.
  • fmtRatefunctioncoreA per-second rate: '1.2/s'.
  • ReadonlyVec2interfacecoreThe read side.
  • smootherconstcoreKen Perlin's quintic: zero second derivative at both ends as well as the first.
  • isSerializablefunctioncoreThe non-throwing form — the load-path predicate.
  • createScopefunctioncoreBuild an empty scope.
  • modfunctioncoreEuclidean modulo: the result carries the sign of divisor, never of value.
  • hashStepfunctioncoreFold one more value into a running hash.
  • fmtPercentfunctioncore0.075 → '7.5%'.
  • v2functioncoreAllocate a vector.
  • EASINGSconstcoreEvery curve above, keyed by name.
  • v2SetfunctioncoreWrite components into out.
  • DurationStyletypecoreHow fmtDuration renders.
  • wrapfunctioncoreWrap value into the half-open range [min, max).
  • asEpochMillisfunctioncoreBrand a number as calendar time, at the one boundary where a real clock is read — or where a st…
  • expectSafeIntegerfunctioncoreReject a count that has left the exactly-representable integers.
  • v2CopyfunctioncoreCopy a into out.
  • v2Addfunctioncoreout = a + b.
  • reversefunctioncoreRun a curve backwards: reverse(quadIn) is the corresponding out-curve.
  • hashPartsfunctioncoreCombine parts into one uint32, non-commutatively: hashParts('a', 'b') and hashParts('b', 'a') d…
  • v2Subfunctioncoreout = a - b.
  • v2Scalefunctioncoreout = a scalar.
  • moveTowardsfunctioncoreStep at most maxDelta toward target, never overshooting.
  • fmtDurationfunctioncore'2m 30s' (short) or '02:30' (clock).
  • asMonotonicMillisfunctioncoreBrand a number as a monotonic reading.
  • unreachablefunctioncoreExhaustiveness check for a discriminated union.
  • inOutfunctioncoreMirror an in-curve into a symmetric in-out curve: the first half is the curve at double speed a…
  • v2AddScaledfunctioncoreout = a + b scalar — the integration step, without a temporary.
  • v2Lerpfunctioncoreout = (1 - t) a + t b, component-wise and unclamped.
  • v2DotfunctioncoreDot product.
  • dampfunctioncoreFrame-rate-independent exponential smoothing — the correct form of "ease toward target".
  • hash2functioncoreWhite noise from a coordinate pair: a uint32 that is a pure function of (seed, x, y) and nothin…
  • v2CrossfunctioncoreThe z component of the 3D cross product.
  • approxfunctioncoreAbsolute-difference comparison against epsilon (default EPSILON), inclusive.
  • v2LenSqfunctioncoreSquared length.
  • expectObjectfunctioncoreNarrow an unknown to a plain object with string keys.
  • v2LenfunctioncoreLength.
  • hash3functioncoreThe same, over three integers — hash2 plus one hashStep.
  • v2DistSqfunctioncoreSquared distance.
  • v2DistfunctioncoreDistance between two points.
  • expectRecordOfFinitefunctioncoreNarrow an unknown to a plain object whose every value is a finite number.
  • hashBytesfunctioncoreDigest an integer array — a frame buffer, a serialized save, any byte sequence.
  • v2NormalizefunctioncoreUnit vector in the direction of a, or (0, 0) when a has no length.
  • v2PerpfunctioncoreRotate 90° counter-clockwise: (-y, x).
  • toUnitfunctioncoreA uint32 as a float in [0, 1) — exactly hashed / 232, the same normalization Rng.next uses, so…
  • v2ApproxfunctioncoreComponent-wise comparison within epsilon (default EPSILON), inclusive.
  • v2RotatefunctioncoreRotate a counter-clockwise by radians.
  • v2AnglefunctioncoreThe direction of a as an angle in (-PI, PI], measured counter-clockwise from +x.
  • v2FromAnglefunctioncoreBuild a vector of the given length (default 1) pointing at radians.
  • createRngfunctioncoreCreate a stream from a numeric or string seed.
  • WavetypeaudioThe five sources.
  • MixerStateinterfaceaudioThe mixer as a value, versioned because it goes in a save and a save that cannot say what it is…
  • BedLayerinterfaceaudioOne continuous layer of a bed.
  • BusIdtypeaudioThe three buses, fixed and closed.
  • MixerinterfaceaudioThe three buses and master.
  • BusNametypeaudioThe three buses plus the one they all feed.
  • BUS_NAMESconstaudioEvery bus name, in the order the mixer walks them.
  • LOOKAHEAD_SECconstaudioHow far ahead the deck schedules, in seconds.
  • PUMP_INTERVAL_MSconstaudioHow often the deck's own timer pumps, in milliseconds.
  • AudioOptionsinterfaceaudioOptions for createAudio.
  • VERSIONconstaudioThe kit version this package was built as part of.
  • TrackVoiceinterfaceaudioThe instrument a track plays.
  • MAX_VOICESconstaudioHard ceiling on one-shot voices in flight.
  • ATTACK_SECconstaudioFixed attack, in seconds.
  • SEMITONEconstaudioEqual temperament: the twelfth root of two, written out rather than computed.
  • NoteinterfaceaudioA step within the bar, and how far above the bar's root it speaks.
  • BedOptionsinterfaceaudioHow a bed is wired, as opposed to what it sounds like.
  • effectiveGainfunctionaudioWhat the device is actually set to for a bus: the player's level, or zero when muted.
  • TrackinterfaceaudioOne instrument's part.
  • RAMP_SECconstaudioTime constant for every gain change made to an already-running node, in seconds.
  • LayerinterfaceaudioOne oscillator or noise burst inside a sound.
  • BedinterfaceaudioA running bed.
  • SonginterfaceaudioA whole piece, as data.
  • SongProbleminterfaceaudioOne thing wrong with a song.
  • AudiointerfaceaudioThe engine.
  • MusicDeckinterfaceaudioA running deck.
  • SoundDefinterfaceaudioA sound, as a game author writes it.
  • createBedfunctionaudioStand up a bed on an engine.
  • PlayOptionsinterfaceaudioPer-event modulation.
  • validateSongfunctionaudioCheck a song for the faults that make it unlistenable rather than unplayable.
  • VoicePlaninterfaceaudioWhat the engine decided to build, handed to every onScheduled listener — one call per layer.
  • createDeckfunctionaudioStand up a deck on an engine.
  • SoundProbleminterfaceaudioOne thing wrong with one sound, named with the numbers in it.
  • validateSoundsfunctionaudioCheck a sound table for the faults that produce a worse game and no error.
  • createAudiofunctionaudioBuild an engine.
  • FootprintinterfaceisoAn axis-aligned footprint on the ground: w × d tiles with its north corner at (gx, gy).
  • HeightFieldinterfaceisoA tile layer read as terrain height, plus the world pixels one height unit is worth.
  • footprintContainsfunctionisoDoes this footprint cover tile (gx, gy)? Half-open: the far edge is not covered, so two footpri…
  • GridPointinterfaceisoA position in grid space, fractional or whole.
  • AnchorinterfaceisoA durable attachment point: where a thing is in grid space, plus how high above the ground plan…
  • footprintOverlapsfunctionisoDo two footprints share any tile? The whole of a placement-legality check, and half-open on the…
  • TiletypeisoA GridPoint whose components are whole numbers: a tile address.
  • unitsToPxfunctionisoHeight units → world pixels.
  • forEachFootprintTilefunctionisoCall fn once per tile of a footprint, in row-major grid order (gy outer, gx inner).
  • anchorToScreenfunctionisoProject an anchor to a screen point, now, for this camera.
  • TileCosttypeisoMovement cost of entering a tile: 0 (or less) for impassable, otherwise a positive integer weig…
  • STEP_ORTHOconstisoCost of an orthogonal step, in the units TileCost multiplies.
  • TileSourceinterfaceisoAnything that can answer "what is on this tile" with a number.
  • STEP_DIAGconstisoCost of a diagonal step: 14 ≈ 10√2.
  • anchorVisiblefunctionisoIs this anchor within marginPx CSS pixels of the viewport?
  • screenToTilefunctionisoThe tile under a screen point, on flat ground.
  • footprintFlatnessfunctionisoHow far from flat the ground under a footprint is, in world pixels: the largest vertex height m…
  • RectinterfaceisoThe kit's rectangle, in min/max form and carrying no coordinate space of its own.
  • MutableTileSourceinterfaceisoA TileSource that can be written to, and that says when it changed.
  • DIR_DXconstisoUnit grid offsets for direction codes 1..8; index 0 is (0, 0) and means "no route".
  • VERSIONconstisoThe kit version this package was built as part of.
  • DIR_DYconstisoGrid dgy per direction code.
  • CameraOptionsinterfaceisoWhat a camera is allowed to do — the opening value of every policy, none of them baked.
  • TileRangeinterfaceisoA half-open rectangle of tiles: gx0 ≤ gx < gx1, gy0 ≤ gy < gy1.
  • anchorPanfunctionisoStereo pan for a sound made at this anchor: -1 hard left, 0 center, +1 hard right, unclamped be…
  • footprintBasefunctionisoThe height a footprint's base should be drawn at, in world pixels: the maximum vertex height un…
  • pxToUnitsfunctionisoWorld pixels → height units: the inverse of unitsToPx, and the conversion that was being writte…
  • PathOptionsinterfaceisoHow a search is allowed to move, shared by PathFinder and FlowField.
  • footprintAnchorfunctionisoThe Anchor a footprint's label, ring, bubble or confirm control should hang from: the center of…
  • TILE_WconstisoTile width in world pixels.
  • TILE_HconstisoTile depth in world pixels.
  • DepthSorterclassisoAn order over a frame's ground footprints: fed rectangles, hands back a permutation.
  • HALF_WconstisoTILE_W / 2, spelled out because it appears in every projection and the division would otherwise…
  • TileGridOptionsinterfaceisoThe shape of an island, fixed at construction.
  • heightAtfunctionisoHeight in world pixels at a fractional grid position, bilinear between the four vertex values t…
  • HALF_HconstisoTILE_H / 2.
  • screenToTileOnHeightsfunctionisoThe tile under a screen point on a heightfield, or false if the ray leaves the map.
  • CamerainterfaceisoThe transform.
  • gridToWorldXfunctionisogrid → world, x only.
  • VolumeinterfaceisoA rectangular volume in a building's local space: offsets and extents in tiles, elevation and h…
  • gridToWorldYfunctionisogrid → world, y only.
  • gridToWorldfunctionisogrid → world, both axes, written into out.
  • TileGridclassisoA fixed rectangle of tiles in one flat typed array.
  • worldToGridXfunctionisoworld → grid, x only.
  • worldToGridYfunctionisoworld → grid, y only.
  • worldToGridfunctionisoworld → grid, both axes, fractional.
  • boxSilhouettefunctionisoThe screen-space silhouette of one box: six points as [x0,y0, … x5,y5] written into out.
  • worldToTilefunctionisoThe tile containing a world point.
  • worldToTileOnHeightsfunctionisoThe tile whose terrain surface is drawn at a world point, or false if the ray that arrives ther…
  • pointInPolygonfunctionisoEven-odd ray cast against count points packed as x,y pairs.
  • depthOffunctionisoPainter's-algorithm scalar key: larger draws later, i.e.
  • pointInTilefunctionisoIs a screen point inside the tile diamond of (gx, gy)? Two comparisons, no polygon.
  • slopeAtfunctionisoThe steepest rise between any two edge-adjacent corners of tile (gx, gy), in world pixels.
  • tileSourceOffunctionisoA read-only tile source backed by a function — procedural terrain from core.hash2 or core.noise…
  • isEdgeOnfunctionisoDoes a grid-space segment project to a vertical line with no screen width — is it edge-on to th…
  • PathclassisoA route: a polyline through grid space that also knows how long it is.
  • tileDiamondfunctionisoThe four world-space corners of a tile diamond, clockwise from the north vertex, written into o…
  • footprintBoundsfunctionisoThe world-space box of a w × d footprint standing heightPx world pixels tall.
  • tileBoundsfunctionisoThe world box of a whole rectangle of tiles — the value CameraOptions.bounds wants.
  • rectSetfunctionisoSet all four edges at once.
  • rectFromSizefunctionisoFrom a position and a size — the form ui and input think in, and the only place in this package…
  • rectWidthfunctionisoWidth.
  • rectHeightfunctionisoHeight.
  • rectCenterXfunctionisoCenter x.
  • pickSortedfunctionisoWhat the player tapped: the insertion index of the last-painted item whose test returns true, o…
  • rectCenterYfunctionisoCenter y.
  • rectContainsfunctionisoIs the point inside? Half-open on the max edges, so a plane tiled with rectangles assigns every…
  • rectIntersectsfunctionisoDo two rectangles share any area? Touching edges do not count, which is the same half-open conv…
  • rectExpandfunctionisoGrow (or, with a negative margin, shrink) in place.
  • rectUnionfunctionisoout becomes the smallest rectangle containing both.
  • rectMakeEmptyfunctionisoReset to the inverted-infinity rectangle, so a loop of rectUnion accumulates a bounding box cor…
  • pathSamplefunctionisoThe grid position at arc length sPx along the path, written into out.
  • rectIsEmptyfunctionisoTrue when the rectangle encloses no area, including the rectMakeEmpty state and any rectangle w…
  • pathDirAtfunctionisoWhich of the eight compass directions the path is heading in at arc length sPx, as a direction…
  • pathProjectfunctionisoThe arc length of the point on the path nearest to grid position (gx, gy).
  • createCamerafunctionisoBuild a camera.
  • gridToScreenfunctionisogrid → screen, including elevation.
  • pathSimplifyfunctionisoCollapse the staircase: remove collinear runs, then pull the path straight wherever the straigh…
  • PathFinderclassisoA\ over a tile source.
  • FlowFieldclassisoA direction per tile, pointing downhill towards the nearest goal.
  • DisposertypeloopUndo one thing.
  • TweenIdtypeloopOpaque, never reused within a session.
  • TweenOptionsinterfaceloopOptions for Tweens.start.
  • DEFAULT_IDLE_PUMP_MSconstloopPeriod of the non-painting pump, in milliseconds.
  • VERSIONconstloopThe kit version this package was built as part of.
  • ClockinterfaceloopThe host's clock, injected.
  • ReplaySourceinterfaceloopA recorded session, seen from here: a length, inputs addressable by tick, and optional checkpoi…
  • ManualClockinterfaceloopA clock a test owns outright.
  • PumpKindtypeloopWhy a pump happened.
  • TimerIdtypeloopOpaque, never reused within a session, and cheap: a number, not an object.
  • PumptypeloopA callback the loop hands to its frame source.
  • SchedulerinterfaceloopThe read-and-schedule half of a timeline.
  • FrameStatsinterfaceloopLive frame figures.
  • DEFAULT_HZconstloopFixed steps per second when hz is not given.
  • FrameSourceinterfaceloopWhere pumps come from.
  • ReplayOptionsinterfaceloopOptions for replay.
  • manualClockfunctionloopA clock that only moves when a test moves it.
  • FrameHostinterfaceloopJust enough of window to drive a loop.
  • BrowserFramesOptionsinterfaceloopOptions for browserFrames.
  • DEFAULT_MAX_CATCH_UP_MSconstloopHow much real time one pump may spend catching up, in ms.
  • TweensinterfaceloopA bag of running tweens the game steps itself.
  • DEFAULT_BUDGET_MSconstloopA pump costing more than this counts against stats.overBudget.
  • ReplayResultinterfaceloopThe verdict.
  • DEFAULT_WINDOW_MSconstloopHow far back the rolling worst-frame figures look, in ms.
  • createTweensfunctionloopAn empty set of tweens.
  • browserFramesfunctionloopBrowser only.
  • TimelineinterfaceloopA scheduler somebody advances.
  • ManualFramesinterfaceloopA frame source a test drives by hand.
  • replayfunctionloopReplay a recorded session and report the first tick at which this build stopped agreeing with t…
  • DEFAULT_WARMUP_FRAMESconstloopPaint intervals discarded at the start of a run, before FrameStats.worstGapMs begins recording.
  • createTimelinefunctionloopA timeline starting at time zero with nothing scheduled.
  • manualFramesfunctionloopA frame source that does nothing until a test tells it to.
  • DEFAULT_ABSENCE_MSconstloopA gap between paints at or above this is an absence, not a frame.
  • LoopPhasetypeloopWhere an exception came from, for onError.
  • JobinterfaceloopA unit of work that must happen soon, at most once per pump, and never on the paint path — a na…
  • LoopOptionsinterfaceloopOptions for createLoop.
  • LoopinterfaceloopA running (or stopped, or paused) loop.
  • createLoopfunctionloopBuild a loop.
  • StorageLikeinterfacepersistThe shape of localStorage and sessionStorage, structurally, so neither is imported.
  • IncrementtypepersistN + 1, at the type level, so a chain that skips a version does not compile.
  • ListenerTargetinterfacepersistaddEventListener/removeEventListener, structurally, so no DOM type is imported.
  • FlushTargetsinterfacepersistThe two hosts a flush has to be wired to, and nothing else about them.
  • StorageAdapterinterfacepersistWhere a save goes.
  • ChecksumtypepersistA checksum over the exact payload text.
  • EnvelopeinterfacepersistWhat is actually on disk.
  • FailureReasontypepersistEvery way a save can fail to become a state.
  • installFlushTriggersfunctionpersistFlush on the events that actually fire, and return a disposer.
  • webStoragefunctionpersistWraps any StorageLike.
  • browserStoragefunctionpersistlocalStorage if the platform will give it up, memory if it will not.
  • memoryStoragefunctionpersistAn in-process map.
  • ReplayCompatinterfacepersistThe only three fields this package reads out of a recorded input log.
  • RecognizetypepersistHow a version recognizes itself: returns the value typed, or throws.
  • defaultChecksumconstpersisthashString from @latticekit/core, rendered as eight lowercase hex digits.
  • ReadFailureinterfacepersistThe report.
  • MigrationStepinterfacepersistOne rung, for reporting and for tests.
  • MigrationChaininterfacepersistA sealed chain from floor to head with no gaps.
  • VERSIONconstpersistThe kit version this package was built as part of.
  • Digesttypepersist"The same pixel", reduced to a uint32.
  • CheckpointinterfacepersistEight bytes.
  • OpenResultinterfacepersistWhat open() and decode() produce.
  • ReplayLoginterfacepersistA recorded session: a starting stream, an input log, and the digests that make the claim checka…
  • ChainBuilderinterfacepersistThe chain under construction.
  • RecorderOptionsinterfacepersistWhat a recorder needs to know before the first tick.
  • WriteSkiptypepersistWhy a write did not happen.
  • WriteFailureinterfacepersistA write that was attempted and refused by the platform.
  • WriteResultinterfacepersistThe outcome of one write attempt.
  • RecorderinterfacepersistRecords checkpoints, and nothing else.
  • RejectedinterfacepersistA save that could not be read, kept so a bug report can carry it.
  • CanceltypepersistUndo a scheduled callback.
  • migrationsfunctionpersistStart a chain at the oldest version you still support, with the recognizer for that version.
  • RefusaltypepersistWhy a replay was not run.
  • DivergenceinterfacepersistWhere two runs first disagreed, and the bracket the bug is inside.
  • ScheduletypepersistRun fn after afterMs have passed, and hand back a way to cancel it.
  • ReplayVerdictinterfacepersistThe answer.
  • SecondsTimelineinterfacepersistA seconds-based timeline, structurally — loop.real and loop.sim both satisfy it.
  • ReplayVerifierinterfacepersistDrives digest comparisons tick by tick.
  • createRecorderfunctionpersistStart recording checkpoints for a session.
  • scheduleFromfunctionpersistTurn a seconds-based timeline into the millisecond Schedule this package takes.
  • createVerifierfunctionpersistBuild the verifier for a log, against this build's identity and input configuration.
  • StoreStatustypepersistWhat is wrong with this store right now, as a condition rather than a message.
  • StoreOptionsinterfacepersistEverything createStore needs.
  • AutosaveOptionsinterfacepersistHow an Autosave decides when to write.
  • AutosaveinterfacepersistA coalescing write handle bound to one getter.
  • StoreinterfacepersistOne key's worth of saved state, versioned by its chain.
  • inspectfunctionpersistThe envelope only, payload untouched, or null if this is not one.
  • elapsedSincefunctionpersistMilliseconds between the loaded save and now — the offline gap, and the one derived quantity th…
  • createStorefunctionpersistBuild a store for one key.
  • EntityIdtypesimAn identity for a thing in the world — a lamp, a building, a pilgrim with a name.
  • IdSourceinterfacesimThe allocator.
  • PhaseinterfacesimOne piece of a piecewise-constant schedule.
  • StockstypesimA stock vector, keyed by node id.
  • CapacityCurveinterfacesimThe wall's one parameter.
  • createIdSourcefunctionsimStart or restore an allocator.
  • StockVectypesimThe mutable form.
  • CostCurveinterfacesimcost(k) = base · growth^k.
  • CatchUpinterfacesimAn absence, and the schedule that ran during it.
  • FlowinterfacesimThe evaluated rate of every edge, plus the integrator's workspace.
  • mintIdfunctionsimTake the next id.
  • VERSIONconstsimThe kit version this package was built as part of.
  • LedgerinterfacesimA stock vector and the instant it is true at.
  • costOfNextfunctionsimb · r^k — the price of the next single unit.
  • capacityWallfunctionsimThe wall: 1 at or under parity, falling linearly to 0 at blackoutAt times over-draw.
  • OfflineCurveinterfacesimUncapped for uncappedSeconds, softcapped at exponent, flat after flatAfterSeconds.
  • asEntityIdfunctionsimNarrow a number that came back from a save.
  • EdgeScaletypesimA per-edge multiplier, evaluated once per buildFlow and held constant across the integration th…
  • capacitySharefunctionsimThe share: min(1, supply / demand).
  • bulkCostfunctionsimb · r^k · (r^n − 1)/(r − 1) — the price of count more, starting from owned.
  • EdgeSpecinterfacesimOne production edge: d(to)/dt += rate × stock(from), or — with no from — d(to)/dt += rate.
  • solveCrossingfunctionsimThe first instant within [0, horizonSeconds] at which node reaches level, or Infinity if it doe…
  • expectFiniteStocksfunctionsimValidate a stock vector, returning it.
  • createFlowfunctionsimAllocate the workspace for one simulated world.
  • capacityLoadfunctionsimdemand / supply, for the meter — the number a HUD paints amber at 0.8, so that 18 of 20 does no…
  • GateRatiostypesimThe ratios in force, one per declared gate.
  • NO_GATESconstsimFor an economy with no gates.
  • elapsedSecondsfunctionsim(atMs − ledger.atMs) / 1000, clamped at zero.
  • CrossinginterfacesimWhere a crossing landed, in both clocks.
  • buildFlowfunctionsimFold per × scale(stocks) × gateRatio into out.rates.
  • EconomySpecinterfacesimEverything a game declares about its economy.
  • projectfunctionsimIntegrate to an instant without committing, into a caller-owned vector.
  • maxBuyablefunctionsimfloor( log_r( c(r−1)/(b·r^k) + 1 ) ), corrected for float rounding, clamped to cap.
  • offlineCreditfunctionsimCredited seconds for a single contiguous absence.
  • MilestonesinterfacesimAscending thresholds, each multiplying once.
  • EdgeinterfacesimA validated edge, in the package's own order.
  • maxOfflineCreditfunctionsimThe most any absence can ever be worth.
  • advancefunctionsimMove the anchor, crediting creditedSeconds of production.
  • advanceOverfunctionsimAdvance across a piecewise-constant schedule, applying the warp once across the whole span and…
  • integratefunctionsimIntegrate the whole vector forward by seconds, exactly, in one step.
  • milestoneMultiplierfunctionsimThe multiplier from milestone bonuses at an owned count.
  • ratesOffunctionsimdx/dt at this instant — what a HUD prints as "per second".
  • offlineElapsedfunctionsimW⁻¹ — the real elapsed time at which creditedSeconds of credit had accrued.
  • EconomyinterfacesimA validated, frozen production graph.
  • reanchorfunctionsimMove the anchor without crediting anything, in either direction.
  • solveCrossingOverfunctionsimThe same solve as solveCrossing, across a whole schedule: walk the phases, integrate each exact…
  • offlineCreditRatefunctionsimdW/dt — "the next second away is worth this much of a second".
  • defineEconomyfunctionsimValidate a spec and compute its evaluation order.
  • zeroStocksfunctionsimA fresh, fully-populated, all-zero vector, keyed in storage order.
  • degreeOffunctionsimThe degree of node's trajectory in t: the longest path into it, so 0 is constant, 1 is linear a…
  • OpNametypedrawThe nine calls a surface can record.
  • SurfaceKindtypedrawWhich backend a Surface is, for the two places that legitimately need to know: a golden test as…
  • contactShadowfunctiondrawA soft contact shadow under a footprint.
  • StopstypedrawA named, immutable set of slot colors: DAY, DUSK, NIGHT.
  • TargetModetypedrawWhat a render target accumulates.
  • LEVEL_HconstdrawWorld pixels per storey.
  • Canvas2dOptsinterfacedrawHow a screen surface is configured.
  • PALETTE_STEPSconstdrawQuantisation levels for Palette.lerp and lerpPalette.
  • washfunctiondrawA full-viewport wash — dusk tint, brownout, pause dim.
  • PaletteinterfacedrawLive slot state for one frame's worth of drawing, plus the revision any cache keys on.
  • levelsToPxfunctiondrawStoreys → world pixels.
  • RgbatypedrawA color packed as 0xRRGGBBAA in a uint32.
  • VariantinterfacedrawThe instance facts the static art may depend on — and therefore everything that would ever belo…
  • OpinterfacedrawOne recorded call, rounded to three decimal places on the way in.
  • DEFAULT_TEXTconstdrawThe kit's default text run: a system stack, semibold, centered both ways.
  • BlitModetypedrawHow a bitmap lands on what is already there.
  • InktypedrawA color, or the name of a palette slot resolved at draw time.
  • MIN_WALL_TEXT_PXconstdrawBelow this many CSS pixels of wall height, glyphs are mush and wallText draws nothing at all.
  • LightFieldOptsinterfacedrawHow a light field is configured.
  • TextStyleinterfacedrawA text run's appearance, passed per call.
  • VERSIONconstdrawThe kit version this package was built as part of.
  • VARIANT_ZEROconstdrawA finished, powered, unnamed instance.
  • LayerconstdrawThe pass ordinals.
  • rgbafunctiondrawPack four channels.
  • ESTIMATED_ADVANCE_RATIOconstdrawAdvance width per point of font size, used by Surface.measure where there are no fonts.
  • FLAG_POWEREDconstdrawThe instance is connected and running.
  • FLAG_BUILDINGconstdrawThe instance is under construction; progress is meaningful.
  • pxToLevelsfunctiondrawWorld pixels → storeys.
  • FLAG_SELECTEDconstdrawThe player has it selected.
  • wallTextfunctiondrawText painted onto a vertical face, sheared into the isometric plane.
  • RecordingSurfaceinterfacedrawA recording surface, and the extra half of the contract a test reads.
  • FLAG_GHOSTconstdrawIt is a placement preview rather than a real thing.
  • FACE_TOPconstdrawRelative brightness of each visible face.
  • GROUND_LIFTconstdrawThe z-fight ladder, in storeys.
  • FACE_LEFTconstdrawThe +gy face — screen-left, and the lit one.
  • BitmapinterfacedrawAn image the kit rendered itself.
  • GHOST_LIFTconstdrawA placement ghost, above anything painted onto the ground.
  • FACE_RIGHTconstdrawThe +gx face — screen-right, and the shaded one.
  • OffscreenOptsinterfacedrawHow a detached surface is configured.
  • SELECT_LIFTconstdrawA selection rim, above the ghost.
  • LightFieldinterfacedrawThe frame's light, accumulated and composited once.
  • createPalettefunctiondrawBuild a live palette from a stop set.
  • screenTextfunctiondrawUnsheared text at a screen pixel — floating numbers, timers, debug readouts.
  • SolidWriterinterfacedrawThe emitter a game's massing is written against.
  • PASS_NAMESconstdrawPass names in order.
  • SHADE_TINTconstdrawCool target that shadowed surfaces drift toward.
  • RecordingTargetinterfacedrawA recording surface used as a render target: the same log, plus the bitmap handle a blit takes…
  • LIGHT_TINTconstdrawWarm target that lit surfaces drift toward.
  • BoxOptsinterfacedrawEverything a box-shaped solid can be told.
  • isoTerrainfunctiondrawOne terrain tile, drawn on its own four corner heights.
  • PassesinterfacedrawThe game's painting, one callback per pass.
  • SurfaceinterfacedrawEverything a backend must provide.
  • OffscreenSurfaceinterfacedrawA Surface backed by a <canvas> element — both factories in this file return one, the detached t…
  • shadefunctiondrawDerive a face color from a base color — the rule the whole look rests on.
  • createRecordingSurfacefunctiondrawA surface that records draw commands and a digest rather than pixels.
  • outlineOffunctiondrawThe silhouette stroke for a solid: its own hue, very dark, never pure black.
  • withAlphafunctiondrawReplace the alpha channel.
  • extendStopsfunctiondrawA stop set plus a game's own slots.
  • VarstypedrawA flat slot → CSS color bag.
  • isoTilefunctiondrawA single flat tile diamond: terrain, pads, the placement grid.
  • mixfunctiondrawLinear per-channel blend in sRGB bytes, alpha included.
  • cssOffunctiondrawPacked color → a CSS rgb()/rgba() string, memoised.
  • isoPatchfunctiondrawA flat quad lying in the ground plane at height z — solar glass, helipads, gravel.
  • lerpPalettefunctiondrawInterpolate two stop sets into CSS strings — the draw → ui seam.
  • hexOffunctiondrawPacked color → #rrggbb, or #rrggbbaa when it is not opaque.
  • paletteVarsfunctiondrawThe same bag, from whatever a live palette currently is.
  • MassingtypedrawStatic art.
  • BASE_SLOTSconstdrawFull daylight, and the working default: createPalette(BASE_SLOTS) is a game that renders.
  • hexfunctiondrawParse #rgb, #rrggbb or #rrggbbaa into a packed color.
  • DAYconstdrawFull daylight.
  • isoBoxfunctiondrawThe workhorse: an axis-aligned box on the grid.
  • DUSKconstdrawThe middle of the transition, as a stop set a game can hold at.
  • createCanvas2dSurfacefunctiondrawWrap a canvas element.
  • NIGHTconstdrawMidnight.
  • AnimatortypedrawLive art over the static image, every frame.
  • hslfunctiondrawHSL → packed.
  • isoCylinderfunctiondrawAn upright cylinder — cooling towers, tanks, silos.
  • createOffscreenSurfacefunctiondrawA detached surface of a fixed size — the one ui needs for shop thumbnails.
  • renderFramefunctiondrawRun one frame's passes in the fixed order.
  • hueToHexfunctiondrawA brand hue straight to #rrggbb, for the DOM.
  • EmittertypedrawEmissive contribution.
  • SpriteDefinterfacedrawA sprite: a footprint, static art, and two optional live hooks.
  • isoRooffunctiondrawA gabled roof: a prism ridged along the gx axis.
  • defineSpritefunctiondrawIdentity at runtime.
  • isoWallfunctiondrawA rectangle on a vertical face — windows, doors, vents, signage, hazard panels.
  • isoPostfunctiondrawA thin upright post — antennae, lightning rods, flagpoles, pylons.
  • drawSpritefunctiondrawDraw a sprite at a grid position.
  • glowDotfunctiondrawA glowing point: a hard core inside a soft halo — status LEDs, lit windows, strobes.
  • createLightFieldfunctiondrawBuild a light field over a surface.
  • drawGhostfunctiondrawA translucent preview during placement, tinted by legality: the ok slot means it will land, bad…
  • RenderTargetinterfacedrawA Surface that renders into memory and hands back the result.
  • drawFootprintfunctiondrawThe marching-ant footprint rectangle on its own — selection rims, build sites, ranges.
  • PeninterfacedrawA frame's worth of context, so a primitive takes coordinates and not plumbing.
  • spriteVolumefunctiondrawThe sprite's massing as an iso.Volume, in world pixels — the picking half of the seam.
  • spriteHeightPxfunctiondrawThe sprite's total height in world pixels — what DepthSorter.add wants for culling.
  • spriteBoundsfunctiondrawScreen-space bounds of a sprite, into iso's Rect.
  • FrameOptsinterfacedrawWhat a frame needs to start.
  • beginFramefunctiondrawOpen a frame: clear the surface and build the pen every primitive is handed.
  • endFramefunctiondrawClose the frame.
  • subPenfunctiondrawA pen onto a different surface and camera, sharing this one's palette and clock.
  • PointerKindtypeinputWhat the player is touching the game with.
  • HeightFieldinterfaceinputA tile layer read as terrain height, plus the world pixels one height unit is worth.
  • DisposertypeinputUndo one thing.
  • GestureProfileinterfaceinputEvery threshold the recognizer and the camera controller consult.
  • ActionBindingtypeinputOne way of producing an action.
  • GridPointinterfaceinputA position in grid space, fractional or whole.
  • ActionMaptypeinputThe declared map, from which the action names are inferred.
  • GestureNametypeinputThe six things a player can do that this package has a name for.
  • ZoomSourcetypeinputWhat produced a zoom.
  • LOG_VERSIONconstinputThe format version of InputLog.
  • FixedStepinterfaceinputA loop's fixed step, in both units it publishes.
  • InputOptionsinterfaceinputOptions for createInput: the headless ones, plus the things only a browser has.
  • InputRecordinginterfaceinputA running recording.
  • TerraininterfaceinputThe elevation a pointer is resolved against, and how far up the search for it starts.
  • HeadlessInputOptionsinterfaceinputEverything a system needs that is not a browser.
  • RawSampletypeinputThe entire input to the recognizer.
  • CameraControllerinterfaceinputThe gestures-to-camera policy.
  • ReplayCursorinterfaceinputA recorded log, seen the way @latticekit/loop's replay driver sees it.
  • InputScopeinterfaceinputA place bindings are owned.
  • TerrainOptiontypeinputWhat a game says about its ground: a heightfield, or the word 'flat'.
  • Vec2interfaceinputA mutable 2D point — the storage, scratch and output type of the whole kit.
  • GestureBaseinterfaceinputThe fields every gesture carries.
  • VERSIONconstinputThe kit version this package was built as part of.
  • fixedStepfunctioninputBuild a step from a rate, for the callers that have no loop to read one off.
  • createLogfunctioninputAn empty log carrying this system's compatibility triple.
  • DomInputSysteminterfaceinputAn InputSystem bound to an element, which is the only thing a DOM one adds.
  • InputLoginterfaceinputA recorded session's input, and everything needed to know the recording is still valid.
  • recordfunctioninputBegin recording every sample this system receives, plus a marker per tick.
  • DiagnosticCodetypeinputThings this package can detect about its host that are always bugs.
  • DiagnosticinterfaceinputA problem worth a sentence, not a throw.
  • createInputfunctioninputBind a world surface.
  • DiagnosticSinktypeinputWhere a diagnostic goes.
  • TapGestureinterfaceinputA press that stayed put.
  • DragGestureinterfaceinputA press that traveled.
  • ProfileScalartypeinputEvery field of GestureProfile that is a plain number.
  • InputSysteminterfaceinputA recognizer, an action map and a camera controller over one camera.
  • replayfunctioninputFeed a recorded log back in, tick by tick, using the log's own tick indices.
  • DEFAULT_PROFILEconstinputThe defaults, each one defended in the doc comment of its field.
  • ZoomGestureinterfaceinput"Scale the world by scale about this point."
  • ProfileOverridestypeinputWhat a game may override.
  • GestureMapinterfaceinputThe gesture name → event type mapping InputScope.on is typed against.
  • ActionEventinterfaceinputAn action fired.
  • replayCursorfunctioninputA cursor over a log, for @latticekit/loop's replay driver.
  • createHeadlessInputfunctioninputBuild a system with no DOM at all, fed only by InputSystem.submit.
  • RollOptionsinterfaceuiHow a roll behaves.
  • BrandOptionsinterfaceuiHow a brand hue is turned into a color.
  • PanelOptionsinterfaceuiHow a panel behaves.
  • ToastKindtypeuiHow a toast reads.
  • AttrstypeuiAttributes for el.
  • ToastOptionsinterfaceuiHow a toast host behaves.
  • CadenceFntypeuiWork registered on a cadence.
  • ThumbSpecinterfaceuiWhat to paint, and how big.
  • ChildtypeuiA child of el.
  • PalettetypeuiA set of named colors — whatever @latticekit/draw produces from interpolating two palettes by a…
  • DisposertypeuiUndo one thing.
  • PaletteOptionsinterfaceuiHow a palette is namespaced on the root.
  • PanelinterfaceuiAn open-and-closable region of the overlay.
  • RollinterfaceuiA number that eases to its target.
  • ToastHostinterfaceuiA place toasts appear.
  • DisposetypeuiUndo a mount, a subscription or a widget.
  • elfunctionuiBuild an element.
  • LayerNametypeuiThe four layers, bottom to top.
  • OverlayOptionsinterfaceuiHow an overlay is created.
  • ThumbCacheinterfaceuiA bounded, keyed set of painted thumbnails.
  • clearfunctionuiEmpty a node.
  • setBrandfunctionuiRecolour the overlay from a single hue in degrees.
  • rollfunctionuiA number that eases to its target on the paint cadence.
  • setTextfunctionuiWrite text only if it changed, and say whether it did.
  • FloatKindtypeuiHow a floating number reads.
  • ScreenPointinterfaceuiA mutable point, used only as an output parameter.
  • panelfunctionuiA panel bound to an overlay.
  • thumbnailsfunctionuiA bounded thumbnail cache bound to an overlay.
  • AcknowledgeOptionsinterfaceuiWhat an acknowledgement says.
  • FloatOptionsinterfaceuiHow a float host behaves.
  • setTokensfunctionuiSet arbitrary custom properties on the overlay root.
  • VERSIONconstuiThe kit version this package was built as part of.
  • MountOptionsinterfaceuiHow one node joins the overlay.
  • showfunctionuiShow or hide, inline and !important, so it wins.
  • hidefunctionuiHide, inline.
  • toastsfunctionuiA toast host bound to an overlay.
  • FloatHostinterfaceuiA pool of floating numbers.
  • pulsefunctionuiRestart a CSS animation on a node — the "+1" bump on a resource pill.
  • interactivefunctionuiGrant pointer events to this node and its subtree, inline.
  • passthroughfunctionuiTake pointer events away from a subtree of an interactive panel.
  • acknowledgefunctionuiTell the player something that must not be missed, and wait until they say they have seen it.
  • floatsfunctionuiFloating "+120" feedback, in the overlay's bottom layer.
  • applyPalettefunctionuiPush a palette onto the overlay as custom properties, and say whether anything moved.
  • OverlayinterfaceuiThe overlay: a root, four layers, two cadences and a teardown.
  • createOverlayfunctionuiBuild an overlay: a pointer-transparent root, four layers, and two cadences that nothing advanc…
  • DriveninterfaceuiThe shape of a game loop, as this package needs it.
  • drivefunctionuiWire an overlay to a loop: update drives tick, render drives repaint.
  • auditOverlayfunctionuiDev-time audit.

What holds between packages

Claims no single package's suite can check, because each is about two packages agreeing. They live in test/contracts/ and each records how it breaks.

claimbetweenbreaks as
draw must not reorder after iso's sort()iso drawthe tap opens the building behind the one under the finger
draw's stroke traces boxSilhouette's six points in orderiso drawhit-testing and pixels diverge with no test in either package noticing
the tick index starts at 0, increments by one, never skips or repeatsloop input persista replay that reports a confident wrong answer
stepMs is a compatibility constant appearing in recorded sessionsloop persista log recorded at 60Hz replayed at 50Hz diverges for reasons no stack trace shows