npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@pilates/core

v1.0.0-rc.1

Published

Headless flex layout engine for terminal UIs. Pure TypeScript, zero dependencies.

Downloads

209

Readme

@pilates/core

Headless flex layout engine for terminal UIs. Imperative Node API, integer cell coordinates, terminal-correct text measurement. Pure TypeScript, zero runtime dependencies.

@pilates/core is what you get when you take Yoga's flex algorithm, rebuild it for the terminal (integer cells, CJK / emoji / wide-char awareness, ANSI escape passthrough), and unbundle it from any UI framework. Use it directly, or wrap it in React, Vue, Svelte, or anything else.

Install

npm install @pilates/core

Quick start

import { Node, Edge } from '@pilates/core';

const root = Node.create();
root.setFlexDirection('row');
root.setWidth(80);
root.setHeight(24);
root.setPadding(Edge.All, 1);

const main = Node.create();
main.setFlex(1);
const sidebar = Node.create();
sidebar.setWidth(20);

root.insertChild(main, 0);
root.insertChild(sidebar, 1);

root.calculateLayout();

main.getComputedLayout();    // { left:1, top:1, width:57, height:22 }
sidebar.getComputedLayout(); // { left:58, top:1, width:20, height:22 }

Style API

Setters mirror Yoga / CSS Flexbox semantics. All values are in terminal cells.

| Category | Setters | |---|---| | Direction | setFlexDirection, setFlexWrap | | Sizing | setWidth, setHeight, setMinWidth, setMinHeight, setMaxWidth, setMaxHeight | | Flex | setFlex (shorthand), setFlexGrow, setFlexShrink, setFlexBasis | | Spacing | setPadding(edge, n), setMargin(edge, n), setGap('row' \| 'column', n) | | Alignment | setJustifyContent, setAlignItems, setAlignSelf, setAlignContent | | Position | setPositionType('relative' \| 'absolute'), setPosition(edge, n) | | Visibility | setDisplay('flex' \| 'none') |

Edge is Top / Right / Bottom / Left / Horizontal / Vertical / All.

Text measurement

import { stringWidth, cellWidth, graphemes, stripAnsi } from '@pilates/core';

stringWidth('hello');      // 5
stringWidth('你好');        // 4 (each CJK char is 2 cells)
stringWidth('🔥');         // 2
stringWidth('👨‍👩‍👧');     // 2 (ZWJ family is one grapheme)
stringWidth('🇯🇵');        // 2 (regional indicator pair = flag)
stringWidth('\x1b[31mred\x1b[0m'); // 3 (ANSI stripped)

Driven by the latest Unicode UCD data: East Asian Width, Emoji Presentation, Grapheme Break Property, Default Ignorable. No runtime fetch — tables are generated at build time and shipped with the package.

Custom text measurement (measure functions)

import { Node, MeasureMode } from '@pilates/core';

const text = Node.create();
text.setMeasureFunc((width, widthMode, height, heightMode) => {
  // Compute the natural width / height of the leaf's content.
  return { width: stringWidth('Hello'), height: 1 };
});

Status

Release candidate (1.0.0-rc.1). The full v1 surface is implemented and verified cell-for-cell against yoga-layout (Meta's reference WASM build).

Out of v1: aspectRatio, RTL/LTR direction inheritance, baseline alignment.

License

MIT