Documentation menu

API reference

Each package's page lists everything it exports, entry point by entry point: the declaration as written in the source (function bodies left out) and its documentation comment. The pages are generated from the packages this site is built with, every time it's built, so they can't drift from the code.

Writing code? Start from working code, not from the reference. Recipes has a task list with filters and a signup form, with their tests, and Forms opens with a complete validated form. Adapt the closest one and check it; come here to look up a name an example or a compiler error shows you. Most of the types are inferred, so you rarely write them yourself.

Package What's in it
@gyral/core define, commands, subscriptions, stores, forms, the view layer; Vite, ESLint
@gyral/http get, request, submitForm, the http driver; fakeHttp for tests
@gyral/router routes, listen, navigate, setHead, makeRouter
@gyral/time delay, debounce, every
@gyral/ssr renderPage, formAction, CSP; static generation, Node adapter, dev server
@gyral/testing step, run, mount, parse, fake drivers, virtual time, mountSsr
@gyral/devtools mountDevtools and the panel

@gyral/mcp (an MCP server for coding agents) and create-gyral (the app scaffolder) aren't in this reference; Packages describes them.

Reading the reference

  • Types are the contract. A component is define<State, Msg, Props, Output>()(tag, spec); ComponentSpec in @gyral/core describes every field of spec.
  • Helper types are exported. Reducer, Variant, ParseResult and StandardSchemaV1 (type-only) are the types Update, IntentParser and the form helpers are built from, so a reducer or parser written outside a spec can be typed without copying Gyral's definitions.
  • Functions return data. Command helpers such as get, delay and navigate return a Command, which does nothing until a reducer returns it.
  • The view layer is Gyral's own. html, css, each, keyed, raw, defineHook and nothing are documented with the rest of @gyral/core; @gyral/core/vite is the preset and @gyral/core/eslint the template rules. Server rendering is @gyral/ssr.

The guides explain how the pieces fit together: start with Components.