@paramrig/vector
Vector documents, bindings, geometry and SVG rendering, with explicit browser and export adapters. Drawing and page layout use this same engine.
npm install @paramrig/vector
import { createVectorDocument, createVectorElement } from '@paramrig/vector'
import { createVectorRenderer } from '@paramrig/vector/browser'
const document = createVectorDocument()
document.elements.push(createVectorElement('rectangle', { x: 20, y: 20, width: 100, height: 60 }))
const view = createVectorRenderer({ container: documentHost, document })
await view.ready
const svg = await view.exportSvg()
view.destroy()
The SDK factory does not save anything. The application adds persistence around that same factory. Import/export project helpers retain the existing project format and return import errors and loss notes.
browser accepts a document, controlled parameter values and optional resource resolvers. update returns a promise; wait for it before exporting the updated result. destroy removes only the owned view and fonts and cancels pending image work.
Resource resolvers are supplied by the host. Font requests include the family, weight, purpose (display or outline) and cancellation signal. Return font bytes or null. Image resolvers return self-contained data URLs. No /fonts path or browser storage is assumed by the package. Carried font bytes are usable without a resolver.
Dedicated entries include model, bindings, geometry, svg, project, resources, export and pdf. PNG uses browser canvas. PDF preserves the existing path writer and reports rasterized or skipped elements. Supply its rasterization callback where needed for effects and unsupported PDF primitives.
Node supports contracts, project serialization and bindings. Typography, canvas-dependent geometry and raster exports require a browser; server rendering is not claimed to match browser text layout. React controls and complete editors are not included.
Supported environment and dependencies
| Environment | Dependencies |
|---|---|
| Node for documents and bindings; browser for typography and raster output | Core, Paper.js, OpenType.js and Fontkit |
Run the complete example
Copy the Vector example into a directory of its own. Its README lists the commands and resource setup. It imports only public packages; no repository aliases, editor sources or development dependencies from ParamRig are required.
Choose the boundary
The packages ship ESM JavaScript and TypeScript declarations. A sub-entry selects the code your bundler loads. A separate package changes what npm installs. The complete editor is part of the application; this SDK exposes its engine or controls.
Compare packages · Build a selective application distribution