@ripl/node ​
The Node.js entry point for Ripl: renders scenes and charts to a terminal with no browser and no DOM emulation.
Features ​
- Platform bindings on import — importing the package registers frame scheduling,
performance.now, a device pixel ratio of 1, default drawing state, text measurement and element stubs, so@ripl/coreruns off-browser without a DOM shim. - Re-exports
@ripl/coreand@ripl/terminal— one import gives you the elements, scene, renderer and the terminal context together. createTerminalOutput()— aprocess.stdout-backedTerminalOutput. Resize subscribers are multiplexed behind a singleSIGWINCHhandler, so ten scenes do not trip Node'sMaxListenersExceededWarning.- Terminal-accurate text metrics — measurement matches what the terminal actually paints (one braille cell per character, scaled by the requested font size), so a box does not jump between the first layout pass and the first frame.
- Unref'd frame timer — the render loop never keeps an otherwise-idle process alive.
- Charts included —
@ripl/chartsdraws through the sameContext, so every chart type works from a script.
Installation ​
bash
# npm
npm install @ripl/node
# yarn
yarn add @ripl/node
# pnpm
pnpm add @ripl/node@ripl/core and @ripl/terminal arrive as dependencies and are re-exported, so this is the only package a terminal project installs. Add @ripl/charts for charts.
Quick start ​
typescript
import {
createCircle,
createContext,
createTerminalOutput,
} from '@ripl/node';
const context = createContext(createTerminalOutput(), {
logicalWidth: 800,
logicalHeight: 600,
});
createCircle({
stroke: '#38bdf8',
lineWidth: 3,
cx: 400,
cy: 300,
radius: 150,
}).render(context);Key API ​
| Export | What it does |
|---|---|
createTerminalOutput | A TerminalOutput backed by process.stdout |
createContext | The terminal context, re-exported from @ripl/terminal |
createScene / createRenderer | The scene graph and render loop, re-exported from @ripl/core |
Related packages ​
@ripl/terminal— the braille/ANSI rendering context itself@ripl/core— the elements, scene graph and animation@ripl/charts— 25 chart types, renderable from a Node script
Documentation ​
Guides and the full API reference are at ripl.run/docs/core/contexts/node.