Nova · guides
How to do things with Nova.
Each guide is a file you can run, set in the theatre’s world. What it prints is what the installed package printed.
First steps.
One action, with a button whose label is bound to the action’s data. The shell is sent a press, and the file prints the tree nova made of it.
pnpm add @niscorp/nova @niscorp/prism @niscorp/strata zodnpx tsx first.mtsimport { createShell, type ActionDefinition } from '@niscorp/nova';
import { defaultRegistry } from '@niscorp/nova/adapters/tty/components';
const passes: ActionDefinition = {
id: 'passes',
data: { sold: 0 },
triggers: [{ event: 'ui:click', ref: 'sell', do: [{ increment: 'sold' }] }],
layout: { component: 'Button', ref: 'sell', props: { label: 'Sell a pass ({{$.sold}} of 120 sold)' } },
};
const shell = createShell({ canvases: [{ id: 'main' }], registry: defaultRegistry(), actions: { passes } });
const runtime = shell.getRuntime(shell.push('main', 'passes'));
shell.dispatch({ type: 'ui:click', ref: 'sell' });
console.log(runtime?.render());[
{
type: 'component',
name: 'Button',
props: { label: 'Sell a pass (1 of 120 sold)' },
children: [],
ref: 'sell'
}
]The label reads from the action’s data, and the press changed it: nothing here is a handler. defaultRegistry() is the terminal kit, which needs no browser. In an app the registry is your own components.
Then, one at a time.
Each is a file of its own and adds one thing. Read them in order, or go to the one you need.