html2canvas-pro 2.4.5 → 2.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (231) hide show
  1. package/README.md +117 -13
  2. package/dist/html2canvas-pro.cjs +3425 -1677
  3. package/dist/html2canvas-pro.cjs.map +1 -1
  4. package/dist/html2canvas-pro.esm.js +3425 -1677
  5. package/dist/html2canvas-pro.esm.js.map +1 -1
  6. package/dist/html2canvas-pro.js +3479 -1731
  7. package/dist/html2canvas-pro.js.map +1 -1
  8. package/dist/html2canvas-pro.min.js +5 -5
  9. package/dist/types/core/cache-storage.d.ts +22 -1
  10. package/dist/types/core/context.d.ts +10 -1
  11. package/dist/types/core/logger.d.ts +0 -3
  12. package/dist/types/core/render-element.d.ts +11 -0
  13. package/dist/types/core/util.d.ts +6 -0
  14. package/dist/types/css/index.d.ts +77 -46
  15. package/dist/types/css/parse.d.ts +15 -0
  16. package/dist/types/css/property-descriptors/accent-color.d.ts +5 -0
  17. package/dist/types/css/property-descriptors/backdrop-filter.d.ts +9 -0
  18. package/dist/types/css/property-descriptors/background-blend-mode.d.ts +16 -16
  19. package/dist/types/css/property-descriptors/border-image-width.d.ts +36 -0
  20. package/dist/types/css/property-descriptors/clip-path.d.ts +16 -2
  21. package/dist/types/css/property-descriptors/isolation.d.ts +6 -0
  22. package/dist/types/css/property-descriptors/mask.d.ts +25 -0
  23. package/dist/types/css/property-descriptors/mix-blend-mode.d.ts +16 -16
  24. package/dist/types/css/property-descriptors/outline.d.ts +15 -0
  25. package/dist/types/css/property-descriptors/text-emphasis.d.ts +22 -0
  26. package/dist/types/css/property-descriptors/text-shadow.d.ts +1 -1
  27. package/dist/types/css/property-descriptors/webkit-box-reflect.d.ts +19 -0
  28. package/dist/types/css/property-descriptors/webkit-text-fill-color.d.ts +9 -0
  29. package/dist/types/css/syntax/token-constants.d.ts +1 -1
  30. package/dist/types/css/types/color-math.d.ts +7 -1
  31. package/dist/types/css/types/color-spaces/a98.d.ts +2 -1
  32. package/dist/types/css/types/color-spaces/p3.d.ts +5 -4
  33. package/dist/types/css/types/color-spaces/pro-photo.d.ts +5 -4
  34. package/dist/types/css/types/color-spaces/rec2020.d.ts +5 -4
  35. package/dist/types/css/types/color-spaces/srgb.d.ts +5 -4
  36. package/dist/types/css/types/color-utilities.d.ts +11 -11
  37. package/dist/types/css/types/color.d.ts +1 -0
  38. package/dist/types/css/types/functions/conic-gradient.d.ts +17 -0
  39. package/dist/types/css/types/functions/image-set.d.ts +11 -0
  40. package/dist/types/css/types/functions/repeating-radial-gradient.d.ts +8 -0
  41. package/dist/types/css/types/image.d.ts +17 -2
  42. package/dist/types/css/types/safe-eval.d.ts +0 -6
  43. package/dist/types/dom/copy-css-styles.d.ts +8 -0
  44. package/dist/types/dom/document-cloner.d.ts +3 -13
  45. package/dist/types/dom/iframe-mount.d.ts +37 -0
  46. package/dist/types/dom/pseudo-content.d.ts +33 -0
  47. package/dist/types/dom/replaced-elements/iframe-element-container.d.ts +2 -2
  48. package/dist/types/dom/replaced-elements/input-element-container.d.ts +1 -1
  49. package/dist/types/options.d.ts +8 -2
  50. package/dist/types/render/canvas/background-renderer.d.ts +28 -0
  51. package/dist/types/render/canvas/border-image-renderer.d.ts +50 -1
  52. package/dist/types/render/canvas/canvas-renderer.d.ts +29 -15
  53. package/dist/types/render/canvas/effects-renderer.d.ts +8 -0
  54. package/dist/types/render/canvas/mask-renderer.d.ts +36 -0
  55. package/dist/types/render/canvas/text-clip-renderer.d.ts +56 -0
  56. package/dist/types/render/canvas/text-renderer.d.ts +22 -0
  57. package/dist/types/render/stacking-context.d.ts +4 -1
  58. package/package.json +41 -42
  59. package/dist/lib/config.js +0 -49
  60. package/dist/lib/core/abort-helper.js +0 -20
  61. package/dist/lib/core/background-parser.js +0 -41
  62. package/dist/lib/core/bitwise.js +0 -5
  63. package/dist/lib/core/cache-storage.js +0 -283
  64. package/dist/lib/core/config-assembler.js +0 -88
  65. package/dist/lib/core/constants.js +0 -25
  66. package/dist/lib/core/context.js +0 -19
  67. package/dist/lib/core/debugger.js +0 -27
  68. package/dist/lib/core/features.js +0 -190
  69. package/dist/lib/core/logger.js +0 -56
  70. package/dist/lib/core/lru-map.js +0 -66
  71. package/dist/lib/core/origin-checker.js +0 -53
  72. package/dist/lib/core/performance-monitor.js +0 -185
  73. package/dist/lib/core/render-element.js +0 -131
  74. package/dist/lib/core/util.js +0 -4
  75. package/dist/lib/core/validator.js +0 -500
  76. package/dist/lib/css/grouped/background-styles.js +0 -36
  77. package/dist/lib/css/grouped/border-styles.js +0 -75
  78. package/dist/lib/css/grouped/font-styles.js +0 -93
  79. package/dist/lib/css/grouped/layout-styles.js +0 -127
  80. package/dist/lib/css/index.js +0 -339
  81. package/dist/lib/css/layout/bounds.js +0 -52
  82. package/dist/lib/css/layout/text.js +0 -133
  83. package/dist/lib/css/property-descriptor.js +0 -2
  84. package/dist/lib/css/property-descriptors/background-blend-mode.js +0 -41
  85. package/dist/lib/css/property-descriptors/background-clip.js +0 -25
  86. package/dist/lib/css/property-descriptors/background-color.js +0 -10
  87. package/dist/lib/css/property-descriptors/background-image.js +0 -24
  88. package/dist/lib/css/property-descriptors/background-origin.js +0 -23
  89. package/dist/lib/css/property-descriptors/background-position.js +0 -19
  90. package/dist/lib/css/property-descriptors/background-repeat.js +0 -33
  91. package/dist/lib/css/property-descriptors/background-size.js +0 -23
  92. package/dist/lib/css/property-descriptors/border-color.js +0 -14
  93. package/dist/lib/css/property-descriptors/border-image-repeat.js +0 -42
  94. package/dist/lib/css/property-descriptors/border-image-slice.js +0 -45
  95. package/dist/lib/css/property-descriptors/border-image-source.js +0 -22
  96. package/dist/lib/css/property-descriptors/border-radius.js +0 -15
  97. package/dist/lib/css/property-descriptors/border-style.js +0 -26
  98. package/dist/lib/css/property-descriptors/border-width.js +0 -20
  99. package/dist/lib/css/property-descriptors/box-decoration-break.js +0 -18
  100. package/dist/lib/css/property-descriptors/box-shadow.js +0 -54
  101. package/dist/lib/css/property-descriptors/clip-path.js +0 -189
  102. package/dist/lib/css/property-descriptors/color.js +0 -10
  103. package/dist/lib/css/property-descriptors/content.js +0 -19
  104. package/dist/lib/css/property-descriptors/counter-increment.js +0 -35
  105. package/dist/lib/css/property-descriptors/counter-reset.js +0 -18
  106. package/dist/lib/css/property-descriptors/direction.js +0 -18
  107. package/dist/lib/css/property-descriptors/display.js +0 -81
  108. package/dist/lib/css/property-descriptors/duration.js +0 -14
  109. package/dist/lib/css/property-descriptors/filter.js +0 -86
  110. package/dist/lib/css/property-descriptors/float.js +0 -22
  111. package/dist/lib/css/property-descriptors/font-family.js +0 -47
  112. package/dist/lib/css/property-descriptors/font-size.js +0 -10
  113. package/dist/lib/css/property-descriptors/font-style.js +0 -20
  114. package/dist/lib/css/property-descriptors/font-variant-ligatures.js +0 -34
  115. package/dist/lib/css/property-descriptors/font-variant.js +0 -13
  116. package/dist/lib/css/property-descriptors/font-weight.js +0 -25
  117. package/dist/lib/css/property-descriptors/image-rendering.js +0 -33
  118. package/dist/lib/css/property-descriptors/letter-spacing.js +0 -21
  119. package/dist/lib/css/property-descriptors/line-break.js +0 -23
  120. package/dist/lib/css/property-descriptors/line-height.js +0 -24
  121. package/dist/lib/css/property-descriptors/list-style-image.js +0 -17
  122. package/dist/lib/css/property-descriptors/list-style-position.js +0 -18
  123. package/dist/lib/css/property-descriptors/list-style-type.js +0 -122
  124. package/dist/lib/css/property-descriptors/margin.js +0 -13
  125. package/dist/lib/css/property-descriptors/mix-blend-mode.js +0 -31
  126. package/dist/lib/css/property-descriptors/object-fit.js +0 -28
  127. package/dist/lib/css/property-descriptors/object-position.js +0 -42
  128. package/dist/lib/css/property-descriptors/opacity.js +0 -16
  129. package/dist/lib/css/property-descriptors/overflow-wrap.js +0 -18
  130. package/dist/lib/css/property-descriptors/overflow.js +0 -27
  131. package/dist/lib/css/property-descriptors/padding.js +0 -14
  132. package/dist/lib/css/property-descriptors/paint-order.js +0 -33
  133. package/dist/lib/css/property-descriptors/position.js +0 -22
  134. package/dist/lib/css/property-descriptors/quotes.js +0 -41
  135. package/dist/lib/css/property-descriptors/rotate.js +0 -27
  136. package/dist/lib/css/property-descriptors/text-align.js +0 -21
  137. package/dist/lib/css/property-descriptors/text-decoration-color.js +0 -10
  138. package/dist/lib/css/property-descriptors/text-decoration-line.js +0 -28
  139. package/dist/lib/css/property-descriptors/text-decoration-style.js +0 -24
  140. package/dist/lib/css/property-descriptors/text-decoration-thickness.js +0 -26
  141. package/dist/lib/css/property-descriptors/text-overflow.js +0 -18
  142. package/dist/lib/css/property-descriptors/text-shadow.js +0 -46
  143. package/dist/lib/css/property-descriptors/text-transform.js +0 -20
  144. package/dist/lib/css/property-descriptors/text-underline-offset.js +0 -23
  145. package/dist/lib/css/property-descriptors/transform-origin.js +0 -24
  146. package/dist/lib/css/property-descriptors/transform.js +0 -57
  147. package/dist/lib/css/property-descriptors/visibility.js +0 -20
  148. package/dist/lib/css/property-descriptors/webkit-line-clamp.js +0 -26
  149. package/dist/lib/css/property-descriptors/webkit-text-stroke-color.js +0 -10
  150. package/dist/lib/css/property-descriptors/webkit-text-stroke-width.js +0 -16
  151. package/dist/lib/css/property-descriptors/white-space.js +0 -32
  152. package/dist/lib/css/property-descriptors/word-break.js +0 -26
  153. package/dist/lib/css/property-descriptors/writing-mode.js +0 -28
  154. package/dist/lib/css/property-descriptors/z-index.js +0 -19
  155. package/dist/lib/css/property-descriptors/zoom.js +0 -18
  156. package/dist/lib/css/syntax/parser.js +0 -141
  157. package/dist/lib/css/syntax/token-constants.js +0 -214
  158. package/dist/lib/css/syntax/token-singletons.js +0 -36
  159. package/dist/lib/css/syntax/token-types.js +0 -10
  160. package/dist/lib/css/syntax/tokenizer.js +0 -502
  161. package/dist/lib/css/type-descriptor.js +0 -2
  162. package/dist/lib/css/types/angle.js +0 -80
  163. package/dist/lib/css/types/color-math.js +0 -25
  164. package/dist/lib/css/types/color-spaces/a98.js +0 -78
  165. package/dist/lib/css/types/color-spaces/p3.js +0 -86
  166. package/dist/lib/css/types/color-spaces/pro-photo.js +0 -83
  167. package/dist/lib/css/types/color-spaces/rec2020.js +0 -85
  168. package/dist/lib/css/types/color-spaces/srgb.js +0 -79
  169. package/dist/lib/css/types/color-utilities.js +0 -342
  170. package/dist/lib/css/types/color.js +0 -400
  171. package/dist/lib/css/types/functions/-prefix-linear-gradient.js +0 -32
  172. package/dist/lib/css/types/functions/-prefix-radial-gradient.js +0 -83
  173. package/dist/lib/css/types/functions/-webkit-gradient.js +0 -59
  174. package/dist/lib/css/types/functions/counter.js +0 -367
  175. package/dist/lib/css/types/functions/gradient.js +0 -163
  176. package/dist/lib/css/types/functions/linear-gradient.js +0 -27
  177. package/dist/lib/css/types/functions/radial-gradient.js +0 -90
  178. package/dist/lib/css/types/functions/repeating-linear-gradient.js +0 -9
  179. package/dist/lib/css/types/image.js +0 -62
  180. package/dist/lib/css/types/index.js +0 -2
  181. package/dist/lib/css/types/length-percentage.js +0 -197
  182. package/dist/lib/css/types/length.js +0 -5
  183. package/dist/lib/css/types/safe-eval.js +0 -80
  184. package/dist/lib/css/types/time.js +0 -17
  185. package/dist/lib/dom/document-cloner.js +0 -618
  186. package/dist/lib/dom/dom-normalizer.js +0 -115
  187. package/dist/lib/dom/element-container.js +0 -71
  188. package/dist/lib/dom/elements/li-element-container.js +0 -11
  189. package/dist/lib/dom/elements/ol-element-container.js +0 -12
  190. package/dist/lib/dom/elements/select-element-container.js +0 -12
  191. package/dist/lib/dom/elements/textarea-element-container.js +0 -11
  192. package/dist/lib/dom/node-parser.js +0 -125
  193. package/dist/lib/dom/node-type-guards.js +0 -81
  194. package/dist/lib/dom/replaced-elements/canvas-element-container.js +0 -13
  195. package/dist/lib/dom/replaced-elements/iframe-element-container.js +0 -38
  196. package/dist/lib/dom/replaced-elements/image-element-container.js +0 -14
  197. package/dist/lib/dom/replaced-elements/index.js +0 -2
  198. package/dist/lib/dom/replaced-elements/input-element-container.js +0 -89
  199. package/dist/lib/dom/replaced-elements/svg-element-container.js +0 -57
  200. package/dist/lib/dom/slot-cloner.js +0 -176
  201. package/dist/lib/dom/text-container.js +0 -35
  202. package/dist/lib/index.js +0 -49
  203. package/dist/lib/options.js +0 -2
  204. package/dist/lib/render/background.js +0 -188
  205. package/dist/lib/render/bezier-curve.js +0 -34
  206. package/dist/lib/render/border.js +0 -104
  207. package/dist/lib/render/bound-curves.js +0 -188
  208. package/dist/lib/render/box-sizing.js +0 -20
  209. package/dist/lib/render/canvas/background-renderer.js +0 -338
  210. package/dist/lib/render/canvas/border-image-renderer.js +0 -153
  211. package/dist/lib/render/canvas/border-renderer.js +0 -184
  212. package/dist/lib/render/canvas/box-shadow-geometry.js +0 -52
  213. package/dist/lib/render/canvas/box-shadow-painter.js +0 -194
  214. package/dist/lib/render/canvas/box-shadow-transform.js +0 -42
  215. package/dist/lib/render/canvas/canvas-path.js +0 -25
  216. package/dist/lib/render/canvas/canvas-renderer.js +0 -610
  217. package/dist/lib/render/canvas/content-renderer.js +0 -270
  218. package/dist/lib/render/canvas/effects-renderer.js +0 -171
  219. package/dist/lib/render/canvas/filter-surface.js +0 -270
  220. package/dist/lib/render/canvas/font-utils.js +0 -46
  221. package/dist/lib/render/canvas/foreignobject-renderer.js +0 -38
  222. package/dist/lib/render/canvas/surface-bounds.js +0 -64
  223. package/dist/lib/render/canvas/text/text-decoration-renderer.js +0 -99
  224. package/dist/lib/render/canvas/text-renderer.js +0 -486
  225. package/dist/lib/render/effects.js +0 -231
  226. package/dist/lib/render/font-metrics.js +0 -53
  227. package/dist/lib/render/object-fit.js +0 -91
  228. package/dist/lib/render/path.js +0 -26
  229. package/dist/lib/render/renderer-interface.js +0 -2
  230. package/dist/lib/render/stacking-context.js +0 -341
  231. package/dist/lib/render/vector.js +0 -16
@@ -1,122 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.listStyleType = void 0;
4
- exports.listStyleType = {
5
- name: 'list-style-type',
6
- initialValue: 'none',
7
- prefix: false,
8
- type: 2 /* PropertyDescriptorParsingType.IDENT_VALUE */,
9
- parse: (_context, type) => {
10
- switch (type) {
11
- case 'disc':
12
- return 0 /* LIST_STYLE_TYPE.DISC */;
13
- case 'circle':
14
- return 1 /* LIST_STYLE_TYPE.CIRCLE */;
15
- case 'square':
16
- return 2 /* LIST_STYLE_TYPE.SQUARE */;
17
- case 'decimal':
18
- return 3 /* LIST_STYLE_TYPE.DECIMAL */;
19
- case 'cjk-decimal':
20
- return 4 /* LIST_STYLE_TYPE.CJK_DECIMAL */;
21
- case 'decimal-leading-zero':
22
- return 5 /* LIST_STYLE_TYPE.DECIMAL_LEADING_ZERO */;
23
- case 'lower-roman':
24
- return 6 /* LIST_STYLE_TYPE.LOWER_ROMAN */;
25
- case 'upper-roman':
26
- return 7 /* LIST_STYLE_TYPE.UPPER_ROMAN */;
27
- case 'lower-greek':
28
- return 8 /* LIST_STYLE_TYPE.LOWER_GREEK */;
29
- case 'lower-alpha':
30
- return 9 /* LIST_STYLE_TYPE.LOWER_ALPHA */;
31
- case 'upper-alpha':
32
- return 10 /* LIST_STYLE_TYPE.UPPER_ALPHA */;
33
- case 'arabic-indic':
34
- return 11 /* LIST_STYLE_TYPE.ARABIC_INDIC */;
35
- case 'armenian':
36
- return 12 /* LIST_STYLE_TYPE.ARMENIAN */;
37
- case 'bengali':
38
- return 13 /* LIST_STYLE_TYPE.BENGALI */;
39
- case 'cambodian':
40
- return 14 /* LIST_STYLE_TYPE.CAMBODIAN */;
41
- case 'cjk-earthly-branch':
42
- return 15 /* LIST_STYLE_TYPE.CJK_EARTHLY_BRANCH */;
43
- case 'cjk-heavenly-stem':
44
- return 16 /* LIST_STYLE_TYPE.CJK_HEAVENLY_STEM */;
45
- case 'cjk-ideographic':
46
- return 17 /* LIST_STYLE_TYPE.CJK_IDEOGRAPHIC */;
47
- case 'devanagari':
48
- return 18 /* LIST_STYLE_TYPE.DEVANAGARI */;
49
- case 'ethiopic-numeric':
50
- return 19 /* LIST_STYLE_TYPE.ETHIOPIC_NUMERIC */;
51
- case 'georgian':
52
- return 20 /* LIST_STYLE_TYPE.GEORGIAN */;
53
- case 'gujarati':
54
- return 21 /* LIST_STYLE_TYPE.GUJARATI */;
55
- case 'gurmukhi':
56
- return 22 /* LIST_STYLE_TYPE.GURMUKHI */;
57
- case 'hebrew':
58
- return 52 /* LIST_STYLE_TYPE.HEBREW */;
59
- case 'hiragana':
60
- return 23 /* LIST_STYLE_TYPE.HIRAGANA */;
61
- case 'hiragana-iroha':
62
- return 24 /* LIST_STYLE_TYPE.HIRAGANA_IROHA */;
63
- case 'japanese-formal':
64
- return 25 /* LIST_STYLE_TYPE.JAPANESE_FORMAL */;
65
- case 'japanese-informal':
66
- return 26 /* LIST_STYLE_TYPE.JAPANESE_INFORMAL */;
67
- case 'kannada':
68
- return 27 /* LIST_STYLE_TYPE.KANNADA */;
69
- case 'katakana':
70
- return 28 /* LIST_STYLE_TYPE.KATAKANA */;
71
- case 'katakana-iroha':
72
- return 29 /* LIST_STYLE_TYPE.KATAKANA_IROHA */;
73
- case 'khmer':
74
- return 30 /* LIST_STYLE_TYPE.KHMER */;
75
- case 'korean-hangul-formal':
76
- return 31 /* LIST_STYLE_TYPE.KOREAN_HANGUL_FORMAL */;
77
- case 'korean-hanja-formal':
78
- return 32 /* LIST_STYLE_TYPE.KOREAN_HANJA_FORMAL */;
79
- case 'korean-hanja-informal':
80
- return 33 /* LIST_STYLE_TYPE.KOREAN_HANJA_INFORMAL */;
81
- case 'lao':
82
- return 34 /* LIST_STYLE_TYPE.LAO */;
83
- case 'lower-armenian':
84
- return 35 /* LIST_STYLE_TYPE.LOWER_ARMENIAN */;
85
- case 'malayalam':
86
- return 36 /* LIST_STYLE_TYPE.MALAYALAM */;
87
- case 'mongolian':
88
- return 37 /* LIST_STYLE_TYPE.MONGOLIAN */;
89
- case 'myanmar':
90
- return 38 /* LIST_STYLE_TYPE.MYANMAR */;
91
- case 'oriya':
92
- return 39 /* LIST_STYLE_TYPE.ORIYA */;
93
- case 'persian':
94
- return 40 /* LIST_STYLE_TYPE.PERSIAN */;
95
- case 'simp-chinese-formal':
96
- return 41 /* LIST_STYLE_TYPE.SIMP_CHINESE_FORMAL */;
97
- case 'simp-chinese-informal':
98
- return 42 /* LIST_STYLE_TYPE.SIMP_CHINESE_INFORMAL */;
99
- case 'tamil':
100
- return 43 /* LIST_STYLE_TYPE.TAMIL */;
101
- case 'telugu':
102
- return 44 /* LIST_STYLE_TYPE.TELUGU */;
103
- case 'thai':
104
- return 45 /* LIST_STYLE_TYPE.THAI */;
105
- case 'tibetan':
106
- return 46 /* LIST_STYLE_TYPE.TIBETAN */;
107
- case 'trad-chinese-formal':
108
- return 47 /* LIST_STYLE_TYPE.TRAD_CHINESE_FORMAL */;
109
- case 'trad-chinese-informal':
110
- return 48 /* LIST_STYLE_TYPE.TRAD_CHINESE_INFORMAL */;
111
- case 'upper-armenian':
112
- return 49 /* LIST_STYLE_TYPE.UPPER_ARMENIAN */;
113
- case 'disclosure-open':
114
- return 50 /* LIST_STYLE_TYPE.DISCLOSURE_OPEN */;
115
- case 'disclosure-closed':
116
- return 51 /* LIST_STYLE_TYPE.DISCLOSURE_CLOSED */;
117
- case 'none':
118
- default:
119
- return -1 /* LIST_STYLE_TYPE.NONE */;
120
- }
121
- }
122
- };
@@ -1,13 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.marginLeft = exports.marginBottom = exports.marginRight = exports.marginTop = void 0;
4
- const marginForSide = (side) => ({
5
- name: `margin-${side}`,
6
- initialValue: '0',
7
- prefix: false,
8
- type: 4 /* PropertyDescriptorParsingType.TOKEN_VALUE */
9
- });
10
- exports.marginTop = marginForSide('top');
11
- exports.marginRight = marginForSide('right');
12
- exports.marginBottom = marginForSide('bottom');
13
- exports.marginLeft = marginForSide('left');
@@ -1,31 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.mixBlendMode = exports.MIX_BLEND_MODE = void 0;
4
- exports.MIX_BLEND_MODE = {
5
- NORMAL: 'normal',
6
- MULTIPLY: 'multiply',
7
- SCREEN: 'screen',
8
- OVERLAY: 'overlay',
9
- DARKEN: 'darken',
10
- LIGHTEN: 'lighten',
11
- COLOR_DODGE: 'color-dodge',
12
- COLOR_BURN: 'color-burn',
13
- HARD_LIGHT: 'hard-light',
14
- SOFT_LIGHT: 'soft-light',
15
- DIFFERENCE: 'difference',
16
- EXCLUSION: 'exclusion',
17
- HUE: 'hue',
18
- SATURATION: 'saturation',
19
- COLOR: 'color',
20
- LUMINOSITY: 'luminosity'
21
- };
22
- const VALID_VALUES = new Set(Object.values(exports.MIX_BLEND_MODE));
23
- exports.mixBlendMode = {
24
- name: 'mix-blend-mode',
25
- initialValue: 'normal',
26
- type: 2 /* PropertyDescriptorParsingType.IDENT_VALUE */,
27
- prefix: false,
28
- parse: (_context, token) => {
29
- return VALID_VALUES.has(token) ? token : exports.MIX_BLEND_MODE.NORMAL;
30
- }
31
- };
@@ -1,28 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.objectFit = void 0;
4
- const parser_1 = require("../syntax/parser");
5
- exports.objectFit = {
6
- name: 'object-fit',
7
- initialValue: 'fill',
8
- prefix: false,
9
- type: 1 /* PropertyDescriptorParsingType.LIST */,
10
- parse: (_context, tokens) => {
11
- return tokens.filter(parser_1.isIdentToken).reduce((bit, token) => {
12
- return bit | parseDisplayValue(token.value);
13
- }, 0 /* OBJECT_FIT.FILL */);
14
- }
15
- };
16
- const parseDisplayValue = (display) => {
17
- switch (display) {
18
- case 'contain':
19
- return 2 /* OBJECT_FIT.CONTAIN */;
20
- case 'cover':
21
- return 4 /* OBJECT_FIT.COVER */;
22
- case 'none':
23
- return 8 /* OBJECT_FIT.NONE */;
24
- case 'scale-down':
25
- return 16 /* OBJECT_FIT.SCALE_DOWN */;
26
- }
27
- return 0 /* OBJECT_FIT.FILL */;
28
- };
@@ -1,42 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.objectPosition = void 0;
4
- const parser_1 = require("../syntax/parser");
5
- const length_percentage_1 = require("../types/length-percentage");
6
- exports.objectPosition = {
7
- name: 'object-position',
8
- initialValue: '50% 50%',
9
- prefix: false,
10
- type: 1 /* PropertyDescriptorParsingType.LIST */,
11
- parse: (_context, tokens) => {
12
- const result = [];
13
- let i = 0;
14
- while (i < tokens.length && result.length < 2) {
15
- const token = tokens[i];
16
- if ((0, parser_1.isIdentToken)(token)) {
17
- switch (token.value) {
18
- case 'left':
19
- case 'top':
20
- result.push(length_percentage_1.ZERO_LENGTH);
21
- break;
22
- case 'center':
23
- result.push(length_percentage_1.FIFTY_PERCENT);
24
- break;
25
- case 'right':
26
- case 'bottom':
27
- result.push(length_percentage_1.HUNDRED_PERCENT);
28
- break;
29
- }
30
- }
31
- else if ((0, length_percentage_1.isLengthPercentage)(token)) {
32
- result.push(token);
33
- }
34
- i++;
35
- }
36
- // Fill to 2 values with defaults
37
- while (result.length < 2) {
38
- result.push(length_percentage_1.FIFTY_PERCENT);
39
- }
40
- return [result[0], result[1]];
41
- }
42
- };
@@ -1,16 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.opacity = void 0;
4
- const parser_1 = require("../syntax/parser");
5
- exports.opacity = {
6
- name: 'opacity',
7
- initialValue: '1',
8
- type: 0 /* PropertyDescriptorParsingType.VALUE */,
9
- prefix: false,
10
- parse: (_context, token) => {
11
- if ((0, parser_1.isNumberToken)(token)) {
12
- return token.number;
13
- }
14
- return 1;
15
- }
16
- };
@@ -1,18 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.overflowWrap = void 0;
4
- exports.overflowWrap = {
5
- name: 'overflow-wrap',
6
- initialValue: 'normal',
7
- prefix: false,
8
- type: 2 /* PropertyDescriptorParsingType.IDENT_VALUE */,
9
- parse: (_context, overflow) => {
10
- switch (overflow) {
11
- case 'break-word':
12
- return "break-word" /* OVERFLOW_WRAP.BREAK_WORD */;
13
- case 'normal':
14
- default:
15
- return "normal" /* OVERFLOW_WRAP.NORMAL */;
16
- }
17
- }
18
- };
@@ -1,27 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.overflow = void 0;
4
- const parser_1 = require("../syntax/parser");
5
- exports.overflow = {
6
- name: 'overflow',
7
- initialValue: 'visible',
8
- prefix: false,
9
- type: 1 /* PropertyDescriptorParsingType.LIST */,
10
- parse: (_context, tokens) => {
11
- return tokens.filter(parser_1.isIdentToken).map((overflow) => {
12
- switch (overflow.value) {
13
- case 'hidden':
14
- return 1 /* OVERFLOW.HIDDEN */;
15
- case 'scroll':
16
- return 2 /* OVERFLOW.SCROLL */;
17
- case 'clip':
18
- return 3 /* OVERFLOW.CLIP */;
19
- case 'auto':
20
- return 4 /* OVERFLOW.AUTO */;
21
- case 'visible':
22
- default:
23
- return 0 /* OVERFLOW.VISIBLE */;
24
- }
25
- });
26
- }
27
- };
@@ -1,14 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.paddingLeft = exports.paddingBottom = exports.paddingRight = exports.paddingTop = void 0;
4
- const paddingForSide = (side) => ({
5
- name: `padding-${side}`,
6
- initialValue: '0',
7
- prefix: false,
8
- type: 3 /* PropertyDescriptorParsingType.TYPE_VALUE */,
9
- format: 'length-percentage'
10
- });
11
- exports.paddingTop = paddingForSide('top');
12
- exports.paddingRight = paddingForSide('right');
13
- exports.paddingBottom = paddingForSide('bottom');
14
- exports.paddingLeft = paddingForSide('left');
@@ -1,33 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.paintOrder = void 0;
4
- const parser_1 = require("../syntax/parser");
5
- exports.paintOrder = {
6
- name: 'paint-order',
7
- initialValue: 'normal',
8
- prefix: false,
9
- type: 1 /* PropertyDescriptorParsingType.LIST */,
10
- parse: (_context, tokens) => {
11
- const DEFAULT_VALUE = [0 /* PAINT_ORDER_LAYER.FILL */, 1 /* PAINT_ORDER_LAYER.STROKE */, 2 /* PAINT_ORDER_LAYER.MARKERS */];
12
- const layers = [];
13
- tokens.filter(parser_1.isIdentToken).forEach((token) => {
14
- switch (token.value) {
15
- case 'stroke':
16
- layers.push(1 /* PAINT_ORDER_LAYER.STROKE */);
17
- break;
18
- case 'fill':
19
- layers.push(0 /* PAINT_ORDER_LAYER.FILL */);
20
- break;
21
- case 'markers':
22
- layers.push(2 /* PAINT_ORDER_LAYER.MARKERS */);
23
- break;
24
- }
25
- });
26
- DEFAULT_VALUE.forEach((value) => {
27
- if (layers.indexOf(value) === -1) {
28
- layers.push(value);
29
- }
30
- });
31
- return layers;
32
- }
33
- };
@@ -1,22 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.position = void 0;
4
- exports.position = {
5
- name: 'position',
6
- initialValue: 'static',
7
- prefix: false,
8
- type: 2 /* PropertyDescriptorParsingType.IDENT_VALUE */,
9
- parse: (_context, position) => {
10
- switch (position) {
11
- case 'relative':
12
- return 1 /* POSITION.RELATIVE */;
13
- case 'absolute':
14
- return 2 /* POSITION.ABSOLUTE */;
15
- case 'fixed':
16
- return 3 /* POSITION.FIXED */;
17
- case 'sticky':
18
- return 4 /* POSITION.STICKY */;
19
- }
20
- return 0 /* POSITION.STATIC */;
21
- }
22
- };
@@ -1,41 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getQuote = exports.quotes = void 0;
4
- const parser_1 = require("../syntax/parser");
5
- exports.quotes = {
6
- name: 'quotes',
7
- initialValue: 'none',
8
- prefix: true,
9
- type: 1 /* PropertyDescriptorParsingType.LIST */,
10
- parse: (_context, tokens) => {
11
- if (tokens.length === 0) {
12
- return null;
13
- }
14
- const first = tokens[0];
15
- if (first.type === 20 /* TokenType.IDENT_TOKEN */ && first.value === 'none') {
16
- return null;
17
- }
18
- const quotes = [];
19
- const filtered = tokens.filter(parser_1.isStringToken);
20
- if (filtered.length % 2 !== 0) {
21
- return null;
22
- }
23
- for (let i = 0; i < filtered.length; i += 2) {
24
- const open = filtered[i].value;
25
- const close = filtered[i + 1].value;
26
- quotes.push({ open, close });
27
- }
28
- return quotes;
29
- }
30
- };
31
- const getQuote = (quotes, depth, open) => {
32
- if (!quotes) {
33
- return '';
34
- }
35
- const quote = quotes[Math.min(depth, quotes.length - 1)];
36
- if (!quote) {
37
- return '';
38
- }
39
- return open ? quote.open : quote.close;
40
- };
41
- exports.getQuote = getQuote;
@@ -1,27 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.rotate = void 0;
4
- const angle_1 = require("../types/angle");
5
- exports.rotate = {
6
- name: 'rotate',
7
- initialValue: 'none',
8
- prefix: false,
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 === 17 /* TokenType.NUMBER_TOKEN */) {
15
- if (token.number === 0) {
16
- return 0;
17
- }
18
- }
19
- if (token.type === 15 /* TokenType.DIMENSION_TOKEN */) {
20
- // Parse angle and convert to degrees for storage
21
- const radians = angle_1.angle.parse(_context, token);
22
- // Store as degrees for consistency
23
- return (radians * 180) / Math.PI;
24
- }
25
- return null;
26
- }
27
- };
@@ -1,21 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.textAlign = void 0;
4
- exports.textAlign = {
5
- name: 'text-align',
6
- initialValue: 'left',
7
- prefix: false,
8
- type: 2 /* PropertyDescriptorParsingType.IDENT_VALUE */,
9
- parse: (_context, textAlign) => {
10
- switch (textAlign) {
11
- case 'right':
12
- return 2 /* TEXT_ALIGN.RIGHT */;
13
- case 'center':
14
- case 'justify':
15
- return 1 /* TEXT_ALIGN.CENTER */;
16
- case 'left':
17
- default:
18
- return 0 /* TEXT_ALIGN.LEFT */;
19
- }
20
- }
21
- };
@@ -1,10 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.textDecorationColor = void 0;
4
- exports.textDecorationColor = {
5
- name: `text-decoration-color`,
6
- initialValue: 'transparent',
7
- prefix: false,
8
- type: 3 /* PropertyDescriptorParsingType.TYPE_VALUE */,
9
- format: 'color'
10
- };
@@ -1,28 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.textDecorationLine = void 0;
4
- const parser_1 = require("../syntax/parser");
5
- exports.textDecorationLine = {
6
- name: 'text-decoration-line',
7
- initialValue: 'none',
8
- prefix: false,
9
- type: 1 /* PropertyDescriptorParsingType.LIST */,
10
- parse: (_context, tokens) => {
11
- return tokens
12
- .filter(parser_1.isIdentToken)
13
- .map((token) => {
14
- switch (token.value) {
15
- case 'underline':
16
- return 1 /* TEXT_DECORATION_LINE.UNDERLINE */;
17
- case 'overline':
18
- return 2 /* TEXT_DECORATION_LINE.OVERLINE */;
19
- case 'line-through':
20
- return 3 /* TEXT_DECORATION_LINE.LINE_THROUGH */;
21
- case 'none':
22
- return 4 /* TEXT_DECORATION_LINE.BLINK */;
23
- }
24
- return 0 /* TEXT_DECORATION_LINE.NONE */;
25
- })
26
- .filter((line) => line !== 0 /* TEXT_DECORATION_LINE.NONE */);
27
- }
28
- };
@@ -1,24 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.textDecorationStyle = void 0;
4
- exports.textDecorationStyle = {
5
- name: 'text-decoration-style',
6
- initialValue: 'solid',
7
- prefix: false,
8
- type: 2 /* PropertyDescriptorParsingType.IDENT_VALUE */,
9
- parse: (_context, style) => {
10
- switch (style) {
11
- case 'double':
12
- return 1 /* TEXT_DECORATION_STYLE.DOUBLE */;
13
- case 'dotted':
14
- return 2 /* TEXT_DECORATION_STYLE.DOTTED */;
15
- case 'dashed':
16
- return 3 /* TEXT_DECORATION_STYLE.DASHED */;
17
- case 'wavy':
18
- return 4 /* TEXT_DECORATION_STYLE.WAVY */;
19
- case 'solid':
20
- default:
21
- return 0 /* TEXT_DECORATION_STYLE.SOLID */;
22
- }
23
- }
24
- };
@@ -1,26 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.textDecorationThickness = void 0;
4
- const parser_1 = require("../syntax/parser");
5
- exports.textDecorationThickness = {
6
- name: 'text-decoration-thickness',
7
- initialValue: 'auto',
8
- prefix: false,
9
- type: 0 /* PropertyDescriptorParsingType.VALUE */,
10
- parse: (_context, token) => {
11
- if ((0, parser_1.isIdentToken)(token)) {
12
- switch (token.value) {
13
- case 'auto':
14
- return 'auto';
15
- case 'from-font':
16
- return 'from-font';
17
- }
18
- }
19
- if ((0, parser_1.isDimensionToken)(token)) {
20
- // Convert to pixels
21
- return token.number;
22
- }
23
- // Default to auto
24
- return 'auto';
25
- }
26
- };
@@ -1,18 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.textOverflow = void 0;
4
- exports.textOverflow = {
5
- name: 'text-overflow',
6
- initialValue: 'clip',
7
- prefix: false,
8
- type: 2 /* PropertyDescriptorParsingType.IDENT_VALUE */,
9
- parse: (_context, textOverflow) => {
10
- switch (textOverflow) {
11
- case 'ellipsis':
12
- return 1 /* TEXT_OVERFLOW.ELLIPSIS */;
13
- case 'clip':
14
- default:
15
- return 0 /* TEXT_OVERFLOW.CLIP */;
16
- }
17
- }
18
- };
@@ -1,46 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.textShadow = void 0;
4
- const parser_1 = require("../syntax/parser");
5
- const length_percentage_1 = require("../types/length-percentage");
6
- const color_1 = require("../types/color");
7
- const length_1 = require("../types/length");
8
- exports.textShadow = {
9
- name: 'text-shadow',
10
- initialValue: 'none',
11
- type: 1 /* PropertyDescriptorParsingType.LIST */,
12
- prefix: false,
13
- parse: (context, tokens) => {
14
- if (tokens.length === 1 && (0, parser_1.isIdentWithValue)(tokens[0], 'none')) {
15
- return [];
16
- }
17
- return (0, parser_1.parseFunctionArgs)(tokens).map((values) => {
18
- const shadow = {
19
- color: color_1.COLORS.TRANSPARENT,
20
- offsetX: length_percentage_1.ZERO_LENGTH,
21
- offsetY: length_percentage_1.ZERO_LENGTH,
22
- blur: length_percentage_1.ZERO_LENGTH
23
- };
24
- let c = 0;
25
- for (let i = 0; i < values.length; i++) {
26
- const token = values[i];
27
- if ((0, length_1.isLength)(token)) {
28
- if (c === 0) {
29
- shadow.offsetX = token;
30
- }
31
- else if (c === 1) {
32
- shadow.offsetY = token;
33
- }
34
- else {
35
- shadow.blur = token;
36
- }
37
- c++;
38
- }
39
- else {
40
- shadow.color = color_1.color.parse(context, token);
41
- }
42
- }
43
- return shadow;
44
- });
45
- }
46
- };
@@ -1,20 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.textTransform = void 0;
4
- exports.textTransform = {
5
- name: 'text-transform',
6
- initialValue: 'none',
7
- prefix: false,
8
- type: 2 /* PropertyDescriptorParsingType.IDENT_VALUE */,
9
- parse: (_context, textTransform) => {
10
- switch (textTransform) {
11
- case 'uppercase':
12
- return 2 /* TEXT_TRANSFORM.UPPERCASE */;
13
- case 'lowercase':
14
- return 1 /* TEXT_TRANSFORM.LOWERCASE */;
15
- case 'capitalize':
16
- return 3 /* TEXT_TRANSFORM.CAPITALIZE */;
17
- }
18
- return 0 /* TEXT_TRANSFORM.NONE */;
19
- }
20
- };