@zumer/snapdom 2.15.0 β 2.16.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 +38 -73
- package/dist/plugins.mjs +1 -1
- package/dist/preCache.mjs +1 -1
- package/dist/snapdom.js +3 -3
- package/dist/snapdom.mjs +3 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -41,14 +41,11 @@ It converts any DOM subtree into a self-contained representation that can be exp
|
|
|
41
41
|
|
|
42
42
|
> π **[Documentation, guides & live demos β snapdom.dev](https://snapdom.dev)**
|
|
43
43
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
* Support same-origin `Γ¬frame`
|
|
50
|
-
* Support CSS counter() and CSS counters()
|
|
51
|
-
* Support `...` line-clamp
|
|
44
|
+
## Features
|
|
45
|
+
|
|
46
|
+
Full DOM capture with embedded styles, pseudo-elements and fonts; export to SVG, PNG, JPG, WebP, `canvas` or Blob β ultra fast, dependency-free, and 100% based on standard Web APIs.
|
|
47
|
+
|
|
48
|
+
π **See the complete technical feature list in [FEATURES.md](FEATURES.md).**
|
|
52
49
|
|
|
53
50
|
## Website & Live Demos
|
|
54
51
|
|
|
@@ -77,54 +74,22 @@ await result.download({ format: 'jpg', filename: 'card.jpg' });
|
|
|
77
74
|
|
|
78
75
|
---
|
|
79
76
|
|
|
80
|
-
## Capture Flow
|
|
81
|
-
|
|
82
|
-
SnapDOM transforms your DOM element through these stages:
|
|
83
|
-
|
|
84
|
-
```
|
|
85
|
-
DOM Element
|
|
86
|
-
β
|
|
87
|
-
Clone
|
|
88
|
-
β
|
|
89
|
-
Styles & Pseudo
|
|
90
|
-
β
|
|
91
|
-
Images & Backgrounds
|
|
92
|
-
β
|
|
93
|
-
Fonts
|
|
94
|
-
β
|
|
95
|
-
SVG foreignObject
|
|
96
|
-
β
|
|
97
|
-
data:image/svg+xml
|
|
98
|
-
β
|
|
99
|
-
toPng / toSvg / toBlob / download
|
|
100
|
-
```
|
|
101
|
-
|
|
102
|
-
| Stage | What happens |
|
|
103
|
-
|-------|--------------|
|
|
104
|
-
| **Clone** | Deep clone with styles, Shadow DOM, iframes. Exclude/filter nodes. |
|
|
105
|
-
| **Styles & Pseudo** | Inline `::before`/`::after` as elements, resolve `counter()`/`counters()`. |
|
|
106
|
-
| **Images & Backgrounds** | Fetch and inline external images/backgrounds as data URLs. |
|
|
107
|
-
| **Fonts** | Embed `@font-face` (optional) and icon fonts. |
|
|
108
|
-
| **SVG** | Wrap clone in `<foreignObject>`, serialize to `data:image/svg+xml`. |
|
|
109
|
-
| **Export** | Convert SVG to PNG/JPG/WebP/Blob or trigger download. |
|
|
110
|
-
|
|
111
|
-
Plugin hooks: `beforeSnap` β `beforeClone` β `afterClone` β `beforeRender` β `afterRender` β `beforeExport` β `afterExport`.
|
|
112
|
-
|
|
113
|
-
|
|
114
77
|
## Table of Contents
|
|
115
78
|
|
|
116
79
|
- [Quick Start](#quick-start)
|
|
117
|
-
- [
|
|
80
|
+
- [Features](#features)
|
|
81
|
+
- [Website & Live Demos](#website--live-demos)
|
|
118
82
|
- [Installation](#installation)
|
|
119
83
|
- [Build Outputs](#build-outputs)
|
|
120
84
|
- [Usage](#usage)
|
|
121
85
|
- [Documentation](#documentation) β full API, Options, Plugins & Cache reference on [snapdom.dev/docs](https://snapdom.dev/docs/)
|
|
122
86
|
- [Limitations](#limitations)
|
|
123
87
|
- [Performance Benchmarks](#performance-benchmarks)
|
|
124
|
-
- [Roadmap](#roadmap)
|
|
125
88
|
- [Development](#development)
|
|
126
89
|
- [Contributors](#contributors)
|
|
127
90
|
- [Sponsors](#sponsors)
|
|
91
|
+
- [Show your support](#show-your-support)
|
|
92
|
+
- [Star History](#star-history)
|
|
128
93
|
- [License](#license)
|
|
129
94
|
|
|
130
95
|
## Installation
|
|
@@ -298,35 +263,6 @@ npm run test:benchmark
|
|
|
298
263
|
```
|
|
299
264
|
|
|
300
265
|
|
|
301
|
-
## Roadmap
|
|
302
|
-
|
|
303
|
-
Planned improvements for future versions of SnapDOM:
|
|
304
|
-
|
|
305
|
-
* [X] **Implement plugin system**
|
|
306
|
-
SnapDOM will support external plugins to extend or override internal behavior (e.g. custom node transformers, exporters, or filters).
|
|
307
|
-
|
|
308
|
-
* [ ] **Refactor to modular architecture**
|
|
309
|
-
Internal logic will be split into smaller, focused modules to improve maintainability and code reuse.
|
|
310
|
-
|
|
311
|
-
* [X] **Decouple internal logic from global options**
|
|
312
|
-
Functions will be redesigned to avoid relying directly on `options`. A centralized capture context will improve clarity, autonomy, and testability. See [`next` branch](https://github.com/zumerlab/snapdom/tree/main)
|
|
313
|
-
|
|
314
|
-
* [X] **Expose cache control**
|
|
315
|
-
Users will be able to manually clear image and font caches or configure their own caching strategies.
|
|
316
|
-
|
|
317
|
-
* [X] **Auto font preloading**
|
|
318
|
-
Required fonts will be automatically detected and preloaded before capture, reducing the need for manual `preCache()` calls.
|
|
319
|
-
|
|
320
|
-
* [X] **Document plugin development**
|
|
321
|
-
A full guide will be provided for creating and registering custom SnapDOM plugins.
|
|
322
|
-
|
|
323
|
-
* [ ] **Make export utilities tree-shakeable**
|
|
324
|
-
Export functions like `toPng`, `toJpg`, `toBlob`, etc. will be restructured into independent modules to support tree shaking and minimal builds.
|
|
325
|
-
|
|
326
|
-
Have ideas or feature requests?
|
|
327
|
-
Feel free to share suggestions or feedback in [GitHub Discussions](https://github.com/zumerlab/snapdom/discussions).
|
|
328
|
-
|
|
329
|
-
|
|
330
266
|
## Development
|
|
331
267
|
|
|
332
268
|
**Source layout:**
|
|
@@ -396,6 +332,35 @@ Special thanks to [@megaphonecolin](https://github.com/megaphonecolin), [@sdrape
|
|
|
396
332
|
|
|
397
333
|
If you'd like to support this project too, you can [become a sponsor](https://github.com/sponsors/tinchox5).
|
|
398
334
|
|
|
335
|
+
## Show your support
|
|
336
|
+
|
|
337
|
+
If snapDOM saved you time, a β on GitHub helps other developers find it β that's the whole ask.
|
|
338
|
+
|
|
339
|
+
Shipping something built with snapDOM? Add the badge to your README:
|
|
340
|
+
|
|
341
|
+
[](https://snapdom.dev)
|
|
342
|
+
|
|
343
|
+
```md
|
|
344
|
+
[](https://snapdom.dev)
|
|
345
|
+
```
|
|
346
|
+
|
|
347
|
+
### Projects using snapDOM
|
|
348
|
+
|
|
349
|
+
snapDOM runs in production across 290+ public repositories ([GitHub dependents graph](https://github.com/zumerlab/snapdom/network/dependents)). A few notable ones, each verified from its own `package.json`:
|
|
350
|
+
|
|
351
|
+
- [LobeHub](https://github.com/lobehub/lobehub) β platform for operating AI agents
|
|
352
|
+
- [Trilium Notes](https://github.com/TriliumNext/Trilium) β hierarchical personal knowledge base
|
|
353
|
+
- [Sealos](https://github.com/labring/sealos) β AI-native cloud operating system
|
|
354
|
+
- [Tencent tmagic-editor](https://github.com/Tencent/tmagic-editor) β low-code page editor
|
|
355
|
+
- [Playroom](https://github.com/seek-oss/playroom) β JSX design tool by SEEK
|
|
356
|
+
- [GPT-Vis](https://github.com/antvis/GPT-Vis) β AI-friendly data viz by Ant Group's AntV
|
|
357
|
+
- [Rabby Wallet](https://github.com/RabbyHub/Rabby) β browser wallet for EVM chains
|
|
358
|
+
- [uMap](https://github.com/umap-project/umap) β OpenStreetMap map builder
|
|
359
|
+
- [ListenBrainz](https://github.com/metabrainz/listenbrainz-server) β music tracker by MetaBrainz
|
|
360
|
+
- [SnapDIFF](https://zumerlab.com/snapdiff/) β in-browser visual regression testing *(by Zumerlab)*
|
|
361
|
+
|
|
362
|
+
See 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.
|
|
363
|
+
|
|
399
364
|
## Star History
|
|
400
365
|
|
|
401
366
|
[](https://www.star-history.com/#zumerlab/snapdom&Date)
|
package/dist/plugins.mjs
CHANGED