@zumer/snapdom 3.1.2-dev.0 → 3.1.2-dev.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +17 -2
- package/dist/snapdom.js +9 -9
- package/dist/snapdom.mjs +9 -9
- package/package.json +1 -1
- package/types/snapdom.d.ts +5 -2
package/README.md
CHANGED
|
@@ -175,9 +175,24 @@ const result = await snapdom(card, {
|
|
|
175
175
|
|
|
176
176
|
[All options](https://snapdom.dev/docs/options/) include shadows, transforms, fonts, CORS, fallbacks and layout reconciliation.
|
|
177
177
|
|
|
178
|
+
### Export a long page
|
|
179
|
+
|
|
180
|
+
With 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:
|
|
181
|
+
|
|
182
|
+
```js
|
|
183
|
+
const capture = await snapdom(article);
|
|
184
|
+
await capture.download({ format: 'png', scale: 2 });
|
|
185
|
+
// Or upload/store the file yourself:
|
|
186
|
+
const blob = await capture.toBlob({ format: 'png', scale: 2, dpr: 1 });
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
SnapDOM 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.
|
|
190
|
+
|
|
191
|
+
This 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.
|
|
192
|
+
|
|
178
193
|
### Export a long page in pieces
|
|
179
194
|
|
|
180
|
-
|
|
195
|
+
`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`:
|
|
181
196
|
|
|
182
197
|
```js
|
|
183
198
|
const capture = await snapdom(article);
|
|
@@ -318,7 +333,7 @@ Capture-affecting plugins suspend memoization unless they declare `pure: true`.
|
|
|
318
333
|
- SnapDOM needs a browser DOM. A server-side Node.js process needs a browser environment to run it.
|
|
319
334
|
- 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.
|
|
320
335
|
- SVG output includes HTML inside `<foreignObject>`. It is suitable for browsers; support varies in other SVG viewers and document tools.
|
|
321
|
-
- Output depends on browser rendering and
|
|
336
|
+
- 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.
|
|
322
337
|
- Canvas, video and other changing surfaces are captured fresh. JavaScript CSSOM edits are not observable automatically; use `invalidate: true` after them.
|
|
323
338
|
- 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.
|
|
324
339
|
|