html2canvas-pro 2.5.1 → 2.5.3
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 +13 -3
- package/dist/html2canvas-pro.cjs +1903 -1478
- package/dist/html2canvas-pro.cjs.map +1 -1
- package/dist/html2canvas-pro.esm.js +1903 -1478
- package/dist/html2canvas-pro.esm.js.map +1 -1
- package/dist/html2canvas-pro.js +1907 -1479
- package/dist/html2canvas-pro.js.map +1 -1
- package/dist/html2canvas-pro.min.js +6 -5
- package/dist/types/core/cache-storage.d.ts +6 -2
- package/dist/types/core/constants.d.ts +11 -0
- package/dist/types/core/context.d.ts +9 -1
- package/dist/types/core/features.d.ts +9 -5
- package/dist/types/core/origin-checker.d.ts +7 -4
- package/dist/types/core/validator.d.ts +0 -2
- package/dist/types/css/grouped/background-styles.d.ts +4 -0
- package/dist/types/css/grouped/border-styles.d.ts +4 -0
- package/dist/types/css/grouped/font-styles.d.ts +4 -0
- package/dist/types/css/grouped/layout-styles.d.ts +4 -0
- package/dist/types/css/index.d.ts +4 -0
- package/dist/types/css/property-descriptor.d.ts +11 -3
- package/dist/types/css/property-descriptors/scale.d.ts +9 -0
- package/dist/types/css/property-descriptors/translate.d.ts +10 -0
- package/dist/types/css/syntax/tokenizer.d.ts +8 -0
- package/dist/types/css/types/color-utilities.d.ts +21 -0
- package/dist/types/css/types/functions/color-mix.d.ts +17 -0
- package/dist/types/dom/adopted-styles.d.ts +23 -0
- package/dist/types/dom/document-cloner.d.ts +12 -0
- package/dist/types/dom/dom-normalizer.d.ts +2 -0
- package/dist/types/dom/elements/li-element-container.d.ts +2 -2
- package/dist/types/dom/elements/ol-element-container.d.ts +2 -2
- package/dist/types/dom/elements/select-element-container.d.ts +2 -2
- package/dist/types/dom/elements/textarea-element-container.d.ts +2 -2
- package/dist/types/dom/iframe-mount.d.ts +36 -0
- package/dist/types/dom/node-parser.d.ts +2 -2
- package/dist/types/dom/replaced-elements/canvas-element-container.d.ts +2 -2
- package/dist/types/dom/replaced-elements/iframe-element-container.d.ts +2 -2
- package/dist/types/dom/replaced-elements/image-element-container.d.ts +2 -2
- package/dist/types/dom/replaced-elements/input-element-container.d.ts +2 -2
- package/dist/types/dom/replaced-elements/svg-element-container.d.ts +2 -2
- package/dist/types/dom/slot-cloner.d.ts +10 -0
- package/dist/types/options.d.ts +24 -0
- package/dist/types/render/canvas/border-image-renderer.d.ts +7 -0
- package/dist/types/render/canvas/canvas-renderer.d.ts +2 -3
- package/dist/types/render/canvas/filter-surface.d.ts +37 -11
- package/dist/types/render/canvas/gradient-rasterizer.d.ts +53 -0
- package/dist/types/render/canvas/mask-renderer.d.ts +5 -2
- package/dist/types/render/canvas/text-clip-renderer.d.ts +0 -1
- package/dist/types/render/canvas/text-renderer.d.ts +1 -0
- package/package.json +25 -48
- package/dist/types/render/font-metrics.d.ts +0 -11
- package/dist/types/render/renderer-interface.d.ts +0 -28
package/README.md
CHANGED
|
@@ -27,7 +27,7 @@ Next generation JavaScript screenshot tool.
|
|
|
27
27
|
html2canvas-pro is a fork of [niklasvh/html2canvas](https://github.com/niklasvh/html2canvas) that includes various fixes and new features. It offers several advantages over the original html2canvas:
|
|
28
28
|
|
|
29
29
|
**Modern CSS support**
|
|
30
|
-
- Color functions `color()` (incl. relative colors), `lab()`, `lch()`, `oklab()`, `oklch()`
|
|
30
|
+
- Color functions `color()` (incl. relative colors), `lab()`, `lch()`, `oklab()`, `oklch()` — other functions resolve through the browser's computed styles
|
|
31
31
|
- `background-clip: text` support
|
|
32
32
|
- `mix-blend-mode` and `background-blend-mode` support
|
|
33
33
|
- `object-fit` support for `<img/>`
|
|
@@ -38,7 +38,7 @@ html2canvas-pro is a fork of [niklasvh/html2canvas](https://github.com/niklasvh/
|
|
|
38
38
|
- `conic-gradient()`, `repeating-conic-gradient()` and `repeating-radial-gradient()` — complete gradient family
|
|
39
39
|
- `text-emphasis` (CJK emphasis marks), `-webkit-box-reflect`, `image-set()`, `border-image-outset` / `border-image-width`
|
|
40
40
|
- `accent-color`, `outline`, `-webkit-text-fill-color`, `isolation`
|
|
41
|
-
- `filter` compositing for eligible layers —
|
|
41
|
+
- `filter` chain compositing for eligible layers — the full standard filter function set rendered on a dedicated surface with correct layer `opacity` (see [filter support notes](docs/filter-support.md))
|
|
42
42
|
- Faithful `box-shadow` rendering, including inset shadows, blur scaling, and shadows through transformed ancestors
|
|
43
43
|
- `image-rendering` CSS property plus `imageSmoothing` / `imageSmoothingQuality` options for pixel-perfect output
|
|
44
44
|
- Border image, counters & quotes, `direction`, `line-height`, `transform-origin`, and more — see the full [feature list](docs/features.md)
|
|
@@ -55,6 +55,16 @@ html2canvas-pro is a fork of [niklasvh/html2canvas](https://github.com/niklasvh/
|
|
|
55
55
|
- LRU caches for CSS parsing and gradient patterns
|
|
56
56
|
- Native canvas filter fast path with verified SVG fallback
|
|
57
57
|
|
|
58
|
+
**Render speed** — html2canvas-pro(latest) vs html2canvas 1.4.1, headless Chromium on Apple M4, `scale: 1`, median of 10 interleaved runs ([benchmark script](scripts/benchmarks/render.bench.mjs), reproduce with `corepack pnpm bench:render`):
|
|
59
|
+
|
|
60
|
+
| Fixture | html2canvas-pro | html2canvas 1.4.1 |
|
|
61
|
+
| --- | --- | --- |
|
|
62
|
+
| Simple document (~40 elements) | **80 ms** | 87 ms |
|
|
63
|
+
| Large document (~1200 elements) | **295 ms** | 468 ms |
|
|
64
|
+
| Modern-CSS page (`oklch()`, `conic-gradient()`, …) | **166 ms** | ✗ cannot render (throws on `oklch()`) |
|
|
65
|
+
|
|
66
|
+
On element-heavy pages html2canvas-pro is ~1.6× faster, and it is the only one of the two that can render modern-CSS content at all. Absolute times vary by machine — compare ratios, not milliseconds.
|
|
67
|
+
|
|
58
68
|
If you found this helpful, don't forget to
|
|
59
69
|
leave a star 🌟.
|
|
60
70
|
|
|
@@ -177,7 +187,7 @@ The project uses [pnpm](https://pnpm.io) (the version is pinned via the `package
|
|
|
177
187
|
corepack pnpm install
|
|
178
188
|
corepack pnpm build # tsc + Rolldown bundles (CJS/ESM/UMD)
|
|
179
189
|
corepack pnpm unittest # Vitest unit tests
|
|
180
|
-
corepack pnpm test # lint + unit tests + browser (
|
|
190
|
+
corepack pnpm test # lint + unit tests + browser reftests (Playwright)
|
|
181
191
|
corepack pnpm docs:dev # VitePress dev server
|
|
182
192
|
corepack pnpm docs:api # Generate the TypeDoc API reference
|
|
183
193
|
```
|