@ohos-ports/html2canvas-pro 0.0.0-stage → 2.3.2-beta.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.
Files changed (344) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +86 -2
  3. package/dist/html2canvas-pro.cjs +11191 -0
  4. package/dist/html2canvas-pro.cjs.map +1 -0
  5. package/dist/html2canvas-pro.esm.js +11182 -0
  6. package/dist/html2canvas-pro.esm.js.map +1 -0
  7. package/dist/html2canvas-pro.js +11196 -0
  8. package/dist/html2canvas-pro.js.map +1 -0
  9. package/dist/html2canvas-pro.min.js +10 -0
  10. package/dist/lib/config.js +49 -0
  11. package/dist/lib/core/abort-helper.js +20 -0
  12. package/dist/lib/core/background-parser.js +41 -0
  13. package/dist/lib/core/bitwise.js +5 -0
  14. package/dist/lib/core/cache-storage.js +268 -0
  15. package/dist/lib/core/config-assembler.js +88 -0
  16. package/dist/lib/core/constants.js +25 -0
  17. package/dist/lib/core/context.js +19 -0
  18. package/dist/lib/core/debugger.js +27 -0
  19. package/dist/lib/core/features.js +190 -0
  20. package/dist/lib/core/logger.js +56 -0
  21. package/dist/lib/core/lru-map.js +66 -0
  22. package/dist/lib/core/origin-checker.js +53 -0
  23. package/dist/lib/core/performance-monitor.js +185 -0
  24. package/dist/lib/core/render-element.js +132 -0
  25. package/dist/lib/core/util.js +4 -0
  26. package/dist/lib/core/validator.js +500 -0
  27. package/dist/lib/css/grouped/background-styles.js +36 -0
  28. package/dist/lib/css/grouped/border-styles.js +75 -0
  29. package/dist/lib/css/grouped/font-styles.js +93 -0
  30. package/dist/lib/css/grouped/layout-styles.js +127 -0
  31. package/dist/lib/css/index.js +330 -0
  32. package/dist/lib/css/layout/bounds.js +52 -0
  33. package/dist/lib/css/layout/text.js +133 -0
  34. package/dist/lib/css/property-descriptor.js +2 -0
  35. package/dist/lib/css/property-descriptors/background-blend-mode.js +41 -0
  36. package/dist/lib/css/property-descriptors/background-clip.js +23 -0
  37. package/dist/lib/css/property-descriptors/background-color.js +10 -0
  38. package/dist/lib/css/property-descriptors/background-image.js +24 -0
  39. package/dist/lib/css/property-descriptors/background-origin.js +23 -0
  40. package/dist/lib/css/property-descriptors/background-position.js +19 -0
  41. package/dist/lib/css/property-descriptors/background-repeat.js +33 -0
  42. package/dist/lib/css/property-descriptors/background-size.js +23 -0
  43. package/dist/lib/css/property-descriptors/border-color.js +14 -0
  44. package/dist/lib/css/property-descriptors/border-image-repeat.js +42 -0
  45. package/dist/lib/css/property-descriptors/border-image-slice.js +45 -0
  46. package/dist/lib/css/property-descriptors/border-image-source.js +22 -0
  47. package/dist/lib/css/property-descriptors/border-radius.js +15 -0
  48. package/dist/lib/css/property-descriptors/border-style.js +26 -0
  49. package/dist/lib/css/property-descriptors/border-width.js +20 -0
  50. package/dist/lib/css/property-descriptors/box-decoration-break.js +18 -0
  51. package/dist/lib/css/property-descriptors/box-shadow.js +54 -0
  52. package/dist/lib/css/property-descriptors/clip-path.js +189 -0
  53. package/dist/lib/css/property-descriptors/color.js +10 -0
  54. package/dist/lib/css/property-descriptors/content.js +19 -0
  55. package/dist/lib/css/property-descriptors/counter-increment.js +35 -0
  56. package/dist/lib/css/property-descriptors/counter-reset.js +18 -0
  57. package/dist/lib/css/property-descriptors/direction.js +18 -0
  58. package/dist/lib/css/property-descriptors/display.js +81 -0
  59. package/dist/lib/css/property-descriptors/duration.js +14 -0
  60. package/dist/lib/css/property-descriptors/filter.js +76 -0
  61. package/dist/lib/css/property-descriptors/float.js +22 -0
  62. package/dist/lib/css/property-descriptors/font-family.js +32 -0
  63. package/dist/lib/css/property-descriptors/font-size.js +10 -0
  64. package/dist/lib/css/property-descriptors/font-style.js +20 -0
  65. package/dist/lib/css/property-descriptors/font-variant-ligatures.js +34 -0
  66. package/dist/lib/css/property-descriptors/font-variant.js +13 -0
  67. package/dist/lib/css/property-descriptors/font-weight.js +25 -0
  68. package/dist/lib/css/property-descriptors/image-rendering.js +33 -0
  69. package/dist/lib/css/property-descriptors/letter-spacing.js +21 -0
  70. package/dist/lib/css/property-descriptors/line-break.js +23 -0
  71. package/dist/lib/css/property-descriptors/line-height.js +24 -0
  72. package/dist/lib/css/property-descriptors/list-style-image.js +17 -0
  73. package/dist/lib/css/property-descriptors/list-style-position.js +18 -0
  74. package/dist/lib/css/property-descriptors/list-style-type.js +122 -0
  75. package/dist/lib/css/property-descriptors/margin.js +13 -0
  76. package/dist/lib/css/property-descriptors/mix-blend-mode.js +31 -0
  77. package/dist/lib/css/property-descriptors/object-fit.js +28 -0
  78. package/dist/lib/css/property-descriptors/object-position.js +42 -0
  79. package/dist/lib/css/property-descriptors/opacity.js +16 -0
  80. package/dist/lib/css/property-descriptors/overflow-wrap.js +18 -0
  81. package/dist/lib/css/property-descriptors/overflow.js +27 -0
  82. package/dist/lib/css/property-descriptors/padding.js +14 -0
  83. package/dist/lib/css/property-descriptors/paint-order.js +33 -0
  84. package/dist/lib/css/property-descriptors/position.js +22 -0
  85. package/dist/lib/css/property-descriptors/quotes.js +41 -0
  86. package/dist/lib/css/property-descriptors/rotate.js +27 -0
  87. package/dist/lib/css/property-descriptors/text-align.js +21 -0
  88. package/dist/lib/css/property-descriptors/text-decoration-color.js +10 -0
  89. package/dist/lib/css/property-descriptors/text-decoration-line.js +28 -0
  90. package/dist/lib/css/property-descriptors/text-decoration-style.js +24 -0
  91. package/dist/lib/css/property-descriptors/text-decoration-thickness.js +26 -0
  92. package/dist/lib/css/property-descriptors/text-overflow.js +18 -0
  93. package/dist/lib/css/property-descriptors/text-shadow.js +46 -0
  94. package/dist/lib/css/property-descriptors/text-transform.js +20 -0
  95. package/dist/lib/css/property-descriptors/text-underline-offset.js +23 -0
  96. package/dist/lib/css/property-descriptors/transform-origin.js +24 -0
  97. package/dist/lib/css/property-descriptors/transform.js +57 -0
  98. package/dist/lib/css/property-descriptors/visibility.js +20 -0
  99. package/dist/lib/css/property-descriptors/webkit-line-clamp.js +26 -0
  100. package/dist/lib/css/property-descriptors/webkit-text-stroke-color.js +10 -0
  101. package/dist/lib/css/property-descriptors/webkit-text-stroke-width.js +16 -0
  102. package/dist/lib/css/property-descriptors/word-break.js +26 -0
  103. package/dist/lib/css/property-descriptors/writing-mode.js +28 -0
  104. package/dist/lib/css/property-descriptors/z-index.js +19 -0
  105. package/dist/lib/css/property-descriptors/zoom.js +18 -0
  106. package/dist/lib/css/syntax/parser.js +140 -0
  107. package/dist/lib/css/syntax/token-constants.js +214 -0
  108. package/dist/lib/css/syntax/token-singletons.js +36 -0
  109. package/dist/lib/css/syntax/token-types.js +10 -0
  110. package/dist/lib/css/syntax/tokenizer.js +502 -0
  111. package/dist/lib/css/type-descriptor.js +2 -0
  112. package/dist/lib/css/types/angle.js +80 -0
  113. package/dist/lib/css/types/color-math.js +25 -0
  114. package/dist/lib/css/types/color-spaces/a98.js +78 -0
  115. package/dist/lib/css/types/color-spaces/p3.js +86 -0
  116. package/dist/lib/css/types/color-spaces/pro-photo.js +83 -0
  117. package/dist/lib/css/types/color-spaces/rec2020.js +85 -0
  118. package/dist/lib/css/types/color-spaces/srgb.js +79 -0
  119. package/dist/lib/css/types/color-utilities.js +342 -0
  120. package/dist/lib/css/types/color.js +400 -0
  121. package/dist/lib/css/types/functions/-prefix-linear-gradient.js +32 -0
  122. package/dist/lib/css/types/functions/-prefix-radial-gradient.js +83 -0
  123. package/dist/lib/css/types/functions/-webkit-gradient.js +59 -0
  124. package/dist/lib/css/types/functions/counter.js +367 -0
  125. package/dist/lib/css/types/functions/gradient.js +163 -0
  126. package/dist/lib/css/types/functions/linear-gradient.js +27 -0
  127. package/dist/lib/css/types/functions/radial-gradient.js +90 -0
  128. package/dist/lib/css/types/functions/repeating-linear-gradient.js +9 -0
  129. package/dist/lib/css/types/image.js +62 -0
  130. package/dist/lib/css/types/index.js +2 -0
  131. package/dist/lib/css/types/length-percentage.js +197 -0
  132. package/dist/lib/css/types/length.js +5 -0
  133. package/dist/lib/css/types/safe-eval.js +80 -0
  134. package/dist/lib/css/types/time.js +17 -0
  135. package/dist/lib/dom/document-cloner.js +597 -0
  136. package/dist/lib/dom/dom-normalizer.js +115 -0
  137. package/dist/lib/dom/element-container.js +56 -0
  138. package/dist/lib/dom/elements/li-element-container.js +11 -0
  139. package/dist/lib/dom/elements/ol-element-container.js +12 -0
  140. package/dist/lib/dom/elements/select-element-container.js +12 -0
  141. package/dist/lib/dom/elements/textarea-element-container.js +11 -0
  142. package/dist/lib/dom/node-parser.js +112 -0
  143. package/dist/lib/dom/node-type-guards.js +81 -0
  144. package/dist/lib/dom/replaced-elements/canvas-element-container.js +13 -0
  145. package/dist/lib/dom/replaced-elements/iframe-element-container.js +38 -0
  146. package/dist/lib/dom/replaced-elements/image-element-container.js +14 -0
  147. package/dist/lib/dom/replaced-elements/index.js +2 -0
  148. package/dist/lib/dom/replaced-elements/input-element-container.js +89 -0
  149. package/dist/lib/dom/replaced-elements/svg-element-container.js +19 -0
  150. package/dist/lib/dom/slot-cloner.js +176 -0
  151. package/dist/lib/dom/text-container.js +35 -0
  152. package/dist/lib/index.js +49 -0
  153. package/dist/lib/options.js +2 -0
  154. package/dist/lib/render/background.js +188 -0
  155. package/dist/lib/render/bezier-curve.js +34 -0
  156. package/dist/lib/render/border.js +104 -0
  157. package/dist/lib/render/bound-curves.js +188 -0
  158. package/dist/lib/render/box-sizing.js +20 -0
  159. package/dist/lib/render/canvas/background-renderer.js +327 -0
  160. package/dist/lib/render/canvas/border-image-renderer.js +153 -0
  161. package/dist/lib/render/canvas/border-renderer.js +184 -0
  162. package/dist/lib/render/canvas/canvas-path.js +25 -0
  163. package/dist/lib/render/canvas/canvas-renderer.js +312 -0
  164. package/dist/lib/render/canvas/content-renderer.js +204 -0
  165. package/dist/lib/render/canvas/effects-renderer.js +171 -0
  166. package/dist/lib/render/canvas/font-utils.js +29 -0
  167. package/dist/lib/render/canvas/foreignobject-renderer.js +38 -0
  168. package/dist/lib/render/canvas/text/text-decoration-renderer.js +99 -0
  169. package/dist/lib/render/canvas/text-renderer.js +485 -0
  170. package/dist/lib/render/effects.js +231 -0
  171. package/dist/lib/render/font-metrics.js +53 -0
  172. package/dist/lib/render/object-fit.js +91 -0
  173. package/dist/lib/render/path.js +26 -0
  174. package/dist/lib/render/renderer-interface.js +2 -0
  175. package/dist/lib/render/stacking-context.js +340 -0
  176. package/dist/lib/render/vector.js +16 -0
  177. package/dist/types/config.d.ts +44 -0
  178. package/dist/types/core/abort-helper.d.ts +12 -0
  179. package/dist/types/core/background-parser.d.ts +16 -0
  180. package/dist/types/core/bitwise.d.ts +1 -0
  181. package/dist/types/core/cache-storage.d.ts +68 -0
  182. package/dist/types/core/config-assembler.d.ts +28 -0
  183. package/dist/types/core/constants.d.ts +22 -0
  184. package/dist/types/core/context.d.ts +22 -0
  185. package/dist/types/core/debugger.d.ts +8 -0
  186. package/dist/types/core/features.d.ts +12 -0
  187. package/dist/types/core/logger.d.ts +18 -0
  188. package/dist/types/core/lru-map.d.ts +37 -0
  189. package/dist/types/core/origin-checker.d.ts +33 -0
  190. package/dist/types/core/performance-monitor.d.ts +120 -0
  191. package/dist/types/core/render-element.d.ts +3 -0
  192. package/dist/types/core/util.d.ts +1 -0
  193. package/dist/types/core/validator.d.ts +130 -0
  194. package/dist/types/css/grouped/background-styles.d.ts +16 -0
  195. package/dist/types/css/grouped/border-styles.d.ts +31 -0
  196. package/dist/types/css/grouped/font-styles.d.ts +35 -0
  197. package/dist/types/css/grouped/layout-styles.d.ts +46 -0
  198. package/dist/types/css/index.d.ts +185 -0
  199. package/dist/types/css/layout/bounds.d.ts +14 -0
  200. package/dist/types/css/layout/text.d.ts +10 -0
  201. package/dist/types/css/property-descriptor.d.ts +40 -0
  202. package/dist/types/css/property-descriptors/background-blend-mode.d.ts +23 -0
  203. package/dist/types/css/property-descriptors/background-clip.d.ts +8 -0
  204. package/dist/types/css/property-descriptors/background-color.d.ts +2 -0
  205. package/dist/types/css/property-descriptors/background-image.d.ts +3 -0
  206. package/dist/types/css/property-descriptors/background-origin.d.ts +8 -0
  207. package/dist/types/css/property-descriptors/background-position.d.ts +5 -0
  208. package/dist/types/css/property-descriptors/background-repeat.d.ts +9 -0
  209. package/dist/types/css/property-descriptors/background-size.d.ts +11 -0
  210. package/dist/types/css/property-descriptors/border-color.d.ts +5 -0
  211. package/dist/types/css/property-descriptors/border-image-repeat.d.ts +12 -0
  212. package/dist/types/css/property-descriptors/border-image-slice.d.ts +10 -0
  213. package/dist/types/css/property-descriptors/border-image-source.d.ts +4 -0
  214. package/dist/types/css/property-descriptors/border-radius.d.ts +7 -0
  215. package/dist/types/css/property-descriptors/border-style.d.ts +12 -0
  216. package/dist/types/css/property-descriptors/border-width.d.ts +5 -0
  217. package/dist/types/css/property-descriptors/box-decoration-break.d.ts +6 -0
  218. package/dist/types/css/property-descriptors/box-shadow.d.ts +14 -0
  219. package/dist/types/css/property-descriptors/clip-path.d.ts +62 -0
  220. package/dist/types/css/property-descriptors/color.d.ts +2 -0
  221. package/dist/types/css/property-descriptors/content.d.ts +4 -0
  222. package/dist/types/css/property-descriptors/counter-increment.d.ts +10 -0
  223. package/dist/types/css/property-descriptors/counter-reset.d.ts +7 -0
  224. package/dist/types/css/property-descriptors/direction.d.ts +6 -0
  225. package/dist/types/css/property-descriptors/display.d.ts +35 -0
  226. package/dist/types/css/property-descriptors/duration.d.ts +2 -0
  227. package/dist/types/css/property-descriptors/filter.d.ts +3 -0
  228. package/dist/types/css/property-descriptors/float.d.ts +9 -0
  229. package/dist/types/css/property-descriptors/font-family.d.ts +4 -0
  230. package/dist/types/css/property-descriptors/font-size.d.ts +2 -0
  231. package/dist/types/css/property-descriptors/font-style.d.ts +7 -0
  232. package/dist/types/css/property-descriptors/font-variant-ligatures.d.ts +14 -0
  233. package/dist/types/css/property-descriptors/font-variant.d.ts +2 -0
  234. package/dist/types/css/property-descriptors/font-weight.d.ts +2 -0
  235. package/dist/types/css/property-descriptors/image-rendering.d.ts +8 -0
  236. package/dist/types/css/property-descriptors/letter-spacing.d.ts +2 -0
  237. package/dist/types/css/property-descriptors/line-break.d.ts +6 -0
  238. package/dist/types/css/property-descriptors/line-height.d.ts +4 -0
  239. package/dist/types/css/property-descriptors/list-style-image.d.ts +3 -0
  240. package/dist/types/css/property-descriptors/list-style-position.d.ts +6 -0
  241. package/dist/types/css/property-descriptors/list-style-type.d.ts +58 -0
  242. package/dist/types/css/property-descriptors/margin.d.ts +5 -0
  243. package/dist/types/css/property-descriptors/mix-blend-mode.d.ts +21 -0
  244. package/dist/types/css/property-descriptors/object-fit.d.ts +10 -0
  245. package/dist/types/css/property-descriptors/object-position.d.ts +4 -0
  246. package/dist/types/css/property-descriptors/opacity.d.ts +2 -0
  247. package/dist/types/css/property-descriptors/overflow-wrap.d.ts +6 -0
  248. package/dist/types/css/property-descriptors/overflow.d.ts +9 -0
  249. package/dist/types/css/property-descriptors/padding.d.ts +5 -0
  250. package/dist/types/css/property-descriptors/paint-order.d.ts +8 -0
  251. package/dist/types/css/property-descriptors/position.d.ts +9 -0
  252. package/dist/types/css/property-descriptors/quotes.d.ts +8 -0
  253. package/dist/types/css/property-descriptors/rotate.d.ts +3 -0
  254. package/dist/types/css/property-descriptors/text-align.d.ts +7 -0
  255. package/dist/types/css/property-descriptors/text-decoration-color.d.ts +2 -0
  256. package/dist/types/css/property-descriptors/text-decoration-line.d.ts +10 -0
  257. package/dist/types/css/property-descriptors/text-decoration-style.d.ts +9 -0
  258. package/dist/types/css/property-descriptors/text-decoration-thickness.d.ts +3 -0
  259. package/dist/types/css/property-descriptors/text-overflow.d.ts +6 -0
  260. package/dist/types/css/property-descriptors/text-shadow.d.ts +12 -0
  261. package/dist/types/css/property-descriptors/text-transform.d.ts +8 -0
  262. package/dist/types/css/property-descriptors/text-underline-offset.d.ts +3 -0
  263. package/dist/types/css/property-descriptors/transform-origin.d.ts +4 -0
  264. package/dist/types/css/property-descriptors/transform.d.ts +4 -0
  265. package/dist/types/css/property-descriptors/visibility.d.ts +7 -0
  266. package/dist/types/css/property-descriptors/webkit-line-clamp.d.ts +7 -0
  267. package/dist/types/css/property-descriptors/webkit-text-stroke-color.d.ts +2 -0
  268. package/dist/types/css/property-descriptors/webkit-text-stroke-width.d.ts +2 -0
  269. package/dist/types/css/property-descriptors/word-break.d.ts +7 -0
  270. package/dist/types/css/property-descriptors/writing-mode.d.ts +11 -0
  271. package/dist/types/css/property-descriptors/z-index.d.ts +7 -0
  272. package/dist/types/css/property-descriptors/zoom.d.ts +3 -0
  273. package/dist/types/css/syntax/parser.d.ts +34 -0
  274. package/dist/types/css/syntax/token-constants.d.ts +74 -0
  275. package/dist/types/css/syntax/token-singletons.d.ts +22 -0
  276. package/dist/types/css/syntax/token-types.d.ts +72 -0
  277. package/dist/types/css/syntax/tokenizer.d.ts +32 -0
  278. package/dist/types/css/type-descriptor.d.ts +6 -0
  279. package/dist/types/css/types/angle.d.ts +7 -0
  280. package/dist/types/css/types/color-math.d.ts +12 -0
  281. package/dist/types/css/types/color-spaces/a98.d.ts +39 -0
  282. package/dist/types/css/types/color-spaces/p3.d.ts +45 -0
  283. package/dist/types/css/types/color-spaces/pro-photo.d.ts +45 -0
  284. package/dist/types/css/types/color-spaces/rec2020.d.ts +45 -0
  285. package/dist/types/css/types/color-spaces/srgb.d.ts +38 -0
  286. package/dist/types/css/types/color-utilities.d.ts +107 -0
  287. package/dist/types/css/types/color.d.ts +8 -0
  288. package/dist/types/css/types/functions/-prefix-linear-gradient.d.ts +4 -0
  289. package/dist/types/css/types/functions/-prefix-radial-gradient.d.ts +4 -0
  290. package/dist/types/css/types/functions/-webkit-gradient.d.ts +4 -0
  291. package/dist/types/css/types/functions/counter.d.ts +10 -0
  292. package/dist/types/css/types/functions/gradient.d.ts +7 -0
  293. package/dist/types/css/types/functions/linear-gradient.d.ts +4 -0
  294. package/dist/types/css/types/functions/radial-gradient.d.ts +12 -0
  295. package/dist/types/css/types/functions/repeating-linear-gradient.d.ts +4 -0
  296. package/dist/types/css/types/image.d.ts +56 -0
  297. package/dist/types/css/types/index.d.ts +1 -0
  298. package/dist/types/css/types/length-percentage.d.ts +62 -0
  299. package/dist/types/css/types/length.d.ts +4 -0
  300. package/dist/types/css/types/safe-eval.d.ts +8 -0
  301. package/dist/types/css/types/time.d.ts +2 -0
  302. package/dist/types/dom/document-cloner.d.ts +57 -0
  303. package/dist/types/dom/dom-normalizer.d.ts +62 -0
  304. package/dist/types/dom/element-container.d.ts +31 -0
  305. package/dist/types/dom/elements/li-element-container.d.ts +6 -0
  306. package/dist/types/dom/elements/ol-element-container.d.ts +7 -0
  307. package/dist/types/dom/elements/select-element-container.d.ts +6 -0
  308. package/dist/types/dom/elements/textarea-element-container.d.ts +6 -0
  309. package/dist/types/dom/node-parser.d.ts +3 -0
  310. package/dist/types/dom/node-type-guards.d.ts +32 -0
  311. package/dist/types/dom/replaced-elements/canvas-element-container.d.ts +8 -0
  312. package/dist/types/dom/replaced-elements/iframe-element-container.d.ts +14 -0
  313. package/dist/types/dom/replaced-elements/image-element-container.d.ts +8 -0
  314. package/dist/types/dom/replaced-elements/index.d.ts +4 -0
  315. package/dist/types/dom/replaced-elements/input-element-container.d.ts +14 -0
  316. package/dist/types/dom/replaced-elements/svg-element-container.d.ts +8 -0
  317. package/dist/types/dom/slot-cloner.d.ts +66 -0
  318. package/dist/types/dom/text-container.d.ts +8 -0
  319. package/dist/types/index.d.ts +36 -0
  320. package/dist/types/options.d.ts +62 -0
  321. package/dist/types/render/background.d.ts +16 -0
  322. package/dist/types/render/bezier-curve.d.ts +14 -0
  323. package/dist/types/render/border.d.ts +6 -0
  324. package/dist/types/render/bound-curves.d.ts +32 -0
  325. package/dist/types/render/box-sizing.d.ts +4 -0
  326. package/dist/types/render/canvas/background-renderer.d.ts +94 -0
  327. package/dist/types/render/canvas/border-image-renderer.d.ts +18 -0
  328. package/dist/types/render/canvas/border-renderer.d.ts +67 -0
  329. package/dist/types/render/canvas/canvas-path.d.ts +3 -0
  330. package/dist/types/render/canvas/canvas-renderer.d.ts +60 -0
  331. package/dist/types/render/canvas/content-renderer.d.ts +43 -0
  332. package/dist/types/render/canvas/effects-renderer.d.ts +90 -0
  333. package/dist/types/render/canvas/font-utils.d.ts +19 -0
  334. package/dist/types/render/canvas/foreignobject-renderer.d.ts +10 -0
  335. package/dist/types/render/canvas/text/text-decoration-renderer.d.ts +18 -0
  336. package/dist/types/render/canvas/text-renderer.d.ts +103 -0
  337. package/dist/types/render/effects.d.ts +112 -0
  338. package/dist/types/render/font-metrics.d.ts +11 -0
  339. package/dist/types/render/object-fit.d.ts +19 -0
  340. package/dist/types/render/path.d.ts +13 -0
  341. package/dist/types/render/renderer-interface.d.ts +28 -0
  342. package/dist/types/render/stacking-context.d.ts +49 -0
  343. package/dist/types/render/vector.d.ts +9 -0
  344. package/package.json +139 -4
@@ -0,0 +1,49 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Html2CanvasConfig = void 0;
4
+ /**
5
+ * Html2Canvas Configuration
6
+ *
7
+ * Manages configuration state for html2canvas rendering.
8
+ * Eliminates the need for global static variables.
9
+ */
10
+ class Html2CanvasConfig {
11
+ constructor(options = {}) {
12
+ const resolvedWindow = options.window || (typeof window !== 'undefined' ? window : undefined);
13
+ if (!resolvedWindow) {
14
+ throw new Error('Window object is required but not available');
15
+ }
16
+ this.window = resolvedWindow;
17
+ this.cspNonce = options.cspNonce;
18
+ this.cache = options.cache;
19
+ }
20
+ /**
21
+ * Create configuration from an element
22
+ * Extracts window from element's owner document
23
+ */
24
+ static fromElement(element, options = {}) {
25
+ const ownerDocument = element.ownerDocument;
26
+ if (!ownerDocument) {
27
+ throw new Error('Element is not attached to a document');
28
+ }
29
+ const defaultView = ownerDocument.defaultView;
30
+ if (!defaultView) {
31
+ throw new Error('Document is not attached to a window');
32
+ }
33
+ return new Html2CanvasConfig({
34
+ window: defaultView,
35
+ ...options
36
+ });
37
+ }
38
+ /**
39
+ * Clone configuration with override options
40
+ */
41
+ clone(options = {}) {
42
+ return new Html2CanvasConfig({
43
+ window: options.window || this.window,
44
+ cspNonce: options.cspNonce ?? this.cspNonce,
45
+ cache: options.cache ?? this.cache
46
+ });
47
+ }
48
+ }
49
+ exports.Html2CanvasConfig = Html2CanvasConfig;
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ /**
3
+ * AbortSignal helper utilities.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.throwIfAborted = void 0;
7
+ /**
8
+ * Throw a DOMException if the given AbortSignal is already aborted.
9
+ * Used at checkpoints throughout the rendering pipeline to support
10
+ * cancellable renders.
11
+ *
12
+ * @param signal - The AbortSignal to check. If undefined or not aborted, this is a no-op.
13
+ * @throws {DOMException} With name 'AbortError' if the signal has been aborted.
14
+ */
15
+ const throwIfAborted = (signal) => {
16
+ if (signal?.aborted) {
17
+ throw new DOMException('The operation was aborted.', 'AbortError');
18
+ }
19
+ };
20
+ exports.throwIfAborted = throwIfAborted;
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.parseBackgroundColor = void 0;
4
+ const color_1 = require("../css/types/color");
5
+ const color_utilities_1 = require("../css/types/color-utilities");
6
+ /**
7
+ * Resolve the background colour for the rendered canvas, following CSS
8
+ * background propagation rules:
9
+ *
10
+ * 1. If the target element is `<html>`, inherit the first opaque ancestor
11
+ * (doc → body → fallback).
12
+ * 2. Otherwise use the user-supplied backgroundColor, or opaque white.
13
+ *
14
+ * @param context - Current rendering context.
15
+ * @param element - The root element being rendered.
16
+ * @param backgroundColorOverride - User-supplied override (string | null).
17
+ * @returns A resolved colour value suitable for filling the canvas.
18
+ */
19
+ const parseBackgroundColor = (context, element, backgroundColorOverride) => {
20
+ const ownerDocument = element.ownerDocument;
21
+ // http://www.w3.org/TR/css3-background/#special-backgrounds
22
+ const documentBackgroundColor = ownerDocument.documentElement
23
+ ? (0, color_1.parseColor)(context, getComputedStyle(ownerDocument.documentElement).backgroundColor)
24
+ : color_1.COLORS.TRANSPARENT;
25
+ const bodyBackgroundColor = ownerDocument.body
26
+ ? (0, color_1.parseColor)(context, getComputedStyle(ownerDocument.body).backgroundColor)
27
+ : color_1.COLORS.TRANSPARENT;
28
+ const defaultBackgroundColor = typeof backgroundColorOverride === 'string'
29
+ ? (0, color_1.parseColor)(context, backgroundColorOverride)
30
+ : backgroundColorOverride === null
31
+ ? color_1.COLORS.TRANSPARENT
32
+ : 0xffffffff;
33
+ return element === ownerDocument.documentElement
34
+ ? (0, color_utilities_1.isTransparent)(documentBackgroundColor)
35
+ ? (0, color_utilities_1.isTransparent)(bodyBackgroundColor)
36
+ ? defaultBackgroundColor
37
+ : bodyBackgroundColor
38
+ : documentBackgroundColor
39
+ : defaultBackgroundColor;
40
+ };
41
+ exports.parseBackgroundColor = parseBackgroundColor;
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.contains = void 0;
4
+ const contains = (bit, value) => (bit & value) !== 0;
5
+ exports.contains = contains;
@@ -0,0 +1,268 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Cache = void 0;
4
+ const features_1 = require("./features");
5
+ class Cache {
6
+ constructor(context, _options) {
7
+ this.context = context;
8
+ this._options = _options;
9
+ this._cache = new Map();
10
+ this._pendingOperations = new Map();
11
+ /** When true, addImage() collects URLs without starting loads. */
12
+ this._deferMode = false;
13
+ /** URLs collected during defer mode, pending batch preload. */
14
+ this._collectedUrls = new Set();
15
+ // Default cache size: 100 items
16
+ this.maxSize = _options.maxCacheSize ?? 100;
17
+ if (this.maxSize < 1) {
18
+ throw new Error('Cache maxSize must be at least 1');
19
+ }
20
+ if (this.maxSize > 10000) {
21
+ this.context.logger.warn(`Cache maxSize ${this.maxSize} is very large and may cause memory issues. ` +
22
+ `Consider using a smaller value (recommended: 100-1000).`);
23
+ }
24
+ }
25
+ /**
26
+ * Enter defer mode: subsequent addImage() calls only collect URLs.
27
+ * Call preloadAll() to exit defer mode and batch-load all URLs.
28
+ */
29
+ startDefer() {
30
+ this._deferMode = true;
31
+ }
32
+ /**
33
+ * Exit defer mode and load all collected URLs in parallel, respecting
34
+ * an optional concurrency cap to avoid overwhelming the browser's network
35
+ * stack (default: 10 concurrent loads).
36
+ * After this call returns, all images are either loaded (cache hit) or
37
+ * failed (logged). Subsequent cache.match() calls return immediately.
38
+ *
39
+ * @param concurrency - Max concurrent image loads (1–100, default 10).
40
+ */
41
+ async preloadAll(concurrency = 10) {
42
+ this._deferMode = false;
43
+ const urls = Array.from(this._collectedUrls);
44
+ this._collectedUrls.clear();
45
+ if (urls.length === 0) {
46
+ return;
47
+ }
48
+ const limit = Math.max(1, Math.min(concurrency, 100));
49
+ this.context.logger.debug(`Preloading ${urls.length} image(s) with concurrency ${limit}`);
50
+ // Load in batches to respect the concurrency cap while maximising
51
+ // parallelism within each batch.
52
+ for (let i = 0; i < urls.length; i += limit) {
53
+ const batch = urls.slice(i, i + limit);
54
+ const operations = batch.map((url) => this._addImageWithPending(url));
55
+ await Promise.allSettled(operations);
56
+ }
57
+ }
58
+ addImage(src) {
59
+ // ── Defer mode: collect only ──────────────────────────────
60
+ if (this._deferMode) {
61
+ if (!this.has(src) && (isBlobImage(src) || isRenderable(src))) {
62
+ this._collectedUrls.add(src);
63
+ }
64
+ return Promise.resolve();
65
+ }
66
+ // ── Normal mode: immediate load ───────────────────────────
67
+ // Wait for any pending operations on this key
68
+ const pending = this._pendingOperations.get(src);
69
+ if (pending) {
70
+ return pending;
71
+ }
72
+ if (this.has(src)) {
73
+ // Move to end for LRU ordering
74
+ const entry = this._cache.get(src);
75
+ this._cache.delete(src);
76
+ this._cache.set(src, entry);
77
+ return Promise.resolve();
78
+ }
79
+ if (isBlobImage(src) || isRenderable(src)) {
80
+ return this._addImageWithPending(src);
81
+ }
82
+ return Promise.resolve();
83
+ }
84
+ /**
85
+ * Shared helper: enqueues loading for a single URL with pending-operation
86
+ * deduplication and error swallowing. Used by both addImage() (normal mode)
87
+ * and preloadAll() (batch mode).
88
+ */
89
+ _addImageWithPending(src) {
90
+ const pending = this._pendingOperations.get(src);
91
+ if (pending) {
92
+ return pending;
93
+ }
94
+ const operation = this._addImageInternal(src);
95
+ this._pendingOperations.set(src, operation);
96
+ operation.finally(() => {
97
+ this._pendingOperations.delete(src);
98
+ });
99
+ return operation;
100
+ }
101
+ async _addImageInternal(src) {
102
+ const timeoutMs = this._options.imageTimeout ?? 15000;
103
+ const imageWithTimeout = this.withTimeout(this.loadImage(src), timeoutMs, `Timed out (${timeoutMs}ms) loading image`);
104
+ // Handle errors to prevent unhandled rejections
105
+ imageWithTimeout.catch((error) => {
106
+ this.context.logger.error(`Failed to load image ${src}: ${error instanceof Error ? error.message : 'Unknown error'}`);
107
+ });
108
+ // Store the promise with timeout in cache
109
+ this.set(src, imageWithTimeout);
110
+ }
111
+ withTimeout(promise, timeoutMs, message) {
112
+ if (timeoutMs <= 0) {
113
+ return promise;
114
+ }
115
+ let timeoutId;
116
+ const timeout = new Promise((_, reject) => {
117
+ timeoutId = setTimeout(() => reject(new Error(message)), timeoutMs);
118
+ });
119
+ return Promise.race([promise, timeout]).finally(() => {
120
+ if (timeoutId !== undefined) {
121
+ clearTimeout(timeoutId);
122
+ }
123
+ });
124
+ }
125
+ match(src) {
126
+ const entry = this._cache.get(src);
127
+ if (entry) {
128
+ // Move to end for LRU ordering (O(1))
129
+ this._cache.delete(src);
130
+ this._cache.set(src, entry);
131
+ return entry.value;
132
+ }
133
+ return undefined;
134
+ }
135
+ /**
136
+ * Set a value in cache with LRU eviction (O(1) via Map insertion order).
137
+ * Map preserves insertion order; delete+set on access moves items to the end.
138
+ * The first key in Map.keys() is always the least recently used.
139
+ */
140
+ set(key, value) {
141
+ if (this._cache.has(key)) {
142
+ // Update existing entry: move to end of Map
143
+ this._cache.delete(key);
144
+ }
145
+ else if (this._cache.size >= this.maxSize) {
146
+ // Evict LRU (first key = least recently used) — O(1)
147
+ const lruKey = this._cache.keys().next().value;
148
+ if (lruKey !== undefined) {
149
+ this._cache.delete(lruKey);
150
+ this.context.logger.debug(`Cache: Evicted LRU entry: ${lruKey}`);
151
+ }
152
+ }
153
+ this._cache.set(key, { value });
154
+ }
155
+ /**
156
+ * Get cache size
157
+ */
158
+ size() {
159
+ return this._cache.size;
160
+ }
161
+ /**
162
+ * Get max cache size
163
+ */
164
+ getMaxSize() {
165
+ return this.maxSize;
166
+ }
167
+ /**
168
+ * Clear all cache entries
169
+ */
170
+ clear() {
171
+ this._cache.clear();
172
+ }
173
+ async loadImage(key) {
174
+ const originChecker = this.context.originChecker;
175
+ const defaultIsSameOrigin = (src) => originChecker.isSameOrigin(src);
176
+ const isSameOrigin = typeof this._options.customIsSameOrigin === 'function'
177
+ ? await this._options.customIsSameOrigin(key, defaultIsSameOrigin)
178
+ : defaultIsSameOrigin(key);
179
+ const useCORS = !isInlineImage(key) && this._options.useCORS === true && features_1.FEATURES.SUPPORT_CORS_IMAGES && !isSameOrigin;
180
+ const useProxy = !isInlineImage(key) &&
181
+ !isSameOrigin &&
182
+ !isBlobImage(key) &&
183
+ typeof this._options.proxy === 'string' &&
184
+ features_1.FEATURES.SUPPORT_CORS_XHR &&
185
+ !useCORS;
186
+ if (!isSameOrigin &&
187
+ this._options.allowTaint === false &&
188
+ !isInlineImage(key) &&
189
+ !isBlobImage(key) &&
190
+ !useProxy &&
191
+ !useCORS) {
192
+ return;
193
+ }
194
+ let src = key;
195
+ if (useProxy) {
196
+ src = await this.proxy(src);
197
+ }
198
+ this.context.logger.debug(`Added image ${key.substring(0, 256)}`);
199
+ return await new Promise((resolve, reject) => {
200
+ const img = new Image();
201
+ img.onload = () => resolve(img);
202
+ img.onerror = reject;
203
+ //ios safari 10.3 taints canvas with data urls unless crossOrigin is set to anonymous
204
+ if (isInlineBase64Image(src) || useCORS) {
205
+ img.crossOrigin = 'anonymous';
206
+ }
207
+ img.src = src;
208
+ if (img.complete === true) {
209
+ // Inline XML images may fail to parse, throwing an Error later on
210
+ setTimeout(() => resolve(img), 500);
211
+ }
212
+ });
213
+ }
214
+ has(key) {
215
+ return this._cache.has(key);
216
+ }
217
+ keys() {
218
+ return Promise.resolve(Array.from(this._cache.keys()));
219
+ }
220
+ proxy(src) {
221
+ const proxy = this._options.proxy;
222
+ if (!proxy) {
223
+ throw new Error('No proxy defined');
224
+ }
225
+ const key = src.substring(0, 256);
226
+ return new Promise((resolve, reject) => {
227
+ const responseType = features_1.FEATURES.SUPPORT_RESPONSE_TYPE ? 'blob' : 'text';
228
+ const xhr = new XMLHttpRequest();
229
+ xhr.onload = () => {
230
+ if (xhr.status === 200) {
231
+ if (responseType === 'text') {
232
+ resolve(xhr.response);
233
+ }
234
+ else {
235
+ const reader = new FileReader();
236
+ reader.addEventListener('load', () => resolve(reader.result), false);
237
+ reader.addEventListener('error', (e) => reject(e), false);
238
+ reader.readAsDataURL(xhr.response);
239
+ }
240
+ }
241
+ else {
242
+ reject(`Failed to proxy resource ${key} with status code ${xhr.status}`);
243
+ }
244
+ };
245
+ xhr.onerror = reject;
246
+ const queryString = proxy.indexOf('?') > -1 ? '&' : '?';
247
+ xhr.open('GET', `${proxy}${queryString}url=${encodeURIComponent(src)}&responseType=${responseType}`);
248
+ if (responseType !== 'text' && xhr instanceof XMLHttpRequest) {
249
+ xhr.responseType = responseType;
250
+ }
251
+ if (this._options.imageTimeout) {
252
+ const timeout = this._options.imageTimeout;
253
+ xhr.timeout = timeout;
254
+ xhr.ontimeout = () => reject(`Timed out (${timeout}ms) proxying ${key}`);
255
+ }
256
+ xhr.send();
257
+ });
258
+ }
259
+ }
260
+ exports.Cache = Cache;
261
+ const INLINE_SVG = /^data:image\/svg\+xml/i;
262
+ const INLINE_BASE64 = /^data:image\/.*;base64,/i;
263
+ const INLINE_IMG = /^data:image\/.*/i;
264
+ const isRenderable = (src) => features_1.FEATURES.SUPPORT_SVG_DRAWING || !isSVG(src);
265
+ const isInlineImage = (src) => INLINE_IMG.test(src);
266
+ const isInlineBase64Image = (src) => INLINE_BASE64.test(src);
267
+ const isBlobImage = (src) => src.substring(0, 4) === 'blob';
268
+ const isSVG = (src) => src.slice(-3).toLowerCase() === 'svg' || INLINE_SVG.test(src);
@@ -0,0 +1,88 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.assembleRenderOptions = exports.assembleCloneOptions = exports.assembleWindowOptions = exports.assembleContextOptions = exports.assembleResourceOptions = exports.coerceNumberOptions = void 0;
4
+ const constants_1 = require("./constants");
5
+ /**
6
+ * Coerce known numeric options from string (or other) values to actual numbers.
7
+ * Mutates the opts object in place — this is intentionally a normalisation
8
+ * (not pure) step that runs once at the beginning of renderElement.
9
+ */
10
+ const coerceNumberOptions = (opts) => {
11
+ const numKeys = [
12
+ 'scale',
13
+ 'width',
14
+ 'height',
15
+ 'imageTimeout',
16
+ 'x',
17
+ 'y',
18
+ 'windowWidth',
19
+ 'windowHeight',
20
+ 'scrollX',
21
+ 'scrollY'
22
+ ];
23
+ numKeys.forEach((key) => {
24
+ const v = opts[key];
25
+ if (v !== undefined && v !== null && typeof v !== 'number') {
26
+ const n = Number(v);
27
+ if (!Number.isNaN(n)) {
28
+ opts[key] = n;
29
+ }
30
+ }
31
+ });
32
+ };
33
+ exports.coerceNumberOptions = coerceNumberOptions;
34
+ /** Assemble resource loading options from user-provided Options. */
35
+ const assembleResourceOptions = (opts) => ({
36
+ allowTaint: opts.allowTaint ?? false,
37
+ imageTimeout: opts.imageTimeout ?? constants_1.DEFAULT_IMAGE_TIMEOUT_MS,
38
+ proxy: opts.proxy,
39
+ useCORS: opts.useCORS ?? false,
40
+ customIsSameOrigin: opts.customIsSameOrigin,
41
+ maxCacheSize: opts.maxCacheSize
42
+ });
43
+ exports.assembleResourceOptions = assembleResourceOptions;
44
+ /** Assemble context (logging + cache) options, extending resource options. */
45
+ const assembleContextOptions = (opts, config, resourceOptions) => ({
46
+ logging: opts.logging ?? true,
47
+ cache: opts.cache ?? config.cache,
48
+ ...resourceOptions
49
+ });
50
+ exports.assembleContextOptions = assembleContextOptions;
51
+ const DEFAULT_WINDOW_WIDTH = 800;
52
+ const DEFAULT_WINDOW_HEIGHT = 600;
53
+ const DEFAULT_SCROLL = 0;
54
+ const assembleWindowOptions = (opts, defaultView) => {
55
+ const win = defaultView;
56
+ return {
57
+ windowWidth: opts.windowWidth ?? win.innerWidth ?? DEFAULT_WINDOW_WIDTH,
58
+ windowHeight: opts.windowHeight ?? win.innerHeight ?? DEFAULT_WINDOW_HEIGHT,
59
+ scrollX: opts.scrollX ?? win.pageXOffset ?? DEFAULT_SCROLL,
60
+ scrollY: opts.scrollY ?? win.pageYOffset ?? DEFAULT_SCROLL
61
+ };
62
+ };
63
+ exports.assembleWindowOptions = assembleWindowOptions;
64
+ /** Assemble DOM cloning options. */
65
+ const assembleCloneOptions = (opts, config, foreignObjectRendering) => ({
66
+ allowTaint: opts.allowTaint ?? false,
67
+ onclone: opts.onclone,
68
+ ignoreElements: opts.ignoreElements,
69
+ iframeContainer: opts.iframeContainer,
70
+ inlineImages: foreignObjectRendering,
71
+ copyStyles: foreignObjectRendering,
72
+ cspNonce: opts.cspNonce ?? config.cspNonce
73
+ });
74
+ exports.assembleCloneOptions = assembleCloneOptions;
75
+ /** Assemble canvas rendering options. */
76
+ const assembleRenderOptions = (opts, backgroundColor, left, top, width, height, devicePixelRatio) => ({
77
+ canvas: opts.canvas,
78
+ backgroundColor,
79
+ signal: opts.signal,
80
+ scale: opts.scale ?? devicePixelRatio ?? 1,
81
+ x: (opts.x ?? 0) + left,
82
+ y: (opts.y ?? 0) + top,
83
+ width: opts.width ?? Math.ceil(width),
84
+ height: opts.height ?? Math.ceil(height),
85
+ imageSmoothing: opts.imageSmoothing,
86
+ imageSmoothingQuality: opts.imageSmoothingQuality
87
+ });
88
+ exports.assembleRenderOptions = assembleRenderOptions;
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ /**
3
+ * Shared numeric constants used across html2canvas-pro.
4
+ * Centralising magic numbers for maintainability.
5
+ */
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.RESOURCE_KEY_LOG_LENGTH = exports.INLINE_IMAGE_RESOLVE_DELAY_MS = exports.IFRAME_READY_POLL_MS = exports.SHADOW_MASK_OFFSET = exports.DEFAULT_IMAGE_TIMEOUT_MS = exports.MAX_IMAGE_CACHE_SIZE = exports.DEFAULT_IMAGE_CACHE_SIZE = exports.PATTERN_CACHE_MAX = exports.PARSE_CACHE_MAX_PER_DESCRIPTOR = void 0;
8
+ /** Maximum entries in the CSS parse cache per descriptor (LRU). */
9
+ exports.PARSE_CACHE_MAX_PER_DESCRIPTOR = 200;
10
+ /** Maximum cached background-image patterns per render session (LRU). */
11
+ exports.PATTERN_CACHE_MAX = 50;
12
+ /** Maximum size of the image-resource cache (entries). */
13
+ exports.DEFAULT_IMAGE_CACHE_SIZE = 100;
14
+ /** Maximum allowed image-resource cache size. */
15
+ exports.MAX_IMAGE_CACHE_SIZE = 10000;
16
+ /** Default image-load timeout in milliseconds. */
17
+ exports.DEFAULT_IMAGE_TIMEOUT_MS = 15000;
18
+ /** Z-axis mask offset used during box-shadow rendering. */
19
+ exports.SHADOW_MASK_OFFSET = 10000;
20
+ /** Polling interval (ms) when waiting for the cloned iframe to become ready. */
21
+ exports.IFRAME_READY_POLL_MS = 50;
22
+ /** Deferred resolution delay (ms) for inline XML images that may fail to parse. */
23
+ exports.INLINE_IMAGE_RESOLVE_DELAY_MS = 500;
24
+ /** Maximum characters logged for image/resource keys. */
25
+ exports.RESOURCE_KEY_LOG_LENGTH = 256;
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Context = void 0;
4
+ const logger_1 = require("./logger");
5
+ const cache_storage_1 = require("./cache-storage");
6
+ const origin_checker_1 = require("./origin-checker");
7
+ class Context {
8
+ constructor(options, windowBounds, config) {
9
+ this.windowBounds = windowBounds;
10
+ this.instanceName = `#${Context.instanceCount++}`;
11
+ this.config = config;
12
+ this.logger = new logger_1.Logger({ id: this.instanceName, enabled: options.logging });
13
+ this.originChecker = new origin_checker_1.OriginChecker(config.window);
14
+ this.cache = options.cache ?? config.cache ?? new cache_storage_1.Cache(this, options);
15
+ this.onError = options.onError;
16
+ }
17
+ }
18
+ exports.Context = Context;
19
+ Context.instanceCount = 1;
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isDebugging = void 0;
4
+ const elementDebuggerAttribute = 'data-html2canvas-debug';
5
+ const getElementDebugType = (element) => {
6
+ if (typeof element.getAttribute !== 'function') {
7
+ return 0 /* DebuggerType.NONE */;
8
+ }
9
+ const attribute = element.getAttribute(elementDebuggerAttribute);
10
+ switch (attribute) {
11
+ case 'all':
12
+ return 1 /* DebuggerType.ALL */;
13
+ case 'clone':
14
+ return 2 /* DebuggerType.CLONE */;
15
+ case 'parse':
16
+ return 3 /* DebuggerType.PARSE */;
17
+ case 'render':
18
+ return 4 /* DebuggerType.RENDER */;
19
+ default:
20
+ return 0 /* DebuggerType.NONE */;
21
+ }
22
+ };
23
+ const isDebugging = (element, type) => {
24
+ const elementType = getElementDebugType(element);
25
+ return elementType === 1 /* DebuggerType.ALL */ || type === elementType;
26
+ };
27
+ exports.isDebugging = isDebugging;