blitz-pdf 0.0.0-stage → 0.1.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 (370) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +355 -2
  3. package/THIRD_PARTY_NOTICES.md +25 -0
  4. package/assets/icon.svg +4 -0
  5. package/dist/api.d.ts +7 -0
  6. package/dist/api.d.ts.map +1 -0
  7. package/dist/api.js +46 -0
  8. package/dist/api.js.map +1 -0
  9. package/dist/assets.d.ts +7 -0
  10. package/dist/assets.d.ts.map +1 -0
  11. package/dist/assets.js +52 -0
  12. package/dist/assets.js.map +1 -0
  13. package/dist/browser.d.ts +3 -0
  14. package/dist/browser.d.ts.map +1 -0
  15. package/dist/browser.js +3 -0
  16. package/dist/browser.js.map +1 -0
  17. package/dist/node.d.ts +3 -0
  18. package/dist/node.d.ts.map +1 -0
  19. package/dist/node.js +10 -0
  20. package/dist/node.js.map +1 -0
  21. package/dist/options.d.ts +24 -0
  22. package/dist/options.d.ts.map +1 -0
  23. package/dist/options.js +135 -0
  24. package/dist/options.js.map +1 -0
  25. package/dist/types.d.ts +51 -0
  26. package/dist/types.d.ts.map +1 -0
  27. package/dist/types.js +2 -0
  28. package/dist/types.js.map +1 -0
  29. package/examples/bun.ts +8 -0
  30. package/examples/german-invoice/README.md +70 -0
  31. package/examples/german-invoice/data.mjs +83 -0
  32. package/examples/german-invoice/invoice.css +59 -0
  33. package/examples/german-invoice/template.mjs +49 -0
  34. package/examples/german-invoice.mjs +20 -0
  35. package/examples/invoice.html +29 -0
  36. package/examples/node.mjs +8 -0
  37. package/examples/pagination.html +40 -0
  38. package/examples/pagination.mjs +8 -0
  39. package/licenses/DejaVu.txt +187 -0
  40. package/licenses/RUST_DEPENDENCIES.txt +11577 -0
  41. package/package.json +89 -4
  42. package/src/api.ts +44 -0
  43. package/src/assets.ts +43 -0
  44. package/src/browser.ts +6 -0
  45. package/src/node.ts +12 -0
  46. package/src/options.ts +101 -0
  47. package/src/types.ts +49 -0
  48. package/vendor/README.md +17 -0
  49. package/vendor/stylo/.cargo-ok +1 -0
  50. package/vendor/stylo/.cargo_vcs_info.json +6 -0
  51. package/vendor/stylo/Cargo.lock +1485 -0
  52. package/vendor/stylo/Cargo.toml +274 -0
  53. package/vendor/stylo/LICENSE +373 -0
  54. package/vendor/stylo/README.md +6 -0
  55. package/vendor/stylo/applicable_declarations.rs +328 -0
  56. package/vendor/stylo/author_styles.rs +79 -0
  57. package/vendor/stylo/bezier.rs +176 -0
  58. package/vendor/stylo/bloom.rs +414 -0
  59. package/vendor/stylo/build.rs +91 -0
  60. package/vendor/stylo/build_gecko.rs +393 -0
  61. package/vendor/stylo/color/color_function.rs +601 -0
  62. package/vendor/stylo/color/component.rs +207 -0
  63. package/vendor/stylo/color/convert.rs +935 -0
  64. package/vendor/stylo/color/gamut/raytrace.rs +265 -0
  65. package/vendor/stylo/color/gamut.rs +227 -0
  66. package/vendor/stylo/color/mix.rs +645 -0
  67. package/vendor/stylo/color/mod.rs +750 -0
  68. package/vendor/stylo/color/parsing.rs +770 -0
  69. package/vendor/stylo/color/to_css.rs +297 -0
  70. package/vendor/stylo/context.rs +716 -0
  71. package/vendor/stylo/counter_style/mod.rs +754 -0
  72. package/vendor/stylo/counter_style/predefined.rs +61 -0
  73. package/vendor/stylo/counter_style/update_predefined.py +35 -0
  74. package/vendor/stylo/custom_properties.rs +2023 -0
  75. package/vendor/stylo/custom_properties_map.rs +220 -0
  76. package/vendor/stylo/data.rs +693 -0
  77. package/vendor/stylo/device/gecko.rs +486 -0
  78. package/vendor/stylo/device/mod.rs +304 -0
  79. package/vendor/stylo/device/servo.rs +507 -0
  80. package/vendor/stylo/dom.rs +1164 -0
  81. package/vendor/stylo/dom_apis.rs +937 -0
  82. package/vendor/stylo/driver.rs +172 -0
  83. package/vendor/stylo/error_reporting.rs +484 -0
  84. package/vendor/stylo/font_face.rs +558 -0
  85. package/vendor/stylo/font_metrics.rs +124 -0
  86. package/vendor/stylo/gecko/anon_boxes.toml +113 -0
  87. package/vendor/stylo/gecko/arc_types.rs +211 -0
  88. package/vendor/stylo/gecko/conversions.rs +59 -0
  89. package/vendor/stylo/gecko/data.rs +222 -0
  90. package/vendor/stylo/gecko/media_features.rs +971 -0
  91. package/vendor/stylo/gecko/mod.rs +20 -0
  92. package/vendor/stylo/gecko/non_ts_pseudo_class_list.rs +119 -0
  93. package/vendor/stylo/gecko/pseudo_element.rs +640 -0
  94. package/vendor/stylo/gecko/pseudo_element_definition.mako.rs +298 -0
  95. package/vendor/stylo/gecko/pseudo_elements.py +137 -0
  96. package/vendor/stylo/gecko/pseudo_elements.toml +197 -0
  97. package/vendor/stylo/gecko/regen_pseudo_elements.py +33 -0
  98. package/vendor/stylo/gecko/restyle_damage.rs +127 -0
  99. package/vendor/stylo/gecko/selector_parser.rs +627 -0
  100. package/vendor/stylo/gecko/snapshot.rs +202 -0
  101. package/vendor/stylo/gecko/snapshot_helpers.rs +334 -0
  102. package/vendor/stylo/gecko/traversal.rs +52 -0
  103. package/vendor/stylo/gecko/wrapper.rs +2258 -0
  104. package/vendor/stylo/gecko_bindings/mod.rs +34 -0
  105. package/vendor/stylo/gecko_bindings/sugar/mod.rs +12 -0
  106. package/vendor/stylo/gecko_bindings/sugar/ns_com_ptr.rs +15 -0
  107. package/vendor/stylo/gecko_bindings/sugar/ns_compatibility.rs +19 -0
  108. package/vendor/stylo/gecko_bindings/sugar/ns_style_auto_array.rs +111 -0
  109. package/vendor/stylo/gecko_bindings/sugar/origin_flags.rs +31 -0
  110. package/vendor/stylo/gecko_bindings/sugar/ownership.rs +70 -0
  111. package/vendor/stylo/gecko_bindings/sugar/refptr.rs +299 -0
  112. package/vendor/stylo/gecko_string_cache/mod.rs +543 -0
  113. package/vendor/stylo/gecko_string_cache/namespace.rs +106 -0
  114. package/vendor/stylo/global_style_data.rs +224 -0
  115. package/vendor/stylo/invalidation/element/document_state.rs +156 -0
  116. package/vendor/stylo/invalidation/element/element_wrapper.rs +432 -0
  117. package/vendor/stylo/invalidation/element/invalidation_map.rs +1631 -0
  118. package/vendor/stylo/invalidation/element/invalidator.rs +1470 -0
  119. package/vendor/stylo/invalidation/element/mod.rs +13 -0
  120. package/vendor/stylo/invalidation/element/relative_selector.rs +1399 -0
  121. package/vendor/stylo/invalidation/element/restyle_hints.rs +226 -0
  122. package/vendor/stylo/invalidation/element/state_and_attributes.rs +756 -0
  123. package/vendor/stylo/invalidation/media_queries.rs +144 -0
  124. package/vendor/stylo/invalidation/mod.rs +10 -0
  125. package/vendor/stylo/invalidation/stylesheets.rs +745 -0
  126. package/vendor/stylo/invalidation/viewport_units.rs +71 -0
  127. package/vendor/stylo/lib.rs +336 -0
  128. package/vendor/stylo/logical_geometry.rs +1684 -0
  129. package/vendor/stylo/macros.rs +70 -0
  130. package/vendor/stylo/matching.rs +1226 -0
  131. package/vendor/stylo/media_queries/media_list.rs +168 -0
  132. package/vendor/stylo/media_queries/media_query.rs +190 -0
  133. package/vendor/stylo/media_queries/mod.rs +13 -0
  134. package/vendor/stylo/parallel.rs +205 -0
  135. package/vendor/stylo/parser.rs +276 -0
  136. package/vendor/stylo/piecewise_linear.rs +282 -0
  137. package/vendor/stylo/prefs.rs +33 -0
  138. package/vendor/stylo/properties/build.py +119 -0
  139. package/vendor/stylo/properties/cascade.rs +2704 -0
  140. package/vendor/stylo/properties/computed_value_flags.rs +206 -0
  141. package/vendor/stylo/properties/counted_unknown_properties.py +104 -0
  142. package/vendor/stylo/properties/counter_style_descriptors.toml +45 -0
  143. package/vendor/stylo/properties/data.py +1375 -0
  144. package/vendor/stylo/properties/declaration_block.rs +1788 -0
  145. package/vendor/stylo/properties/font_face_descriptors.toml +50 -0
  146. package/vendor/stylo/properties/gecko.mako.rs +1555 -0
  147. package/vendor/stylo/properties/helpers/animated_properties.mako.rs +800 -0
  148. package/vendor/stylo/properties/helpers.mako.rs +812 -0
  149. package/vendor/stylo/properties/longhands.toml +4305 -0
  150. package/vendor/stylo/properties/mod.rs +1857 -0
  151. package/vendor/stylo/properties/properties.html.mako +31 -0
  152. package/vendor/stylo/properties/properties.mako.rs +3103 -0
  153. package/vendor/stylo/properties/property_descriptors.toml +18 -0
  154. package/vendor/stylo/properties/shorthands.rs +4241 -0
  155. package/vendor/stylo/properties/shorthands.toml +575 -0
  156. package/vendor/stylo/properties/vendored_python/mako-1.3.10-py3-none-any.whl +0 -0
  157. package/vendor/stylo/properties/vendored_python/markupsafe/LICENSE.txt +28 -0
  158. package/vendor/stylo/properties/vendored_python/markupsafe/__init__.py +384 -0
  159. package/vendor/stylo/properties/vendored_python/toml-0.10.2-py2.py3-none-any.whl +0 -0
  160. package/vendor/stylo/properties/view_transition_descriptors.toml +11 -0
  161. package/vendor/stylo/properties_and_values/mod.rs +12 -0
  162. package/vendor/stylo/properties_and_values/registry.rs +65 -0
  163. package/vendor/stylo/properties_and_values/rule.rs +331 -0
  164. package/vendor/stylo/properties_and_values/syntax/ascii.rs +60 -0
  165. package/vendor/stylo/properties_and_values/syntax/data_type.rs +146 -0
  166. package/vendor/stylo/properties_and_values/syntax/mod.rs +437 -0
  167. package/vendor/stylo/properties_and_values/value.rs +758 -0
  168. package/vendor/stylo/queries/condition.rs +996 -0
  169. package/vendor/stylo/queries/feature.rs +199 -0
  170. package/vendor/stylo/queries/feature_expression.rs +1170 -0
  171. package/vendor/stylo/queries/mod.rs +19 -0
  172. package/vendor/stylo/queries/values.rs +46 -0
  173. package/vendor/stylo/rule_cache.rs +267 -0
  174. package/vendor/stylo/rule_collector.rs +554 -0
  175. package/vendor/stylo/rule_tree/core.rs +787 -0
  176. package/vendor/stylo/rule_tree/level.rs +396 -0
  177. package/vendor/stylo/rule_tree/map.rs +201 -0
  178. package/vendor/stylo/rule_tree/mod.rs +427 -0
  179. package/vendor/stylo/rule_tree/source.rs +80 -0
  180. package/vendor/stylo/rule_tree/unsafe_box.rs +78 -0
  181. package/vendor/stylo/scoped_tls.rs +80 -0
  182. package/vendor/stylo/selector_map.rs +1050 -0
  183. package/vendor/stylo/selector_parser.rs +305 -0
  184. package/vendor/stylo/servo/animation.rs +1922 -0
  185. package/vendor/stylo/servo/attr.rs +714 -0
  186. package/vendor/stylo/servo/encoding_support.rs +81 -0
  187. package/vendor/stylo/servo/media_features.rs +254 -0
  188. package/vendor/stylo/servo/mod.rs +16 -0
  189. package/vendor/stylo/servo/restyle_damage.rs +215 -0
  190. package/vendor/stylo/servo/selector_parser.rs +1036 -0
  191. package/vendor/stylo/servo/shadow_parts.rs +207 -0
  192. package/vendor/stylo/shared_lock.rs +271 -0
  193. package/vendor/stylo/sharing/checks.rs +281 -0
  194. package/vendor/stylo/sharing/mod.rs +1000 -0
  195. package/vendor/stylo/simple_buckets_map.rs +52 -0
  196. package/vendor/stylo/str.rs +168 -0
  197. package/vendor/stylo/style_adjuster.rs +1086 -0
  198. package/vendor/stylo/style_resolver.rs +658 -0
  199. package/vendor/stylo/stylesheet_set.rs +658 -0
  200. package/vendor/stylo/stylesheets/appearance_base_rule.rs +51 -0
  201. package/vendor/stylo/stylesheets/container_rule.rs +769 -0
  202. package/vendor/stylo/stylesheets/counter_style_rule.rs +7 -0
  203. package/vendor/stylo/stylesheets/document_rule.rs +272 -0
  204. package/vendor/stylo/stylesheets/font_face_rule.rs +7 -0
  205. package/vendor/stylo/stylesheets/font_feature_values_rule.rs +481 -0
  206. package/vendor/stylo/stylesheets/font_palette_values_rule.rs +304 -0
  207. package/vendor/stylo/stylesheets/import_rule.rs +259 -0
  208. package/vendor/stylo/stylesheets/keyframes_rule.rs +733 -0
  209. package/vendor/stylo/stylesheets/layer_rule.rs +221 -0
  210. package/vendor/stylo/stylesheets/loader.rs +29 -0
  211. package/vendor/stylo/stylesheets/margin_rule.rs +190 -0
  212. package/vendor/stylo/stylesheets/media_rule.rs +191 -0
  213. package/vendor/stylo/stylesheets/mod.rs +918 -0
  214. package/vendor/stylo/stylesheets/namespace_rule.rs +43 -0
  215. package/vendor/stylo/stylesheets/nested_declarations_rule.rs +51 -0
  216. package/vendor/stylo/stylesheets/origin.rs +249 -0
  217. package/vendor/stylo/stylesheets/page_rule.rs +354 -0
  218. package/vendor/stylo/stylesheets/position_try_rule.rs +68 -0
  219. package/vendor/stylo/stylesheets/property_rule.rs +5 -0
  220. package/vendor/stylo/stylesheets/rule_list.rs +167 -0
  221. package/vendor/stylo/stylesheets/rule_parser.rs +1189 -0
  222. package/vendor/stylo/stylesheets/rules_iterator.rs +397 -0
  223. package/vendor/stylo/stylesheets/scope_rule.rs +511 -0
  224. package/vendor/stylo/stylesheets/starting_style_rule.rs +54 -0
  225. package/vendor/stylo/stylesheets/style_rule.rs +80 -0
  226. package/vendor/stylo/stylesheets/stylesheet.rs +570 -0
  227. package/vendor/stylo/stylesheets/supports_rule.rs +486 -0
  228. package/vendor/stylo/stylesheets/view_transition_rule.rs +81 -0
  229. package/vendor/stylo/stylist.rs +5076 -0
  230. package/vendor/stylo/thread_state.rs +87 -0
  231. package/vendor/stylo/traversal.rs +765 -0
  232. package/vendor/stylo/traversal_flags.rs +68 -0
  233. package/vendor/stylo/typed_om/mod.rs +981 -0
  234. package/vendor/stylo/typed_om/numeric.rs +128 -0
  235. package/vendor/stylo/typed_om/numeric_declaration.rs +93 -0
  236. package/vendor/stylo/typed_om/numeric_type.rs +640 -0
  237. package/vendor/stylo/typed_om/sum_value.rs +426 -0
  238. package/vendor/stylo/url/gecko.rs +367 -0
  239. package/vendor/stylo/url/mod.rs +71 -0
  240. package/vendor/stylo/url/servo.rs +239 -0
  241. package/vendor/stylo/use_counters/mod.rs +137 -0
  242. package/vendor/stylo/values/animated/color.rs +103 -0
  243. package/vendor/stylo/values/animated/effects.rs +26 -0
  244. package/vendor/stylo/values/animated/font.rs +37 -0
  245. package/vendor/stylo/values/animated/grid.rs +161 -0
  246. package/vendor/stylo/values/animated/lists.rs +141 -0
  247. package/vendor/stylo/values/animated/mod.rs +550 -0
  248. package/vendor/stylo/values/animated/svg.rs +46 -0
  249. package/vendor/stylo/values/animated/text.rs +58 -0
  250. package/vendor/stylo/values/animated/transform.rs +1592 -0
  251. package/vendor/stylo/values/computed/align.rs +90 -0
  252. package/vendor/stylo/values/computed/angle.rs +130 -0
  253. package/vendor/stylo/values/computed/animation.rs +124 -0
  254. package/vendor/stylo/values/computed/background.rs +13 -0
  255. package/vendor/stylo/values/computed/basic_shape.rs +267 -0
  256. package/vendor/stylo/values/computed/border.rs +163 -0
  257. package/vendor/stylo/values/computed/box.rs +267 -0
  258. package/vendor/stylo/values/computed/calc.rs +334 -0
  259. package/vendor/stylo/values/computed/color.rs +161 -0
  260. package/vendor/stylo/values/computed/column.rs +11 -0
  261. package/vendor/stylo/values/computed/corner_shape.rs +155 -0
  262. package/vendor/stylo/values/computed/counters.rs +26 -0
  263. package/vendor/stylo/values/computed/easing.rs +109 -0
  264. package/vendor/stylo/values/computed/effects.rs +30 -0
  265. package/vendor/stylo/values/computed/flex.rs +19 -0
  266. package/vendor/stylo/values/computed/font.rs +1517 -0
  267. package/vendor/stylo/values/computed/image.rs +273 -0
  268. package/vendor/stylo/values/computed/length.rs +576 -0
  269. package/vendor/stylo/values/computed/length_percentage.rs +1055 -0
  270. package/vendor/stylo/values/computed/list.rs +16 -0
  271. package/vendor/stylo/values/computed/mod.rs +1141 -0
  272. package/vendor/stylo/values/computed/motion.rs +73 -0
  273. package/vendor/stylo/values/computed/outline.rs +7 -0
  274. package/vendor/stylo/values/computed/page.rs +77 -0
  275. package/vendor/stylo/values/computed/param.rs +9 -0
  276. package/vendor/stylo/values/computed/percentage.rs +143 -0
  277. package/vendor/stylo/values/computed/position.rs +273 -0
  278. package/vendor/stylo/values/computed/ratio.rs +88 -0
  279. package/vendor/stylo/values/computed/rect.rs +19 -0
  280. package/vendor/stylo/values/computed/resolution.rs +76 -0
  281. package/vendor/stylo/values/computed/svg.rs +66 -0
  282. package/vendor/stylo/values/computed/table.rs +7 -0
  283. package/vendor/stylo/values/computed/text.rs +199 -0
  284. package/vendor/stylo/values/computed/time.rs +83 -0
  285. package/vendor/stylo/values/computed/transform.rs +559 -0
  286. package/vendor/stylo/values/computed/tree_counting.rs +30 -0
  287. package/vendor/stylo/values/computed/ui.rs +23 -0
  288. package/vendor/stylo/values/computed/url.rs +12 -0
  289. package/vendor/stylo/values/distance.rs +139 -0
  290. package/vendor/stylo/values/generics/animation.rs +363 -0
  291. package/vendor/stylo/values/generics/background.rs +65 -0
  292. package/vendor/stylo/values/generics/basic_shape.rs +1389 -0
  293. package/vendor/stylo/values/generics/border.rs +303 -0
  294. package/vendor/stylo/values/generics/box.rs +552 -0
  295. package/vendor/stylo/values/generics/calc.rs +2986 -0
  296. package/vendor/stylo/values/generics/color.rs +318 -0
  297. package/vendor/stylo/values/generics/column.rs +44 -0
  298. package/vendor/stylo/values/generics/counters.rs +320 -0
  299. package/vendor/stylo/values/generics/easing.rs +132 -0
  300. package/vendor/stylo/values/generics/effects.rs +131 -0
  301. package/vendor/stylo/values/generics/flex.rs +34 -0
  302. package/vendor/stylo/values/generics/font.rs +376 -0
  303. package/vendor/stylo/values/generics/grid.rs +962 -0
  304. package/vendor/stylo/values/generics/image.rs +653 -0
  305. package/vendor/stylo/values/generics/length.rs +656 -0
  306. package/vendor/stylo/values/generics/mod.rs +303 -0
  307. package/vendor/stylo/values/generics/motion.rs +274 -0
  308. package/vendor/stylo/values/generics/page.rs +167 -0
  309. package/vendor/stylo/values/generics/position.rs +669 -0
  310. package/vendor/stylo/values/generics/ratio.rs +88 -0
  311. package/vendor/stylo/values/generics/rect.rs +147 -0
  312. package/vendor/stylo/values/generics/size.rs +102 -0
  313. package/vendor/stylo/values/generics/svg.rs +226 -0
  314. package/vendor/stylo/values/generics/text.rs +268 -0
  315. package/vendor/stylo/values/generics/transform.rs +1157 -0
  316. package/vendor/stylo/values/generics/ui.rs +147 -0
  317. package/vendor/stylo/values/generics/url.rs +51 -0
  318. package/vendor/stylo/values/mod.rs +820 -0
  319. package/vendor/stylo/values/resolved/animation.rs +33 -0
  320. package/vendor/stylo/values/resolved/color.rs +53 -0
  321. package/vendor/stylo/values/resolved/counters.rs +45 -0
  322. package/vendor/stylo/values/resolved/mod.rs +316 -0
  323. package/vendor/stylo/values/specified/align.rs +711 -0
  324. package/vendor/stylo/values/specified/angle.rs +407 -0
  325. package/vendor/stylo/values/specified/animation.rs +921 -0
  326. package/vendor/stylo/values/specified/background.rs +270 -0
  327. package/vendor/stylo/values/specified/basic_shape.rs +986 -0
  328. package/vendor/stylo/values/specified/border.rs +430 -0
  329. package/vendor/stylo/values/specified/box.rs +2231 -0
  330. package/vendor/stylo/values/specified/calc.rs +1657 -0
  331. package/vendor/stylo/values/specified/color.rs +1210 -0
  332. package/vendor/stylo/values/specified/column.rs +11 -0
  333. package/vendor/stylo/values/specified/corner_shape.rs +152 -0
  334. package/vendor/stylo/values/specified/counters.rs +242 -0
  335. package/vendor/stylo/values/specified/easing.rs +225 -0
  336. package/vendor/stylo/values/specified/effects.rs +421 -0
  337. package/vendor/stylo/values/specified/flex.rs +42 -0
  338. package/vendor/stylo/values/specified/font.rs +2103 -0
  339. package/vendor/stylo/values/specified/frequency.rs +39 -0
  340. package/vendor/stylo/values/specified/grid.rs +407 -0
  341. package/vendor/stylo/values/specified/image.rs +1385 -0
  342. package/vendor/stylo/values/specified/intersection_observer.rs +80 -0
  343. package/vendor/stylo/values/specified/length.rs +2024 -0
  344. package/vendor/stylo/values/specified/list.rs +190 -0
  345. package/vendor/stylo/values/specified/mod.rs +531 -0
  346. package/vendor/stylo/values/specified/motion.rs +316 -0
  347. package/vendor/stylo/values/specified/number.rs +603 -0
  348. package/vendor/stylo/values/specified/outline.rs +69 -0
  349. package/vendor/stylo/values/specified/page.rs +94 -0
  350. package/vendor/stylo/values/specified/param.rs +121 -0
  351. package/vendor/stylo/values/specified/percentage.rs +364 -0
  352. package/vendor/stylo/values/specified/position.rs +2247 -0
  353. package/vendor/stylo/values/specified/ratio.rs +29 -0
  354. package/vendor/stylo/values/specified/rect.rs +28 -0
  355. package/vendor/stylo/values/specified/resolution.rs +237 -0
  356. package/vendor/stylo/values/specified/source_size_list.rs +135 -0
  357. package/vendor/stylo/values/specified/svg.rs +427 -0
  358. package/vendor/stylo/values/specified/svg_path.rs +1115 -0
  359. package/vendor/stylo/values/specified/table.rs +38 -0
  360. package/vendor/stylo/values/specified/text.rs +1561 -0
  361. package/vendor/stylo/values/specified/time.rs +313 -0
  362. package/vendor/stylo/values/specified/transform.rs +599 -0
  363. package/vendor/stylo/values/specified/tree_counting.rs +32 -0
  364. package/vendor/stylo/values/specified/ui.rs +344 -0
  365. package/vendor/stylo/values/specified/url.rs +12 -0
  366. package/vendor/stylo/values/tagged_numeric.rs +253 -0
  367. package/wasm/blitz_pdf.d.ts +67 -0
  368. package/wasm/blitz_pdf.js +699 -0
  369. package/wasm/blitz_pdf_bg.wasm +0 -0
  370. package/wasm/blitz_pdf_bg.wasm.d.ts +20 -0
@@ -0,0 +1,331 @@
1
+ /* This Source Code Form is subject to the terms of the Mozilla Public
2
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
3
+ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
4
+
5
+ //! The [`@property`] at-rule.
6
+ //!
7
+ //! https://drafts.css-houdini.org/css-properties-values-api-1/#at-property-rule
8
+
9
+ use super::{
10
+ registry::PropertyRegistration,
11
+ value::{
12
+ AllowComputationallyDependent, ComputedValue as ComputedRegisteredValue,
13
+ SpecifiedValue as SpecifiedRegisteredValue,
14
+ },
15
+ };
16
+ use crate::custom_properties::{Name as CustomPropertyName, SpecifiedValue};
17
+ use crate::derives::*;
18
+ use crate::error_reporting::ContextualParseError;
19
+ use crate::parser::{Parse, ParserContext};
20
+ use crate::shared_lock::{SharedRwLockReadGuard, ToCssWithGuard};
21
+ use crate::values::{computed, serialize_atom_name};
22
+ use cssparser::{BasicParseErrorKind, ParseErrorKind, Parser, RuleBodyParser, SourceLocation};
23
+ use malloc_size_of::{MallocSizeOf, MallocSizeOfOps};
24
+ use servo_arc::Arc;
25
+ use std::fmt::{self, Write};
26
+ use style_traits::{
27
+ CssStringWriter, CssWriter, ParseError, PropertyInheritsParseError, PropertySyntaxParseError,
28
+ StyleParseErrorKind, ToCss,
29
+ };
30
+ use to_shmem::{SharedMemoryBuilder, ToShmem};
31
+
32
+ pub use super::syntax::Descriptor as SyntaxDescriptor;
33
+ pub use crate::properties::property::{DescriptorId, DescriptorParser, Descriptors};
34
+
35
+ /// Parse the block inside a `@property` rule.
36
+ ///
37
+ /// Valid `@property` rules result in a registered custom property, as if `registerProperty()` had
38
+ /// been called with equivalent parameters.
39
+ pub fn parse_property_block(
40
+ context: &ParserContext,
41
+ input: &mut Parser,
42
+ name: PropertyRuleName,
43
+ source_location: SourceLocation,
44
+ ) -> Result<PropertyRegistration, ParseError> {
45
+ let mut descriptors = Descriptors::default();
46
+ let mut parser = DescriptorParser {
47
+ context,
48
+ descriptors: &mut descriptors,
49
+ };
50
+ let iter = RuleBodyParser::new(input, &mut parser);
51
+ let mut syntax_err = None;
52
+ let mut inherits_err = None;
53
+ for declaration in iter {
54
+ if !context.error_reporting_enabled() {
55
+ continue;
56
+ }
57
+ if let Err((error, slice, location)) = declaration {
58
+ let error = match error.kind {
59
+ // If the provided string is not a valid syntax string (if it
60
+ // returns failure when consume a syntax definition is called on
61
+ // it), the descriptor is invalid and must be ignored.
62
+ ParseErrorKind::Custom(StyleParseErrorKind::PropertySyntaxField(_)) => {
63
+ syntax_err = Some(error.clone());
64
+ ContextualParseError::UnsupportedValue(slice, error)
65
+ },
66
+
67
+ // If the provided string is not a valid inherits string,
68
+ // the descriptor is invalid and must be ignored.
69
+ ParseErrorKind::Custom(StyleParseErrorKind::PropertyInheritsField(_)) => {
70
+ inherits_err = Some(error.clone());
71
+ ContextualParseError::UnsupportedValue(slice, error)
72
+ },
73
+
74
+ // Unknown descriptors are invalid and ignored, but do not
75
+ // invalidate the @property rule.
76
+ _ => ContextualParseError::UnsupportedPropertyDescriptor(slice, error),
77
+ };
78
+ context.log_css_error(location, error);
79
+ }
80
+ }
81
+
82
+ // https://drafts.css-houdini.org/css-properties-values-api-1/#the-syntax-descriptor:
83
+ //
84
+ // The syntax descriptor is required for the @property rule to be valid; if it’s
85
+ // missing, the @property rule is invalid.
86
+ let Some(ref syntax) = descriptors.syntax else {
87
+ return Err(if let Some(err) = syntax_err {
88
+ err
89
+ } else {
90
+ let err = ParseError::custom(StyleParseErrorKind::PropertySyntaxField(
91
+ PropertySyntaxParseError::NoSyntax,
92
+ ));
93
+ context.log_css_error(
94
+ source_location,
95
+ ContextualParseError::UnsupportedValue("", err.clone()),
96
+ );
97
+ err
98
+ });
99
+ };
100
+
101
+ // https://drafts.css-houdini.org/css-properties-values-api-1/#inherits-descriptor:
102
+ //
103
+ // The inherits descriptor is required for the @property rule to be valid; if it’s
104
+ // missing, the @property rule is invalid.
105
+ if descriptors.inherits.is_none() {
106
+ return Err(if let Some(err) = inherits_err {
107
+ err
108
+ } else {
109
+ let err = ParseError::custom(StyleParseErrorKind::PropertyInheritsField(
110
+ PropertyInheritsParseError::NoInherits,
111
+ ));
112
+ context.log_css_error(
113
+ source_location,
114
+ ContextualParseError::UnsupportedValue("", err.clone()),
115
+ );
116
+ err
117
+ });
118
+ };
119
+
120
+ if PropertyRegistration::validate_initial_value(syntax, descriptors.initial_value.as_deref())
121
+ .is_err()
122
+ {
123
+ return Err(ParseError::from_basic_kind(
124
+ BasicParseErrorKind::AtRuleBodyInvalid,
125
+ ));
126
+ }
127
+
128
+ Ok(PropertyRegistration {
129
+ name,
130
+ descriptors,
131
+ url_data: context.url_data.clone(),
132
+ source_location,
133
+ })
134
+ }
135
+
136
+ /// Errors that can happen when registering a property.
137
+ #[allow(missing_docs)]
138
+ pub enum PropertyRegistrationError {
139
+ NoInitialValue,
140
+ InvalidInitialValue,
141
+ InitialValueNotComputationallyIndependent,
142
+ }
143
+
144
+ impl PropertyRegistration {
145
+ /// Measure heap usage.
146
+ pub fn size_of(&self, _: &SharedRwLockReadGuard, ops: &mut MallocSizeOfOps) -> usize {
147
+ MallocSizeOf::size_of(self, ops)
148
+ }
149
+
150
+ /// Computes the value of the computationally independent initial value.
151
+ pub fn compute_initial_value(
152
+ &self,
153
+ computed_context: &computed::Context,
154
+ ) -> Result<ComputedRegisteredValue, ()> {
155
+ let Some(ref initial) = self.descriptors.initial_value else {
156
+ return Err(());
157
+ };
158
+
159
+ if self.descriptors.is_universal() {
160
+ return Ok(ComputedRegisteredValue::universal(Arc::clone(initial)));
161
+ }
162
+
163
+ let mut input = Parser::new(initial.css_text());
164
+ input.skip_whitespace();
165
+
166
+ match SpecifiedRegisteredValue::compute(
167
+ &mut input,
168
+ &self.descriptors,
169
+ None,
170
+ &self.url_data,
171
+ computed_context,
172
+ AllowComputationallyDependent::No,
173
+ /* attr_taint */ Default::default(),
174
+ ) {
175
+ Ok(computed) => Ok(computed),
176
+ Err(_) => Err(()),
177
+ }
178
+ }
179
+
180
+ /// Performs syntax validation as per the initial value descriptor.
181
+ /// https://drafts.css-houdini.org/css-properties-values-api-1/#initial-value-descriptor
182
+ pub fn validate_initial_value(
183
+ syntax: &SyntaxDescriptor,
184
+ initial_value: Option<&SpecifiedValue>,
185
+ ) -> Result<(), PropertyRegistrationError> {
186
+ use crate::properties::CSSWideKeyword;
187
+ // If the value of the syntax descriptor is the universal syntax definition, then the
188
+ // initial-value descriptor is optional. If omitted, the initial value of the property is
189
+ // the guaranteed-invalid value.
190
+ if syntax.is_universal() && initial_value.is_none() {
191
+ return Ok(());
192
+ }
193
+
194
+ // Otherwise, if the value of the syntax descriptor is not the universal syntax definition,
195
+ // the following conditions must be met for the @property rule to be valid:
196
+
197
+ // The initial-value descriptor must be present.
198
+ let Some(initial) = initial_value else {
199
+ return Err(PropertyRegistrationError::NoInitialValue);
200
+ };
201
+
202
+ // A value that references the environment or other variables is not computationally
203
+ // independent.
204
+ if initial.has_references() {
205
+ return Err(PropertyRegistrationError::InitialValueNotComputationallyIndependent);
206
+ }
207
+
208
+ let mut input = Parser::new(initial.css_text());
209
+ input.skip_whitespace();
210
+
211
+ // The initial-value cannot include CSS-wide keywords.
212
+ if input.try_parse(CSSWideKeyword::parse).is_ok() {
213
+ return Err(PropertyRegistrationError::InitialValueNotComputationallyIndependent);
214
+ }
215
+
216
+ match SpecifiedRegisteredValue::parse(
217
+ &mut input,
218
+ syntax,
219
+ &initial.url_data,
220
+ None,
221
+ AllowComputationallyDependent::No,
222
+ /* attr_taint */ Default::default(),
223
+ ) {
224
+ Ok(_) => {},
225
+ Err(_) => return Err(PropertyRegistrationError::InvalidInitialValue),
226
+ }
227
+
228
+ Ok(())
229
+ }
230
+ }
231
+
232
+ impl ToCssWithGuard for PropertyRegistration {
233
+ /// <https://drafts.css-houdini.org/css-properties-values-api-1/#serialize-a-csspropertyrule>
234
+ fn to_css(&self, _guard: &SharedRwLockReadGuard, dest: &mut CssStringWriter) -> fmt::Result {
235
+ dest.write_str("@property ")?;
236
+ self.name.to_css(&mut CssWriter::new(dest))?;
237
+ dest.write_str(" { ")?;
238
+ self.descriptors.to_css(&mut CssWriter::new(dest))?;
239
+ dest.write_char('}')
240
+ }
241
+ }
242
+
243
+ impl ToShmem for PropertyRegistration {
244
+ fn to_shmem(&self, _builder: &mut SharedMemoryBuilder) -> to_shmem::Result<Self> {
245
+ Err(String::from(
246
+ "ToShmem failed for PropertyRule: cannot handle @property rules",
247
+ ))
248
+ }
249
+ }
250
+
251
+ /// A custom property name wrapper that includes the `--` prefix in its serialization
252
+ #[derive(Clone, Debug, PartialEq, MallocSizeOf)]
253
+ pub struct PropertyRuleName(pub CustomPropertyName);
254
+
255
+ impl ToCss for PropertyRuleName {
256
+ fn to_css<W: Write>(&self, dest: &mut CssWriter<W>) -> fmt::Result {
257
+ dest.write_str("--")?;
258
+ serialize_atom_name(&self.0, dest)
259
+ }
260
+ }
261
+
262
+ /// <https://drafts.css-houdini.org/css-properties-values-api-1/#inherits-descriptor>
263
+ #[derive(Clone, Debug, MallocSizeOf, PartialEq, ToCss, ToShmem)]
264
+ pub enum Inherits {
265
+ /// `true` value for the `inherits` descriptor
266
+ True,
267
+ /// `false` value for the `inherits` descriptor
268
+ False,
269
+ }
270
+
271
+ impl Parse for Inherits {
272
+ fn parse(_context: &ParserContext, input: &mut Parser) -> Result<Self, ParseError> {
273
+ // FIXME(bug 1927012): Remove `return` from try_match_ident_ignore_ascii_case so the closure
274
+ // can be removed.
275
+ let result: Result<Inherits, ParseError> = (|| {
276
+ try_match_ident_ignore_ascii_case! { input,
277
+ "true" => Ok(Inherits::True),
278
+ "false" => Ok(Inherits::False),
279
+ }
280
+ })();
281
+ if result.is_err() {
282
+ Err(ParseError::custom(
283
+ StyleParseErrorKind::PropertyInheritsField(
284
+ PropertyInheritsParseError::InvalidInherits,
285
+ ),
286
+ ))
287
+ } else {
288
+ result
289
+ }
290
+ }
291
+ }
292
+
293
+ /// Specifies the initial value of the custom property registration represented by the @property
294
+ /// rule, controlling the property’s initial value.
295
+ ///
296
+ /// The SpecifiedValue is wrapped in an Arc to avoid copying when using it.
297
+ pub type InitialValue = Arc<SpecifiedValue>;
298
+
299
+ impl Parse for InitialValue {
300
+ fn parse(context: &ParserContext, input: &mut Parser) -> Result<Self, ParseError> {
301
+ input.skip_whitespace();
302
+ Ok(Arc::new(SpecifiedValue::parse(
303
+ input,
304
+ Some(&context.namespaces.prefixes),
305
+ context.url_data,
306
+ )?))
307
+ }
308
+ }
309
+
310
+ impl Descriptors {
311
+ /// Returns descriptors for an unregistered property.
312
+ #[inline]
313
+ pub fn unregistered() -> &'static Self {
314
+ static UNREGISTERED: Descriptors = Descriptors {
315
+ inherits: Some(Inherits::True),
316
+ syntax: Some(SyntaxDescriptor::universal()),
317
+ initial_value: None,
318
+ };
319
+ &UNREGISTERED
320
+ }
321
+
322
+ /// Whether this property inherits.
323
+ pub fn inherits(&self) -> bool {
324
+ self.inherits != Some(Inherits::False)
325
+ }
326
+
327
+ /// Whether this property uses universal syntax.
328
+ pub fn is_universal(&self) -> bool {
329
+ self.syntax.as_ref().is_none_or(|s| s.is_universal())
330
+ }
331
+ }
@@ -0,0 +1,60 @@
1
+ /* This Source Code Form is subject to the terms of the Mozilla Public
2
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
3
+ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
4
+
5
+ /// Trims ASCII whitespace characters from a slice, and returns the trimmed input.
6
+ pub fn trim_ascii_whitespace(input: &str) -> &str {
7
+ if input.is_empty() {
8
+ return input;
9
+ }
10
+
11
+ let mut start = 0;
12
+ {
13
+ let mut iter = input.as_bytes().iter();
14
+ loop {
15
+ let byte = match iter.next() {
16
+ Some(b) => b,
17
+ None => return "",
18
+ };
19
+
20
+ if !byte.is_ascii_whitespace() {
21
+ break;
22
+ }
23
+ start += 1;
24
+ }
25
+ }
26
+
27
+ let mut end = input.len();
28
+ assert!(start < end);
29
+ {
30
+ let mut iter = input.as_bytes()[start..].iter().rev();
31
+ loop {
32
+ let byte = match iter.next() {
33
+ Some(b) => b,
34
+ None => {
35
+ debug_assert!(false, "We should have caught this in the loop above!");
36
+ return "";
37
+ },
38
+ };
39
+
40
+ if !byte.is_ascii_whitespace() {
41
+ break;
42
+ }
43
+ end -= 1;
44
+ }
45
+ }
46
+
47
+ &input[start..end]
48
+ }
49
+
50
+ #[test]
51
+ fn trim_ascii_whitespace_test() {
52
+ fn test(i: &str, o: &str) {
53
+ assert_eq!(trim_ascii_whitespace(i), o)
54
+ }
55
+
56
+ test("", "");
57
+ test(" ", "");
58
+ test(" a b c ", "a b c");
59
+ test(" \t \t \ta b c \t \t \t \t", "a b c");
60
+ }
@@ -0,0 +1,146 @@
1
+ /* This Source Code Form is subject to the terms of the Mozilla Public
2
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
3
+ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
4
+
5
+ //! Used for parsing and serializing component names from the syntax string.
6
+
7
+ use super::{Component, ComponentName, Multiplier};
8
+ use crate::derives::*;
9
+ use std::fmt::{self, Debug, Write};
10
+ use style_traits::{CssWriter, ToCss};
11
+
12
+ /// Some types (lengths and colors) depend on other properties to resolve correctly.
13
+ #[derive(Clone, Copy, Debug, Default, PartialEq, Eq, MallocSizeOf, ToShmem)]
14
+ pub struct DependentDataTypes(u8);
15
+ bitflags! {
16
+ impl DependentDataTypes: u8 {
17
+ /// <length> values depend on font-size/line-height/zoom...
18
+ const LENGTH = 1 << 0;
19
+ /// <color> values depend on color-scheme, etc..
20
+ const COLOR= 1 << 1;
21
+ }
22
+ }
23
+
24
+ /// <https://drafts.css-houdini.org/css-properties-values-api-1/#supported-names>
25
+ #[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, ToShmem)]
26
+ pub enum DataType {
27
+ /// Any valid `<length>` value
28
+ Length,
29
+ /// `<number>` values
30
+ Number,
31
+ /// Any valid <percentage> value
32
+ Percentage,
33
+ /// Any valid `<length>` or `<percentage>` value, any valid `<calc()>` expression combining
34
+ /// `<length>` and `<percentage>` components.
35
+ LengthPercentage,
36
+ /// Any valid `<color>` value
37
+ Color,
38
+ /// Any valid `<image>` value
39
+ Image,
40
+ /// Any valid `<url>` value
41
+ Url,
42
+ /// Any valid `<integer>` value
43
+ Integer,
44
+ /// Any valid `<angle>` value
45
+ Angle,
46
+ /// Any valid `<time>` value
47
+ Time,
48
+ /// Any valid `<resolution>` value
49
+ Resolution,
50
+ /// Any valid `<transform-function>` value
51
+ TransformFunction,
52
+ /// Any valid `<custom-ident>` value
53
+ CustomIdent,
54
+ /// A list of valid `<transform-function>` values. Note that "<transform-list>" is a pre-multiplied
55
+ /// data type name equivalent to "<transform-function>+"
56
+ TransformList,
57
+ /// Any valid `<string>` value
58
+ ///
59
+ /// <https://github.com/w3c/css-houdini-drafts/issues/1103>
60
+ String,
61
+ }
62
+
63
+ impl DataType {
64
+ /// Converts a component name from a pre-multiplied data type to its un-pre-multiplied equivalent.
65
+ ///
66
+ /// <https://drafts.css-houdini.org/css-properties-values-api-1/#pre-multiplied-data-type-name>
67
+ pub fn unpremultiply(&self) -> Option<Component> {
68
+ match *self {
69
+ DataType::TransformList => Some(Component {
70
+ name: ComponentName::DataType(DataType::TransformFunction),
71
+ multiplier: Some(Multiplier::Space),
72
+ }),
73
+ _ => None,
74
+ }
75
+ }
76
+
77
+ /// Parses a syntax component name.
78
+ pub fn from_str(ty: &str) -> Option<Self> {
79
+ Some(match ty.as_bytes() {
80
+ b"length" => DataType::Length,
81
+ b"number" => DataType::Number,
82
+ b"percentage" => DataType::Percentage,
83
+ b"length-percentage" => DataType::LengthPercentage,
84
+ b"color" => DataType::Color,
85
+ b"image" => DataType::Image,
86
+ b"url" => DataType::Url,
87
+ b"integer" => DataType::Integer,
88
+ b"angle" => DataType::Angle,
89
+ b"time" => DataType::Time,
90
+ b"resolution" => DataType::Resolution,
91
+ b"transform-function" => DataType::TransformFunction,
92
+ b"custom-ident" => DataType::CustomIdent,
93
+ b"transform-list" => DataType::TransformList,
94
+ b"string" => DataType::String,
95
+ _ => return None,
96
+ })
97
+ }
98
+
99
+ /// Returns which kinds of dependent data types this property might contain.
100
+ pub fn dependent_types(&self) -> DependentDataTypes {
101
+ match self {
102
+ DataType::Length
103
+ | DataType::LengthPercentage
104
+ | DataType::TransformFunction
105
+ | DataType::TransformList => DependentDataTypes::LENGTH,
106
+ DataType::Color => DependentDataTypes::COLOR,
107
+ DataType::Number
108
+ | DataType::Percentage
109
+ | DataType::Image
110
+ | DataType::Url
111
+ | DataType::Integer
112
+ | DataType::Angle
113
+ | DataType::Time
114
+ | DataType::Resolution
115
+ | DataType::CustomIdent
116
+ | DataType::String => DependentDataTypes::empty(),
117
+ }
118
+ }
119
+ }
120
+
121
+ impl ToCss for DataType {
122
+ fn to_css<W>(&self, dest: &mut CssWriter<W>) -> fmt::Result
123
+ where
124
+ W: Write,
125
+ {
126
+ dest.write_char('<')?;
127
+ dest.write_str(match *self {
128
+ DataType::Length => "length",
129
+ DataType::Number => "number",
130
+ DataType::Percentage => "percentage",
131
+ DataType::LengthPercentage => "length-percentage",
132
+ DataType::Color => "color",
133
+ DataType::Image => "image",
134
+ DataType::Url => "url",
135
+ DataType::Integer => "integer",
136
+ DataType::Angle => "angle",
137
+ DataType::Time => "time",
138
+ DataType::Resolution => "resolution",
139
+ DataType::TransformFunction => "transform-function",
140
+ DataType::CustomIdent => "custom-ident",
141
+ DataType::TransformList => "transform-list",
142
+ DataType::String => "string",
143
+ })?;
144
+ dest.write_char('>')
145
+ }
146
+ }