@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,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.textUnderlineOffset = void 0;
4
+ const parser_1 = require("../syntax/parser");
5
+ exports.textUnderlineOffset = {
6
+ name: 'text-underline-offset',
7
+ initialValue: 'auto',
8
+ prefix: false,
9
+ type: 0 /* PropertyDescriptorParsingType.VALUE */,
10
+ parse: (_context, token) => {
11
+ if ((0, parser_1.isIdentToken)(token)) {
12
+ if (token.value === 'auto') {
13
+ return 'auto';
14
+ }
15
+ }
16
+ if ((0, parser_1.isDimensionToken)(token)) {
17
+ // Return pixel value
18
+ return token.number;
19
+ }
20
+ // Default to auto
21
+ return 'auto';
22
+ }
23
+ };
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.transformOrigin = void 0;
4
+ const length_percentage_1 = require("../types/length-percentage");
5
+ const tokenizer_1 = require("../syntax/tokenizer");
6
+ const DEFAULT_VALUE = {
7
+ type: 16 /* TokenType.PERCENTAGE_TOKEN */,
8
+ number: 50,
9
+ flags: tokenizer_1.FLAG_INTEGER
10
+ };
11
+ const DEFAULT = [DEFAULT_VALUE, DEFAULT_VALUE];
12
+ exports.transformOrigin = {
13
+ name: 'transform-origin',
14
+ initialValue: '50% 50%',
15
+ prefix: true,
16
+ type: 1 /* PropertyDescriptorParsingType.LIST */,
17
+ parse: (_context, tokens) => {
18
+ const origins = tokens.filter(length_percentage_1.isLengthPercentage);
19
+ if (origins.length !== 2) {
20
+ return DEFAULT;
21
+ }
22
+ return [origins[0], origins[1]];
23
+ }
24
+ };
@@ -0,0 +1,57 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.transform = void 0;
4
+ const angle_1 = require("../types/angle");
5
+ exports.transform = {
6
+ name: 'transform',
7
+ initialValue: 'none',
8
+ prefix: true,
9
+ type: 0 /* PropertyDescriptorParsingType.VALUE */,
10
+ parse: (_context, token) => {
11
+ if (token.type === 20 /* TokenType.IDENT_TOKEN */ && token.value === 'none') {
12
+ return null;
13
+ }
14
+ if (token.type === 18 /* TokenType.FUNCTION */) {
15
+ const transformFunction = SUPPORTED_TRANSFORM_FUNCTIONS[token.name];
16
+ if (typeof transformFunction === 'undefined') {
17
+ throw new Error(`Attempting to parse an unsupported transform function "${token.name}"`);
18
+ }
19
+ return transformFunction(_context, token.values);
20
+ }
21
+ return null;
22
+ }
23
+ };
24
+ const matrix = (_context, args) => {
25
+ const values = args.filter((arg) => arg.type === 17 /* TokenType.NUMBER_TOKEN */).map((arg) => arg.number);
26
+ return values.length === 6 ? values : null;
27
+ };
28
+ // doesn't support 3D transforms at the moment
29
+ const matrix3d = (_context, args) => {
30
+ const values = args.filter((arg) => arg.type === 17 /* TokenType.NUMBER_TOKEN */).map((arg) => arg.number);
31
+ const [a1, b1, {}, {}, a2, b2, {}, {}, {}, {}, {}, {}, a4, b4, {}, {}] = values;
32
+ return values.length === 16 ? [a1, b1, a2, b2, a4, b4] : null;
33
+ };
34
+ const rotate = (context, args) => {
35
+ if (args.length !== 1) {
36
+ return null;
37
+ }
38
+ const arg = args[0];
39
+ let radians = 0;
40
+ if (arg.type === 17 /* TokenType.NUMBER_TOKEN */ && arg.number === 0) {
41
+ radians = 0;
42
+ }
43
+ else if (arg.type === 15 /* TokenType.DIMENSION_TOKEN */) {
44
+ radians = angle_1.angle.parse(context, arg);
45
+ }
46
+ else {
47
+ return null;
48
+ }
49
+ const cos = Math.cos(radians);
50
+ const sin = Math.sin(radians);
51
+ return [cos, sin, -sin, cos, 0, 0];
52
+ };
53
+ const SUPPORTED_TRANSFORM_FUNCTIONS = {
54
+ matrix: matrix,
55
+ matrix3d: matrix3d,
56
+ rotate: rotate
57
+ };
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.visibility = void 0;
4
+ exports.visibility = {
5
+ name: 'visibility',
6
+ initialValue: 'none',
7
+ prefix: false,
8
+ type: 2 /* PropertyDescriptorParsingType.IDENT_VALUE */,
9
+ parse: (_context, visibility) => {
10
+ switch (visibility) {
11
+ case 'hidden':
12
+ return 1 /* VISIBILITY.HIDDEN */;
13
+ case 'collapse':
14
+ return 2 /* VISIBILITY.COLLAPSE */;
15
+ case 'visible':
16
+ default:
17
+ return 0 /* VISIBILITY.VISIBLE */;
18
+ }
19
+ }
20
+ };
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.webkitLineClamp = void 0;
4
+ /**
5
+ * -webkit-line-clamp property descriptor
6
+ * Used with display: -webkit-box and -webkit-box-orient: vertical
7
+ * to limit text to a specific number of lines
8
+ */
9
+ exports.webkitLineClamp = {
10
+ name: '-webkit-line-clamp',
11
+ initialValue: 'none',
12
+ prefix: true,
13
+ type: 0 /* PropertyDescriptorParsingType.VALUE */,
14
+ parse: (_context, token) => {
15
+ // 'none' means no line clamping
16
+ if (token.type === 20 /* TokenType.IDENT_TOKEN */ && token.value === 'none') {
17
+ return 0;
18
+ }
19
+ // Number value specifies the number of lines
20
+ if (token.type === 17 /* TokenType.NUMBER_TOKEN */) {
21
+ return Math.max(0, Math.floor(token.number));
22
+ }
23
+ // Default to 0 (no clamping)
24
+ return 0;
25
+ }
26
+ };
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.webkitTextStrokeColor = void 0;
4
+ exports.webkitTextStrokeColor = {
5
+ name: `-webkit-text-stroke-color`,
6
+ initialValue: 'currentcolor',
7
+ prefix: false,
8
+ type: 3 /* PropertyDescriptorParsingType.TYPE_VALUE */,
9
+ format: 'color'
10
+ };
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.webkitTextStrokeWidth = void 0;
4
+ const parser_1 = require("../syntax/parser");
5
+ exports.webkitTextStrokeWidth = {
6
+ name: `-webkit-text-stroke-width`,
7
+ initialValue: '0',
8
+ type: 0 /* PropertyDescriptorParsingType.VALUE */,
9
+ prefix: false,
10
+ parse: (_context, token) => {
11
+ if ((0, parser_1.isDimensionToken)(token)) {
12
+ return token.number;
13
+ }
14
+ return 0;
15
+ }
16
+ };
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.wordBreak = exports.WORD_BREAK = void 0;
4
+ var WORD_BREAK;
5
+ (function (WORD_BREAK) {
6
+ WORD_BREAK["NORMAL"] = "normal";
7
+ WORD_BREAK["BREAK_ALL"] = "break-all";
8
+ WORD_BREAK["KEEP_ALL"] = "keep-all";
9
+ })(WORD_BREAK || (exports.WORD_BREAK = WORD_BREAK = {}));
10
+ exports.wordBreak = {
11
+ name: 'word-break',
12
+ initialValue: 'normal',
13
+ prefix: false,
14
+ type: 2 /* PropertyDescriptorParsingType.IDENT_VALUE */,
15
+ parse: (_context, wordBreak) => {
16
+ switch (wordBreak) {
17
+ case 'break-all':
18
+ return WORD_BREAK.BREAK_ALL;
19
+ case 'keep-all':
20
+ return WORD_BREAK.KEEP_ALL;
21
+ case 'normal':
22
+ default:
23
+ return WORD_BREAK.NORMAL;
24
+ }
25
+ }
26
+ };
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.writingMode = exports.isSidewaysWritingMode = exports.isVerticalWritingMode = void 0;
4
+ const isVerticalWritingMode = (writingMode) => writingMode !== 0 /* WRITING_MODE.HORIZONTAL_TB */;
5
+ exports.isVerticalWritingMode = isVerticalWritingMode;
6
+ const isSidewaysWritingMode = (writingMode) => writingMode === 3 /* WRITING_MODE.SIDEWAYS_RL */ || writingMode === 4 /* WRITING_MODE.SIDEWAYS_LR */;
7
+ exports.isSidewaysWritingMode = isSidewaysWritingMode;
8
+ exports.writingMode = {
9
+ name: 'writing-mode',
10
+ initialValue: 'horizontal-tb',
11
+ prefix: false,
12
+ type: 2 /* PropertyDescriptorParsingType.IDENT_VALUE */,
13
+ parse: (_context, writingMode) => {
14
+ switch (writingMode) {
15
+ case 'vertical-rl':
16
+ return 1 /* WRITING_MODE.VERTICAL_RL */;
17
+ case 'vertical-lr':
18
+ return 2 /* WRITING_MODE.VERTICAL_LR */;
19
+ case 'sideways-rl':
20
+ return 3 /* WRITING_MODE.SIDEWAYS_RL */;
21
+ case 'sideways-lr':
22
+ return 4 /* WRITING_MODE.SIDEWAYS_LR */;
23
+ case 'horizontal-tb':
24
+ default:
25
+ return 0 /* WRITING_MODE.HORIZONTAL_TB */;
26
+ }
27
+ }
28
+ };
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.zIndex = void 0;
4
+ const parser_1 = require("../syntax/parser");
5
+ exports.zIndex = {
6
+ name: 'z-index',
7
+ initialValue: 'auto',
8
+ prefix: false,
9
+ type: 0 /* PropertyDescriptorParsingType.VALUE */,
10
+ parse: (_context, token) => {
11
+ if (token.type === 20 /* TokenType.IDENT_TOKEN */) {
12
+ return { auto: true, order: 0 };
13
+ }
14
+ if ((0, parser_1.isNumberToken)(token)) {
15
+ return { auto: false, order: token.number };
16
+ }
17
+ throw new Error(`Invalid z-index number parsed`);
18
+ }
19
+ };
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.zoom = void 0;
4
+ exports.zoom = {
5
+ name: 'zoom',
6
+ initialValue: '1',
7
+ type: 0 /* PropertyDescriptorParsingType.VALUE */,
8
+ prefix: false,
9
+ parse: (_context, token) => {
10
+ if (token.type === 16 /* TokenType.PERCENTAGE_TOKEN */) {
11
+ return Math.max(0, token.number / 100);
12
+ }
13
+ if (token.type === 17 /* TokenType.NUMBER_TOKEN */) {
14
+ return Math.max(0, token.number);
15
+ }
16
+ return 1;
17
+ }
18
+ };
@@ -0,0 +1,140 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.parseFunctionArgs = exports.nonFunctionArgSeparator = exports.nonWhiteSpace = exports.isIdentWithValue = exports.isStringToken = exports.isIdentToken = exports.isNumberToken = exports.isDimensionToken = exports.Parser = void 0;
4
+ const tokenizer_1 = require("./tokenizer");
5
+ class Parser {
6
+ constructor(tokens) {
7
+ this._tokens = tokens;
8
+ }
9
+ static create(value) {
10
+ const tokenizer = new tokenizer_1.Tokenizer();
11
+ tokenizer.write(value);
12
+ return new Parser(tokenizer.read());
13
+ }
14
+ static parseValue(value) {
15
+ return Parser.create(value).parseComponentValue();
16
+ }
17
+ static parseValues(value) {
18
+ return Parser.create(value).parseComponentValues();
19
+ }
20
+ parseComponentValue() {
21
+ let token = this.consumeToken();
22
+ while (token.type === 31 /* TokenType.WHITESPACE_TOKEN */) {
23
+ token = this.consumeToken();
24
+ }
25
+ if (token.type === 32 /* TokenType.EOF_TOKEN */) {
26
+ throw new SyntaxError(`Error parsing CSS component value, unexpected EOF`);
27
+ }
28
+ this.reconsumeToken(token);
29
+ const value = this.consumeComponentValue();
30
+ do {
31
+ token = this.consumeToken();
32
+ } while (token.type === 31 /* TokenType.WHITESPACE_TOKEN */);
33
+ if (token.type === 32 /* TokenType.EOF_TOKEN */) {
34
+ return value;
35
+ }
36
+ throw new SyntaxError(`Error parsing CSS component value, multiple values found when expecting only one`);
37
+ }
38
+ parseComponentValues() {
39
+ const values = [];
40
+ while (true) {
41
+ const value = this.consumeComponentValue();
42
+ if (value.type === 32 /* TokenType.EOF_TOKEN */) {
43
+ return values;
44
+ }
45
+ values.push(value);
46
+ }
47
+ }
48
+ consumeComponentValue() {
49
+ const token = this.consumeToken();
50
+ switch (token.type) {
51
+ case 11 /* TokenType.LEFT_CURLY_BRACKET_TOKEN */:
52
+ case 28 /* TokenType.LEFT_SQUARE_BRACKET_TOKEN */:
53
+ case 2 /* TokenType.LEFT_PARENTHESIS_TOKEN */:
54
+ return this.consumeSimpleBlock(token.type);
55
+ case 19 /* TokenType.FUNCTION_TOKEN */:
56
+ return this.consumeFunction(token);
57
+ }
58
+ return token;
59
+ }
60
+ consumeSimpleBlock(type) {
61
+ const block = { type, values: [] };
62
+ let token = this.consumeToken();
63
+ while (true) {
64
+ if (token.type === 32 /* TokenType.EOF_TOKEN */ || isEndingTokenFor(token, type)) {
65
+ return block;
66
+ }
67
+ this.reconsumeToken(token);
68
+ block.values.push(this.consumeComponentValue());
69
+ token = this.consumeToken();
70
+ }
71
+ }
72
+ consumeFunction(functionToken) {
73
+ const cssFunction = {
74
+ name: functionToken.value,
75
+ values: [],
76
+ type: 18 /* TokenType.FUNCTION */
77
+ };
78
+ while (true) {
79
+ const token = this.consumeToken();
80
+ if (token.type === 32 /* TokenType.EOF_TOKEN */ || token.type === 3 /* TokenType.RIGHT_PARENTHESIS_TOKEN */) {
81
+ return cssFunction;
82
+ }
83
+ this.reconsumeToken(token);
84
+ cssFunction.values.push(this.consumeComponentValue());
85
+ }
86
+ }
87
+ consumeToken() {
88
+ const token = this._tokens.shift();
89
+ return typeof token === 'undefined' ? tokenizer_1.EOF_TOKEN : token;
90
+ }
91
+ reconsumeToken(token) {
92
+ this._tokens.unshift(token);
93
+ }
94
+ }
95
+ exports.Parser = Parser;
96
+ const isDimensionToken = (token) => token.type === 15 /* TokenType.DIMENSION_TOKEN */;
97
+ exports.isDimensionToken = isDimensionToken;
98
+ const isNumberToken = (token) => token.type === 17 /* TokenType.NUMBER_TOKEN */;
99
+ exports.isNumberToken = isNumberToken;
100
+ const isIdentToken = (token) => token.type === 20 /* TokenType.IDENT_TOKEN */;
101
+ exports.isIdentToken = isIdentToken;
102
+ const isStringToken = (token) => token.type === 0 /* TokenType.STRING_TOKEN */;
103
+ exports.isStringToken = isStringToken;
104
+ const isIdentWithValue = (token, value) => (0, exports.isIdentToken)(token) && token.value === value;
105
+ exports.isIdentWithValue = isIdentWithValue;
106
+ const nonWhiteSpace = (token) => token.type !== 31 /* TokenType.WHITESPACE_TOKEN */;
107
+ exports.nonWhiteSpace = nonWhiteSpace;
108
+ const nonFunctionArgSeparator = (token) => token.type !== 31 /* TokenType.WHITESPACE_TOKEN */ && token.type !== 4 /* TokenType.COMMA_TOKEN */;
109
+ exports.nonFunctionArgSeparator = nonFunctionArgSeparator;
110
+ const parseFunctionArgs = (tokens) => {
111
+ const args = [];
112
+ let arg = [];
113
+ tokens.forEach((token) => {
114
+ if (token.type === 4 /* TokenType.COMMA_TOKEN */) {
115
+ if (arg.length === 0) {
116
+ throw new Error(`Error parsing function args, zero tokens for arg`);
117
+ }
118
+ args.push(arg);
119
+ arg = [];
120
+ return;
121
+ }
122
+ if (token.type !== 31 /* TokenType.WHITESPACE_TOKEN */) {
123
+ arg.push(token);
124
+ }
125
+ });
126
+ if (arg.length) {
127
+ args.push(arg);
128
+ }
129
+ return args;
130
+ };
131
+ exports.parseFunctionArgs = parseFunctionArgs;
132
+ const isEndingTokenFor = (token, type) => {
133
+ if (type === 11 /* TokenType.LEFT_CURLY_BRACKET_TOKEN */ && token.type === 12 /* TokenType.RIGHT_CURLY_BRACKET_TOKEN */) {
134
+ return true;
135
+ }
136
+ if (type === 28 /* TokenType.LEFT_SQUARE_BRACKET_TOKEN */ && token.type === 29 /* TokenType.RIGHT_SQUARE_BRACKET_TOKEN */) {
137
+ return true;
138
+ }
139
+ return type === 2 /* TokenType.LEFT_PARENTHESIS_TOKEN */ && token.type === 3 /* TokenType.RIGHT_PARENTHESIS_TOKEN */;
140
+ };
@@ -0,0 +1,214 @@
1
+ "use strict";
2
+ // CSS tokenizer code-point constants and character-classification predicates.
3
+ // Pure functions with no runtime dependencies — usable without the Tokenizer class.
4
+ Object.defineProperty(exports, "__esModule", { value: true });
5
+ exports.E = exports.A = exports.z = exports.u = exports.f = exports.e = exports.a = exports.ZERO = exports.EOF = exports.DELETE = exports.INFORMATION_SEPARATOR_ONE = exports.SHIFT_OUT = exports.LINE_TABULATION = exports.BACKSPACE = exports.NULL = exports.FULL_STOP = exports.SEMICOLON = exports.COLON = exports.COMMA = exports.PLUS_SIGN = exports.ASTERISK = exports.REPLACEMENT_CHARACTER = exports.CONTROL = exports.TILDE = exports.VERTICAL_LINE = exports.RIGHT_CURLY_BRACKET = exports.QUESTION_MARK = exports.LEFT_CURLY_BRACKET = exports.CIRCUMFLEX_ACCENT = exports.RIGHT_SQUARE_BRACKET = exports.LEFT_SQUARE_BRACKET = exports.COMMERCIAL_AT = exports.GREATER_THAN_SIGN = exports.LESS_THAN_SIGN = exports.EXCLAMATION_MARK = exports.HYPHEN_MINUS = exports.LOW_LINE = exports.RIGHT_PARENTHESIS = exports.LEFT_PARENTHESIS = exports.APOSTROPHE = exports.PERCENTAGE_SIGN = exports.DOLLAR_SIGN = exports.NUMBER_SIGN = exports.EQUALS_SIGN = exports.QUOTATION_MARK = exports.SPACE = exports.CHARACTER_TABULATION = exports.REVERSE_SOLIDUS = exports.SOLIDUS = exports.LINE_FEED = void 0;
6
+ exports.stringToNumber = exports.isNumberStart = exports.isIdentifierStart = exports.isValidEscape = exports.isNonPrintableCodePoint = exports.isNameCodePoint = exports.isNameStartCodePoint = exports.isWhiteSpace = exports.isNonASCIICodePoint = exports.isLetter = exports.isUpperCaseLetter = exports.isLowerCaseLetter = exports.isHex = exports.isSurrogateCodePoint = exports.isDigit = exports.Z = exports.U = exports.F = void 0;
7
+ const LINE_FEED = 0x000a;
8
+ exports.LINE_FEED = LINE_FEED;
9
+ const SOLIDUS = 0x002f;
10
+ exports.SOLIDUS = SOLIDUS;
11
+ const REVERSE_SOLIDUS = 0x005c;
12
+ exports.REVERSE_SOLIDUS = REVERSE_SOLIDUS;
13
+ const CHARACTER_TABULATION = 0x0009;
14
+ exports.CHARACTER_TABULATION = CHARACTER_TABULATION;
15
+ const SPACE = 0x0020;
16
+ exports.SPACE = SPACE;
17
+ const QUOTATION_MARK = 0x0022;
18
+ exports.QUOTATION_MARK = QUOTATION_MARK;
19
+ const EQUALS_SIGN = 0x003d;
20
+ exports.EQUALS_SIGN = EQUALS_SIGN;
21
+ const NUMBER_SIGN = 0x0023;
22
+ exports.NUMBER_SIGN = NUMBER_SIGN;
23
+ const DOLLAR_SIGN = 0x0024;
24
+ exports.DOLLAR_SIGN = DOLLAR_SIGN;
25
+ const PERCENTAGE_SIGN = 0x0025;
26
+ exports.PERCENTAGE_SIGN = PERCENTAGE_SIGN;
27
+ const APOSTROPHE = 0x0027;
28
+ exports.APOSTROPHE = APOSTROPHE;
29
+ const LEFT_PARENTHESIS = 0x0028;
30
+ exports.LEFT_PARENTHESIS = LEFT_PARENTHESIS;
31
+ const RIGHT_PARENTHESIS = 0x0029;
32
+ exports.RIGHT_PARENTHESIS = RIGHT_PARENTHESIS;
33
+ const LOW_LINE = 0x005f;
34
+ exports.LOW_LINE = LOW_LINE;
35
+ const HYPHEN_MINUS = 0x002d;
36
+ exports.HYPHEN_MINUS = HYPHEN_MINUS;
37
+ const EXCLAMATION_MARK = 0x0021;
38
+ exports.EXCLAMATION_MARK = EXCLAMATION_MARK;
39
+ const LESS_THAN_SIGN = 0x003c;
40
+ exports.LESS_THAN_SIGN = LESS_THAN_SIGN;
41
+ const GREATER_THAN_SIGN = 0x003e;
42
+ exports.GREATER_THAN_SIGN = GREATER_THAN_SIGN;
43
+ const COMMERCIAL_AT = 0x0040;
44
+ exports.COMMERCIAL_AT = COMMERCIAL_AT;
45
+ const LEFT_SQUARE_BRACKET = 0x005b;
46
+ exports.LEFT_SQUARE_BRACKET = LEFT_SQUARE_BRACKET;
47
+ const RIGHT_SQUARE_BRACKET = 0x005d;
48
+ exports.RIGHT_SQUARE_BRACKET = RIGHT_SQUARE_BRACKET;
49
+ const CIRCUMFLEX_ACCENT = 0x003d;
50
+ exports.CIRCUMFLEX_ACCENT = CIRCUMFLEX_ACCENT;
51
+ const LEFT_CURLY_BRACKET = 0x007b;
52
+ exports.LEFT_CURLY_BRACKET = LEFT_CURLY_BRACKET;
53
+ const QUESTION_MARK = 0x003f;
54
+ exports.QUESTION_MARK = QUESTION_MARK;
55
+ const RIGHT_CURLY_BRACKET = 0x007d;
56
+ exports.RIGHT_CURLY_BRACKET = RIGHT_CURLY_BRACKET;
57
+ const VERTICAL_LINE = 0x007c;
58
+ exports.VERTICAL_LINE = VERTICAL_LINE;
59
+ const TILDE = 0x007e;
60
+ exports.TILDE = TILDE;
61
+ const CONTROL = 0x0080;
62
+ exports.CONTROL = CONTROL;
63
+ const REPLACEMENT_CHARACTER = 0xfffd;
64
+ exports.REPLACEMENT_CHARACTER = REPLACEMENT_CHARACTER;
65
+ const ASTERISK = 0x002a;
66
+ exports.ASTERISK = ASTERISK;
67
+ const PLUS_SIGN = 0x002b;
68
+ exports.PLUS_SIGN = PLUS_SIGN;
69
+ const COMMA = 0x002c;
70
+ exports.COMMA = COMMA;
71
+ const COLON = 0x003a;
72
+ exports.COLON = COLON;
73
+ const SEMICOLON = 0x003b;
74
+ exports.SEMICOLON = SEMICOLON;
75
+ const FULL_STOP = 0x002e;
76
+ exports.FULL_STOP = FULL_STOP;
77
+ const NULL = 0x0000;
78
+ exports.NULL = NULL;
79
+ const BACKSPACE = 0x0008;
80
+ exports.BACKSPACE = BACKSPACE;
81
+ const LINE_TABULATION = 0x000b;
82
+ exports.LINE_TABULATION = LINE_TABULATION;
83
+ const SHIFT_OUT = 0x000e;
84
+ exports.SHIFT_OUT = SHIFT_OUT;
85
+ const INFORMATION_SEPARATOR_ONE = 0x001f;
86
+ exports.INFORMATION_SEPARATOR_ONE = INFORMATION_SEPARATOR_ONE;
87
+ const DELETE = 0x007f;
88
+ exports.DELETE = DELETE;
89
+ const EOF = -1;
90
+ exports.EOF = EOF;
91
+ const ZERO = 0x0030;
92
+ exports.ZERO = ZERO;
93
+ const a = 0x0061;
94
+ exports.a = a;
95
+ const e = 0x0065;
96
+ exports.e = e;
97
+ const f = 0x0066;
98
+ exports.f = f;
99
+ const u = 0x0075;
100
+ exports.u = u;
101
+ const z = 0x007a;
102
+ exports.z = z;
103
+ const A = 0x0041;
104
+ exports.A = A;
105
+ const E = 0x0045;
106
+ exports.E = E;
107
+ const F = 0x0046;
108
+ exports.F = F;
109
+ const U = 0x0055;
110
+ exports.U = U;
111
+ const Z = 0x005a;
112
+ exports.Z = Z;
113
+ const css_line_break_1 = require("css-line-break");
114
+ const isDigit = (codePoint) => codePoint >= ZERO && codePoint <= 0x0039;
115
+ exports.isDigit = isDigit;
116
+ const isSurrogateCodePoint = (codePoint) => codePoint >= 0xd800 && codePoint <= 0xdfff;
117
+ exports.isSurrogateCodePoint = isSurrogateCodePoint;
118
+ const isHex = (codePoint) => isDigit(codePoint) || (codePoint >= A && codePoint <= F) || (codePoint >= a && codePoint <= f);
119
+ exports.isHex = isHex;
120
+ const isLowerCaseLetter = (codePoint) => codePoint >= a && codePoint <= z;
121
+ exports.isLowerCaseLetter = isLowerCaseLetter;
122
+ const isUpperCaseLetter = (codePoint) => codePoint >= A && codePoint <= Z;
123
+ exports.isUpperCaseLetter = isUpperCaseLetter;
124
+ const isLetter = (codePoint) => isLowerCaseLetter(codePoint) || isUpperCaseLetter(codePoint);
125
+ exports.isLetter = isLetter;
126
+ const isNonASCIICodePoint = (codePoint) => codePoint >= CONTROL;
127
+ exports.isNonASCIICodePoint = isNonASCIICodePoint;
128
+ const isWhiteSpace = (codePoint) => codePoint === LINE_FEED || codePoint === CHARACTER_TABULATION || codePoint === SPACE;
129
+ exports.isWhiteSpace = isWhiteSpace;
130
+ const isNameStartCodePoint = (codePoint) => isLetter(codePoint) || isNonASCIICodePoint(codePoint) || codePoint === LOW_LINE;
131
+ exports.isNameStartCodePoint = isNameStartCodePoint;
132
+ const isNameCodePoint = (codePoint) => isNameStartCodePoint(codePoint) || isDigit(codePoint) || codePoint === HYPHEN_MINUS;
133
+ exports.isNameCodePoint = isNameCodePoint;
134
+ const isNonPrintableCodePoint = (codePoint) => {
135
+ return ((codePoint >= NULL && codePoint <= BACKSPACE) ||
136
+ codePoint === LINE_TABULATION ||
137
+ (codePoint >= SHIFT_OUT && codePoint <= INFORMATION_SEPARATOR_ONE) ||
138
+ codePoint === DELETE);
139
+ };
140
+ exports.isNonPrintableCodePoint = isNonPrintableCodePoint;
141
+ const isValidEscape = (c1, c2) => {
142
+ if (c1 !== REVERSE_SOLIDUS) {
143
+ return false;
144
+ }
145
+ return c2 !== LINE_FEED;
146
+ };
147
+ exports.isValidEscape = isValidEscape;
148
+ const isIdentifierStart = (c1, c2, c3) => {
149
+ if (c1 === HYPHEN_MINUS) {
150
+ return isNameStartCodePoint(c2) || isValidEscape(c2, c3);
151
+ }
152
+ else if (isNameStartCodePoint(c1)) {
153
+ return true;
154
+ }
155
+ else if (c1 === REVERSE_SOLIDUS && isValidEscape(c1, c2)) {
156
+ return true;
157
+ }
158
+ return false;
159
+ };
160
+ exports.isIdentifierStart = isIdentifierStart;
161
+ const isNumberStart = (c1, c2, c3) => {
162
+ if (c1 === PLUS_SIGN || c1 === HYPHEN_MINUS) {
163
+ if (isDigit(c2)) {
164
+ return true;
165
+ }
166
+ return c2 === FULL_STOP && isDigit(c3);
167
+ }
168
+ if (c1 === FULL_STOP) {
169
+ return isDigit(c2);
170
+ }
171
+ return isDigit(c1);
172
+ };
173
+ exports.isNumberStart = isNumberStart;
174
+ const stringToNumber = (codePoints) => {
175
+ let c = 0;
176
+ let sign = 1;
177
+ if (codePoints[c] === PLUS_SIGN || codePoints[c] === HYPHEN_MINUS) {
178
+ if (codePoints[c] === HYPHEN_MINUS) {
179
+ sign = -1;
180
+ }
181
+ c++;
182
+ }
183
+ const integers = [];
184
+ while (isDigit(codePoints[c])) {
185
+ integers.push(codePoints[c++]);
186
+ }
187
+ const int = integers.length ? parseInt((0, css_line_break_1.fromCodePoint)(...integers), 10) : 0;
188
+ if (codePoints[c] === FULL_STOP) {
189
+ c++;
190
+ }
191
+ const fraction = [];
192
+ while (isDigit(codePoints[c])) {
193
+ fraction.push(codePoints[c++]);
194
+ }
195
+ const fracd = fraction.length;
196
+ const frac = fracd ? parseInt((0, css_line_break_1.fromCodePoint)(...fraction), 10) : 0;
197
+ if (codePoints[c] === E || codePoints[c] === e) {
198
+ c++;
199
+ }
200
+ let expsign = 1;
201
+ if (codePoints[c] === PLUS_SIGN || codePoints[c] === HYPHEN_MINUS) {
202
+ if (codePoints[c] === HYPHEN_MINUS) {
203
+ expsign = -1;
204
+ }
205
+ c++;
206
+ }
207
+ const exponent = [];
208
+ while (isDigit(codePoints[c])) {
209
+ exponent.push(codePoints[c++]);
210
+ }
211
+ const exp = exponent.length ? parseInt((0, css_line_break_1.fromCodePoint)(...exponent), 10) : 0;
212
+ return sign * (int + frac * Math.pow(10, -fracd)) * Math.pow(10, expsign * exp);
213
+ };
214
+ exports.stringToNumber = stringToNumber;
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.EOF_TOKEN = exports.WHITESPACE_TOKEN = exports.RIGHT_SQUARE_BRACKET_TOKEN = exports.LEFT_SQUARE_BRACKET_TOKEN = exports.SEMICOLON_TOKEN = exports.COLON_TOKEN = exports.CDC_TOKEN = exports.CDO_TOKEN = exports.BAD_STRING_TOKEN = exports.BAD_URL_TOKEN = exports.SUBSTRING_MATCH_TOKEN = exports.RIGHT_CURLY_BRACKET_TOKEN = exports.LEFT_CURLY_BRACKET_TOKEN = exports.INCLUDE_MATCH_TOKEN = exports.DASH_MATCH_TOKEN = exports.COLUMN_TOKEN = exports.PREFIX_MATCH_TOKEN = exports.SUFFIX_MATCH_TOKEN = exports.COMMA_TOKEN = exports.RIGHT_PARENTHESIS_TOKEN = exports.LEFT_PARENTHESIS_TOKEN = void 0;
4
+ exports.LEFT_PARENTHESIS_TOKEN = {
5
+ type: 2 /* TokenType.LEFT_PARENTHESIS_TOKEN */
6
+ };
7
+ exports.RIGHT_PARENTHESIS_TOKEN = {
8
+ type: 3 /* TokenType.RIGHT_PARENTHESIS_TOKEN */
9
+ };
10
+ exports.COMMA_TOKEN = { type: 4 /* TokenType.COMMA_TOKEN */ };
11
+ exports.SUFFIX_MATCH_TOKEN = { type: 13 /* TokenType.SUFFIX_MATCH_TOKEN */ };
12
+ exports.PREFIX_MATCH_TOKEN = { type: 8 /* TokenType.PREFIX_MATCH_TOKEN */ };
13
+ exports.COLUMN_TOKEN = { type: 21 /* TokenType.COLUMN_TOKEN */ };
14
+ exports.DASH_MATCH_TOKEN = { type: 9 /* TokenType.DASH_MATCH_TOKEN */ };
15
+ exports.INCLUDE_MATCH_TOKEN = { type: 10 /* TokenType.INCLUDE_MATCH_TOKEN */ };
16
+ exports.LEFT_CURLY_BRACKET_TOKEN = {
17
+ type: 11 /* TokenType.LEFT_CURLY_BRACKET_TOKEN */
18
+ };
19
+ exports.RIGHT_CURLY_BRACKET_TOKEN = {
20
+ type: 12 /* TokenType.RIGHT_CURLY_BRACKET_TOKEN */
21
+ };
22
+ exports.SUBSTRING_MATCH_TOKEN = { type: 14 /* TokenType.SUBSTRING_MATCH_TOKEN */ };
23
+ exports.BAD_URL_TOKEN = { type: 23 /* TokenType.BAD_URL_TOKEN */ };
24
+ exports.BAD_STRING_TOKEN = { type: 1 /* TokenType.BAD_STRING_TOKEN */ };
25
+ exports.CDO_TOKEN = { type: 25 /* TokenType.CDO_TOKEN */ };
26
+ exports.CDC_TOKEN = { type: 24 /* TokenType.CDC_TOKEN */ };
27
+ exports.COLON_TOKEN = { type: 26 /* TokenType.COLON_TOKEN */ };
28
+ exports.SEMICOLON_TOKEN = { type: 27 /* TokenType.SEMICOLON_TOKEN */ };
29
+ exports.LEFT_SQUARE_BRACKET_TOKEN = {
30
+ type: 28 /* TokenType.LEFT_SQUARE_BRACKET_TOKEN */
31
+ };
32
+ exports.RIGHT_SQUARE_BRACKET_TOKEN = {
33
+ type: 29 /* TokenType.RIGHT_SQUARE_BRACKET_TOKEN */
34
+ };
35
+ exports.WHITESPACE_TOKEN = { type: 31 /* TokenType.WHITESPACE_TOKEN */ };
36
+ exports.EOF_TOKEN = { type: 32 /* TokenType.EOF_TOKEN */ };