@zumer/snapdom 2.0.0-dev.0 → 2.0.0-dev.2

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 CHANGED
@@ -29,6 +29,8 @@
29
29
  </a>
30
30
  </p>
31
31
 
32
+ <p align="center">English | <a href="README_CN.md">简体中文</a></p>
33
+
32
34
  # snapDOM
33
35
 
34
36
  **snapDOM** is a fast and accurate DOM-to-image capture tool built for **Zumly**, a zoom-based view transition framework.
@@ -72,8 +74,8 @@ It captures any HTML element as a scalable SVG image, preserving styles, fonts,
72
74
  - [iconFonts](#iconfonts)
73
75
  - [excludeFonts](#excludefonts)
74
76
  - [Filtering nodes: `exclude` vs `filter`](#filtering-nodes-exclude-vs-filter)
75
- - [straighten](#straighten)
76
- - [noShadows](#no-shadows)
77
+ - [outerTransforms](#outerTransforms)
78
+ - [outerShadows](#no-shadows)
77
79
  - [Cache control](#cache-control)
78
80
  - [preCache](#precache--optional-helper)
79
81
  - [Plugins (BETA)](#plugins-beta)
@@ -228,8 +230,8 @@ All capture methods accept an `options` object:
228
230
  | `cache` | string | `"soft"` | `disabled` \| `soft` \| `auto` \| `full` |
229
231
  | `placeholders` | boolean | `true` | Show placeholders for images/CORS iframes |
230
232
  | `fallbackURL` | string \| function | - | Fallback image for `<img>` load failure |
231
- | `straighten` | boolean | `false` | Straightens the root: removes `translate/rotate` but preserves `scale/skew`, producing a flat, reusable capture |
232
- | `noShadows` | boolean | `false` | Do not expand the root’s bounding box for shadows/blur/outline, and strip those visual effects from the cloned root |
233
+ | `outerTransforms` | boolean | `true` | When `false` removes `translate/rotate` but preserves `scale/skew`, producing a flat, reusable capture |
234
+ | `outerShadows` | boolean | `false` | Do not expand the root’s bounding box for shadows/blur/outline, and strip those visual effects from the cloned root |
233
235
 
234
236
  ### Fallback image on `<img>` load failure
235
237
 
@@ -354,26 +356,25 @@ await snapdom.toPng(el, {
354
356
  });
355
357
  ```
356
358
 
357
- ### Straighten
358
-
359
- When capturing rotated or translated elements, you may want to **straighten** the root so the snapshot can be reused in another layout without inheriting those transforms.
359
+ ### outerTransforms
360
360
 
361
- - **`straighten: true`**
362
- Straightens the cloned root: **removes `translate` and `rotate`** but **keeps `scale/skew`** to preserve proportions.
363
- The output is **flat, upright, and ready** to embed elsewhere.
361
+ When capturing rotated or translated elements, you may want use **outerTransforms: false** option if you want to eliminate those external transforms. So, the output is **flat, upright, and ready** to use elsewhere.
364
362
 
363
+ - **`outerTransforms: true (default)`**
364
+ **Keeps the original `transforms` and `rotate`**.
365
+
365
366
 
366
- ### noShadows
367
- - **`noShadows: true`**
367
+ ### outerShadows
368
+ - **`outerShadows: false (default)`**
368
369
  Prevents expanding the bounding box for shadows, blur, or outline on the root, and also strips `box-shadow`, `text-shadow`, `filter: blur()/drop-shadow()`, and `outline` from the cloned root.
369
370
 
370
- > 💡 **Tip:** Using both (`straighten` + `noShadows`) produces a strict, minimal bounding box with no visual bleed.
371
+ > 💡 **Tip:** Using both (`outerTransforms: false` + `outerShadows: false`) produces a strict, minimal bounding box with no visual bleed.
371
372
 
372
373
  **Example**
373
374
 
374
375
  ```js
375
- // Straighten and remove shadow bleed
376
- await snapdom.toSvg(el, { straighten: true, noShadows: true });
376
+ // outerTransforms and remove shadow bleed
377
+ await snapdom.toSvg(el, { outerTransforms: true, outerShadows: true });
377
378
  ```
378
379
 
379
380
  ## Cache control
@@ -474,7 +475,7 @@ const out = await snapdom(element, {
474
475
  Every hook receives a single `context` object that contains normalized capture state:
475
476
 
476
477
  * **Input & options:**
477
- `element`, `debug`, `fast`, `scale`, `dpr`, `width`, `height`, `backgroundColor`, `quality`, `useProxy`, `cache`, `straighten`, `noShadows`, `embedFonts`, `localFonts`, `iconFonts`, `excludeFonts`, `exclude`, `excludeMode`, `filter`, `filterMode`, `fallbackURL`.
478
+ `element`, `debug`, `fast`, `scale`, `dpr`, `width`, `height`, `backgroundColor`, `quality`, `useProxy`, `cache`, `outerTransforms`, `outerShadows`, `embedFonts`, `localFonts`, `iconFonts`, `excludeFonts`, `exclude`, `excludeMode`, `filter`, `filterMode`, `fallbackURL`.
478
479
 
479
480
  * **Intermediate values (depending on stage):**
480
481
  `clone`, `classCSS`, `styleCache`, `fontsCSS`, `baseCSS`, `svgString`, `dataURL`.
@@ -752,6 +753,7 @@ For detailed contribution guidelines, please see [CONTRIBUTING](https://github.c
752
753
  <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>
753
754
  <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>
754
755
  <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>
756
+ <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>
755
757
  <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>
756
758
  <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>
757
759
  <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>
@@ -759,7 +761,7 @@ For detailed contribution guidelines, please see [CONTRIBUTING](https://github.c
759
761
  <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>
760
762
  <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>
761
763
  <a href="https://github.com/elliots" title="elliots"><img src="https://avatars.githubusercontent.com/u/622455?v=4&s=100" style="border-radius:10px; width:60px; height:60px; object-fit:cover; margin:5px;" alt="elliots"/></a>
762
- <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>
764
+ <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>
763
765
  <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>
764
766
  <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>
765
767
  <a href="https://github.com/titoBouzout" title="titoBouzout"><img src="https://avatars.githubusercontent.com/u/64156?v=4&s=100" style="border-radius:10px; width:60px; height:60px; object-fit:cover; margin:5px;" alt="titoBouzout"/></a>
@@ -785,4 +787,4 @@ If you'd like to support this project too, you can [become a sponsor](https://gi
785
787
 
786
788
  ## License
787
789
 
788
- MIT © Zumerlab
790
+ MIT © Zumerlab