
Product
Introducing Repository Access Permissions and Custom Roles
Socket now supports Custom Roles and Repository Access Permissions so organizations can control who can access specific repositories and actions.
Live Demo & Interactive Examples
https://github.com/user-attachments/assets/bd67d28e-1841-474e-8d3c-8a7e76f272ba
DOM-free layout engine for the web. Combines Yoga (flexbox) with Pretext (text measurement) to compute complete UI geometry — positions, sizes, and text line breaks — without ever touching the DOM.
The browser's layout engine is a black box that blocks the main thread. Every getBoundingClientRect() or offsetHeight call triggers synchronous layout reflow. When components independently measure text, each measurement triggers a reflow of the entire document.
Yoga solves box layout (flexbox) in pure JS/WASM, but punts on text — it requires you to supply a MeasureFunction callback externally. Pretext solves text measurement with canvas measureText, but doesn't do box layout. Textura joins them: declare a tree of flex containers and text nodes, get back exact pixel geometry for everything.
This unlocks:
npm install textura
import { init, computeLayout } from 'textura'
// Initialize Yoga WASM (call once)
await init()
// Describe your UI as a tree
const result = computeLayout({
width: 400,
padding: 16,
flexDirection: 'column',
gap: 12,
children: [
{
text: 'Hello World',
font: '24px Inter',
lineHeight: 32,
},
{
flexDirection: 'row',
gap: 8,
children: [
{ width: 80, height: 80 }, // avatar
{
text: 'This is a message that will wrap to multiple lines based on available width.',
font: '16px Inter',
lineHeight: 22,
flexGrow: 1,
},
],
},
],
})
// result is a tree of computed layouts:
// {
// x: 0, y: 0, width: 400, height: ...,
// children: [
// { x: 16, y: 16, width: 368, height: 32, text: 'Hello World', lineCount: 1 },
// { x: 16, y: 60, width: 368, height: ...,
// children: [
// { x: 0, y: 0, width: 80, height: 80 },
// { x: 88, y: 0, width: 280, height: ..., text: '...', lineCount: ... },
// ]
// },
// ]
// }
init(): Promise<void>Initialize the Yoga WASM runtime. Must be called once before computeLayout.
computeLayout(tree, options?): ComputedLayoutCompute layout for a declarative UI tree. Returns positions, sizes, and text metadata for every node.
Options:
width?: number — available width for the rootheight?: number — available height for the rootdirection?: 'ltr' | 'rtl' — text direction (default: 'ltr')Box nodes — flex containers with children:
{
flexDirection: 'row',
gap: 8,
padding: 16,
children: [...]
}
Text nodes — leaf nodes with measured text content:
{
text: 'Hello world',
font: '16px Inter', // canvas font shorthand
lineHeight: 22, // line height in px
whiteSpace: 'pre-wrap', // optional: preserve spaces/tabs/newlines
}
Both node types accept all flexbox properties: flexDirection, flexWrap, justifyContent, alignItems, alignSelf, alignContent, flexGrow, flexShrink, flexBasis, width, height, minWidth, maxWidth, minHeight, maxHeight, padding*, margin*, border*, gap, position, top/right/bottom/left, aspectRatio, overflow, display.
ComputedLayoutinterface ComputedLayout {
x: number
y: number
width: number
height: number
children: ComputedLayout[]
text?: string // present on text nodes
lineCount?: number // present on text nodes
}
clearCache(): voidClear Pretext's internal measurement caches.
destroy(): voidRelease Yoga resources. Mostly useful for tests.
The Textura MCP server gives AI coding agents (Claude Code, Codex) layout vision — compute geometry, detect issues, validate responsive breakpoints, and auto-fix problems. Works with any framework.
One-line install:
claude mcp add textura npx @razroo/textura-mcp
Uninstall:
claude mcp remove textura
Or manually add to .mcp.json (project-level) or ~/.claude/settings.json (global):
{
"mcpServers": {
"textura": {
"command": "npx",
"args": ["-y", "@razroo/textura-mcp"]
}
}
}
To uninstall manually, remove the textura entry from the config file.
Add to your Codex MCP configuration:
{
"mcpServers": {
"textura": {
"command": "npx",
"args": ["-y", "@razroo/textura-mcp"]
}
}
}
To uninstall, remove the textura entry from the config file.
Open Settings → MCP → Add new MCP server, or add to .cursor/mcp.json:
{
"mcpServers": {
"textura": {
"command": "npx",
"args": ["-y", "@razroo/textura-mcp"]
}
}
}
To uninstall, remove the entry from MCP settings.
Add to ~/.codeium/windsurf/mcp_config.json:
{
"mcpServers": {
"textura": {
"command": "npx",
"args": ["-y", "@razroo/textura-mcp"]
}
}
}
To uninstall, remove the entry from the config file.
One-line install:
code --add-mcp '{"name":"textura","command":"npx","args":["-y","@razroo/textura-mcp"]}'
Or add to .vscode/mcp.json:
{
"servers": {
"textura": {
"command": "npx",
"args": ["-y", "@razroo/textura-mcp"]
}
}
}
To uninstall, remove the entry from MCP settings or delete the server from the MCP panel.
Any MCP client that supports stdio transport can use Textura. The server config is:
{
"command": "npx",
"args": ["-y", "@razroo/textura-mcp"]
}
To uninstall, remove the server entry from your client's MCP configuration.
| Tool | What it does |
|---|---|
compute_layout | Compute exact pixel positions and sizes for a layout tree |
analyze_layout | Find text overflow, element overlap, small touch targets, cramped spacing |
validate_responsive | Check a layout at mobile/tablet/desktop/wide in one call |
fix_layout | Auto-fix detected issues, return corrected tree + change descriptions |
You ask the agent to check your layout. The agent reads your component code (React, Vue, Svelte, Tailwind, etc.), translates the layout structure into a Textura tree, and calls the MCP:
// Your component:
<div className="flex flex-col gap-4 p-6">
<h1 className="text-2xl font-bold">Dashboard</h1>
<div className="flex gap-4">
<Card>Revenue: $12.4M</Card>
<Card>Users: 847K</Card>
</div>
</div>
// Agent translates to Textura tree:
{
"flexDirection": "column", "gap": 16, "padding": 24,
"children": [
{ "text": "Dashboard", "font": "700 24px Inter", "lineHeight": 32 },
{ "flexDirection": "row", "gap": 16, "children": [
{ "padding": 16, "children": [{ "text": "Revenue: $12.4M", "font": "16px Inter", "lineHeight": 24 }] },
{ "padding": 16, "children": [{ "text": "Users: 847K", "font": "16px Inter", "lineHeight": 24 }] }
]}
]
}
The MCP returns exact geometry and issues. The agent applies fixes back to your actual code. No browser needed.
computeLayout builds a Yoga node tree from your descriptionprepare() + layout() into Yoga's MeasureFunction — when Yoga asks "how tall is this text at width X?", Pretext answers using canvas-based measurement with cached segment widthsThe text measurement is the key piece: Pretext handles Unicode segmentation, CJK character breaking, Arabic/bidi text, emoji, soft hyphens, and browser-specific quirks — all via Intl.Segmenter and canvas measureText, with 7680/7680 accuracy across Chrome/Safari/Firefox.
OffscreenCanvas in a worker) for text measurementwhite-space: normal, word-break: normal, overflow-wrap: break-word, line-break: autoInter, Helvetica) — system-ui can produce inaccurate measurements on macOSFAQs
DOM-free layout engine combining Yoga flexbox with Pretext text measurement
The npm package textura receives a total of 282 weekly downloads. As such, textura popularity was classified as not popular.
We found that textura demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Product
Socket now supports Custom Roles and Repository Access Permissions so organizations can control who can access specific repositories and actions.

Product
Socket MCP now lets AI assistants review org alerts, investigate threats using the Socket threat feed, and inspect package files in addition to dependency scoring.

Product
Socket Firewall blocks malicious VS Code and Open VSX extensions before install, protecting developers from compromised editor marketplaces.