[ DOCS ] /docs/sdk
SDK reference
The functions and types a script can import. This reference is generated when the site is built from the declaration files (.eith) in /eitri/sdk/, the same files the console's Docs tab shows, so it always matches what the console offers.
Modules#
| Import | What it is for | Functions |
|---|---|---|
| site | The page, its content and the actions, events and data scripts plug into. | 13 |
| site/theme | The look: accent colour, weather, grid, glow and screen effects. | 11 |
| site/fx | One-shot effects: glitch, shake, flash, sparks, scan, decode and typeout. | 7 |
| site/ui | Toasts, the banner, and prompts that use the command palette. | 5 |
| site/keys | Key bindings, sequences and modes, in the style of rex.bind. | 5 |
| site/time | Timers: after, every and cancel. | 3 |
| site/sound | Small synthesized sounds. | 3 |
| card | Draw an SVG card from a GitHub profile with canvas-style calls. | 24 |
site and its submodules are for scripts in the console. card is for scripts in the card studio and the card API; the two runtimes do not share modules.
Reading a declaration#
pub fn name(a: T) -> Ris a function with typed parameters and a return type. Most of the SDK returnsvoid: calling it asks the page to do something.[]Tis an array ofT;?Tis aTornull;fn(A) -> Ris a function value, which you pass as a lambda.pub structis a record you build withmodule.Name { field: value }; every field is required.pub enumlists the cases you write as.Case.pub let name: Tis a value the host provides, such assite.projects.- A function marked written in Eitri (a few in
card) has a body in the file, not in the host; only its signature is shown here.
How calls reach the page#
A call such as theme.hue(150) does not change the page by itself. The runtime records it, and when the script (or a callback) finishes without a fault, the site applies all the recorded calls together, clamping every value to its range. A script that faults part-way through its top level changes nothing. The numbers each module accepts, and the limits on counts and lengths, are listed on its page.