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.
Files changed (231) hide show
  1. package/README.md +117 -13
  2. package/dist/html2canvas-pro.cjs +3425 -1677
  3. package/dist/html2canvas-pro.cjs.map +1 -1
  4. package/dist/html2canvas-pro.esm.js +3425 -1677
  5. package/dist/html2canvas-pro.esm.js.map +1 -1
  6. package/dist/html2canvas-pro.js +3479 -1731
  7. package/dist/html2canvas-pro.js.map +1 -1
  8. package/dist/html2canvas-pro.min.js +5 -5
  9. package/dist/types/core/cache-storage.d.ts +22 -1
  10. package/dist/types/core/context.d.ts +10 -1
  11. package/dist/types/core/logger.d.ts +0 -3
  12. package/dist/types/core/render-element.d.ts +11 -0
  13. package/dist/types/core/util.d.ts +6 -0
  14. package/dist/types/css/index.d.ts +77 -46
  15. package/dist/types/css/parse.d.ts +15 -0
  16. package/dist/types/css/property-descriptors/accent-color.d.ts +5 -0
  17. package/dist/types/css/property-descriptors/backdrop-filter.d.ts +9 -0
  18. package/dist/types/css/property-descriptors/background-blend-mode.d.ts +16 -16
  19. package/dist/types/css/property-descriptors/border-image-width.d.ts +36 -0
  20. package/dist/types/css/property-descriptors/clip-path.d.ts +16 -2
  21. package/dist/types/css/property-descriptors/isolation.d.ts +6 -0
  22. package/dist/types/css/property-descriptors/mask.d.ts +25 -0
  23. package/dist/types/css/property-descriptors/mix-blend-mode.d.ts +16 -16
  24. package/dist/types/css/property-descriptors/outline.d.ts +15 -0
  25. package/dist/types/css/property-descriptors/text-emphasis.d.ts +22 -0
  26. package/dist/types/css/property-descriptors/text-shadow.d.ts +1 -1
  27. package/dist/types/css/property-descriptors/webkit-box-reflect.d.ts +19 -0
  28. package/dist/types/css/property-descriptors/webkit-text-fill-color.d.ts +9 -0
  29. package/dist/types/css/syntax/token-constants.d.ts +1 -1
  30. package/dist/types/css/types/color-math.d.ts +7 -1
  31. package/dist/types/css/types/color-spaces/a98.d.ts +2 -1
  32. package/dist/types/css/types/color-spaces/p3.d.ts +5 -4
  33. package/dist/types/css/types/color-spaces/pro-photo.d.ts +5 -4
  34. package/dist/types/css/types/color-spaces/rec2020.d.ts +5 -4
  35. package/dist/types/css/types/color-spaces/srgb.d.ts +5 -4
  36. package/dist/types/css/types/color-utilities.d.ts +11 -11
  37. package/dist/types/css/types/color.d.ts +1 -0
  38. package/dist/types/css/types/functions/conic-gradient.d.ts +17 -0
  39. package/dist/types/css/types/functions/image-set.d.ts +11 -0
  40. package/dist/types/css/types/functions/repeating-radial-gradient.d.ts +8 -0
  41. package/dist/types/css/types/image.d.ts +17 -2
  42. package/dist/types/css/types/safe-eval.d.ts +0 -6
  43. package/dist/types/dom/copy-css-styles.d.ts +8 -0
  44. package/dist/types/dom/document-cloner.d.ts +3 -13
  45. package/dist/types/dom/iframe-mount.d.ts +37 -0
  46. package/dist/types/dom/pseudo-content.d.ts +33 -0
  47. package/dist/types/dom/replaced-elements/iframe-element-container.d.ts +2 -2
  48. package/dist/types/dom/replaced-elements/input-element-container.d.ts +1 -1
  49. package/dist/types/options.d.ts +8 -2
  50. package/dist/types/render/canvas/background-renderer.d.ts +28 -0
  51. package/dist/types/render/canvas/border-image-renderer.d.ts +50 -1
  52. package/dist/types/render/canvas/canvas-renderer.d.ts +29 -15
  53. package/dist/types/render/canvas/effects-renderer.d.ts +8 -0
  54. package/dist/types/render/canvas/mask-renderer.d.ts +36 -0
  55. package/dist/types/render/canvas/text-clip-renderer.d.ts +56 -0
  56. package/dist/types/render/canvas/text-renderer.d.ts +22 -0
  57. package/dist/types/render/stacking-context.d.ts +4 -1
  58. package/package.json +41 -42
  59. package/dist/lib/config.js +0 -49
  60. package/dist/lib/core/abort-helper.js +0 -20
  61. package/dist/lib/core/background-parser.js +0 -41
  62. package/dist/lib/core/bitwise.js +0 -5
  63. package/dist/lib/core/cache-storage.js +0 -283
  64. package/dist/lib/core/config-assembler.js +0 -88
  65. package/dist/lib/core/constants.js +0 -25
  66. package/dist/lib/core/context.js +0 -19
  67. package/dist/lib/core/debugger.js +0 -27
  68. package/dist/lib/core/features.js +0 -190
  69. package/dist/lib/core/logger.js +0 -56
  70. package/dist/lib/core/lru-map.js +0 -66
  71. package/dist/lib/core/origin-checker.js +0 -53
  72. package/dist/lib/core/performance-monitor.js +0 -185
  73. package/dist/lib/core/render-element.js +0 -131
  74. package/dist/lib/core/util.js +0 -4
  75. package/dist/lib/core/validator.js +0 -500
  76. package/dist/lib/css/grouped/background-styles.js +0 -36
  77. package/dist/lib/css/grouped/border-styles.js +0 -75
  78. package/dist/lib/css/grouped/font-styles.js +0 -93
  79. package/dist/lib/css/grouped/layout-styles.js +0 -127
  80. package/dist/lib/css/index.js +0 -339
  81. package/dist/lib/css/layout/bounds.js +0 -52
  82. package/dist/lib/css/layout/text.js +0 -133
  83. package/dist/lib/css/property-descriptor.js +0 -2
  84. package/dist/lib/css/property-descriptors/background-blend-mode.js +0 -41
  85. package/dist/lib/css/property-descriptors/background-clip.js +0 -25
  86. package/dist/lib/css/property-descriptors/background-color.js +0 -10
  87. package/dist/lib/css/property-descriptors/background-image.js +0 -24
  88. package/dist/lib/css/property-descriptors/background-origin.js +0 -23
  89. package/dist/lib/css/property-descriptors/background-position.js +0 -19
  90. package/dist/lib/css/property-descriptors/background-repeat.js +0 -33
  91. package/dist/lib/css/property-descriptors/background-size.js +0 -23
  92. package/dist/lib/css/property-descriptors/border-color.js +0 -14
  93. package/dist/lib/css/property-descriptors/border-image-repeat.js +0 -42
  94. package/dist/lib/css/property-descriptors/border-image-slice.js +0 -45
  95. package/dist/lib/css/property-descriptors/border-image-source.js +0 -22
  96. package/dist/lib/css/property-descriptors/border-radius.js +0 -15
  97. package/dist/lib/css/property-descriptors/border-style.js +0 -26
  98. package/dist/lib/css/property-descriptors/border-width.js +0 -20
  99. package/dist/lib/css/property-descriptors/box-decoration-break.js +0 -18
  100. package/dist/lib/css/property-descriptors/box-shadow.js +0 -54
  101. package/dist/lib/css/property-descriptors/clip-path.js +0 -189
  102. package/dist/lib/css/property-descriptors/color.js +0 -10
  103. package/dist/lib/css/property-descriptors/content.js +0 -19
  104. package/dist/lib/css/property-descriptors/counter-increment.js +0 -35
  105. package/dist/lib/css/property-descriptors/counter-reset.js +0 -18
  106. package/dist/lib/css/property-descriptors/direction.js +0 -18
  107. package/dist/lib/css/property-descriptors/display.js +0 -81
  108. package/dist/lib/css/property-descriptors/duration.js +0 -14
  109. package/dist/lib/css/property-descriptors/filter.js +0 -86
  110. package/dist/lib/css/property-descriptors/float.js +0 -22
  111. package/dist/lib/css/property-descriptors/font-family.js +0 -47
  112. package/dist/lib/css/property-descriptors/font-size.js +0 -10
  113. package/dist/lib/css/property-descriptors/font-style.js +0 -20
  114. package/dist/lib/css/property-descriptors/font-variant-ligatures.js +0 -34
  115. package/dist/lib/css/property-descriptors/font-variant.js +0 -13
  116. package/dist/lib/css/property-descriptors/font-weight.js +0 -25
  117. package/dist/lib/css/property-descriptors/image-rendering.js +0 -33
  118. package/dist/lib/css/property-descriptors/letter-spacing.js +0 -21
  119. package/dist/lib/css/property-descriptors/line-break.js +0 -23
  120. package/dist/lib/css/property-descriptors/line-height.js +0 -24
  121. package/dist/lib/css/property-descriptors/list-style-image.js +0 -17
  122. package/dist/lib/css/property-descriptors/list-style-position.js +0 -18
  123. package/dist/lib/css/property-descriptors/list-style-type.js +0 -122
  124. package/dist/lib/css/property-descriptors/margin.js +0 -13
  125. package/dist/lib/css/property-descriptors/mix-blend-mode.js +0 -31
  126. package/dist/lib/css/property-descriptors/object-fit.js +0 -28
  127. package/dist/lib/css/property-descriptors/object-position.js +0 -42
  128. package/dist/lib/css/property-descriptors/opacity.js +0 -16
  129. package/dist/lib/css/property-descriptors/overflow-wrap.js +0 -18
  130. package/dist/lib/css/property-descriptors/overflow.js +0 -27
  131. package/dist/lib/css/property-descriptors/padding.js +0 -14
  132. package/dist/lib/css/property-descriptors/paint-order.js +0 -33
  133. package/dist/lib/css/property-descriptors/position.js +0 -22
  134. package/dist/lib/css/property-descriptors/quotes.js +0 -41
  135. package/dist/lib/css/property-descriptors/rotate.js +0 -27
  136. package/dist/lib/css/property-descriptors/text-align.js +0 -21
  137. package/dist/lib/css/property-descriptors/text-decoration-color.js +0 -10
  138. package/dist/lib/css/property-descriptors/text-decoration-line.js +0 -28
  139. package/dist/lib/css/property-descriptors/text-decoration-style.js +0 -24
  140. package/dist/lib/css/property-descriptors/text-decoration-thickness.js +0 -26
  141. package/dist/lib/css/property-descriptors/text-overflow.js +0 -18
  142. package/dist/lib/css/property-descriptors/text-shadow.js +0 -46
  143. package/dist/lib/css/property-descriptors/text-transform.js +0 -20
  144. package/dist/lib/css/property-descriptors/text-underline-offset.js +0 -23
  145. package/dist/lib/css/property-descriptors/transform-origin.js +0 -24
  146. package/dist/lib/css/property-descriptors/transform.js +0 -57
  147. package/dist/lib/css/property-descriptors/visibility.js +0 -20
  148. package/dist/lib/css/property-descriptors/webkit-line-clamp.js +0 -26
  149. package/dist/lib/css/property-descriptors/webkit-text-stroke-color.js +0 -10
  150. package/dist/lib/css/property-descriptors/webkit-text-stroke-width.js +0 -16
  151. package/dist/lib/css/property-descriptors/white-space.js +0 -32
  152. package/dist/lib/css/property-descriptors/word-break.js +0 -26
  153. package/dist/lib/css/property-descriptors/writing-mode.js +0 -28
  154. package/dist/lib/css/property-descriptors/z-index.js +0 -19
  155. package/dist/lib/css/property-descriptors/zoom.js +0 -18
  156. package/dist/lib/css/syntax/parser.js +0 -141
  157. package/dist/lib/css/syntax/token-constants.js +0 -214
  158. package/dist/lib/css/syntax/token-singletons.js +0 -36
  159. package/dist/lib/css/syntax/token-types.js +0 -10
  160. package/dist/lib/css/syntax/tokenizer.js +0 -502
  161. package/dist/lib/css/type-descriptor.js +0 -2
  162. package/dist/lib/css/types/angle.js +0 -80
  163. package/dist/lib/css/types/color-math.js +0 -25
  164. package/dist/lib/css/types/color-spaces/a98.js +0 -78
  165. package/dist/lib/css/types/color-spaces/p3.js +0 -86
  166. package/dist/lib/css/types/color-spaces/pro-photo.js +0 -83
  167. package/dist/lib/css/types/color-spaces/rec2020.js +0 -85
  168. package/dist/lib/css/types/color-spaces/srgb.js +0 -79
  169. package/dist/lib/css/types/color-utilities.js +0 -342
  170. package/dist/lib/css/types/color.js +0 -400
  171. package/dist/lib/css/types/functions/-prefix-linear-gradient.js +0 -32
  172. package/dist/lib/css/types/functions/-prefix-radial-gradient.js +0 -83
  173. package/dist/lib/css/types/functions/-webkit-gradient.js +0 -59
  174. package/dist/lib/css/types/functions/counter.js +0 -367
  175. package/dist/lib/css/types/functions/gradient.js +0 -163
  176. package/dist/lib/css/types/functions/linear-gradient.js +0 -27
  177. package/dist/lib/css/types/functions/radial-gradient.js +0 -90
  178. package/dist/lib/css/types/functions/repeating-linear-gradient.js +0 -9
  179. package/dist/lib/css/types/image.js +0 -62
  180. package/dist/lib/css/types/index.js +0 -2
  181. package/dist/lib/css/types/length-percentage.js +0 -197
  182. package/dist/lib/css/types/length.js +0 -5
  183. package/dist/lib/css/types/safe-eval.js +0 -80
  184. package/dist/lib/css/types/time.js +0 -17
  185. package/dist/lib/dom/document-cloner.js +0 -618
  186. package/dist/lib/dom/dom-normalizer.js +0 -115
  187. package/dist/lib/dom/element-container.js +0 -71
  188. package/dist/lib/dom/elements/li-element-container.js +0 -11
  189. package/dist/lib/dom/elements/ol-element-container.js +0 -12
  190. package/dist/lib/dom/elements/select-element-container.js +0 -12
  191. package/dist/lib/dom/elements/textarea-element-container.js +0 -11
  192. package/dist/lib/dom/node-parser.js +0 -125
  193. package/dist/lib/dom/node-type-guards.js +0 -81
  194. package/dist/lib/dom/replaced-elements/canvas-element-container.js +0 -13
  195. package/dist/lib/dom/replaced-elements/iframe-element-container.js +0 -38
  196. package/dist/lib/dom/replaced-elements/image-element-container.js +0 -14
  197. package/dist/lib/dom/replaced-elements/index.js +0 -2
  198. package/dist/lib/dom/replaced-elements/input-element-container.js +0 -89
  199. package/dist/lib/dom/replaced-elements/svg-element-container.js +0 -57
  200. package/dist/lib/dom/slot-cloner.js +0 -176
  201. package/dist/lib/dom/text-container.js +0 -35
  202. package/dist/lib/index.js +0 -49
  203. package/dist/lib/options.js +0 -2
  204. package/dist/lib/render/background.js +0 -188
  205. package/dist/lib/render/bezier-curve.js +0 -34
  206. package/dist/lib/render/border.js +0 -104
  207. package/dist/lib/render/bound-curves.js +0 -188
  208. package/dist/lib/render/box-sizing.js +0 -20
  209. package/dist/lib/render/canvas/background-renderer.js +0 -338
  210. package/dist/lib/render/canvas/border-image-renderer.js +0 -153
  211. package/dist/lib/render/canvas/border-renderer.js +0 -184
  212. package/dist/lib/render/canvas/box-shadow-geometry.js +0 -52
  213. package/dist/lib/render/canvas/box-shadow-painter.js +0 -194
  214. package/dist/lib/render/canvas/box-shadow-transform.js +0 -42
  215. package/dist/lib/render/canvas/canvas-path.js +0 -25
  216. package/dist/lib/render/canvas/canvas-renderer.js +0 -610
  217. package/dist/lib/render/canvas/content-renderer.js +0 -270
  218. package/dist/lib/render/canvas/effects-renderer.js +0 -171
  219. package/dist/lib/render/canvas/filter-surface.js +0 -270
  220. package/dist/lib/render/canvas/font-utils.js +0 -46
  221. package/dist/lib/render/canvas/foreignobject-renderer.js +0 -38
  222. package/dist/lib/render/canvas/surface-bounds.js +0 -64
  223. package/dist/lib/render/canvas/text/text-decoration-renderer.js +0 -99
  224. package/dist/lib/render/canvas/text-renderer.js +0 -486
  225. package/dist/lib/render/effects.js +0 -231
  226. package/dist/lib/render/font-metrics.js +0 -53
  227. package/dist/lib/render/object-fit.js +0 -91
  228. package/dist/lib/render/path.js +0 -26
  229. package/dist/lib/render/renderer-interface.js +0 -2
  230. package/dist/lib/render/stacking-context.js +0 -341
  231. package/dist/lib/render/vector.js +0 -16
@@ -5,6 +5,11 @@ export interface ResourceOptions {
5
5
  allowTaint: boolean;
6
6
  proxy?: string;
7
7
  customIsSameOrigin?: (this: void, src: string, oldFn: (src: string) => boolean) => boolean | Promise<boolean>;
8
+ /**
9
+ * LRU cap for normal-mode (immediate) loads. Default: 100.
10
+ * Suspended between startDefer() and preloadAll() so every image collected
11
+ * during a render stays available to the renderer, which never reloads.
12
+ */
8
13
  maxCacheSize?: number;
9
14
  }
10
15
  export declare class Cache {
@@ -17,6 +22,19 @@ export declare class Cache {
17
22
  private _deferMode;
18
23
  /** URLs collected during defer mode, pending batch preload. */
19
24
  private _collectedUrls;
25
+ /**
26
+ * Eviction is suspended between startDefer() and the end of preloadAll():
27
+ * the render pipeline loads every image it is going to paint inside that
28
+ * window, and match() never reloads, so an LRU eviction there would
29
+ * silently drop images from the output on pages with more unique images
30
+ * than maxSize.
31
+ *
32
+ * A counter (not a flag) keeps nested/overlapping defer windows — e.g.
33
+ * two renders sharing one cache via `config.cache` — suspended until the
34
+ * last one finishes preloading.
35
+ */
36
+ private _evictionSuspendCount;
37
+ private get _evictionEnabled();
20
38
  constructor(context: Context, _options: ResourceOptions);
21
39
  /**
22
40
  * Enter defer mode: subsequent addImage() calls only collect URLs.
@@ -31,8 +49,11 @@ export declare class Cache {
31
49
  * failed (logged). Subsequent cache.match() calls return immediately.
32
50
  *
33
51
  * @param concurrency - Max concurrent image loads (1–100, default 10).
52
+ * @param onProgress - Invoked once before loading and after each settled
53
+ * batch with (settledCount, totalCount), enabling coarse progress UI.
54
+ * Not invoked when there is nothing to load.
34
55
  */
35
- preloadAll(concurrency?: number): Promise<void>;
56
+ preloadAll(concurrency?: number, onProgress?: (loaded: number, total: number) => void): Promise<void>;
36
57
  addImage(src: string): Promise<void>;
37
58
  /**
38
59
  * Shared helper: enqueues loading for a single URL with pending-operation
@@ -10,7 +10,6 @@ export type ContextOptions = {
10
10
  onError?: (error: Error) => void;
11
11
  } & ResourceOptions;
12
12
  export declare class Context {
13
- windowBounds: Bounds;
14
13
  private readonly instanceName;
15
14
  readonly logger: Logger;
16
15
  readonly cache: Cache;
@@ -18,5 +17,15 @@ export declare class Context {
18
17
  readonly config: Html2CanvasConfig;
19
18
  readonly onError?: (error: Error) => void;
20
19
  private static instanceCount;
20
+ private _windowBounds;
21
21
  constructor(options: ContextOptions, windowBounds: Bounds, config: Html2CanvasConfig);
22
+ /** Viewport bounds in page coordinates; added to client rects during bounds parsing. */
23
+ get windowBounds(): Bounds;
24
+ /**
25
+ * Compensate window bounds for a page scroll that the browser performed
26
+ * underneath us. Used by the document cloner: WebKit's scroll anchoring can
27
+ * scroll the cloned iframe after `onclone`, and the offset must be applied
28
+ * to subsequent bounds parsing (the only sanctioned mutation of this value).
29
+ */
30
+ adjustWindowBounds(left: number, top: number): void;
22
31
  }
@@ -3,9 +3,6 @@ export interface LoggerOptions {
3
3
  enabled: boolean;
4
4
  }
5
5
  export declare class Logger {
6
- static instances: {
7
- [key: string]: Logger;
8
- };
9
6
  private readonly id;
10
7
  private readonly enabled;
11
8
  private readonly start;
@@ -1,3 +1,14 @@
1
1
  import { Html2CanvasConfig } from '../config';
2
2
  import type { Options } from '../options';
3
+ /**
4
+ * Progress milestones emitted via `Options.onProgress`.
5
+ * Phase names are stable API; percentages are coarse estimates.
6
+ */
7
+ export declare const enum ProgressPhase {
8
+ CLONE = "clone",
9
+ PARSE = "parse",
10
+ PRELOAD = "preload",
11
+ LAYOUT = "layout",
12
+ RENDER = "render"
13
+ }
3
14
  export declare const renderElement: (element: HTMLElement, opts: Partial<Options>, config: Html2CanvasConfig) => Promise<HTMLCanvasElement>;
@@ -1 +1,7 @@
1
1
  export declare const SMALL_IMAGE = "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7";
2
+ /**
3
+ * Indexed access where the shape/arity is guaranteed by construction (the CSS
4
+ * grammar or a preceding length check). Throws on the impossible case instead
5
+ * of silently propagating `undefined`.
6
+ */
7
+ export declare const at: <T>(items: readonly T[], index: number) => T;
@@ -1,74 +1,83 @@
1
- import { backgroundClip } from './property-descriptors/background-clip';
2
- import { backgroundImage } from './property-descriptors/background-image';
3
- import { backgroundOrigin } from './property-descriptors/background-origin';
4
- import { backgroundPosition } from './property-descriptors/background-position';
5
- import { backgroundRepeat } from './property-descriptors/background-repeat';
6
- import { backgroundSize } from './property-descriptors/background-size';
7
- import { borderBottomLeftRadius, borderBottomRightRadius, borderTopLeftRadius, borderTopRightRadius } from './property-descriptors/border-radius';
8
- import { borderBottomStyle, borderLeftStyle, borderRightStyle, borderTopStyle } from './property-descriptors/border-style';
9
- import { borderBottomWidth, borderLeftWidth, borderRightWidth, borderTopWidth } from './property-descriptors/border-width';
10
- import { ClipPathValue } from './property-descriptors/clip-path';
11
- import { direction } from './property-descriptors/direction';
12
- import { display } from './property-descriptors/display';
1
+ import { CSSValue } from './syntax/parser';
2
+ import { Color } from './types/color';
13
3
  import { float } from './property-descriptors/float';
4
+ import { OVERFLOW } from './property-descriptors/overflow';
5
+ import { textDecorationLine } from './property-descriptors/text-decoration-line';
6
+ import { content } from './property-descriptors/content';
7
+ import { quotes } from './property-descriptors/quotes';
8
+ import { counterIncrement } from './property-descriptors/counter-increment';
9
+ import { counterReset } from './property-descriptors/counter-reset';
10
+ import { Context } from '../core/context';
11
+ import { BorderStyles } from './grouped/border-styles';
12
+ import { BackgroundStyles } from './grouped/background-styles';
13
+ import { FontStyles } from './grouped/font-styles';
14
+ import { LayoutStyles } from './grouped/layout-styles';
15
+ import { position } from './property-descriptors/position';
16
+ import { visibility } from './property-descriptors/visibility';
14
17
  import { letterSpacing } from './property-descriptors/letter-spacing';
15
18
  import { lineBreak } from './property-descriptors/line-break';
16
19
  import { listStyleImage } from './property-descriptors/list-style-image';
17
20
  import { listStylePosition } from './property-descriptors/list-style-position';
18
21
  import { listStyleType } from './property-descriptors/list-style-type';
19
- import { OVERFLOW } from './property-descriptors/overflow';
20
- import { overflowWrap } from './property-descriptors/overflow-wrap';
21
- import { textAlign } from './property-descriptors/text-align';
22
- import { position } from './property-descriptors/position';
22
+ import { opacity } from './property-descriptors/opacity';
23
23
  import { textShadow } from './property-descriptors/text-shadow';
24
24
  import { textTransform } from './property-descriptors/text-transform';
25
- import { transform } from './property-descriptors/transform';
26
- import { transformOrigin } from './property-descriptors/transform-origin';
27
- import { rotate } from './property-descriptors/rotate';
28
- import { visibility } from './property-descriptors/visibility';
25
+ import { textDecorationStyle } from './property-descriptors/text-decoration-style';
26
+ import { textDecorationThickness } from './property-descriptors/text-decoration-thickness';
27
+ import { textUnderlineOffset } from './property-descriptors/text-underline-offset';
28
+ import { paintOrder } from './property-descriptors/paint-order';
29
+ import { webkitLineClamp } from './property-descriptors/webkit-line-clamp';
29
30
  import { wordBreak } from './property-descriptors/word-break';
30
31
  import { whiteSpace } from './property-descriptors/white-space';
31
32
  import { writingMode } from './property-descriptors/writing-mode';
32
33
  import { zIndex } from './property-descriptors/z-index';
33
- import { CSSValue } from './syntax/parser';
34
- import { Color } from './types/color';
35
- import { opacity } from './property-descriptors/opacity';
36
- import { textDecorationLine } from './property-descriptors/text-decoration-line';
37
- import { textDecorationStyle } from './property-descriptors/text-decoration-style';
38
- import { textDecorationThickness } from './property-descriptors/text-decoration-thickness';
39
- import { textUnderlineOffset } from './property-descriptors/text-underline-offset';
40
- import { LengthPercentage } from './types/length-percentage';
34
+ import { MixBlendMode } from './property-descriptors/mix-blend-mode';
35
+ import { filter } from './property-descriptors/filter';
36
+ import { zoom } from './property-descriptors/zoom';
37
+ import { ClipPathValue } from './property-descriptors/clip-path';
38
+ import { borderBottomLeftRadius, borderBottomRightRadius, borderTopLeftRadius, borderTopRightRadius } from './property-descriptors/border-radius';
39
+ import { borderBottomStyle, borderLeftStyle, borderRightStyle, borderTopStyle } from './property-descriptors/border-style';
40
+ import { borderBottomWidth, borderLeftWidth, borderRightWidth, borderTopWidth } from './property-descriptors/border-width';
41
+ import { backgroundClip } from './property-descriptors/background-clip';
42
+ import { backgroundImage } from './property-descriptors/background-image';
43
+ import { backgroundOrigin } from './property-descriptors/background-origin';
44
+ import { backgroundPosition } from './property-descriptors/background-position';
45
+ import { backgroundRepeat } from './property-descriptors/background-repeat';
46
+ import { backgroundSize } from './property-descriptors/background-size';
47
+ import { boxShadow } from './property-descriptors/box-shadow';
48
+ import { direction } from './property-descriptors/direction';
49
+ import { display } from './property-descriptors/display';
41
50
  import { fontFamily } from './property-descriptors/font-family';
42
- import { fontWeight } from './property-descriptors/font-weight';
43
- import { fontVariant } from './property-descriptors/font-variant';
44
51
  import { fontStyle } from './property-descriptors/font-style';
45
- import { content } from './property-descriptors/content';
46
- import { counterIncrement } from './property-descriptors/counter-increment';
47
- import { counterReset } from './property-descriptors/counter-reset';
52
+ import { fontVariant } from './property-descriptors/font-variant';
53
+ import { fontWeight } from './property-descriptors/font-weight';
48
54
  import { duration } from './property-descriptors/duration';
49
- import { quotes } from './property-descriptors/quotes';
50
- import { boxShadow } from './property-descriptors/box-shadow';
51
- import { paintOrder } from './property-descriptors/paint-order';
55
+ import { overflowWrap } from './property-descriptors/overflow-wrap';
56
+ import { textAlign } from './property-descriptors/text-align';
57
+ import { transform } from './property-descriptors/transform';
58
+ import { transformOrigin } from './property-descriptors/transform-origin';
59
+ import { rotate } from './property-descriptors/rotate';
60
+ import { LengthPercentage } from './types/length-percentage';
52
61
  import { webkitTextStrokeWidth } from './property-descriptors/webkit-text-stroke-width';
53
- import { webkitLineClamp } from './property-descriptors/webkit-line-clamp';
54
- import { Context } from '../core/context';
55
62
  import { objectFit } from './property-descriptors/object-fit';
56
63
  import { textOverflow } from './property-descriptors/text-overflow';
57
64
  import { imageRendering } from './property-descriptors/image-rendering';
58
- import { MixBlendMode } from './property-descriptors/mix-blend-mode';
59
- import { filter } from './property-descriptors/filter';
60
65
  import { fontVariantLigatures } from './property-descriptors/font-variant-ligatures';
61
- import { zoom } from './property-descriptors/zoom';
62
66
  import { objectPosition } from './property-descriptors/object-position';
63
67
  import { backgroundBlendMode } from './property-descriptors/background-blend-mode';
64
68
  import { borderImageSource } from './property-descriptors/border-image-source';
65
69
  import { borderImageSlice } from './property-descriptors/border-image-slice';
66
70
  import { borderImageRepeat } from './property-descriptors/border-image-repeat';
67
71
  import { boxDecorationBreak } from './property-descriptors/box-decoration-break';
68
- import { BorderStyles } from './grouped/border-styles';
69
- import { BackgroundStyles } from './grouped/background-styles';
70
- import { FontStyles } from './grouped/font-styles';
71
- import { LayoutStyles } from './grouped/layout-styles';
72
+ import { type AccentColor } from './property-descriptors/accent-color';
73
+ import { type WebkitTextFillColor } from './property-descriptors/webkit-text-fill-color';
74
+ import { type ISOLATION } from './property-descriptors/isolation';
75
+ import { type OUTLINE_STYLE, type OutlineColor } from './property-descriptors/outline';
76
+ import { type FilterValue } from './property-descriptors/filter';
77
+ import { type MaskImage, type MaskPosition, type MaskRepeat, type MaskSize } from './property-descriptors/mask';
78
+ import { type TextEmphasisColor, type TextEmphasisPosition as TextEmphasisPositionValue, type TextEmphasisStyle } from './property-descriptors/text-emphasis';
79
+ import { type BorderImageOutset, type BorderImageWidthSide } from './property-descriptors/border-image-width';
80
+ import { type BoxReflectValue } from './property-descriptors/webkit-box-reflect';
72
81
  export declare class CSSParsedDeclaration {
73
82
  animationDuration: ReturnType<typeof duration.parse>;
74
83
  backgroundClip: ReturnType<typeof backgroundClip.parse>;
@@ -157,6 +166,29 @@ export declare class CSSParsedDeclaration {
157
166
  borderImageSlice: ReturnType<typeof borderImageSlice.parse>;
158
167
  borderImageRepeat: ReturnType<typeof borderImageRepeat.parse>;
159
168
  boxDecorationBreak: ReturnType<typeof boxDecorationBreak.parse>;
169
+ accentColor: AccentColor;
170
+ webkitTextFillColor: WebkitTextFillColor;
171
+ isolation: ISOLATION;
172
+ outlineColor: OutlineColor;
173
+ outlineStyle: OUTLINE_STYLE;
174
+ outlineWidth: number;
175
+ outlineOffset: number;
176
+ backdropFilter: FilterValue;
177
+ maskImage: MaskImage;
178
+ maskPosition: MaskPosition;
179
+ maskRepeat: MaskRepeat;
180
+ maskSize: MaskSize;
181
+ textEmphasisStyle: TextEmphasisStyle;
182
+ textEmphasisColor: TextEmphasisColor;
183
+ textEmphasisPosition: TextEmphasisPositionValue;
184
+ borderImageWidth: {
185
+ top: BorderImageWidthSide;
186
+ right: BorderImageWidthSide;
187
+ bottom: BorderImageWidthSide;
188
+ left: BorderImageWidthSide;
189
+ };
190
+ borderImageOutset: BorderImageOutset;
191
+ webkitBoxReflect: BoxReflectValue;
160
192
  private _border?;
161
193
  private _background?;
162
194
  private _font?;
@@ -165,7 +197,6 @@ export declare class CSSParsedDeclaration {
165
197
  get background(): BackgroundStyles;
166
198
  get font(): FontStyles;
167
199
  get layout(): LayoutStyles;
168
- private static readonly standardProps;
169
200
  constructor(context: Context, declaration: CSSStyleDeclaration);
170
201
  isVisible(): boolean;
171
202
  isTransparent(): boolean;
@@ -0,0 +1,15 @@
1
+ /**
2
+ * CSS property registry and value parser.
3
+ *
4
+ * Owns the canonical list of parsed standard properties (the single place to
5
+ * register a new CSS property: add the descriptor import and one table row)
6
+ * and the shared LRU parse cache that turns computed style strings into
7
+ * strongly-typed values.
8
+ *
9
+ * Extracted from css/index.ts so the declaration data class stays free of
10
+ * parsing machinery.
11
+ */
12
+ import { CSSPropertyDescriptor } from './property-descriptor';
13
+ import { Context } from '../core/context';
14
+ export declare const STANDARD_PROPERTIES: [string, CSSPropertyDescriptor<unknown>, string][];
15
+ export declare const parse: (context: Context, descriptor: CSSPropertyDescriptor<any>, style?: string | null) => any;
@@ -0,0 +1,5 @@
1
+ import { IPropertyValueDescriptor } from '../property-descriptor';
2
+ import { type Color } from '../types/color';
3
+ /** `null` represents the `auto` keyword: browser-default control colour. */
4
+ export type AccentColor = Color | null;
5
+ export declare const accentColor: IPropertyValueDescriptor<AccentColor>;
@@ -0,0 +1,9 @@
1
+ import { IPropertyListDescriptor } from '../property-descriptor';
2
+ import { type FilterValue } from './filter';
3
+ /**
4
+ * backdrop-filter shares the filter value grammar and canvas filter string
5
+ * reconstruction. Rendering captures the already-painted backdrop region and
6
+ * applies the filter surface pipeline to it.
7
+ */
8
+ export type BackdropFilter = FilterValue;
9
+ export declare const backdropFilter: IPropertyListDescriptor<BackdropFilter>;
@@ -1,21 +1,21 @@
1
1
  import { IPropertyListDescriptor } from '../property-descriptor';
2
2
  export declare const MIX_BLEND_MODE: {
3
- readonly NORMAL: "normal";
4
- readonly MULTIPLY: "multiply";
5
- readonly SCREEN: "screen";
6
- readonly OVERLAY: "overlay";
7
- readonly DARKEN: "darken";
8
- readonly LIGHTEN: "lighten";
9
- readonly COLOR_DODGE: "color-dodge";
10
- readonly COLOR_BURN: "color-burn";
11
- readonly HARD_LIGHT: "hard-light";
12
- readonly SOFT_LIGHT: "soft-light";
13
- readonly DIFFERENCE: "difference";
14
- readonly EXCLUSION: "exclusion";
15
- readonly HUE: "hue";
16
- readonly SATURATION: "saturation";
17
- readonly COLOR: "color";
18
- readonly LUMINOSITY: "luminosity";
3
+ readonly NORMAL: 'normal';
4
+ readonly MULTIPLY: 'multiply';
5
+ readonly SCREEN: 'screen';
6
+ readonly OVERLAY: 'overlay';
7
+ readonly DARKEN: 'darken';
8
+ readonly LIGHTEN: 'lighten';
9
+ readonly COLOR_DODGE: 'color-dodge';
10
+ readonly COLOR_BURN: 'color-burn';
11
+ readonly HARD_LIGHT: 'hard-light';
12
+ readonly SOFT_LIGHT: 'soft-light';
13
+ readonly DIFFERENCE: 'difference';
14
+ readonly EXCLUSION: 'exclusion';
15
+ readonly HUE: 'hue';
16
+ readonly SATURATION: 'saturation';
17
+ readonly COLOR: 'color';
18
+ readonly LUMINOSITY: 'luminosity';
19
19
  };
20
20
  export type BackgroundBlendMode = BlendModeValue[];
21
21
  type BlendModeValue = (typeof MIX_BLEND_MODE)[keyof typeof MIX_BLEND_MODE];
@@ -0,0 +1,36 @@
1
+ import { IPropertyListDescriptor } from '../property-descriptor';
2
+ export type BorderImageWidthSide = {
3
+ kind: 'auto';
4
+ } | {
5
+ kind: 'length';
6
+ value: number;
7
+ } | {
8
+ kind: 'percentage';
9
+ value: number;
10
+ } | {
11
+ kind: 'number';
12
+ value: number;
13
+ };
14
+ /**
15
+ * border-image-width controls the width of the nine-slice border areas.
16
+ * `auto` (= the corresponding border width), `number` (multiples of the
17
+ * border width), lengths and percentages of the border image area are all
18
+ * resolved against the border widths at render time.
19
+ */
20
+ export declare const borderImageWidth: IPropertyListDescriptor<{
21
+ top: BorderImageWidthSide;
22
+ right: BorderImageWidthSide;
23
+ bottom: BorderImageWidthSide;
24
+ left: BorderImageWidthSide;
25
+ }>;
26
+ export interface BorderImageOutset {
27
+ top: BorderImageWidthSide;
28
+ right: BorderImageWidthSide;
29
+ bottom: BorderImageWidthSide;
30
+ left: BorderImageWidthSide;
31
+ }
32
+ /**
33
+ * border-image-outset pushes the border image area outside the border box.
34
+ * Only lengths and numbers (multiples of the border width) are valid here.
35
+ */
36
+ export declare const borderImageOutset: IPropertyListDescriptor<BorderImageOutset>;
@@ -6,7 +6,8 @@ export declare const enum CLIP_PATH_TYPE {
6
6
  CIRCLE = 2,
7
7
  ELLIPSE = 3,
8
8
  POLYGON = 4,
9
- PATH = 5
9
+ PATH = 5,
10
+ XYWH = 6
10
11
  }
11
12
  /** Radius keyword or length-percentage for circle/ellipse. */
12
13
  export type ShapeRadius = LengthPercentage | 'closest-side' | 'farthest-side';
@@ -58,5 +59,18 @@ export interface PathClipPath {
58
59
  type: CLIP_PATH_TYPE.PATH;
59
60
  d: string;
60
61
  }
61
- export type ClipPathValue = NoneClipPath | InsetClipPath | CircleClipPath | EllipseClipPath | PolygonClipPath | PathClipPath;
62
+ /**
63
+ * xywh( <length-percentage>{2} <length-percentage>{2} [ round <'border-radius'> ]? )
64
+ * A rectangle at (x, y) with the given width and height, from the top-left
65
+ * corner of the reference box. The optional round clause is parsed but
66
+ * ignored (same as inset).
67
+ */
68
+ export interface XywhClipPath {
69
+ type: CLIP_PATH_TYPE.XYWH;
70
+ x: LengthPercentage;
71
+ y: LengthPercentage;
72
+ width: LengthPercentage;
73
+ height: LengthPercentage;
74
+ }
75
+ export type ClipPathValue = NoneClipPath | InsetClipPath | CircleClipPath | EllipseClipPath | PolygonClipPath | PathClipPath | XywhClipPath;
62
76
  export declare const clipPath: IPropertyValueDescriptor<ClipPathValue>;
@@ -0,0 +1,6 @@
1
+ import { IPropertyIdentValueDescriptor } from '../property-descriptor';
2
+ export declare const enum ISOLATION {
3
+ AUTO = 0,
4
+ ISOLATE = 1
5
+ }
6
+ export declare const isolation: IPropertyIdentValueDescriptor<ISOLATION>;
@@ -0,0 +1,25 @@
1
+ import { IPropertyListDescriptor } from '../property-descriptor';
2
+ import { type BackgroundPosition } from './background-position';
3
+ import { type BackgroundRepeat } from './background-repeat';
4
+ import { type BackgroundSize } from './background-size';
5
+ import { ICSSImage } from '../types/image';
6
+ /**
7
+ * CSS Masking (mask-image / mask-position / mask-repeat / mask-size).
8
+ *
9
+ * Value grammars are identical to their background counterparts, so the
10
+ * background parsers are reused verbatim — including the addImage side
11
+ * effect that requires `skipCache` on mask-image. -webkit-mask-* aliases
12
+ * resolve to these properties in computed style.
13
+ *
14
+ * mask-mode/mask-clip/mask-origin/mask-composite are accepted by the browser
15
+ * but not parsed here; rendering assumes the default alpha masking with
16
+ * `add` layer compositing.
17
+ */
18
+ export type MaskImage = ICSSImage[];
19
+ export type MaskPosition = BackgroundPosition;
20
+ export type MaskRepeat = BackgroundRepeat;
21
+ export type MaskSize = BackgroundSize;
22
+ export declare const maskImage: IPropertyListDescriptor<MaskImage>;
23
+ export declare const maskPosition: IPropertyListDescriptor<MaskPosition>;
24
+ export declare const maskRepeat: IPropertyListDescriptor<MaskRepeat>;
25
+ export declare const maskSize: IPropertyListDescriptor<MaskSize>;
@@ -1,21 +1,21 @@
1
1
  import { IPropertyIdentValueDescriptor } from '../property-descriptor';
2
2
  export declare const MIX_BLEND_MODE: {
3
- readonly NORMAL: "normal";
4
- readonly MULTIPLY: "multiply";
5
- readonly SCREEN: "screen";
6
- readonly OVERLAY: "overlay";
7
- readonly DARKEN: "darken";
8
- readonly LIGHTEN: "lighten";
9
- readonly COLOR_DODGE: "color-dodge";
10
- readonly COLOR_BURN: "color-burn";
11
- readonly HARD_LIGHT: "hard-light";
12
- readonly SOFT_LIGHT: "soft-light";
13
- readonly DIFFERENCE: "difference";
14
- readonly EXCLUSION: "exclusion";
15
- readonly HUE: "hue";
16
- readonly SATURATION: "saturation";
17
- readonly COLOR: "color";
18
- readonly LUMINOSITY: "luminosity";
3
+ readonly NORMAL: 'normal';
4
+ readonly MULTIPLY: 'multiply';
5
+ readonly SCREEN: 'screen';
6
+ readonly OVERLAY: 'overlay';
7
+ readonly DARKEN: 'darken';
8
+ readonly LIGHTEN: 'lighten';
9
+ readonly COLOR_DODGE: 'color-dodge';
10
+ readonly COLOR_BURN: 'color-burn';
11
+ readonly HARD_LIGHT: 'hard-light';
12
+ readonly SOFT_LIGHT: 'soft-light';
13
+ readonly DIFFERENCE: 'difference';
14
+ readonly EXCLUSION: 'exclusion';
15
+ readonly HUE: 'hue';
16
+ readonly SATURATION: 'saturation';
17
+ readonly COLOR: 'color';
18
+ readonly LUMINOSITY: 'luminosity';
19
19
  };
20
20
  export type MixBlendMode = (typeof MIX_BLEND_MODE)[keyof typeof MIX_BLEND_MODE];
21
21
  export declare const mixBlendMode: IPropertyIdentValueDescriptor<MixBlendMode>;
@@ -0,0 +1,15 @@
1
+ import { IPropertyValueDescriptor, IPropertyIdentValueDescriptor } from '../property-descriptor';
2
+ import { type Color } from '../types/color';
3
+ export declare const enum OUTLINE_STYLE {
4
+ NONE = 0,
5
+ AUTO = 1,
6
+ SOLID = 2,
7
+ DASHED = 3,
8
+ DOTTED = 4,
9
+ DOUBLE = 5
10
+ }
11
+ export type OutlineColor = Color | null;
12
+ export declare const outlineStyle: IPropertyIdentValueDescriptor<OUTLINE_STYLE>;
13
+ export declare const outlineColor: IPropertyValueDescriptor<OutlineColor>;
14
+ export declare const outlineWidth: IPropertyValueDescriptor<number>;
15
+ export declare const outlineOffset: IPropertyValueDescriptor<number>;
@@ -0,0 +1,22 @@
1
+ import { IPropertyListDescriptor, IPropertyValueDescriptor } from '../property-descriptor';
2
+ import { type Color } from '../types/color';
3
+ export type TextEmphasisShape = 'dot' | 'circle' | 'double-circle' | 'triangle' | 'sesame';
4
+ /**
5
+ * `null` — `none`. A string — custom mark character(s). Otherwise the keyword
6
+ * pair resolved from the computed value (e.g. "filled circle").
7
+ */
8
+ export type TextEmphasisStyle = {
9
+ fill: boolean;
10
+ shape: TextEmphasisShape;
11
+ } | string | null;
12
+ export declare const textEmphasisStyle: IPropertyListDescriptor<TextEmphasisStyle>;
13
+ /** `null` = currentcolor; the renderer falls back to the text colour. */
14
+ export type TextEmphasisColor = Color | null;
15
+ export declare const textEmphasisColor: IPropertyValueDescriptor<TextEmphasisColor>;
16
+ export interface TextEmphasisPosition {
17
+ /** Marks above the text (over) or below (under). */
18
+ over: boolean;
19
+ /** Vertical-writing side for horizontal default; kept for completeness. */
20
+ right: boolean;
21
+ }
22
+ export declare const textEmphasisPosition: IPropertyListDescriptor<TextEmphasisPosition>;
@@ -1,5 +1,5 @@
1
1
  import { IPropertyListDescriptor } from '../property-descriptor';
2
- import { Color } from '../types/color';
2
+ import { type Color } from '../types/color';
3
3
  import { Length } from '../types/length';
4
4
  export type TextShadow = TextShadowItem[];
5
5
  interface TextShadowItem {
@@ -0,0 +1,19 @@
1
+ import { IPropertyListDescriptor } from '../property-descriptor';
2
+ import { ICSSImage } from '../types/image';
3
+ export type BoxReflectDirection = 'below' | 'above' | 'left' | 'right';
4
+ export interface BoxReflect {
5
+ direction: BoxReflectDirection;
6
+ /** Gap between the element and its reflection, in pixels. */
7
+ offset: number;
8
+ /** Optional mask applied to the reflection (element coordinate space). */
9
+ mask: ICSSImage | null;
10
+ }
11
+ export type BoxReflectValue = BoxReflect | null;
12
+ /**
13
+ * -webkit-box-reflect: <direction> <offset>? <mask-image>?
14
+ *
15
+ * Chrome serialises the computed value with the mask's border-image
16
+ * bookkeeping appended (e.g. "... linear-gradient(...) 0 fill / auto /
17
+ * 0 stretch"), so tokens after the image are parsed and ignored.
18
+ */
19
+ export declare const webkitBoxReflect: IPropertyListDescriptor<BoxReflectValue>;
@@ -0,0 +1,9 @@
1
+ import { IPropertyValueDescriptor } from '../property-descriptor';
2
+ import { type Color } from '../types/color';
3
+ /**
4
+ * `null` represents `currentcolor`: the text renderer falls back to `color`.
5
+ * Computed styles resolve currentcolor in browsers, but jsdom and older
6
+ * engines may hand us the keyword verbatim.
7
+ */
8
+ export type WebkitTextFillColor = Color | null;
9
+ export declare const webkitTextFillColor: IPropertyValueDescriptor<WebkitTextFillColor>;
@@ -19,7 +19,7 @@ declare const GREATER_THAN_SIGN = 62;
19
19
  declare const COMMERCIAL_AT = 64;
20
20
  declare const LEFT_SQUARE_BRACKET = 91;
21
21
  declare const RIGHT_SQUARE_BRACKET = 93;
22
- declare const CIRCUMFLEX_ACCENT = 61;
22
+ declare const CIRCUMFLEX_ACCENT = 94;
23
23
  declare const LEFT_CURLY_BRACKET = 123;
24
24
  declare const QUESTION_MARK = 63;
25
25
  declare const RIGHT_CURLY_BRACKET = 125;
@@ -6,7 +6,13 @@
6
6
  * Clamp a value between min and max
7
7
  */
8
8
  export declare const clamp: (value: number, min: number, max: number) => number;
9
+ /** An RGB triple. */
10
+ export type RGB3 = [number, number, number];
11
+ /** An RGBA color as separate components. */
12
+ export type RGBA4 = [number, number, number, number];
13
+ /** A 3x3 matrix stored row-major as nine numbers. */
14
+ export type Matrix3x3 = [number, number, number, number, number, number, number, number, number];
9
15
  /**
10
16
  * Multiply two 3x3 matrices
11
17
  */
12
- export declare const multiplyMatrices: (A: number[], B: number[]) => [number, number, number];
18
+ export declare const multiplyMatrices: (A: Matrix3x3, B: RGB3) => RGB3;
@@ -1,6 +1,7 @@
1
1
  /**
2
2
  * A98-RGB related functions
3
3
  */
4
+ import { RGBA4 } from '../color-math';
4
5
  /**
5
6
  * Convert XYZ to a98 linear
6
7
  *
@@ -36,4 +37,4 @@ export declare const a98FromXYZ: (args: [number, number, number, number]) => [nu
36
37
  *
37
38
  * @param args
38
39
  */
39
- export declare const convertA98rgb: (args: number[]) => number;
40
+ export declare const convertA98rgb: (args: RGBA4) => number;