How zumerlab/snapdom works
SnapDOM captures a rendered DOM subtree into a reusable frozen result, then exposes image, canvas, Blob, and download outputs. Its plugin package extends that result with HTML/context/agent-map exports, document formats, and live recordings; vector export also produces editable artwork and Figma payloads. The core capture stages and major plugin branches are represented, but several plugin internals were not sampled, so their links rely on README capability statements rather than inferred call chains.
Main entry points: snapdom.js Capture API · src/index.js Vector export · src/index.js PDF export · styles.js Style snapshots
Components 23
Capture core
- Capture API
src/api/snapdom.js - Option context
src/core/context.js - DOM capture
src/core/capture.js
Capture preparation
- DOM cloning
src/core/clone.js - Style snapshots
src/modules/styles.js - Font embedding
src/modules/fonts.js - Capture caches
src/core/cache.js
Core outputs
- SVG rendering
src/engines/svg.js - Canvas export
src/exporters/toCanvas.js - File download
src/exporters/download.js
Capture plugins
- HTML export
packages/plugins/html-export.js - Context export
packages/plugins/context-export.js - Agent map
packages/plugins/agent-map.js - GIF recording
packages/plugins/gif-export.js - Video recording
packages/plugins/video-export.js
Document and vector
- PDF export
packages/plugins/pdf/src/index.js - PDF text layer
packages/plugins/pdf/src/text-layer.js - PDF writer
packages/plugins/pdf/src/writer/index.js - Vector export
packages/plugins/vector/src/index.js - Vector collection
packages/plugins/vector/src/collect/box.js - Vector text
packages/plugins/vector/src/collect/text.js - Flat SVG output
packages/plugins/vector/src/emit/svg-flat.js
Other components
- Page caller
Connections 24
- Page caller → Capture API: captures element
README.md - Capture API → Option context: normalizes options
src/api/snapdom.js - Capture API → DOM capture: captures DOM
src/api/snapdom.js - Capture API → DOM cloning: prepares clone
src/api/snapdom.js - Capture API → Style snapshots: embeds styles
src/api/snapdom.js - Capture API → Font embedding: waits for fonts
src/api/snapdom.js - Capture API → SVG rendering: renders capture
src/engines/svg.js - Capture API → Canvas export: exports canvas
src/api/snapdom.js - Capture API → File download: downloads result
src/exporters/download.js - Style snapshots → Capture caches: uses shared cache
src/modules/styles.js - Font embedding → Capture caches: uses shared cache
src/modules/fonts.js - Canvas export → File download: provides raster output
src/exporters/download.js - Capture API → HTML export: offers plugin export
README.md - Capture API → Context export: offers plugin export
README.md - Capture API → Agent map: offers plugin export
README.md - Capture API → GIF recording: records live element
README.md - Capture API → Video recording: records live element
README.md - Capture API → PDF export: offers plugin export
README.md - PDF export → PDF text layer: builds text layer
packages/plugins/pdf/src/index.js - PDF export → PDF writer: writes PDF
packages/plugins/pdf/src/index.js - Capture API → Vector export: offers plugin export
README.md - Vector export → Vector collection: collects geometry
packages/plugins/vector/src/index.js - Vector export → Vector text: collects text
packages/plugins/vector/src/index.js - Vector export → Flat SVG output: emits SVG
packages/plugins/vector/src/index.js