@coolms/document-engine
v0.1.0-alpha.2
Published
Framework-agnostic vanilla TypeScript document layout engine: OOXML model, deterministic text measurement from font files, and pagination with reflow. Zero runtime dependencies — the arithmetic is ours, so the browser and the server agree by construction.
Downloads
23
Readme
@coolms/document-engine
Framework-agnostic vanilla TypeScript document layout engine: OOXML model, deterministic text measurement from font files, and pagination with reflow. Zero runtime dependencies — the arithmetic is ours, so the browser and the server agree by construction.
Why it has no dependencies
The engine decides where a line breaks and where a page ends. If that arithmetic came from a library, the browser and the server would each get whatever version they resolved, and a document would paginate one way in the editor and another way in the PDF. Owning the arithmetic is what makes the two agree by construction, so the absence of dependencies is the feature rather than an economy.
Text measurement reads the font files in assets/fonts directly -- the metrics
come from the same faces the renderer uses, not from a table that can drift away
from them.
Install
npm install @coolms/document-engineimport { ... } from '@coolms/document-engine';Scripts
| | |
|---|---|
| npm run build | tsc -p tsconfig.build.json |
| npm run test | vitest run |
| npm run test:watch | vitest |
| npm run typecheck | tsc --noEmit |
| npm run audit:claims | node tools/audit-claims.mjs |
Requirements
Node >=20. No runtime dependencies; TypeScript and vitest are dev-only.
Branches
develop is the default and where work lands; main carries releases. The package is a pre-release and carries no compatibility promise.
