html2canvas-pro 2.4.5 → 2.5.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 +115 -13
- package/dist/html2canvas-pro.cjs +3058 -1607
- package/dist/html2canvas-pro.cjs.map +1 -1
- package/dist/html2canvas-pro.esm.js +3058 -1607
- package/dist/html2canvas-pro.esm.js.map +1 -1
- package/dist/html2canvas-pro.js +3055 -1604
- package/dist/html2canvas-pro.js.map +1 -1
- package/dist/html2canvas-pro.min.js +5 -5
- package/dist/types/core/cache-storage.d.ts +4 -1
- package/dist/types/core/context.d.ts +10 -1
- package/dist/types/core/render-element.d.ts +11 -0
- package/dist/types/core/util.d.ts +6 -0
- package/dist/types/css/index.d.ts +77 -46
- package/dist/types/css/parse.d.ts +15 -0
- package/dist/types/css/property-descriptors/accent-color.d.ts +5 -0
- package/dist/types/css/property-descriptors/backdrop-filter.d.ts +9 -0
- package/dist/types/css/property-descriptors/background-blend-mode.d.ts +16 -16
- package/dist/types/css/property-descriptors/border-image-width.d.ts +36 -0
- package/dist/types/css/property-descriptors/clip-path.d.ts +16 -2
- package/dist/types/css/property-descriptors/isolation.d.ts +6 -0
- package/dist/types/css/property-descriptors/mask.d.ts +25 -0
- package/dist/types/css/property-descriptors/mix-blend-mode.d.ts +16 -16
- package/dist/types/css/property-descriptors/outline.d.ts +15 -0
- package/dist/types/css/property-descriptors/text-emphasis.d.ts +22 -0
- package/dist/types/css/property-descriptors/text-shadow.d.ts +1 -1
- package/dist/types/css/property-descriptors/webkit-box-reflect.d.ts +19 -0
- package/dist/types/css/property-descriptors/webkit-text-fill-color.d.ts +9 -0
- package/dist/types/css/syntax/token-constants.d.ts +1 -1
- package/dist/types/css/types/color-math.d.ts +7 -1
- package/dist/types/css/types/color-spaces/a98.d.ts +2 -1
- package/dist/types/css/types/color-spaces/p3.d.ts +5 -4
- package/dist/types/css/types/color-spaces/pro-photo.d.ts +5 -4
- package/dist/types/css/types/color-spaces/rec2020.d.ts +5 -4
- package/dist/types/css/types/color-spaces/srgb.d.ts +5 -4
- package/dist/types/css/types/color-utilities.d.ts +11 -11
- package/dist/types/css/types/color.d.ts +1 -0
- package/dist/types/css/types/functions/conic-gradient.d.ts +11 -0
- package/dist/types/css/types/functions/image-set.d.ts +11 -0
- package/dist/types/css/types/functions/repeating-radial-gradient.d.ts +8 -0
- package/dist/types/css/types/image.d.ts +15 -2
- package/dist/types/css/types/safe-eval.d.ts +0 -6
- package/dist/types/dom/copy-css-styles.d.ts +8 -0
- package/dist/types/dom/document-cloner.d.ts +3 -13
- package/dist/types/dom/iframe-mount.d.ts +37 -0
- package/dist/types/dom/pseudo-content.d.ts +33 -0
- package/dist/types/dom/replaced-elements/iframe-element-container.d.ts +2 -2
- package/dist/types/options.d.ts +8 -2
- package/dist/types/render/canvas/background-renderer.d.ts +19 -0
- package/dist/types/render/canvas/border-image-renderer.d.ts +50 -1
- package/dist/types/render/canvas/canvas-renderer.d.ts +21 -15
- package/dist/types/render/canvas/mask-renderer.d.ts +36 -0
- package/dist/types/render/canvas/text-clip-renderer.d.ts +36 -0
- package/dist/types/render/canvas/text-renderer.d.ts +22 -0
- package/dist/types/render/stacking-context.d.ts +4 -1
- package/package.json +39 -40
- package/dist/lib/config.js +0 -49
- package/dist/lib/core/abort-helper.js +0 -20
- package/dist/lib/core/background-parser.js +0 -41
- package/dist/lib/core/bitwise.js +0 -5
- package/dist/lib/core/cache-storage.js +0 -283
- package/dist/lib/core/config-assembler.js +0 -88
- package/dist/lib/core/constants.js +0 -25
- package/dist/lib/core/context.js +0 -19
- package/dist/lib/core/debugger.js +0 -27
- package/dist/lib/core/features.js +0 -190
- package/dist/lib/core/logger.js +0 -56
- package/dist/lib/core/lru-map.js +0 -66
- package/dist/lib/core/origin-checker.js +0 -53
- package/dist/lib/core/performance-monitor.js +0 -185
- package/dist/lib/core/render-element.js +0 -131
- package/dist/lib/core/util.js +0 -4
- package/dist/lib/core/validator.js +0 -500
- package/dist/lib/css/grouped/background-styles.js +0 -36
- package/dist/lib/css/grouped/border-styles.js +0 -75
- package/dist/lib/css/grouped/font-styles.js +0 -93
- package/dist/lib/css/grouped/layout-styles.js +0 -127
- package/dist/lib/css/index.js +0 -339
- package/dist/lib/css/layout/bounds.js +0 -52
- package/dist/lib/css/layout/text.js +0 -133
- package/dist/lib/css/property-descriptor.js +0 -2
- package/dist/lib/css/property-descriptors/background-blend-mode.js +0 -41
- package/dist/lib/css/property-descriptors/background-clip.js +0 -25
- package/dist/lib/css/property-descriptors/background-color.js +0 -10
- package/dist/lib/css/property-descriptors/background-image.js +0 -24
- package/dist/lib/css/property-descriptors/background-origin.js +0 -23
- package/dist/lib/css/property-descriptors/background-position.js +0 -19
- package/dist/lib/css/property-descriptors/background-repeat.js +0 -33
- package/dist/lib/css/property-descriptors/background-size.js +0 -23
- package/dist/lib/css/property-descriptors/border-color.js +0 -14
- package/dist/lib/css/property-descriptors/border-image-repeat.js +0 -42
- package/dist/lib/css/property-descriptors/border-image-slice.js +0 -45
- package/dist/lib/css/property-descriptors/border-image-source.js +0 -22
- package/dist/lib/css/property-descriptors/border-radius.js +0 -15
- package/dist/lib/css/property-descriptors/border-style.js +0 -26
- package/dist/lib/css/property-descriptors/border-width.js +0 -20
- package/dist/lib/css/property-descriptors/box-decoration-break.js +0 -18
- package/dist/lib/css/property-descriptors/box-shadow.js +0 -54
- package/dist/lib/css/property-descriptors/clip-path.js +0 -189
- package/dist/lib/css/property-descriptors/color.js +0 -10
- package/dist/lib/css/property-descriptors/content.js +0 -19
- package/dist/lib/css/property-descriptors/counter-increment.js +0 -35
- package/dist/lib/css/property-descriptors/counter-reset.js +0 -18
- package/dist/lib/css/property-descriptors/direction.js +0 -18
- package/dist/lib/css/property-descriptors/display.js +0 -81
- package/dist/lib/css/property-descriptors/duration.js +0 -14
- package/dist/lib/css/property-descriptors/filter.js +0 -86
- package/dist/lib/css/property-descriptors/float.js +0 -22
- package/dist/lib/css/property-descriptors/font-family.js +0 -47
- package/dist/lib/css/property-descriptors/font-size.js +0 -10
- package/dist/lib/css/property-descriptors/font-style.js +0 -20
- package/dist/lib/css/property-descriptors/font-variant-ligatures.js +0 -34
- package/dist/lib/css/property-descriptors/font-variant.js +0 -13
- package/dist/lib/css/property-descriptors/font-weight.js +0 -25
- package/dist/lib/css/property-descriptors/image-rendering.js +0 -33
- package/dist/lib/css/property-descriptors/letter-spacing.js +0 -21
- package/dist/lib/css/property-descriptors/line-break.js +0 -23
- package/dist/lib/css/property-descriptors/line-height.js +0 -24
- package/dist/lib/css/property-descriptors/list-style-image.js +0 -17
- package/dist/lib/css/property-descriptors/list-style-position.js +0 -18
- package/dist/lib/css/property-descriptors/list-style-type.js +0 -122
- package/dist/lib/css/property-descriptors/margin.js +0 -13
- package/dist/lib/css/property-descriptors/mix-blend-mode.js +0 -31
- package/dist/lib/css/property-descriptors/object-fit.js +0 -28
- package/dist/lib/css/property-descriptors/object-position.js +0 -42
- package/dist/lib/css/property-descriptors/opacity.js +0 -16
- package/dist/lib/css/property-descriptors/overflow-wrap.js +0 -18
- package/dist/lib/css/property-descriptors/overflow.js +0 -27
- package/dist/lib/css/property-descriptors/padding.js +0 -14
- package/dist/lib/css/property-descriptors/paint-order.js +0 -33
- package/dist/lib/css/property-descriptors/position.js +0 -22
- package/dist/lib/css/property-descriptors/quotes.js +0 -41
- package/dist/lib/css/property-descriptors/rotate.js +0 -27
- package/dist/lib/css/property-descriptors/text-align.js +0 -21
- package/dist/lib/css/property-descriptors/text-decoration-color.js +0 -10
- package/dist/lib/css/property-descriptors/text-decoration-line.js +0 -28
- package/dist/lib/css/property-descriptors/text-decoration-style.js +0 -24
- package/dist/lib/css/property-descriptors/text-decoration-thickness.js +0 -26
- package/dist/lib/css/property-descriptors/text-overflow.js +0 -18
- package/dist/lib/css/property-descriptors/text-shadow.js +0 -46
- package/dist/lib/css/property-descriptors/text-transform.js +0 -20
- package/dist/lib/css/property-descriptors/text-underline-offset.js +0 -23
- package/dist/lib/css/property-descriptors/transform-origin.js +0 -24
- package/dist/lib/css/property-descriptors/transform.js +0 -57
- package/dist/lib/css/property-descriptors/visibility.js +0 -20
- package/dist/lib/css/property-descriptors/webkit-line-clamp.js +0 -26
- package/dist/lib/css/property-descriptors/webkit-text-stroke-color.js +0 -10
- package/dist/lib/css/property-descriptors/webkit-text-stroke-width.js +0 -16
- package/dist/lib/css/property-descriptors/white-space.js +0 -32
- package/dist/lib/css/property-descriptors/word-break.js +0 -26
- package/dist/lib/css/property-descriptors/writing-mode.js +0 -28
- package/dist/lib/css/property-descriptors/z-index.js +0 -19
- package/dist/lib/css/property-descriptors/zoom.js +0 -18
- package/dist/lib/css/syntax/parser.js +0 -141
- package/dist/lib/css/syntax/token-constants.js +0 -214
- package/dist/lib/css/syntax/token-singletons.js +0 -36
- package/dist/lib/css/syntax/token-types.js +0 -10
- package/dist/lib/css/syntax/tokenizer.js +0 -502
- package/dist/lib/css/type-descriptor.js +0 -2
- package/dist/lib/css/types/angle.js +0 -80
- package/dist/lib/css/types/color-math.js +0 -25
- package/dist/lib/css/types/color-spaces/a98.js +0 -78
- package/dist/lib/css/types/color-spaces/p3.js +0 -86
- package/dist/lib/css/types/color-spaces/pro-photo.js +0 -83
- package/dist/lib/css/types/color-spaces/rec2020.js +0 -85
- package/dist/lib/css/types/color-spaces/srgb.js +0 -79
- package/dist/lib/css/types/color-utilities.js +0 -342
- package/dist/lib/css/types/color.js +0 -400
- package/dist/lib/css/types/functions/-prefix-linear-gradient.js +0 -32
- package/dist/lib/css/types/functions/-prefix-radial-gradient.js +0 -83
- package/dist/lib/css/types/functions/-webkit-gradient.js +0 -59
- package/dist/lib/css/types/functions/counter.js +0 -367
- package/dist/lib/css/types/functions/gradient.js +0 -163
- package/dist/lib/css/types/functions/linear-gradient.js +0 -27
- package/dist/lib/css/types/functions/radial-gradient.js +0 -90
- package/dist/lib/css/types/functions/repeating-linear-gradient.js +0 -9
- package/dist/lib/css/types/image.js +0 -62
- package/dist/lib/css/types/index.js +0 -2
- package/dist/lib/css/types/length-percentage.js +0 -197
- package/dist/lib/css/types/length.js +0 -5
- package/dist/lib/css/types/safe-eval.js +0 -80
- package/dist/lib/css/types/time.js +0 -17
- package/dist/lib/dom/document-cloner.js +0 -618
- package/dist/lib/dom/dom-normalizer.js +0 -115
- package/dist/lib/dom/element-container.js +0 -71
- package/dist/lib/dom/elements/li-element-container.js +0 -11
- package/dist/lib/dom/elements/ol-element-container.js +0 -12
- package/dist/lib/dom/elements/select-element-container.js +0 -12
- package/dist/lib/dom/elements/textarea-element-container.js +0 -11
- package/dist/lib/dom/node-parser.js +0 -125
- package/dist/lib/dom/node-type-guards.js +0 -81
- package/dist/lib/dom/replaced-elements/canvas-element-container.js +0 -13
- package/dist/lib/dom/replaced-elements/iframe-element-container.js +0 -38
- package/dist/lib/dom/replaced-elements/image-element-container.js +0 -14
- package/dist/lib/dom/replaced-elements/index.js +0 -2
- package/dist/lib/dom/replaced-elements/input-element-container.js +0 -89
- package/dist/lib/dom/replaced-elements/svg-element-container.js +0 -57
- package/dist/lib/dom/slot-cloner.js +0 -176
- package/dist/lib/dom/text-container.js +0 -35
- package/dist/lib/index.js +0 -49
- package/dist/lib/options.js +0 -2
- package/dist/lib/render/background.js +0 -188
- package/dist/lib/render/bezier-curve.js +0 -34
- package/dist/lib/render/border.js +0 -104
- package/dist/lib/render/bound-curves.js +0 -188
- package/dist/lib/render/box-sizing.js +0 -20
- package/dist/lib/render/canvas/background-renderer.js +0 -338
- package/dist/lib/render/canvas/border-image-renderer.js +0 -153
- package/dist/lib/render/canvas/border-renderer.js +0 -184
- package/dist/lib/render/canvas/box-shadow-geometry.js +0 -52
- package/dist/lib/render/canvas/box-shadow-painter.js +0 -194
- package/dist/lib/render/canvas/box-shadow-transform.js +0 -42
- package/dist/lib/render/canvas/canvas-path.js +0 -25
- package/dist/lib/render/canvas/canvas-renderer.js +0 -610
- package/dist/lib/render/canvas/content-renderer.js +0 -270
- package/dist/lib/render/canvas/effects-renderer.js +0 -171
- package/dist/lib/render/canvas/filter-surface.js +0 -270
- package/dist/lib/render/canvas/font-utils.js +0 -46
- package/dist/lib/render/canvas/foreignobject-renderer.js +0 -38
- package/dist/lib/render/canvas/surface-bounds.js +0 -64
- package/dist/lib/render/canvas/text/text-decoration-renderer.js +0 -99
- package/dist/lib/render/canvas/text-renderer.js +0 -486
- package/dist/lib/render/effects.js +0 -231
- package/dist/lib/render/font-metrics.js +0 -53
- package/dist/lib/render/object-fit.js +0 -91
- package/dist/lib/render/path.js +0 -26
- package/dist/lib/render/renderer-interface.js +0 -2
- package/dist/lib/render/stacking-context.js +0 -341
- package/dist/lib/render/vector.js +0 -16
package/README.md
CHANGED
|
@@ -15,26 +15,45 @@ Next generation JavaScript screenshot tool.
|
|
|
15
15
|
<a href="https://deepwiki.com/yorickshan/html2canvas-pro"><img src="https://deepwiki.com/badge.svg" alt="Ask DeepWiki"></a>
|
|
16
16
|
</p>
|
|
17
17
|
<p align="center">
|
|
18
|
-
<a href="https://yorickshan.github.io/html2canvas-pro/getting-started.html">Getting Started</a>
|
|
18
|
+
<a href="https://yorickshan.github.io/html2canvas-pro/getting-started.html">Getting Started</a> ·
|
|
19
|
+
<a href="https://yorickshan.github.io/html2canvas-pro/configuration.html">Configuration</a> ·
|
|
20
|
+
<a href="https://yorickshan.github.io/html2canvas-pro/features.html">Features</a> ·
|
|
21
|
+
<a href="https://yorickshan.github.io/html2canvas-pro/faq.html">FAQ</a>
|
|
19
22
|
</p>
|
|
20
23
|
<br>
|
|
21
24
|
|
|
22
25
|
## Why html2canvas-pro?
|
|
23
26
|
|
|
24
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
|
+
|
|
29
|
+
**Modern CSS support**
|
|
25
30
|
- Color functions `color()` (incl. relative colors), `lab()`, `lch()`, `oklab()`, `oklch()`
|
|
26
31
|
- `background-clip: text` support
|
|
27
|
-
- `mix-blend-mode` support
|
|
32
|
+
- `mix-blend-mode` and `background-blend-mode` support
|
|
28
33
|
- `object-fit` support for `<img/>`
|
|
29
|
-
- CSS `clip-path` support (inset, circle, ellipse, polygon, path)
|
|
34
|
+
- CSS `clip-path` support (inset, rect, xywh, circle, ellipse, polygon, path)
|
|
30
35
|
- CSS `writing-mode` support (horizontal-tb, vertical-rl, vertical-lr)
|
|
31
|
-
-
|
|
32
|
-
-
|
|
33
|
-
-
|
|
34
|
-
-
|
|
35
|
-
-
|
|
36
|
-
-
|
|
37
|
-
-
|
|
36
|
+
- `mask-image` alpha masks with position/size/repeat (see [mask support](docs/features.md#mask-support))
|
|
37
|
+
- `backdrop-filter: blur()` for frosted-glass captures (see [backdrop-filter support](docs/features.md#backdrop-filter-support))
|
|
38
|
+
- `conic-gradient()` and `repeating-radial-gradient()` — complete gradient family
|
|
39
|
+
- `text-emphasis` (CJK emphasis marks), `-webkit-box-reflect`, `image-set()`, `border-image-outset` / `border-image-width`
|
|
40
|
+
- `accent-color`, `outline`, `-webkit-text-fill-color`, `isolation`
|
|
41
|
+
- `filter` compositing for eligible layers — `blur()` / `drop-shadow()` rendered on a dedicated surface with correct layer `opacity` (see [filter support notes](docs/filter-support.md))
|
|
42
|
+
- Faithful `box-shadow` rendering, including inset shadows, blur scaling, and shadows through transformed ancestors
|
|
43
|
+
- `image-rendering` CSS property plus `imageSmoothing` / `imageSmoothingQuality` options for pixel-perfect output
|
|
44
|
+
- Border image, counters & quotes, `direction`, `line-height`, `transform-origin`, and more — see the full [feature list](docs/features.md)
|
|
45
|
+
|
|
46
|
+
**Developer experience**
|
|
47
|
+
- **Security validation** — Built-in input validation (`Validator` API, XSS/SSRF protection)
|
|
48
|
+
- **Performance monitoring** — Built-in `PerformanceMonitor` with per-phase timings
|
|
49
|
+
- **Error, progress & cancellation hooks** — `onError` for failed resources, `onProgress` for pipeline milestones (incl. per-batch image preload progress), `AbortSignal` cancellation
|
|
50
|
+
- **TypeScript** — First-class type definitions included
|
|
51
|
+
- **Shadow DOM & Web Components** — slot assignment, shadow-root cloning, and automatic iframe placement
|
|
52
|
+
|
|
53
|
+
**Performance**
|
|
54
|
+
- Deferred (batched, parallel) image preloading
|
|
55
|
+
- LRU caches for CSS parsing and gradient patterns
|
|
56
|
+
- Native canvas filter fast path with verified SVG fallback
|
|
38
57
|
|
|
39
58
|
If you found this helpful, don't forget to
|
|
40
59
|
leave a star 🌟.
|
|
@@ -48,11 +67,12 @@ yarn add html2canvas-pro
|
|
|
48
67
|
```
|
|
49
68
|
|
|
50
69
|
## Usage
|
|
70
|
+
|
|
51
71
|
```javascript
|
|
52
72
|
import html2canvas from 'html2canvas-pro';
|
|
53
73
|
```
|
|
54
74
|
|
|
55
|
-
To render an `element` with html2canvas-pro with some (optional) [options](
|
|
75
|
+
To render an `element` with html2canvas-pro with some (optional) [options](docs/configuration.md), simply call `html2canvas(element, options);`
|
|
56
76
|
|
|
57
77
|
### Basic Example
|
|
58
78
|
|
|
@@ -62,9 +82,20 @@ html2canvas(document.body).then(function(canvas) {
|
|
|
62
82
|
});
|
|
63
83
|
```
|
|
64
84
|
|
|
85
|
+
### Script tag / CDN
|
|
86
|
+
|
|
87
|
+
A browser bundle is also available (exposes the global `window.html2canvas`):
|
|
88
|
+
|
|
89
|
+
```html
|
|
90
|
+
<script src="https://cdn.jsdelivr.net/npm/html2canvas-pro/dist/html2canvas-pro.min.js"></script>
|
|
91
|
+
<script>
|
|
92
|
+
html2canvas(document.body).then((canvas) => document.body.appendChild(canvas));
|
|
93
|
+
</script>
|
|
94
|
+
```
|
|
95
|
+
|
|
65
96
|
### Controlling Output Dimensions
|
|
66
97
|
|
|
67
|
-
⚠️ **Important**: By default, the output canvas dimensions are affected by `devicePixelRatio`.
|
|
98
|
+
⚠️ **Important**: By default, the output canvas dimensions are affected by `devicePixelRatio`.
|
|
68
99
|
|
|
69
100
|
```javascript
|
|
70
101
|
// If you need exact pixel dimensions (e.g., for a specific file size):
|
|
@@ -78,7 +109,78 @@ html2canvas(element, {
|
|
|
78
109
|
});
|
|
79
110
|
```
|
|
80
111
|
|
|
81
|
-
See the [Configuration Guide](
|
|
112
|
+
See the [Configuration Guide](docs/configuration.md#canvas-dimensions) for more details.
|
|
113
|
+
|
|
114
|
+
### Error Handling & Cancellation
|
|
115
|
+
|
|
116
|
+
```javascript
|
|
117
|
+
const controller = new AbortController();
|
|
118
|
+
|
|
119
|
+
html2canvas(element, {
|
|
120
|
+
useCORS: true,
|
|
121
|
+
onError: (error) => {
|
|
122
|
+
// Called when a resource (image, font, …) fails to load.
|
|
123
|
+
// The render continues — this is a notification hook, not an abort.
|
|
124
|
+
console.warn('Resource failed:', error);
|
|
125
|
+
},
|
|
126
|
+
signal: controller.signal // Rejects with an AbortError when aborted
|
|
127
|
+
}).then(canvas => {
|
|
128
|
+
document.body.appendChild(canvas);
|
|
129
|
+
});
|
|
130
|
+
|
|
131
|
+
// Cancel an in-progress capture:
|
|
132
|
+
controller.abort();
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
### Pixel-Perfect Capture
|
|
136
|
+
|
|
137
|
+
```javascript
|
|
138
|
+
html2canvas(element, {
|
|
139
|
+
imageSmoothing: false, // Disable anti-aliasing globally
|
|
140
|
+
scale: 2 // Upscale without blur
|
|
141
|
+
});
|
|
142
|
+
// Or per-element via CSS: style="image-rendering: pixelated"
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
## API
|
|
146
|
+
|
|
147
|
+
The package exports `html2canvas` (default), plus the following named exports:
|
|
148
|
+
|
|
149
|
+
| Export | Description |
|
|
150
|
+
| --- | --- |
|
|
151
|
+
| `html2canvas` | Render an element to a `<canvas>` |
|
|
152
|
+
| `Html2CanvasConfig` | Per-call runtime config (CSP nonce, shared cache) |
|
|
153
|
+
| `Validator` / `createDefaultValidator` | Input validation (URLs, proxy allow-list, element checks) |
|
|
154
|
+
| `PerformanceMonitor` | Phase-level timing metrics |
|
|
155
|
+
| `Options` | The full options type |
|
|
156
|
+
|
|
157
|
+
Full type definitions ship with the package — your editor's IntelliSense covers every option. An HTML API reference can be generated locally with `corepack pnpm docs:api` (TypeDoc).
|
|
158
|
+
|
|
159
|
+
## Documentation
|
|
160
|
+
|
|
161
|
+
The full documentation site lives at [yorickshan.github.io/html2canvas-pro](https://yorickshan.github.io/html2canvas-pro/):
|
|
162
|
+
|
|
163
|
+
- [Getting Started](docs/getting-started.md) — installation, usage, live demo
|
|
164
|
+
- [Configuration](docs/configuration.md) — every option with defaults and examples
|
|
165
|
+
- [Features](docs/features.md) — supported CSS properties and values
|
|
166
|
+
- [Proxy](docs/proxy.md) — cross-origin image handling
|
|
167
|
+
- [FAQ](docs/faq.md) — canvas size, tainted canvas, browser limits
|
|
168
|
+
- [Architecture](docs/ARCHITECTURE.md) — how the rendering pipeline works
|
|
169
|
+
|
|
170
|
+
## Development
|
|
171
|
+
|
|
172
|
+
The project uses [pnpm](https://pnpm.io) (the version is pinned via the `packageManager` field — Corepack handles it automatically). Unit tests require **Node.js 24** (jsdom 30).
|
|
173
|
+
|
|
174
|
+
```sh
|
|
175
|
+
corepack pnpm install
|
|
176
|
+
corepack pnpm build # tsc + Rolldown bundles (CJS/ESM/UMD)
|
|
177
|
+
corepack pnpm unittest # Vitest unit tests
|
|
178
|
+
corepack pnpm test # lint + unit tests + browser (Karma) tests
|
|
179
|
+
corepack pnpm docs:dev # VitePress dev server
|
|
180
|
+
corepack pnpm docs:api # Generate the TypeDoc API reference
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
See [CONTRIBUTING.md](docs/CONTRIBUTING.md) for the full guide, including how to add a new CSS property.
|
|
82
184
|
|
|
83
185
|
## Contribution
|
|
84
186
|
|