{"_id":"@zumer/snapdom@3.3.7","bugs":{"url":"https://github.com/zumerlab/snapdom/issues"},"dist":{"shasum":"7f94bbfe5c810d0cb230088ab9667dc5d794fd3e","tarball":"http://registry-npm.ywwl.com/@zumer/snapdom/download/@zumer/snapdom-3.3.7.tgz","fileCount":6,"integrity":"sha512-32gUTSVJ8wCRLjJO2FiHhDGq5W6Z8bs7oMdKLF3LnBvsr6DOEEQtshOQ5QIV2hTszhBruo97st1CriS4ytXrOA==","signatures":[{"sig":"MEYCIQD9emQKPAxjCoJBft1s/OGV2BthZvQPNluc1snnaZprwwIhAPhfCp5s6Vi2DOaUwJHKuycKEF/xse+8Xo+YwNROcAXD","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIHG6X3+/jdRukq2/Tp3aQ+oMkJn8mY8oT3jk4/hX0dLUAiADrbmHe7nMXFKyaM8PgA/9yEr/9W7kOXcWE0riIgf89Q=="}],"unpackedSize":626265,"size":210837,"noattachment":false,"key":"/@zumer/snapdom/-/@zumer/snapdom-3.3.7.tgz"},"main":"./dist/snapdom.js","name":"@zumer/snapdom","type":"module","types":"./types/snapdom.d.ts","author":{"name":"Juan Martin Muda"},"module":"./dist/snapdom.mjs","exports":{".":{"types":"./types/snapdom.d.ts","import":"./dist/snapdom.mjs","default":"./dist/snapdom.mjs"},"./plugins":{"types":"./types/snapdom.d.ts","import":"./dist/snapdom.mjs","default":"./dist/snapdom.mjs"},"./package.json":"./package.json"},"funding":{"url":"https://github.com/sponsors/tinchox5","type":"github"},"gitHead":"584ff7bdc82274695f2e7c08f8bee50b005607ce","license":"MIT","scripts":{"bump":"npx @zumerbox/bump && npx @zumerbox/changelog","lint":"eslint src __tests__ --ext .js","site":"npm run compile && node scripts/serve-site.mjs","test":"npm run lint && npm run test:types && npm run test:release-checks && npm run test:bundle && node scripts/vitest.mjs run --browser.headless --reporter=verbose","build":"npm pack","compile":"node esbuild.config.mjs","prepack":"npm run compile","release":"REQUIRE_VISUAL=1 npm run test:full && npm run test:pack && npm run test:benchmark && npm run build && echo \"\\n→ Review CHANGELOG.md, then: npm run release:push\"","bump:dry":"npx @zumerbox/bump -d","lint:fix":"eslint src __tests__ --ext .js --fix","test:pdf":"node packages/plugins/pdf/test/verify.mjs && node packages/plugins/pdf/test/megacheck.mjs && node packages/plugins/pdf/test/encryptcheck.mjs","test:full":"npm run lint && npm run test:types && npm run test:release-checks && npm run test:bundle && BROWSER=all node scripts/vitest.mjs run --browser.headless --reporter=dot","test:pack":"node scripts/check-pack.mjs","test:types":"tsc --noEmit","publish:dev":"node scripts/publish-dev.mjs","test:bundle":"npm run compile && node scripts/verify-legacy-bundle.mjs","test:vector":"node packages/plugins/vector/test/verify-vector.mjs && node packages/plugins/vector/test/verify-h2d.mjs && node packages/plugins/vector/test/verify-plugin.mjs && node packages/plugins/vector/test/verify-mathml.mjs","test:visual":"node scripts/vitest.mjs run __tests__/visual.demos. --browser.headless --reporter=verbose","test:webkit":"BROWSER=webkit node scripts/vitest.mjs run --browser.headless --reporter=verbose","bump:plugins":"npm run bump --workspace=@zumer/snapdom-plugins","publish:beta":"npm publish --tag beta","release:push":"git add CHANGELOG.md && git commit -m \"Bumped version\" && git push --follow-tags","report:cross":"node scripts/cross-report.mjs","test:firefox":"BROWSER=firefox node scripts/vitest.mjs run --browser.headless --reporter=verbose","build:plugins":"npm pack --workspace=@zumer/snapdom-plugins","test:coverage":"npx vitest run --browser.headless --coverage","bench:realpage":"node scripts/realpage-bench.mjs","test:benchmark":"node scripts/benchmark-stable.mjs","publish:plugins":"npm publish --workspace=@zumer/snapdom-plugins --access public --tag latest","release:plugins":"REQUIRE_VISUAL=1 npm run test:full && npm run test:pdf && npm run test:vector && npm run test:pack && npm run build:plugins && echo \"Review packages/plugins/CHANGELOG.md, then: npm run publish:plugins\"","bump:plugins:dry":"npm run bump:dry --workspace=@zumer/snapdom-plugins","test:release-checks":"node --test scripts/release-checks.node.mjs scripts/benchmark-statistics.node.mjs","test:benchmark:legacy":"npx vitest bench --browser.headless --watch=false"},"version":"3.3.7","_npmUser":{"name":"tinchox5","email":"martinmuda@gmail.com"},"homepage":"https://snapdom.dev/","keywords":["zumerlab","snapDOM","html2canvas","html2canvas alternative","dom-to-image alternative","html-to-image","screenshot","engine","html capture","dom capture","html to image","dom to image","html screenshot","capture element","html snapshot","element screenshot","web capture","snapshot tool","render html","capture dom","web snapshot","html export","dom snapshot","html to png","html to svg"],"overrides":{"vite":"^6"},"repository":{"url":"git+https://github.com/zumerlab/snapdom.git","type":"git"},"workspaces":["packages/*"],"_npmVersion":"11.11.0","description":"SnapDOM is a high-performance engine for capturing, modifying, and converting DOM elements into any format.","directories":{},"maintainers":[{"name":"tinchox5","email":"martinmuda@gmail.com"}],"sideEffects":false,"_nodeVersion":"25.8.1","_hasShrinkwrap":false,"devDependencies":{"eslint":"^9.36.0","vitest":"^4.1.12","esbuild":"^0.28.1","globals":"^16.4.0","@eslint/js":"^9.36.0","pdfjs-dist":"4.10.38","playwright":"1.55.1","typescript":"^7.0.2","@vitest/browser":"^4.1.12","@zumer/snapdiff":"^0.3.0","@vitest/coverage-v8":"^4.1.12","@vitest/browser-playwright":"^4.1.12"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/snapdom_3.3.7_1792689861332_0.14383187081023552"},"readme":"<p align=\"center\">\n  <a href=\"https://snapdom.dev\">\n    <img src=\"https://raw.githubusercontent.com/zumerlab/snapdom/main/docs/assets/newhero.png\" width=\"80%\">\n  </a>\n</p>\n<p align=\"center\">\n <a href=\"https://snapdom.dev\">\n    <img alt=\"Website\" src=\"https://img.shields.io/badge/Website-snapdom.dev-2ea44f?style=flat-square\">\n  </a>\n  <a href=\"https://www.npmjs.com/package/@zumer/snapdom\">\n    <img alt=\"NPM version\" src=\"https://img.shields.io/npm/v/@zumer/snapdom?style=flat-square&label=Version\">\n  </a>\n  <a href=\"https://www.npmjs.com/package/@zumer/snapdom\">\n    <img alt=\"NPM weekly downloads\" src=\"https://img.shields.io/npm/dw/@zumer/snapdom?style=flat-square&label=Downloads\">\n  </a>\n  <a href=\"https://github.com/zumerlab/snapdom/graphs/contributors\">\n    <img alt=\"GitHub contributors\" src=\"https://img.shields.io/github/contributors/zumerlab/snapdom?style=flat-square&label=Contributors\">\n  </a>\n  <a href=\"https://github.com/zumerlab/snapdom/stargazers\">\n    <img alt=\"GitHub stars\" src=\"https://img.shields.io/github/stars/zumerlab/snapdom?style=flat-square&label=Stars\">\n  </a>\n  <a href=\"https://github.com/zumerlab/snapdom/network/members\">\n    <img alt=\"GitHub forks\" src=\"https://img.shields.io/github/forks/zumerlab/snapdom?style=flat-square&label=Forks\">\n  </a>\n  <a href=\"https://github.com/sponsors/tinchox5\">\n    <img alt=\"Sponsor tinchox5\" src=\"https://img.shields.io/github/sponsors/tinchox5?style=flat-square&label=Sponsor\">\n  </a>\n\n  <a href=\"https://github.com/zumerlab/snapdom/blob/main/LICENSE\">\n    <img alt=\"License\" src=\"https://img.shields.io/github/license/zumerlab/snapdom?style=flat-square\">\n  </a>\n</p>\n\n<p align=\"center\">English | <a href=\"README_CN.md\">简体中文</a></p>\n\n# SnapDOM\n\nSnapDOM is a high-performance engine for capturing, modifying, and converting DOM elements into any format.\n\nImages and canvas ship in the core. Plugins turn the same capture into self-contained HTML, PDF, editable vectors, GIF, video or context for agents. Everything runs in the page, with no core dependencies.\n\n[Documentation and demos](https://snapdom.dev/) · [Technical features](FEATURES.md) · [Official plugins](packages/plugins/README.md) · [简体中文](README_CN.md)\n\n## Why SnapDOM\n\n- **Speed.** Unchanged elements reuse their last capture, and small changes rebuild only the affected subtree. [Run the live benchmark](https://snapdom.dev/compare/live/) in your browser.\n- **Fidelity.** The output matches what the browser painted. Every release runs a pixel suite of real demo pages before it ships.\n- **Flexibility.** Capture once, export many formats. Official plugins add outputs, and the same [plugin hooks](PLUGIN_SPEC.md) let you write your own.\n- **Maintenance.** About one release a week over the past year, MIT licensed, with a public [changelog](CHANGELOG.md).\n\n## Quick start\n\n```sh\nnpm i @zumer/snapdom\n```\n\n```js\nimport { snapdom } from '@zumer/snapdom';\n\nconst card = document.querySelector('#card');\nconst image = await snapdom.toPng(card);\ndocument.body.appendChild(image);\n```\n\nCapture once when you need several outputs:\n\n```js\nconst result = await snapdom(card);\n\nconst image = await result.toPng();\nconst canvas = await result.toCanvas();\nconst blob = await result.toBlob({ format: 'png' });\nawait result.download({ format: 'jpg', filename: 'card' });\n```\n\nThe result keeps that capture even if the source element later changes. Call `snapdom(card)` again to capture its new state.\n\n## What you can build\n\n| Use | Output | Provided by |\n| --- | --- | --- |\n| Share a card, chart, invoice or dashboard | SVG, PNG, JPG, WebP, canvas or Blob | Core |\n| Reuse a capture in a texture, overlay or transition | Canvas plus capture geometry | Core |\n| Save a page fragment for later display | HTML with captured styles and fonts | [`html-export`](packages/plugins/README.md#html-export) plugin |\n| Give an agent or a log a view of page content | Text/JSON context, or an image with an element map | [`context-export`](packages/plugins/README.md#context-export) / [`agent-map`](packages/plugins/README.md#agent-map) plugins |\n| Download a document or record changing content | Searchable, paginated PDF, animated GIF or browser-encoded video | [`pdf`](packages/plugins/pdf/README.md) / [`gif-export`](packages/plugins/README.md#gif-export) / [`video-export`](packages/plugins/README.md#video-export) plugins |\n| Export editable artwork or paste into Figma | Native SVG shapes and text, or a Figma clipboard payload | [`vector`](packages/plugins/vector/README.md) plugin |\n\nImage, HTML and context exports use the captured state. GIF and video plugins record the live element over time.\n\n## Installation\n\nInstall the core and, when you need them, the official plugins:\n\n```sh\nnpm i @zumer/snapdom@latest @zumer/snapdom-plugins@latest\n```\n\nPlugins 4.x require SnapDOM 3.3.0 or newer within 3.x. They include the PDF and Vector exporters, MIT licensed like the core. Their sources live in `packages/plugins/`.\n\nOr load it in a browser:\n\n```html\n<script src=\"https://unpkg.com/@zumer/snapdom@latest/dist/snapdom.js\"></script>\n<script>\n  snapdom.toPng(document.querySelector('#card')).then(image => {\n    document.body.appendChild(image);\n  });\n</script>\n```\n\nAs an ES module from a CDN:\n\n```js\nimport { snapdom } from 'https://esm.sh/@zumer/snapdom@latest';\nimport { htmlExport } from 'https://esm.sh/@zumer/snapdom-plugins@latest/html-export';\n```\n\n`https://unpkg.com/@zumer/snapdom@latest/dist/snapdom.mjs` serves the same module. These examples load the latest published core and plugins.\n\n### Build outputs\n\n| File | Use |\n| --- | --- |\n| `dist/snapdom.mjs` | ES module for imports and bundlers |\n| `dist/snapdom.js` | Script tag exposing `window.snapdom` |\n| `types/snapdom.d.ts` | TypeScript declarations |\n\nThere is no CommonJS build. `@zumer/snapdom/plugins` and the package root share the same runtime and plugin registry.\n\n## Usage\n\n### Choose an output\n\n| Result method | Returns |\n| --- | --- |\n| `toPng()`, `toJpg()`, `toWebp()` | An `HTMLImageElement` |\n| `toSvg()` | An SVG-backed `HTMLImageElement` |\n| `toCanvas()` | An `HTMLCanvasElement` |\n| `toBlob()` | An SVG `Blob` unless a format was explicitly set on the capture or export |\n| `toRaw()` / `url` | The capture's SVG data URL |\n| `download()` | Downloads the chosen format |\n| `to(name, options?)` | Runs a core or plugin exporter by name |\n\nOne-step shortcuts such as `snapdom.toPng(element, options)` capture and export in one call. Results also have `toJpeg()` as an alias for `toJpg()`. `toImg()` remains available; prefer `toSvg()` for an SVG image.\n\n### Set size and exclude content\n\n```js\nconst result = await snapdom(card, {\n  width: 800,\n  dpr: 1,\n  backgroundColor: '#ffffff',\n  exclude: '.capture-ignore',\n  excludeMode: 'remove'\n});\n```\n\n`width` and `height` define output size. If only one is set, the aspect ratio is preserved. `scale` applies when neither is set, and `dpr` multiplies the pixel dimensions. `download()` always uses DPR 1, so the file matches the element's CSS size; pass `scale: devicePixelRatio` for a file as sharp as the screen.\n\n| Common option | Default | Purpose |\n| --- | --- | --- |\n| `scale` / `dpr` | `1` / device pixel ratio | Output resolution |\n| `width` / `height` | Unset | Output dimensions |\n| `embedFonts` | `'auto'` | Embed the web fonts the capture uses |\n| `backgroundColor` | Transparent; white for JPG/WebP | Output background |\n| `exclude` | None | Selectors or predicates; `true` means exclude |\n| `excludeMode` | `'hide'` | Keep an invisible spacer, or use `'remove'` |\n| `filter` | None | Predicate; `true` keeps a node and `false` filters it out |\n| `filterMode` | `'hide'` | Independent layout mode for nodes rejected by `filter` |\n| `clip` | Unset | Capture the viewport or a page-coordinate rectangle |\n| `captureSelection` | `false` | Include the user's text selection |\n| `canvas` | Unset | Reuse an existing canvas |\n| `invalidate` | `false` | Refresh after changes such as programmatic CSSOM edits |\n| `fast` | `true` | `false` keeps the page responsive during long captures |\n\n[All options](https://snapdom.dev/docs/options/) include shadows, transforms, fonts, CORS, fallbacks and layout reconciliation.\n\n### Export a long page\n\nWith the default SVG engine, PNG file exports automatically handle captures beyond the browser's canvas limits. Capture once, then download one full-resolution file or get its Blob:\n\n```js\nconst capture = await snapdom(article);\nawait capture.download({ format: 'png', scale: 2 });\n// Or upload/store the file yourself:\nconst blob = await capture.toBlob({ format: 'png', scale: 2, dpr: 1 });\n```\n\nSnapDOM renders the frozen capture in windows and encodes them into one PNG. It preserves the requested dimensions, including shadows and padding, without allocating a canvas for the whole image. `download()` always uses DPR 1; `toBlob()` uses the capture's DPR unless you override it. Ordinary-sized exports use the native encoder.\n\nThis requires `CompressionStream`; older browsers keep the existing downscale and warning. Very large files still take time and memory to encode, and the application opening them has its own image limits.\n\n### Export a long page in pieces\n\n`toCanvas()`, `toPng()` and JPEG/WebP exports still use a single canvas and scale down past SnapDOM's size guards (16,384px per side in Safari, 32,767px in Chrome/Firefox, plus an area limit). When you need separate canvases, use `crop`:\n\n```js\nconst capture = await snapdom(article);\nconst { contentX, contentY, w0, h0 } = capture.meta;\nconst pieceHeight = 4000; // CSS px\n\nfor (let y = 0; y < h0; y += pieceHeight) {\n  const canvas = await capture.toCanvas({\n    scale: 2,\n    dpr: 1,\n    crop: { x: contentX, y: contentY + y, width: w0, height: Math.min(pieceHeight, h0 - y) }\n  });\n  // save or upload this piece, then move on\n}\n```\n\n`crop` is a rectangle, not a switch. It is in the coordinates of `capture.meta`, and each call returns one canvas. The capture runs once; only the rasterization repeats. Keep `pieceHeight × scale × dpr` under the limit, and set `dpr` yourself, since it defaults to the device pixel ratio. [How tiling works](https://snapdom.dev/blog/huge-page-mosaic/).\n\n### Export HTML or structured context\n\n```js\nimport { htmlExport, contextExport } from '@zumer/snapdom-plugins';\n\nconst result = await snapdom(card, {\n  plugins: [htmlExport(), contextExport({ format: 'json' })]\n});\n\nconst html = await result.toHtml();\nconst context = await result.toContext();\n```\n\nThe same plugin system supports overlays, redaction and custom exporters. Local plugins override global plugins by name. See the [official plugin reference](packages/plugins/README.md) and [plugin specification](PLUGIN_SPEC.md).\n\n### Export PDF and editable vectors\n\nPDF returns a `Blob` with searchable, selectable text, links, pagination and optional form fields. Vector returns an SVG string without `<foreignObject>`, preserving supported shapes and editable text.\n\n```js\nimport { snapdom } from '@zumer/snapdom';\nimport { pdf } from '@zumer/snapdom-plugins/pdf';\nimport { vector } from '@zumer/snapdom-plugins/vector';\n\nconst documentCapture = await snapdom(element, { plugins: [pdf()] });\nconst blob = await documentCapture.toPdf({ page: 'a4', margin: 36 });\n\nconst artwork = await snapdom(element, { plugins: [vector()] });\nconst svg = await artwork.toVector();\ncopyButton.addEventListener('click', () => artwork.toFigma());\n```\n\nPass PDF capture settings to `pdf()` and paper, margin and download settings to `toPdf()`. `toFigma()` returns `Promise<void>` and needs the async clipboard API on HTTPS or localhost, called from a user action. Vector requires a connected source element; unsupported paint is diagnosed by the engine. See the [PDF reference](packages/plugins/pdf/REFERENCE.md) and [Vector contract](packages/plugins/vector/CONTRACT.md).\n\n### Capture HTML strings\n\n```js\nconst result = await snapdom.fromString('<article>Hello</article>');\nconst image = await result.toPng();\n```\n\nSanitize untrusted HTML first, with DOMPurify or equivalent. The string is parsed and activated like markup you wrote yourself: inline handlers such as `<img onerror>` run in the caller's origin, and can keep running after the mount is removed. `fromString()` mounts the markup offscreen and removes it after capture.\n\n### Feed a WebGL texture\n\n```js\nconst canvas = document.createElement('canvas');\nconst texture = new THREE.CanvasTexture(canvas);\ntexture.colorSpace = THREE.SRGBColorSpace;\n\nasync function refresh(element) {\n  await snapdom.toCanvas(element, { canvas, scale: 1, dpr: 1 });\n  texture.needsUpdate = true;\n}\n```\n\n`result.meta` contains the capture geometry needed to place an exported image over the source interface. The [labs](https://snapdom.dev/showcase/#labs) show textures, mirrors and transitions.\n\n## Limitations\n\n- SnapDOM needs a browser DOM. A server-side Node.js process needs a browser environment to run it.\n- Cross-origin images, fonts and stylesheets need readable resources or an appropriate proxy. `crossorigin` does not grant access unless the server also allows it. Cross-origin iframes use placeholders.\n- SVG output includes HTML inside `<foreignObject>`. It is suitable for browsers; support varies in other SVG viewers and document tools.\n- Output depends on browser rendering and image limits; for tall PNG files see [Export a long page](#export-a-long-page). Safari may fall back to PNG when WebP encoding is unavailable.\n- Canvas, video and other changing surfaces are captured fresh. JavaScript CSSOM edits are not observable automatically; use `invalidate: true` after them.\n- Core captures visible input values. Semantic plugins redact sensitive field values in their text/map output, but their attached image needs `redactInputs` or `exclude` if you want those pixels hidden too.\n\n[Technical features and browser behavior](FEATURES.md) covers the details.\n\n## What's new in v3\n\n- Eligible unchanged captures reuse the first result. Safe local changes rebuild only affected subtrees; other changes use a full capture.\n- Web fonts embed automatically when used. System-font captures skip that work.\n- The style pass avoids redundant reads, and per-capture state is isolated for concurrent captures.\n- Safari image decoding and drawing retain their browser-specific handling.\n- `snapdom.preCapture()` can prepare captures on user intent. It learns a control when a capture starts during its press/click event, then prepares that capture on later hover or focus.\n\n```js\nsnapdom.preCapture();\nbutton.onclick = () => snapdom.toPng(card);\n```\n\nImage compression and resource caching remain automatic. They do not make rasterization or image encoding free. See [performance measurements](BENCHMARKS.md) and the [cache guide](https://snapdom.dev/docs/cache/).\n\nSnapDOM has two rendering engines: **SVG**, the default, and **html-in-canvas**, which paints the same captured clone through the browser's native canvas API. Select the second with `engine: 'html-in-canvas'`.\n\nThe second engine is experimental: it still needs a compatible browser with its canvas drawing flag enabled, plus a build compiled with `SNAPDOM_CANVAS_ENGINE=1`. The default build includes SVG only. Unsupported captures fall back to SVG. A successful native capture produces a bitmap, so its URL and `toRaw()` return PNG, not serialized SVG. See [ARCHITECTURE.md](ARCHITECTURE.md) for details.\n\n## Migrating from v2\n\nThe main capture pattern remains `snapdom(element, options)`. This guide compares v3 with **v2.x.x**, whose [source](https://github.com/zumerlab/snapdom/tree/v2) remains available. Review these changes before upgrading:\n\n| In v2 | In v3 | What to change |\n| --- | --- | --- |\n| Web fonts were opt-in | `embedFonts: 'auto'` | Usually nothing; use `false` only if you want to omit them |\n| Raster width/height could be multiplied by `scale` | Width/height win over scale | Pass the final size: `width: 400` instead of `width: 200, scale: 2` |\n| `burst` opted into repeat memoization | Eligible captures memoize automatically; `burst` is no longer documented or supported | Remove `burst` (the engine still reads it for internal use, do not rely on it) and use `invalidate: true` for one fresh capture after unobservable changes such as `sheet.insertRule()` |\n| `preCache` prepared resources | Removed; `preCapture()` learns capture intent | Remove `preCache`; `preCapture()` is not a drop-in rename |\n| `fast: false` cloned through idle callbacks | `fast: false` pauses about every frame, at nearly the same total time | Keep `fast: false` |\n| `filter` / `filterMode` and `exclude` / `excludeMode` could be used together | Both controls and their independent modes remain supported; `exclude` also accepts predicates | Keep existing rules and modes; use the additional predicate form only when useful |\n| `cache: 'auto'` or `'full'` | Both map to `'soft'` | Usually omit it; `'disabled'` / `false` is for debugging |\n| `compress` controlled embedded image downsampling | Image optimization is automatic; `compress` is no longer documented or supported | Remove `compress`; the engine still reads it for internal use, do not rely on it |\n| `resolvePicturePlaceholders` / `pictureResolver` configured lazy-image preparation | Responsive/lazy image resolution happens on the clone; these options are no longer documented or supported | Remove the options and handle custom loading/timeouts in your app before capture; the engine still reads `resolvePicturePlaceholders` for internal use, do not rely on it |\n| Some visible input values were redacted | Core masks passwords only | Add `redactInputs()` for other fields |\n| `afterExport` returns became the next hook's payload, not the caller's result | Returns are ignored; hooks receive the same export payload | Stop chaining through return values; use `defineExports` to produce a different output |\n| Plugins v2.x.x exposed `@zumer/snapdom-plugins/html-in-canvas` | That subpath is removed | Use the experimental core `engine: 'html-in-canvas'` with a compatible custom build; the default build uses SVG |\n| TypeScript exported `PluginExportFacade` | The named type is removed; `ctx.exports` still provides core exporters | Infer it in `defineExports`, or use `NonNullable<CaptureContext['exports']>` |\n\n### Use filter and exclude together\n\n`filter` and `exclude` are independent controls, as in v2. `filter(node)` returns true to keep a node and false to filter it out; `filterMode` controls how a filtered node affects layout. `exclude` specifies additional omissions using selectors or predicates; an exclusion predicate returns true to omit the node. `excludeMode` controls those omissions. You can keep both controls and different modes in the same capture:\n\n```js\n// Works in v2 and v3: hide private fields, remove the toolbar.\nawait snapdom(card, {\n  filter: node => !node.matches('[data-private]'),\n  filterMode: 'hide',\n  exclude: ['.toolbar'],\n  excludeMode: 'remove'\n});\n```\n\n`'hide'` keeps an invisible spacer; `'remove'` drops the node and allows reflow. Both omit its content. V3 additionally lets `exclude` mix selectors and predicates, such as `exclude: ['.toolbar', node => node.dataset.export === 'omit']`; any matching rule excludes the node. This is optional and does not replace `filter` or merge the two modes. The separate CSS-effect plugin named `filter` is also available.\n\nBoth modes default to `'hide'`. Per node, `data-capture=\"exclude\"` is checked first, then `exclude`, then `filter`. The first omission decides the mode and stops evaluation for that node: if it matches `exclude`, `excludeMode` wins even when `filter` would reject it with a different mode. `filter` uses the v2 truthiness rule: any falsy return filters the node out.\n\n### Prefer selectors to callbacks in polling loops\n\nA function-valued `filter`, `exclude`, `excludeStyleProps` or `fallbackURL` turns off memoization and differential recapture, so a polling loop with a predicate pays a full capture on every tick. When the rule can be written as a selector, pass the selector and keep the reuse.\n\nCaptures with function-valued `filter`, `exclude`, `excludeStyleProps` or `fallbackURL` run fresh so applicable callbacks can read current application state on each new capture. They do not reuse an unchanged capture or an earlier callback's style/fallback decision. You do not need `invalidate` just because a callback's closure changed:\n\n```js\nlet privateMode = false;\nconst options = {\n  exclude: node => privateMode && node.matches('[data-private]'),\n  excludeMode: 'remove'\n};\nconst before = await snapdom(card, options);\nprivateMode = true;\nconst after = await snapdom(card, options); // evaluates the current policy\n```\n\n`before` still contains its original captured state; exporting it again does not apply a new policy. Use a new capture such as `after`. Keep exclusion and style predicates synchronous and boolean-returning. `invalidate: true` remains necessary after unobservable changes such as direct CSSOM edits.\n\nCapture-affecting plugins suspend memoization unless they declare `pure: true`. Declare it only for deterministic hooks; timestamps and callbacks reading external state must run again. See the [v3 plugin contract](PLUGIN_SPEC.md).\n\n## Performance benchmarks\n\n[Recorded measurements](BENCHMARKS.md) separate first captures, repeat captures and image-heavy scenes. The [live comparison](https://snapdom.dev/compare/live/) runs in your browser and identifies the package version it loads.\n\nFor a useful comparison, use the same scene, output format, scale and DPR. Compare the images as well as the times.\n\n## Documentation\n\n- [Plugin demos](https://snapdom.dev/showcase/#plugins), [PDF demos](https://snapdom.dev/plugins/pdf/) and [Vector demos](https://snapdom.dev/plugins/vector/)\n- [v2 source](https://github.com/zumerlab/snapdom/tree/v2)\n- [API](https://snapdom.dev/docs/api/) and [options](https://snapdom.dev/docs/options/)\n- [Framework guides](https://snapdom.dev/how-to/#frameworks) and [how-to examples](https://snapdom.dev/how-to/)\n- [Official plugins](packages/plugins/README.md), [plugin specification](PLUGIN_SPEC.md) and [contributing plugins](CONTRIBUTING_PLUGINS.md)\n- [Architecture](ARCHITECTURE.md) and [technical features](FEATURES.md)\n\n## Development\n\nFrom this checkout:\n\n```sh\nnpm install\nnpx playwright install\nnpm run compile\nnpm run lint\nnpm run test:types\nnpm run test:bundle\nBROWSER=all npx vitest run __tests__ --browser.headless\nnpm run test:pack\n```\n\n`npm run site` serves the docs with the local build. `npm test` checks lint without changing files; use `npm run lint:fix` to apply fixes. See [ARCHITECTURE.md](ARCHITECTURE.md) for implementation notes.\n\n## Contributors\n\n<!-- CONTRIBUTORS:START -->\n<p>\n<a href=\"https://github.com/tinchox5\" title=\"tinchox5\"><img src=\"https://avatars.githubusercontent.com/u/11557901?v=4&s=100\" style=\"border-radius:10px; width:60px; height:60px; object-fit:cover; margin:5px;\" alt=\"tinchox5\"/></a>\n<a href=\"https://github.com/claude\" title=\"claude\"><img src=\"https://avatars.githubusercontent.com/u/81847?v=4&s=100\" style=\"border-radius:10px; width:60px; height:60px; object-fit:cover; margin:5px;\" alt=\"claude\"/></a>\n<a href=\"https://github.com/pdufour\" title=\"pdufour\"><img src=\"https://avatars.githubusercontent.com/u/1239145?v=4&s=100\" style=\"border-radius:10px; width:60px; height:60px; object-fit:cover; margin:5px;\" alt=\"pdufour\"/></a>\n<a href=\"https://github.com/FlavioLimaMindera\" title=\"FlavioLimaMindera\"><img src=\"https://avatars.githubusercontent.com/u/96424442?v=4&s=100\" style=\"border-radius:10px; width:60px; height:60px; object-fit:cover; margin:5px;\" alt=\"FlavioLimaMindera\"/></a>\n<a href=\"https://github.com/Jarvis2018\" title=\"Jarvis2018\"><img src=\"https://avatars.githubusercontent.com/u/36788851?v=4&s=100\" style=\"border-radius:10px; width:60px; height:60px; object-fit:cover; margin:5px;\" alt=\"Jarvis2018\"/></a>\n<a href=\"https://github.com/tarwin\" title=\"tarwin\"><img src=\"https://avatars.githubusercontent.com/u/646149?v=4&s=100\" style=\"border-radius:10px; width:60px; height:60px; object-fit:cover; margin:5px;\" alt=\"tarwin\"/></a>\n<a href=\"https://github.com/Amyuan23\" title=\"Amyuan23\"><img src=\"https://avatars.githubusercontent.com/u/25892910?v=4&s=100\" style=\"border-radius:10px; width:60px; height:60px; object-fit:cover; margin:5px;\" alt=\"Amyuan23\"/></a>\n<a href=\"https://github.com/kohaiy\" title=\"kohaiy\"><img src=\"https://avatars.githubusercontent.com/u/15622127?v=4&s=100\" style=\"border-radius:10px; width:60px; height:60px; object-fit:cover; margin:5px;\" alt=\"kohaiy\"/></a>\n<a href=\"https://github.com/airamhr9\" title=\"airamhr9\"><img src=\"https://avatars.githubusercontent.com/u/57371081?v=4&s=100\" style=\"border-radius:10px; width:60px; height:60px; object-fit:cover; margin:5px;\" alt=\"airamhr9\"/></a>\n<a href=\"https://github.com/jswhisperer\" title=\"jswhisperer\"><img src=\"https://avatars.githubusercontent.com/u/1177690?v=4&s=100\" style=\"border-radius:10px; width:60px; height:60px; object-fit:cover; margin:5px;\" alt=\"jswhisperer\"/></a>\n<a href=\"https://github.com/K1ender\" title=\"K1ender\"><img src=\"https://avatars.githubusercontent.com/u/146767945?v=4&s=100\" style=\"border-radius:10px; width:60px; height:60px; object-fit:cover; margin:5px;\" alt=\"K1ender\"/></a>\n<a href=\"https://github.com/mosuzi\" title=\"mosuzi\"><img src=\"https://avatars.githubusercontent.com/u/43341701?v=4&s=100\" style=\"border-radius:10px; width:60px; height:60px; object-fit:cover; margin:5px;\" alt=\"mosuzi\"/></a>\n<a href=\"https://github.com/ninecc\" title=\"ninecc\"><img src=\"https://avatars.githubusercontent.com/u/18310590?v=4&s=100\" style=\"border-radius:10px; width:60px; height:60px; object-fit:cover; margin:5px;\" alt=\"ninecc\"/></a>\n<a href=\"https://github.com/00200200\" title=\"00200200\"><img src=\"https://avatars.githubusercontent.com/u/83299832?v=4&s=100\" style=\"border-radius:10px; width:60px; height:60px; object-fit:cover; margin:5px;\" alt=\"00200200\"/></a>\n<a href=\"https://github.com/17biubiu\" title=\"17biubiu\"><img src=\"https://avatars.githubusercontent.com/u/13295895?v=4&s=100\" style=\"border-radius:10px; width:60px; height:60px; object-fit:cover; margin:5px;\" alt=\"17biubiu\"/></a>\n<a href=\"https://github.com/av01d\" title=\"av01d\"><img src=\"https://avatars.githubusercontent.com/u/6247646?v=4&s=100\" style=\"border-radius:10px; width:60px; height:60px; object-fit:cover; margin:5px;\" alt=\"av01d\"/></a>\n<a href=\"https://github.com/CHOYSEN\" title=\"CHOYSEN\"><img src=\"https://avatars.githubusercontent.com/u/25995358?v=4&s=100\" style=\"border-radius:10px; width:60px; height:60px; object-fit:cover; margin:5px;\" alt=\"CHOYSEN\"/></a>\n<a href=\"https://github.com/pedrocateexte\" title=\"pedrocateexte\"><img src=\"https://avatars.githubusercontent.com/u/207524750?v=4&s=100\" style=\"border-radius:10px; width:60px; height:60px; object-fit:cover; margin:5px;\" alt=\"pedrocateexte\"/></a>\n<a href=\"https://github.com/domialex\" title=\"domialex\"><img src=\"https://avatars.githubusercontent.com/u/4694217?v=4&s=100\" style=\"border-radius:10px; width:60px; height:60px; object-fit:cover; margin:5px;\" alt=\"domialex\"/></a>\n<a href=\"https://github.com/stypr\" title=\"stypr\"><img src=\"https://avatars.githubusercontent.com/u/6625978?v=4&s=100\" style=\"border-radius:10px; width:60px; height:60px; object-fit:cover; margin:5px;\" alt=\"stypr\"/></a>\n<a href=\"https://github.com/jamalkamaladdin\" title=\"jamalkamaladdin\"><img src=\"https://avatars.githubusercontent.com/u/256541632?v=4&s=100\" style=\"border-radius:10px; width:60px; height:60px; object-fit:cover; margin:5px;\" alt=\"jamalkamaladdin\"/></a>\n<a href=\"https://github.com/MFA-G\" title=\"MFA-G\"><img src=\"https://avatars.githubusercontent.com/u/136257088?v=4&s=100\" style=\"border-radius:10px; width:60px; height:60px; object-fit:cover; margin:5px;\" alt=\"MFA-G\"/></a>\n<a href=\"https://github.com/mon-jai\" title=\"mon-jai\"><img src=\"https://avatars.githubusercontent.com/u/91261297?v=4&s=100\" style=\"border-radius:10px; width:60px; height:60px; object-fit:cover; margin:5px;\" alt=\"mon-jai\"/></a>\n<a href=\"https://github.com/puneetdixit200\" title=\"puneetdixit200\"><img src=\"https://avatars.githubusercontent.com/u/236133619?v=4&s=100\" style=\"border-radius:10px; width:60px; height:60px; object-fit:cover; margin:5px;\" alt=\"puneetdixit200\"/></a>\n<a href=\"https://github.com/RexSkz\" title=\"RexSkz\"><img src=\"https://avatars.githubusercontent.com/u/27483702?v=4&s=100\" style=\"border-radius:10px; width:60px; height:60px; object-fit:cover; margin:5px;\" alt=\"RexSkz\"/></a>\n<a href=\"https://github.com/RinZ27\" title=\"RinZ27\"><img src=\"https://avatars.githubusercontent.com/u/222222878?v=4&s=100\" style=\"border-radius:10px; width:60px; height:60px; object-fit:cover; margin:5px;\" alt=\"RinZ27\"/></a>\n<a href=\"https://github.com/sharuzzaman\" title=\"sharuzzaman\"><img src=\"https://avatars.githubusercontent.com/u/7421941?v=4&s=100\" style=\"border-radius:10px; width:60px; height:60px; object-fit:cover; margin:5px;\" alt=\"sharuzzaman\"/></a>\n<a href=\"https://github.com/simon1uo\" title=\"simon1uo\"><img src=\"https://avatars.githubusercontent.com/u/60037549?v=4&s=100\" style=\"border-radius:10px; width:60px; height:60px; object-fit:cover; margin:5px;\" alt=\"simon1uo\"/></a>\n</p>\n<!-- CONTRIBUTORS:END -->\n\n## Sponsors\n\nSpecial thanks to [@megaphonecolin](https://github.com/megaphonecolin), [@sdraper69](https://github.com/sdraper69), [@reynaldichernando](https://github.com/reynaldichernando), [@gamma-app](https://github.com/gamma-app), [@jrjohnson](https://github.com/jrjohnson), and [@ryanander](https://github.com/ryanander) for supporting this project!\n\nIf you'd like to support this project too, you can [become a sponsor](https://github.com/sponsors/tinchox5).\n\n## Show your support\n\nIf SnapDOM saved you time, a star on GitHub helps other developers find it.\n\nShipping something built with SnapDOM? Add the badge to your README:\n\n[![Built with SnapDOM](https://img.shields.io/badge/built%20with-SnapDOM-blue)](https://snapdom.dev)\n\n```md\n[![Built with SnapDOM](https://img.shields.io/badge/built%20with-SnapDOM-blue)](https://snapdom.dev)\n```\n\n### Projects using SnapDOM\n\nProjects using SnapDOM include:\n\n- [LobeHub](https://github.com/lobehub/lobehub) — platform for operating AI agents\n- [Hugging Face Chat UI](https://github.com/huggingface/chat-ui) — HuggingChat interface with artifact preview captures\n- [Sealos](https://github.com/labring/sealos) — AI-native cloud operating system\n- [Tencent tmagic-editor](https://github.com/Tencent/tmagic-editor) — low-code page editor\n- [Playroom](https://github.com/seek-oss/playroom) — JSX design tool by SEEK\n- [GPT-Vis](https://github.com/antvis/GPT-Vis) — AI-friendly data viz by Ant Group's AntV\n- [Rabby Wallet](https://github.com/RabbyHub/Rabby) — browser wallet for EVM chains\n- [uMap](https://github.com/umap-project/umap) — OpenStreetMap map builder\n- [ListenBrainz](https://github.com/metabrainz/listenbrainz-server) — music tracker by MetaBrainz\n- [Mind Elixir](https://github.com/SSShooter/mind-elixir-core) — mind-map core; recommends SnapDOM for image export\n- [Kong UI Components](https://github.com/Kong/public-ui-components) — Kong's dashboard renderer exports PDFs with SnapDOM\n- [SnapDIFF](https://zumerlab.com/snapdiff/) — in-browser visual regression testing *(by Zumerlab)*\n\nSee the full gallery at **[snapdom.dev/made-with](https://snapdom.dev/made-with/)**. Shipping SnapDOM? [Open a PR](https://github.com/zumerlab/snapdom/pulls) to add your project — real, verifiable projects only.\n\n## License\n\nMIT © Zumerlab\n","publish_time":1792689861446,"_cnpm_publish_time":1792689861446,"dist-tags":{"beta":"3.0.0-beta.1","canvas":"3.4.1-canvas.0","colin":"2.16.0-colin.0","dev":"3.7.2-dev.0","dist":"1.9.12-dev.4","latest":"3.7.1"}}