Documentation Index
Fetch the complete documentation index at: https://mintlify.com/open-pencil/open-pencil/llms.txt
Use this file to discover all available pages before exploring further.
Core API Overview
The@open-pencil/core package provides the core scene graph, rendering, layout, and Figma-compatible API for OpenPencil.
Installation
Key Modules
SceneGraph
Central data structure for the document tree. Nodes stored in a flatMap<string, SceneNode> with parent-child relationships via parentIndex references.
Learn more →
SkiaRenderer
CanvasKit-based (Skia WASM) renderer. Renders scene graph to WebGL surface with viewport culling, picture caching, and overlay support. Learn more →Layout (Yoga)
Flexbox layout engine using Yoga WASM. Computes auto-layout (Figma-compatible) for frames withlayoutMode !== 'NONE'.
Learn more →
FigmaAPI
Figma Plugin API-compatible interface for scripting and tools. WrapsSceneGraph with a proxy-based API matching figma.* global.
Learn more →
Architecture
- Zero DOM dependencies: Runs headless in Node.js/Bun
- Flat node storage:
Map<string, SceneNode>for O(1) lookups - Immutable-style updates:
graph.updateNode(id, changes)invalidates caches - Picture caching: Pre-render nodes with effects/shadows, skip re-render on pan/zoom
Usage Example
Type Definitions
Next Steps
- SceneGraph API - Node tree, variables, instances
- Renderer API - Rendering, overlays, culling
- Layout API - Auto-layout computation
- FigmaAPI - Figma-compatible scripting interface