html2canvas-pro 2.4.5 → 2.5.1
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 +117 -13
- package/dist/html2canvas-pro.cjs +3425 -1677
- package/dist/html2canvas-pro.cjs.map +1 -1
- package/dist/html2canvas-pro.esm.js +3425 -1677
- package/dist/html2canvas-pro.esm.js.map +1 -1
- package/dist/html2canvas-pro.js +3479 -1731
- package/dist/html2canvas-pro.js.map +1 -1
- package/dist/html2canvas-pro.min.js +5 -5
- package/dist/types/core/cache-storage.d.ts +22 -1
- package/dist/types/core/context.d.ts +10 -1
- package/dist/types/core/logger.d.ts +0 -3
- 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 +17 -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 +17 -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/dom/replaced-elements/input-element-container.d.ts +1 -1
- package/dist/types/options.d.ts +8 -2
- package/dist/types/render/canvas/background-renderer.d.ts +28 -0
- package/dist/types/render/canvas/border-image-renderer.d.ts +50 -1
- package/dist/types/render/canvas/canvas-renderer.d.ts +29 -15
- package/dist/types/render/canvas/effects-renderer.d.ts +8 -0
- package/dist/types/render/canvas/mask-renderer.d.ts +36 -0
- package/dist/types/render/canvas/text-clip-renderer.d.ts +56 -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 +41 -42
- 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
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Display-P3 related functions
|
|
3
3
|
*/
|
|
4
|
+
import { RGB3, RGBA4 } from '../color-math';
|
|
4
5
|
/**
|
|
5
6
|
* Convert P3 Linear to xyz
|
|
6
7
|
*
|
|
@@ -18,19 +19,19 @@ export declare const xyzToP3Linear: (xyz: [number, number, number]) => [number,
|
|
|
18
19
|
*
|
|
19
20
|
* @param p3
|
|
20
21
|
*/
|
|
21
|
-
export declare const p32p3Linear: (p3:
|
|
22
|
+
export declare const p32p3Linear: (p3: RGB3) => RGB3;
|
|
22
23
|
/**
|
|
23
24
|
* Convert P3 Linear to P3
|
|
24
25
|
*
|
|
25
26
|
* @param p3l
|
|
26
27
|
*/
|
|
27
|
-
export declare const p3Linear2p3: (p3l:
|
|
28
|
+
export declare const p3Linear2p3: (p3l: RGB3) => RGB3;
|
|
28
29
|
/**
|
|
29
30
|
* Convert P3 to XYZ
|
|
30
31
|
*
|
|
31
32
|
* @param args
|
|
32
33
|
*/
|
|
33
|
-
export declare const p3ToXYZ: (args:
|
|
34
|
+
export declare const p3ToXYZ: (args: RGB3) => RGB3;
|
|
34
35
|
/**
|
|
35
36
|
* Convert XYZ to P3
|
|
36
37
|
*
|
|
@@ -42,4 +43,4 @@ export declare const p3FromXYZ: (args: [number, number, number, number]) => [num
|
|
|
42
43
|
*
|
|
43
44
|
* @param args
|
|
44
45
|
*/
|
|
45
|
-
export declare const convertP3: (args:
|
|
46
|
+
export declare const convertP3: (args: RGBA4) => number;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Pro Photo related functions
|
|
3
3
|
*/
|
|
4
|
+
import { RGB3, RGBA4 } from '../color-math';
|
|
4
5
|
/**
|
|
5
6
|
* Convert linear-light display-p3 to XYZ D65
|
|
6
7
|
*
|
|
@@ -18,19 +19,19 @@ export declare const xyzToProPhotoLinear: (xyz: [number, number, number]) => [nu
|
|
|
18
19
|
*
|
|
19
20
|
* @param p3
|
|
20
21
|
*/
|
|
21
|
-
export declare const proPhotoToProPhotoLinear: (p3:
|
|
22
|
+
export declare const proPhotoToProPhotoLinear: (p3: RGB3) => RGB3;
|
|
22
23
|
/**
|
|
23
24
|
* Convert Pro-Photo Linear to Pro-Photo
|
|
24
25
|
*
|
|
25
26
|
* @param p3
|
|
26
27
|
*/
|
|
27
|
-
export declare const proPhotoLinearToProPhoto: (p3:
|
|
28
|
+
export declare const proPhotoLinearToProPhoto: (p3: RGB3) => RGB3;
|
|
28
29
|
/**
|
|
29
30
|
* Convert Pro-Photo to XYZ
|
|
30
31
|
*
|
|
31
32
|
* @param args
|
|
32
33
|
*/
|
|
33
|
-
export declare const proPhotoToXYZ: (args:
|
|
34
|
+
export declare const proPhotoToXYZ: (args: RGB3) => RGB3;
|
|
34
35
|
/**
|
|
35
36
|
* Convert XYZ to Pro-Photo
|
|
36
37
|
*
|
|
@@ -42,4 +43,4 @@ export declare const proPhotoFromXYZ: (args: [number, number, number, number]) =
|
|
|
42
43
|
*
|
|
43
44
|
* @param args
|
|
44
45
|
*/
|
|
45
|
-
export declare const convertProPhoto: (args:
|
|
46
|
+
export declare const convertProPhoto: (args: RGBA4) => number;
|
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* REC2020 related functions
|
|
3
3
|
*/
|
|
4
|
+
import { RGB3, RGBA4 } from '../color-math';
|
|
4
5
|
/**
|
|
5
6
|
* Convert rec2020 to rec2020 linear
|
|
6
7
|
*
|
|
7
8
|
* @param rgb
|
|
8
9
|
*/
|
|
9
|
-
export declare const rec20202rec2020Linear: (rgb:
|
|
10
|
+
export declare const rec20202rec2020Linear: (rgb: RGB3) => RGB3;
|
|
10
11
|
/**
|
|
11
12
|
* Convert rec2020 linear to rec2020
|
|
12
13
|
*
|
|
13
14
|
* @param rgb
|
|
14
15
|
*/
|
|
15
|
-
export declare const rec2020Linear2rec2020: (rgb:
|
|
16
|
+
export declare const rec2020Linear2rec2020: (rgb: RGB3) => RGB3;
|
|
16
17
|
/**
|
|
17
18
|
* Convert rec2020 linear to XYZ D65
|
|
18
19
|
*
|
|
@@ -30,7 +31,7 @@ export declare const xyzToRec2020Linear: (xyz: [number, number, number]) => [num
|
|
|
30
31
|
*
|
|
31
32
|
* @param args
|
|
32
33
|
*/
|
|
33
|
-
export declare const rec2020ToXYZ: (args:
|
|
34
|
+
export declare const rec2020ToXYZ: (args: RGB3) => RGB3;
|
|
34
35
|
/**
|
|
35
36
|
* Convert XYZ to Rec2020
|
|
36
37
|
*
|
|
@@ -42,4 +43,4 @@ export declare const rec2020FromXYZ: (args: [number, number, number, number]) =>
|
|
|
42
43
|
*
|
|
43
44
|
* @param args
|
|
44
45
|
*/
|
|
45
|
-
export declare const convertRec2020: (args:
|
|
46
|
+
export declare const convertRec2020: (args: RGBA4) => number;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* SRGB related functions
|
|
3
3
|
*/
|
|
4
|
+
import { RGB3, RGBA4 } from '../color-math';
|
|
4
5
|
/**
|
|
5
6
|
* Convert XYZ to linear-light sRGB
|
|
6
7
|
*
|
|
@@ -18,21 +19,21 @@ export declare const rgbLinear2xyz: (xyz: [number, number, number]) => [number,
|
|
|
18
19
|
*
|
|
19
20
|
* @param rgb
|
|
20
21
|
*/
|
|
21
|
-
export declare const srgbLinear2rgb: (rgb:
|
|
22
|
+
export declare const srgbLinear2rgb: (rgb: RGB3) => RGB3;
|
|
22
23
|
/**
|
|
23
24
|
* Convert RGB to sRGB
|
|
24
25
|
*
|
|
25
26
|
* @param rgb
|
|
26
27
|
*/
|
|
27
|
-
export declare const rgb2rgbLinear: (rgb:
|
|
28
|
+
export declare const rgb2rgbLinear: (rgb: RGB3) => RGB3;
|
|
28
29
|
/**
|
|
29
30
|
* XYZ to SRGB
|
|
30
31
|
*
|
|
31
32
|
* @param args
|
|
32
33
|
*/
|
|
33
|
-
export declare const srgbFromXYZ: (args:
|
|
34
|
+
export declare const srgbFromXYZ: (args: RGBA4) => RGBA4;
|
|
34
35
|
/**
|
|
35
36
|
* XYZ to SRGB-Linear
|
|
36
37
|
* @param args
|
|
37
38
|
*/
|
|
38
|
-
export declare const srgbLinearFromXYZ: (args:
|
|
39
|
+
export declare const srgbLinearFromXYZ: (args: RGBA4) => RGBA4;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Context } from '../../core/context';
|
|
2
2
|
import { CSSValue } from '../syntax/parser';
|
|
3
|
-
import { clamp, multiplyMatrices } from './color-math';
|
|
3
|
+
import { clamp, multiplyMatrices, RGB3, RGBA4 } from './color-math';
|
|
4
4
|
type Color = number;
|
|
5
5
|
export declare const isTransparent: (color: Color) => boolean;
|
|
6
6
|
export declare const asString: (color: Color) => string;
|
|
@@ -8,18 +8,18 @@ export declare const pack: (r: number, g: number, b: number, a: number) => Color
|
|
|
8
8
|
export declare const getTokenColorValue: (token: CSSValue, i: number) => number;
|
|
9
9
|
export declare const isRelativeTransform: (tokens: CSSValue[]) => boolean;
|
|
10
10
|
export { clamp, multiplyMatrices };
|
|
11
|
-
export declare const packSrgb: (args:
|
|
12
|
-
export declare const packSrgbLinear: (
|
|
13
|
-
export declare const packXYZ: (args:
|
|
11
|
+
export declare const packSrgb: (args: RGBA4) => number;
|
|
12
|
+
export declare const packSrgbLinear: (args: RGBA4) => number;
|
|
13
|
+
export declare const packXYZ: (args: RGBA4) => number;
|
|
14
14
|
export declare const packLab: (_context: Context, args: CSSValue[]) => number;
|
|
15
15
|
export declare const packOkLab: (_context: Context, args: CSSValue[]) => number;
|
|
16
16
|
export declare const packOkLch: (_context: Context, args: CSSValue[]) => number;
|
|
17
17
|
export declare const packLch: (_context: Context, args: CSSValue[]) => number;
|
|
18
|
-
export declare const extractHslComponents: (context: Context, args: CSSValue[]) =>
|
|
18
|
+
export declare const extractHslComponents: (context: Context, args: CSSValue[]) => RGBA4;
|
|
19
19
|
export declare const packHSL: (context: Context, args: CSSValue[]) => number;
|
|
20
|
-
export declare const extractLchComponents: (args: CSSValue[]) =>
|
|
21
|
-
export declare const extractLabComponents: (args: CSSValue[]) =>
|
|
22
|
-
export declare const extractOkLchComponents: (args: CSSValue[]) =>
|
|
20
|
+
export declare const extractLchComponents: (args: CSSValue[]) => RGBA4;
|
|
21
|
+
export declare const extractLabComponents: (args: CSSValue[]) => RGBA4;
|
|
22
|
+
export declare const extractOkLchComponents: (args: CSSValue[]) => RGBA4;
|
|
23
23
|
/**
|
|
24
24
|
* Convert D65 to D50
|
|
25
25
|
*
|
|
@@ -80,7 +80,7 @@ export declare const oklabToXyz: (_context: Context, args: CSSValue[]) => [numbe
|
|
|
80
80
|
*
|
|
81
81
|
* @param args
|
|
82
82
|
*/
|
|
83
|
-
export declare const xyz50ToXYZ: (args:
|
|
83
|
+
export declare const xyz50ToXYZ: (args: RGBA4 | RGB3) => RGB3;
|
|
84
84
|
/**
|
|
85
85
|
* Does nothing, required for SUPPORTED_COLOR_SPACES_FROM_XYZ in the _color() function
|
|
86
86
|
*
|
|
@@ -98,10 +98,10 @@ export declare const xyz50FromXYZ: (args: [number, number, number, number]) => [
|
|
|
98
98
|
*
|
|
99
99
|
* @param args
|
|
100
100
|
*/
|
|
101
|
-
export declare const convertXyz: (args:
|
|
101
|
+
export declare const convertXyz: (args: RGBA4) => number;
|
|
102
102
|
/**
|
|
103
103
|
* Convert XYZ-50 to SRGB and Pack
|
|
104
104
|
*
|
|
105
105
|
* @param args
|
|
106
106
|
*/
|
|
107
|
-
export declare const convertXyz50: (args:
|
|
107
|
+
export declare const convertXyz50: (args: RGBA4) => number;
|
|
@@ -3,6 +3,7 @@ import { Context } from '../../core/context';
|
|
|
3
3
|
export type Color = number;
|
|
4
4
|
export declare const color: ITypeDescriptor<Color>;
|
|
5
5
|
export declare const parseColor: (context: Context, value: string) => Color;
|
|
6
|
+
export declare const TRANSPARENT_COLOR: Color;
|
|
6
7
|
export declare const COLORS: {
|
|
7
8
|
[key: string]: Color;
|
|
8
9
|
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { CSSValue } from '../../syntax/parser';
|
|
2
|
+
import { CSSConicGradientImage } from '../image';
|
|
3
|
+
import { Context } from '../../../core/context';
|
|
4
|
+
/**
|
|
5
|
+
* conic-gradient( [ from <angle> ]? [ at <position> ]?, <color-stop-list> )
|
|
6
|
+
*
|
|
7
|
+
* The gradient sweeps clockwise from `from <angle>` (0deg = 12 o'clock)
|
|
8
|
+
* around `at <position>` (default: center). The first comma-separated group
|
|
9
|
+
* may carry the from/at clauses; every following group is a color stop.
|
|
10
|
+
*/
|
|
11
|
+
export declare const conicGradient: (context: Context, tokens: CSSValue[]) => CSSConicGradientImage;
|
|
12
|
+
/**
|
|
13
|
+
* repeating-conic-gradient shares the conic-gradient grammar exactly; only
|
|
14
|
+
* the image type differs, which switches the renderer to periodic stops
|
|
15
|
+
* stacked across the full sweep.
|
|
16
|
+
*/
|
|
17
|
+
export declare const repeatingConicGradient: (context: Context, tokens: CSSValue[]) => CSSConicGradientImage;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { CSSValue } from '../../syntax/parser';
|
|
2
|
+
import { ICSSImage } from '../image';
|
|
3
|
+
import { Context } from '../../../core/context';
|
|
4
|
+
/**
|
|
5
|
+
* image-set(url(a.png) 1x, url(b.png) 2x)
|
|
6
|
+
*
|
|
7
|
+
* Browsers keep image-set in the computed value, so the candidate matching
|
|
8
|
+
* the current devicePixelRatio is selected here: the smallest resolution >=
|
|
9
|
+
* DPR, falling back to the largest candidate below it.
|
|
10
|
+
*/
|
|
11
|
+
export declare const imageSet: (context: Context, tokens: CSSValue[]) => ICSSImage;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { CSSValue } from '../../syntax/parser';
|
|
2
|
+
import { CSSRadialGradientImage } from '../image';
|
|
3
|
+
import { Context } from '../../../core/context';
|
|
4
|
+
/**
|
|
5
|
+
* repeating-radial-gradient shares the radial-gradient grammar exactly; only
|
|
6
|
+
* the image type differs, which switches the renderer to periodic stops.
|
|
7
|
+
*/
|
|
8
|
+
export declare const repeatingRadialGradient: (context: Context, tokens: CSSValue[]) => CSSRadialGradientImage;
|
|
@@ -6,11 +6,17 @@ export declare const enum CSSImageType {
|
|
|
6
6
|
URL = 0,
|
|
7
7
|
LINEAR_GRADIENT = 1,
|
|
8
8
|
RADIAL_GRADIENT = 2,
|
|
9
|
-
REPEATING_LINEAR_GRADIENT = 3
|
|
9
|
+
REPEATING_LINEAR_GRADIENT = 3,
|
|
10
|
+
REPEATING_RADIAL_GRADIENT = 4,
|
|
11
|
+
CONIC_GRADIENT = 5,
|
|
12
|
+
REPEATING_CONIC_GRADIENT = 6
|
|
10
13
|
}
|
|
11
14
|
export declare const isLinearGradient: (background: ICSSImage) => background is CSSLinearGradientImage;
|
|
12
15
|
export declare const isRadialGradient: (background: ICSSImage) => background is CSSRadialGradientImage;
|
|
13
16
|
export declare const isRepeatingLinearGradient: (background: ICSSImage) => background is CSSLinearGradientImage;
|
|
17
|
+
export declare const isRepeatingRadialGradient: (background: ICSSImage) => background is CSSRadialGradientImage;
|
|
18
|
+
export declare const isConicGradient: (background: ICSSImage) => background is CSSConicGradientImage;
|
|
19
|
+
export declare const isRepeatingConicGradient: (background: ICSSImage) => background is CSSConicGradientImage;
|
|
14
20
|
export interface UnprocessedGradientColorStop {
|
|
15
21
|
color: Color;
|
|
16
22
|
stop: LengthPercentage | null;
|
|
@@ -46,11 +52,20 @@ export declare const enum CSSRadialExtent {
|
|
|
46
52
|
}
|
|
47
53
|
export type CSSRadialSize = CSSRadialExtent | LengthPercentage[];
|
|
48
54
|
export interface CSSRadialGradientImage extends ICSSGradientImage {
|
|
49
|
-
type: CSSImageType.RADIAL_GRADIENT;
|
|
55
|
+
type: CSSImageType.RADIAL_GRADIENT | CSSImageType.REPEATING_RADIAL_GRADIENT;
|
|
50
56
|
shape: CSSRadialShape;
|
|
51
57
|
size: CSSRadialSize;
|
|
52
58
|
position: LengthPercentage[];
|
|
53
59
|
}
|
|
60
|
+
/**
|
|
61
|
+
* conic-gradient( [ from <angle> ]? [ at <position> ]?, <color-stop-list> )
|
|
62
|
+
* `angle` is the `from` angle in radians, measured clockwise from 12 o'clock.
|
|
63
|
+
*/
|
|
64
|
+
export interface CSSConicGradientImage extends ICSSGradientImage {
|
|
65
|
+
type: CSSImageType.CONIC_GRADIENT | CSSImageType.REPEATING_CONIC_GRADIENT;
|
|
66
|
+
angle: number;
|
|
67
|
+
position: LengthPercentage[];
|
|
68
|
+
}
|
|
54
69
|
export declare const image: ITypeDescriptor<ICSSImage>;
|
|
55
70
|
export declare function isSupportedImage(value: CSSValue): boolean;
|
|
56
71
|
export {};
|
|
@@ -1,8 +1,2 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Safe arithmetic expression evaluator — replaces `new Function()`.
|
|
3
|
-
*
|
|
4
|
-
* Supports only: numbers, +, -, *, /, parentheses.
|
|
5
|
-
* Does NOT execute arbitrary code. Returns NaN on any illegal token.
|
|
6
|
-
*/
|
|
7
1
|
declare const safeEvalArithmetic: (expr: string) => number;
|
|
8
2
|
export default safeEvalArithmetic;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Computed-style copying for cloned elements.
|
|
3
|
+
*
|
|
4
|
+
* Copies every computed CSS property of the source element onto the clone's
|
|
5
|
+
* inline style so the clone renders identically without stylesheets (the
|
|
6
|
+
* clone iframe only carries the <style> tags the cloner could read).
|
|
7
|
+
*/
|
|
8
|
+
export declare const copyCSSStyles: <T extends HTMLElement | SVGElement>(style: CSSStyleDeclaration, target: T) => T;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { Bounds } from '../css/layout/bounds';
|
|
2
2
|
import { Context } from '../core/context';
|
|
3
|
+
export { copyCSSStyles } from './copy-css-styles';
|
|
4
|
+
export { serializeDoctype } from './iframe-mount';
|
|
3
5
|
export interface CloneOptions {
|
|
4
6
|
ignoreElements?: (element: Element) => boolean;
|
|
5
7
|
onclone?: (document: Document, element: HTMLElement) => void;
|
|
@@ -25,8 +27,8 @@ export declare class DocumentCloner {
|
|
|
25
27
|
clonedReferenceElement?: HTMLElement;
|
|
26
28
|
private readonly documentElement;
|
|
27
29
|
private readonly counters;
|
|
30
|
+
private readonly pseudoContents;
|
|
28
31
|
private readonly slotCloner;
|
|
29
|
-
private quoteDepth;
|
|
30
32
|
constructor(context: Context, element: HTMLElement, options: CloneConfigurations);
|
|
31
33
|
toIFrame(ownerDocument: Document, windowSize: Bounds): Promise<HTMLIFrameElement>;
|
|
32
34
|
createElementClone<T extends HTMLElement | SVGElement>(node: T): HTMLElement | SVGElement;
|
|
@@ -41,17 +43,5 @@ export declare class DocumentCloner {
|
|
|
41
43
|
*/
|
|
42
44
|
cloneChildNodes(node: Element, clone: HTMLElement | SVGElement, copyStyles: boolean): void;
|
|
43
45
|
cloneNode(node: Node, copyStyles: boolean): Node;
|
|
44
|
-
resolvePseudoContent(node: Element, clone: Element, style: CSSStyleDeclaration, pseudoElt: PseudoElementType): HTMLElement | void;
|
|
45
46
|
static destroy(container: HTMLIFrameElement): boolean;
|
|
46
47
|
}
|
|
47
|
-
declare enum PseudoElementType {
|
|
48
|
-
BEFORE = 0,
|
|
49
|
-
AFTER = 1
|
|
50
|
-
}
|
|
51
|
-
export declare const copyCSSStyles: <T extends HTMLElement | SVGElement>(style: CSSStyleDeclaration, target: T) => T;
|
|
52
|
-
/**
|
|
53
|
-
* Serialise a document type declaration to an HTML string.
|
|
54
|
-
* @internal – exported for testing only, not part of the public API.
|
|
55
|
-
*/
|
|
56
|
-
export declare const serializeDoctype: (doctype?: DocumentType | null) => string;
|
|
57
|
-
export {};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Mounts the cloned document into a hidden iframe and waits for it to become
|
|
3
|
+
* paintable.
|
|
4
|
+
*
|
|
5
|
+
* Extracted from DocumentCloner so the cloner only owns node-cloning strategy;
|
|
6
|
+
* this module owns the iframe lifecycle: container creation, document.write,
|
|
7
|
+
* Trusted Types, load polling, webfont/image readiness, the onclone hook and
|
|
8
|
+
* WebKit scroll-anchoring compensation.
|
|
9
|
+
*/
|
|
10
|
+
import { Bounds } from '../css/layout/bounds';
|
|
11
|
+
import { Context } from '../core/context';
|
|
12
|
+
export interface CloneMountOptions {
|
|
13
|
+
/** Cloned <html> root to adopt into the iframe document. */
|
|
14
|
+
documentElement: HTMLElement;
|
|
15
|
+
/** Clone of the render target; must exist before mounting. */
|
|
16
|
+
clonedReferenceElement: HTMLElement | undefined;
|
|
17
|
+
/** nodeName of the original render target, for error messages. */
|
|
18
|
+
referenceElementName: string;
|
|
19
|
+
/** [clonedNode, scrollLeft, scrollTop] pairs captured during cloning. */
|
|
20
|
+
scrolledElements: [Element, number, number][];
|
|
21
|
+
/** Consumer hook, invoked with the cloned document before measuring. */
|
|
22
|
+
onclone?: (document: Document, element: HTMLElement) => void;
|
|
23
|
+
/** Mount the iframe inside a shadow root instead of <body>. */
|
|
24
|
+
container?: HTMLElement | ShadowRoot;
|
|
25
|
+
}
|
|
26
|
+
export declare const createIFrameContainer: (ownerDocument: Document, bounds: Bounds, customContainer?: HTMLElement | ShadowRoot) => HTMLIFrameElement;
|
|
27
|
+
/**
|
|
28
|
+
* Serialise a document type declaration to an HTML string.
|
|
29
|
+
* @internal – exported for testing only, not part of the public API.
|
|
30
|
+
*/
|
|
31
|
+
export declare const serializeDoctype: (doctype?: DocumentType | null) => string;
|
|
32
|
+
/**
|
|
33
|
+
* Point the clone's relative URLs at the source document.
|
|
34
|
+
* @internal – exported for testing only, not part of the public API.
|
|
35
|
+
*/
|
|
36
|
+
export declare const addBase: (targetELement: HTMLElement, baseUri: string) => void;
|
|
37
|
+
export declare const mountCloneInIFrame: (context: Context, ownerDocument: Document, windowSize: Bounds, mount: CloneMountOptions) => Promise<HTMLIFrameElement>;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pseudo-element (::before / ::after) content resolution.
|
|
3
|
+
*
|
|
4
|
+
* Extracted from DocumentCloner: the cloner creates surrogate
|
|
5
|
+
* `<html2canvaspseudoelement>` nodes carrying the pseudo's computed styles and
|
|
6
|
+
* resolved content tokens (strings, url() images, attr(), counter(s), and
|
|
7
|
+
* quotes) as children of the cloning element. The hide classes ensure the
|
|
8
|
+
* surrogate itself is never painted; only its children are.
|
|
9
|
+
*/
|
|
10
|
+
import { CounterState } from '../css/types/functions/counter';
|
|
11
|
+
import { Context } from '../core/context';
|
|
12
|
+
export declare enum PseudoElementType {
|
|
13
|
+
BEFORE = 0,
|
|
14
|
+
AFTER = 1
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Inject the stylesheet that hides pseudo-element surrogate containers.
|
|
18
|
+
* Called on the cloned <body> so the surrogates themselves never render.
|
|
19
|
+
*/
|
|
20
|
+
export declare const createPseudoHideStyles: (body: HTMLElement, cspNonce?: string) => void;
|
|
21
|
+
/**
|
|
22
|
+
* Resolves computed `content` of ::before/::after into surrogate DOM nodes.
|
|
23
|
+
*
|
|
24
|
+
* One instance per DocumentCloner: `quoteDepth` tracks open-quote/close-quote
|
|
25
|
+
* pairing across the whole clone walk, shared with the cloner's counter state.
|
|
26
|
+
*/
|
|
27
|
+
export declare class PseudoContentResolver {
|
|
28
|
+
private readonly context;
|
|
29
|
+
private readonly counters;
|
|
30
|
+
private quoteDepth;
|
|
31
|
+
constructor(context: Context, counters: CounterState);
|
|
32
|
+
resolvePseudoContent(node: Element, clone: Element, style: CSSStyleDeclaration, pseudoElt: PseudoElementType): HTMLElement | void;
|
|
33
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ElementContainer } from '../element-container';
|
|
2
|
-
import { Color } from '../../css/types/color';
|
|
2
|
+
import { type Color } from '../../css/types/color';
|
|
3
3
|
import { Context } from '../../core/context';
|
|
4
|
-
type ParseTreeFunction = (context: Context, node:
|
|
4
|
+
type ParseTreeFunction = (context: Context, node: HTMLElement) => ElementContainer;
|
|
5
5
|
export declare class IFrameElementContainer extends ElementContainer {
|
|
6
6
|
src: string;
|
|
7
7
|
width: number;
|
|
@@ -3,7 +3,7 @@ import { Context } from '../../core/context';
|
|
|
3
3
|
export declare const CHECKBOX = "checkbox";
|
|
4
4
|
export declare const RADIO = "radio";
|
|
5
5
|
export declare const PASSWORD = "password";
|
|
6
|
-
export declare const INPUT_COLOR =
|
|
6
|
+
export declare const INPUT_COLOR = 7733247;
|
|
7
7
|
export declare const PLACEHOLDER_COLOR = 1970632191;
|
|
8
8
|
export declare class InputElementContainer extends ElementContainer {
|
|
9
9
|
readonly type: string;
|
package/dist/types/options.d.ts
CHANGED
|
@@ -55,8 +55,14 @@ export type Options = CloneOptions & WindowOptions & RenderOptions & ContextOpti
|
|
|
55
55
|
onError?: (error: Error) => void;
|
|
56
56
|
/**
|
|
57
57
|
* Called at key milestones during the render pipeline.
|
|
58
|
-
* `phase` is one of: 'clone'
|
|
59
|
-
* `progress` is 0
|
|
58
|
+
* `phase` is one of: 'clone' | 'parse' | 'preload' | 'layout' | 'render'.
|
|
59
|
+
* `progress` is a coarse 0–100 estimate. Milestones:
|
|
60
|
+
* clone 10 (cloning starts), clone 30 (cloned document ready),
|
|
61
|
+
* parse 50 (style/DOM parse done),
|
|
62
|
+
* preload 50–60 (image fetching; one event per settled batch),
|
|
63
|
+
* layout 60 (bounds + images ready),
|
|
64
|
+
* render 90 (canvas painted), render 100 (cleanup done).
|
|
65
|
+
* Callback exceptions are caught and logged, never fatal.
|
|
60
66
|
*/
|
|
61
67
|
onProgress?: (phase: string, progress: number) => void;
|
|
62
68
|
};
|
|
@@ -66,6 +66,34 @@ export declare class BackgroundRenderer {
|
|
|
66
66
|
* Render a radial gradient background
|
|
67
67
|
*/
|
|
68
68
|
private renderRadialGradient;
|
|
69
|
+
/**
|
|
70
|
+
* Render a repeating radial gradient.
|
|
71
|
+
*
|
|
72
|
+
* Canvas radial gradients have no native repeat mode, so the stop list is
|
|
73
|
+
* stacked: with period p (the last stop position) the stops are re-added
|
|
74
|
+
* k*p + s for k = 0..ceil(radius / p) - 1, clipped to the [0, 1] gradient
|
|
75
|
+
* range. The full repeating gradient is then rasterised with the same
|
|
76
|
+
* ellipse pattern trick as the plain radial renderer.
|
|
77
|
+
*/
|
|
78
|
+
private renderRepeatingRadialGradient;
|
|
79
|
+
/**
|
|
80
|
+
* Render a conic gradient.
|
|
81
|
+
*
|
|
82
|
+
* Color stops are angular: percentages of the full 360° sweep, normalised
|
|
83
|
+
* by processing against a line length of 1. Canvas createConicGradient
|
|
84
|
+
* measures its start angle in the same clockwise-from-12-o'clock space as
|
|
85
|
+
* CSS `from <angle>`.
|
|
86
|
+
*/
|
|
87
|
+
private renderConicGradient;
|
|
88
|
+
/**
|
|
89
|
+
* Render a repeating conic gradient background.
|
|
90
|
+
*
|
|
91
|
+
* Canvas conic gradient stops span the full 2π sweep as [0, 1], so the
|
|
92
|
+
* one-cycle stop list is stacked k·period + s for k = 0..cycles-1 over the
|
|
93
|
+
* whole sweep — the same periodic-stop stacking the repeating linear and
|
|
94
|
+
* radial renderers use along their gradient lines.
|
|
95
|
+
*/
|
|
96
|
+
private renderRepeatingConicGradient;
|
|
69
97
|
/**
|
|
70
98
|
* Render a repeating pattern with offset
|
|
71
99
|
*
|
|
@@ -9,10 +9,59 @@
|
|
|
9
9
|
import { BorderImageSlice } from '../../css/property-descriptors/border-image-slice';
|
|
10
10
|
import { BorderImageRepeat } from '../../css/property-descriptors/border-image-repeat';
|
|
11
11
|
import { Bounds } from '../../css/layout/bounds';
|
|
12
|
+
export interface BorderImageSides {
|
|
13
|
+
top: number;
|
|
14
|
+
right: number;
|
|
15
|
+
bottom: number;
|
|
16
|
+
left: number;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Resolve border-image-width to per-side pixel widths. `auto` uses the
|
|
20
|
+
* corresponding border width, numbers multiply it, lengths are absolute and
|
|
21
|
+
* percentages refer to the border image area (width for left/right, height
|
|
22
|
+
* for top/bottom).
|
|
23
|
+
*/
|
|
24
|
+
export declare const resolveBorderImageWidths: (width: {
|
|
25
|
+
top: {
|
|
26
|
+
kind: string;
|
|
27
|
+
value?: number;
|
|
28
|
+
};
|
|
29
|
+
right: {
|
|
30
|
+
kind: string;
|
|
31
|
+
value?: number;
|
|
32
|
+
};
|
|
33
|
+
bottom: {
|
|
34
|
+
kind: string;
|
|
35
|
+
value?: number;
|
|
36
|
+
};
|
|
37
|
+
left: {
|
|
38
|
+
kind: string;
|
|
39
|
+
value?: number;
|
|
40
|
+
};
|
|
41
|
+
} | null, borderWidths: [number, number, number, number], area: Bounds) => [number, number, number, number];
|
|
42
|
+
/** Resolve border-image-outset to per-side pixel offsets (numbers multiply the border width). */
|
|
43
|
+
export declare const resolveBorderImageOutset: (outset: {
|
|
44
|
+
top: {
|
|
45
|
+
kind: string;
|
|
46
|
+
value?: number;
|
|
47
|
+
};
|
|
48
|
+
right: {
|
|
49
|
+
kind: string;
|
|
50
|
+
value?: number;
|
|
51
|
+
};
|
|
52
|
+
bottom: {
|
|
53
|
+
kind: string;
|
|
54
|
+
value?: number;
|
|
55
|
+
};
|
|
56
|
+
left: {
|
|
57
|
+
kind: string;
|
|
58
|
+
value?: number;
|
|
59
|
+
};
|
|
60
|
+
} | null, borderWidths: [number, number, number, number]) => BorderImageSides;
|
|
12
61
|
export declare class BorderImageRenderer {
|
|
13
62
|
private readonly ctx;
|
|
14
63
|
constructor(ctx: CanvasRenderingContext2D);
|
|
15
|
-
renderBorderImage(bounds: Bounds, image: HTMLImageElement, slice: BorderImageSlice, repeat: BorderImageRepeat, borderTopWidth: number, borderRightWidth: number, borderBottomWidth: number, borderLeftWidth: number): void;
|
|
64
|
+
renderBorderImage(bounds: Bounds, image: HTMLImageElement, slice: BorderImageSlice, repeat: BorderImageRepeat, borderTopWidth: number, borderRightWidth: number, borderBottomWidth: number, borderLeftWidth: number, outset?: BorderImageSides): void;
|
|
16
65
|
private drawRegion;
|
|
17
66
|
private drawRepeatedEdge;
|
|
18
67
|
}
|
|
@@ -45,11 +45,24 @@ export declare class CanvasRenderer {
|
|
|
45
45
|
private readonly borderImageRenderer;
|
|
46
46
|
private readonly effectsRenderer;
|
|
47
47
|
private readonly textRenderer;
|
|
48
|
+
private readonly textClipRenderer;
|
|
48
49
|
private legacySubtree;
|
|
49
50
|
constructor(context: Context, options: RenderConfigurations, surfaceRoot?: ElementPaint | undefined, surfaceBudget?: SurfaceBudget);
|
|
50
51
|
renderStack(stack: StackingContext): Promise<void>;
|
|
51
52
|
private canComposite;
|
|
52
53
|
private renderCompositedStack;
|
|
54
|
+
/**
|
|
55
|
+
* Composite an alpha mask onto a finished element surface: all mask
|
|
56
|
+
* layers are painted additively into a mask surface, then kept pixels are
|
|
57
|
+
* selected with destination-in.
|
|
58
|
+
*/
|
|
59
|
+
private applyMask;
|
|
60
|
+
/**
|
|
61
|
+
* Mirror the element surface in the given direction and offset, optionally
|
|
62
|
+
* masked (the -webkit-box-reflect mask applies in element space, so it is
|
|
63
|
+
* composited in the mirrored space where the reflection was drawn).
|
|
64
|
+
*/
|
|
65
|
+
private drawReflection;
|
|
53
66
|
renderNode(paint: ElementPaint): Promise<void>;
|
|
54
67
|
/**
|
|
55
68
|
* Helper method to render text with paint order support
|
|
@@ -63,23 +76,24 @@ export declare class CanvasRenderer {
|
|
|
63
76
|
formatPath(paths: Path[]): void;
|
|
64
77
|
private renderSurfaceBoxShadow;
|
|
65
78
|
renderNodeBackgroundAndBorders(paint: ElementPaint): Promise<void>;
|
|
66
|
-
render(element: ElementContainer): Promise<HTMLCanvasElement>;
|
|
67
79
|
/**
|
|
68
|
-
*
|
|
69
|
-
*
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
*
|
|
74
|
-
*
|
|
75
|
-
*
|
|
76
|
-
*
|
|
77
|
-
*
|
|
80
|
+
* Draw the element outline: a single closed stroke around the border box,
|
|
81
|
+
* offset outwards. Outlines paint atop content and do not affect layout.
|
|
82
|
+
*/
|
|
83
|
+
private renderOutline;
|
|
84
|
+
/**
|
|
85
|
+
* Rasterise a gradient border-image-source across the border image area.
|
|
86
|
+
* CSS allows any <image> as the border-image source; gradients are painted
|
|
87
|
+
* over the whole border-image box and then sliced by the regular 9-slice
|
|
88
|
+
* pipeline, matching browser behaviour for `border-image: linear-gradient()`.
|
|
89
|
+
* Returns null when the gradient could not be painted.
|
|
78
90
|
*/
|
|
79
|
-
private
|
|
91
|
+
private rasterizeGradientSource;
|
|
80
92
|
/**
|
|
81
|
-
*
|
|
82
|
-
*
|
|
93
|
+
* Filter the already-painted content beneath the element's border box and
|
|
94
|
+
* paint the result back, approximating CSS backdrop-filter for the
|
|
95
|
+
* blur/drop-shadow subset supported by parseSimpleFilter.
|
|
83
96
|
*/
|
|
84
|
-
private
|
|
97
|
+
private renderBackdropFilter;
|
|
98
|
+
render(element: ElementContainer): Promise<HTMLCanvasElement>;
|
|
85
99
|
}
|
|
@@ -16,6 +16,13 @@ import { Path } from '../path';
|
|
|
16
16
|
*/
|
|
17
17
|
export interface EffectsRendererDependencies {
|
|
18
18
|
ctx: CanvasRenderingContext2D;
|
|
19
|
+
/**
|
|
20
|
+
* Device-pixel ratio of the bound context. Canvas shadow metrics
|
|
21
|
+
* (offset/blur) live in device space, unaffected by the context
|
|
22
|
+
* transform, so drop-shadow() blur must be scaled like the offsets.
|
|
23
|
+
* Defaults to 1.
|
|
24
|
+
*/
|
|
25
|
+
scale?: number;
|
|
19
26
|
}
|
|
20
27
|
/**
|
|
21
28
|
* Path callback for clip effects
|
|
@@ -57,6 +64,7 @@ export interface EffectsPathCallback {
|
|
|
57
64
|
export declare class EffectsRenderer {
|
|
58
65
|
private readonly ctx;
|
|
59
66
|
private readonly pathCallback;
|
|
67
|
+
private readonly scale;
|
|
60
68
|
private readonly activeEffects;
|
|
61
69
|
/** Whether a canvas state save was performed for the current batch. */
|
|
62
70
|
private didSave;
|