@zumer/snapdom 3.0.0-beta.1 → 3.0.1-dev.0
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 +12 -9
- package/dist/snapdom.js +9 -9
- package/dist/snapdom.mjs +9 -9
- package/package.json +3 -2
- package/types/snapdom.d.ts +11 -0
package/README.md
CHANGED
|
@@ -42,7 +42,7 @@ Export images and canvas with the core. Use plugins for self-contained HTML, pag
|
|
|
42
42
|
|
|
43
43
|
[Documentation and demos](https://snapdom.dev/) · [Technical features](FEATURES.md) · [Official plugins](packages/plugins/README.md) · [简体中文](README_CN.md)
|
|
44
44
|
|
|
45
|
-
This checkout documents **v3**. The migration guide below compares it with
|
|
45
|
+
This checkout documents **v3.x.x**. The migration guide below compares it with **v2.x.x**. The [v2 source](https://github.com/zumerlab/snapdom/tree/v2) and [v2 documentation](https://snapdom.dev/v2/) remain available.
|
|
46
46
|
|
|
47
47
|
## What you can build
|
|
48
48
|
|
|
@@ -84,13 +84,13 @@ The result keeps that capture even if the source element later changes. Call `sn
|
|
|
84
84
|
Install the core and, when you need them, the official plugins; use matching major versions:
|
|
85
85
|
|
|
86
86
|
```sh
|
|
87
|
-
npm i @zumer/snapdom @zumer/snapdom-plugins
|
|
87
|
+
npm i @zumer/snapdom@latest @zumer/snapdom-plugins@latest
|
|
88
88
|
```
|
|
89
89
|
|
|
90
90
|
Or load it in a browser:
|
|
91
91
|
|
|
92
92
|
```html
|
|
93
|
-
<script src="https://unpkg.com/@zumer/snapdom/dist/snapdom.js"></script>
|
|
93
|
+
<script src="https://unpkg.com/@zumer/snapdom@latest/dist/snapdom.js"></script>
|
|
94
94
|
<script>
|
|
95
95
|
snapdom.toPng(document.querySelector('#card')).then(image => {
|
|
96
96
|
document.body.appendChild(image);
|
|
@@ -101,11 +101,11 @@ Or load it in a browser:
|
|
|
101
101
|
As an ES module from a CDN:
|
|
102
102
|
|
|
103
103
|
```js
|
|
104
|
-
import { snapdom } from 'https://esm.sh/@zumer/snapdom';
|
|
105
|
-
import { htmlExport } from 'https://esm.sh/@zumer/snapdom-plugins/html-export';
|
|
104
|
+
import { snapdom } from 'https://esm.sh/@zumer/snapdom@latest';
|
|
105
|
+
import { htmlExport } from 'https://esm.sh/@zumer/snapdom-plugins@latest/html-export';
|
|
106
106
|
```
|
|
107
107
|
|
|
108
|
-
`https://unpkg.com/@zumer/snapdom/dist/snapdom.mjs` serves the same module.
|
|
108
|
+
`https://unpkg.com/@zumer/snapdom@latest/dist/snapdom.mjs` serves the same module. These examples load the latest published core and plugins.
|
|
109
109
|
|
|
110
110
|
To run the docs site against a local build of this checkout instead:
|
|
111
111
|
|
|
@@ -171,6 +171,7 @@ const result = await snapdom(card, {
|
|
|
171
171
|
| `captureSelection` | `false` | Include the user's text selection |
|
|
172
172
|
| `canvas` | Unset | Reuse an existing canvas |
|
|
173
173
|
| `invalidate` | `false` | Refresh after changes such as programmatic CSSOM edits |
|
|
174
|
+
| `fast` | `true` | `false` keeps the page responsive during long captures |
|
|
174
175
|
|
|
175
176
|
[All options](https://snapdom.dev/docs/options/) include shadows, transforms, fonts, CORS, fallbacks and layout reconciliation.
|
|
176
177
|
|
|
@@ -236,7 +237,7 @@ The second engine is experimental: it still needs a compatible browser with its
|
|
|
236
237
|
|
|
237
238
|
## Migrating from v2
|
|
238
239
|
|
|
239
|
-
The main capture pattern remains `snapdom(element, options)`. This guide compares v3 with **v2.
|
|
240
|
+
The main capture pattern remains `snapdom(element, options)`. This guide compares v3 with **v2.x.x**; review these changes before upgrading:
|
|
240
241
|
|
|
241
242
|
| In v2 | In v3 | What to change |
|
|
242
243
|
| --- | --- | --- |
|
|
@@ -244,13 +245,14 @@ The main capture pattern remains `snapdom(element, options)`. This guide compare
|
|
|
244
245
|
| 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` |
|
|
245
246
|
| `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()` |
|
|
246
247
|
| `preCache` prepared resources | Removed; `preCapture()` learns capture intent | Remove `preCache`; `preCapture()` is not a drop-in rename |
|
|
247
|
-
| `fast`
|
|
248
|
+
| `fast: false` cloned through idle callbacks | `fast: false` pauses about every frame, at nearly the same total time | Keep `fast: false` |
|
|
248
249
|
| `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 |
|
|
249
250
|
| `cache: 'auto'` or `'full'` | Both map to `'soft'` | Usually omit it; `'disabled'` / `false` is for debugging |
|
|
250
251
|
| `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 |
|
|
251
252
|
| `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 |
|
|
252
253
|
| Some visible input values were redacted | Core masks passwords only | Add `redactInputs()` for other fields |
|
|
253
254
|
| `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 |
|
|
255
|
+
| 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 |
|
|
254
256
|
| TypeScript exported `PluginExportFacade` | The named type is removed; `ctx.exports` still provides core exporters | Infer it in `defineExports`, or use `NonNullable<CaptureContext['exports']>` |
|
|
255
257
|
|
|
256
258
|
### Use filter and exclude together
|
|
@@ -309,6 +311,7 @@ For a useful comparison, use the same scene, output format, scale and DPR. Compa
|
|
|
309
311
|
|
|
310
312
|
## Documentation
|
|
311
313
|
|
|
314
|
+
- [Archived v2 documentation](https://snapdom.dev/v2/) and [v2 source](https://github.com/zumerlab/snapdom/tree/v2)
|
|
312
315
|
- [API](https://snapdom.dev/docs/api/) and [options](https://snapdom.dev/docs/options/)
|
|
313
316
|
- [Framework guides](https://snapdom.dev/guides/) and [how-to examples](https://snapdom.dev/how-to/)
|
|
314
317
|
- [Official plugins](packages/plugins/README.md), [plugin specification](PLUGIN_SPEC.md) and [contributing plugins](CONTRIBUTING_PLUGINS.md)
|
|
@@ -336,6 +339,7 @@ npm run test:pack
|
|
|
336
339
|
<!-- CONTRIBUTORS:START -->
|
|
337
340
|
<p>
|
|
338
341
|
<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>
|
|
342
|
+
<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>
|
|
339
343
|
<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>
|
|
340
344
|
<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>
|
|
341
345
|
<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>
|
|
@@ -351,7 +355,6 @@ npm run test:pack
|
|
|
351
355
|
<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>
|
|
352
356
|
<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>
|
|
353
357
|
<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>
|
|
354
|
-
<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>
|
|
355
358
|
<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>
|
|
356
359
|
<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>
|
|
357
360
|
<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>
|