blitz-pdf 0.0.0-stage → 0.1.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.
- package/LICENSE +21 -0
- package/README.md +391 -2
- package/THIRD_PARTY_NOTICES.md +25 -0
- package/assets/icon.svg +4 -0
- package/dist/api.d.ts +7 -0
- package/dist/api.d.ts.map +1 -0
- package/dist/api.js +46 -0
- package/dist/api.js.map +1 -0
- package/dist/assets.d.ts +7 -0
- package/dist/assets.d.ts.map +1 -0
- package/dist/assets.js +52 -0
- package/dist/assets.js.map +1 -0
- package/dist/browser.d.ts +3 -0
- package/dist/browser.d.ts.map +1 -0
- package/dist/browser.js +3 -0
- package/dist/browser.js.map +1 -0
- package/dist/node.d.ts +3 -0
- package/dist/node.d.ts.map +1 -0
- package/dist/node.js +10 -0
- package/dist/node.js.map +1 -0
- package/dist/options.d.ts +24 -0
- package/dist/options.d.ts.map +1 -0
- package/dist/options.js +135 -0
- package/dist/options.js.map +1 -0
- package/dist/types.d.ts +51 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/examples/bun.ts +8 -0
- package/examples/german-invoice/README.md +70 -0
- package/examples/german-invoice/data.mjs +83 -0
- package/examples/german-invoice/invoice.css +59 -0
- package/examples/german-invoice/template.mjs +49 -0
- package/examples/german-invoice.mjs +20 -0
- package/examples/invoice.html +29 -0
- package/examples/node.mjs +8 -0
- package/examples/pagination.html +40 -0
- package/examples/pagination.mjs +8 -0
- package/licenses/DejaVu.txt +187 -0
- package/licenses/RUST_DEPENDENCIES.txt +11577 -0
- package/package.json +89 -4
- package/src/api.ts +44 -0
- package/src/assets.ts +43 -0
- package/src/browser.ts +6 -0
- package/src/node.ts +12 -0
- package/src/options.ts +101 -0
- package/src/types.ts +49 -0
- package/vendor/README.md +17 -0
- package/vendor/stylo/.cargo-ok +1 -0
- package/vendor/stylo/.cargo_vcs_info.json +6 -0
- package/vendor/stylo/Cargo.lock +1485 -0
- package/vendor/stylo/Cargo.toml +274 -0
- package/vendor/stylo/LICENSE +373 -0
- package/vendor/stylo/README.md +6 -0
- package/vendor/stylo/applicable_declarations.rs +328 -0
- package/vendor/stylo/author_styles.rs +79 -0
- package/vendor/stylo/bezier.rs +176 -0
- package/vendor/stylo/bloom.rs +414 -0
- package/vendor/stylo/build.rs +91 -0
- package/vendor/stylo/build_gecko.rs +393 -0
- package/vendor/stylo/color/color_function.rs +601 -0
- package/vendor/stylo/color/component.rs +207 -0
- package/vendor/stylo/color/convert.rs +935 -0
- package/vendor/stylo/color/gamut/raytrace.rs +265 -0
- package/vendor/stylo/color/gamut.rs +227 -0
- package/vendor/stylo/color/mix.rs +645 -0
- package/vendor/stylo/color/mod.rs +750 -0
- package/vendor/stylo/color/parsing.rs +770 -0
- package/vendor/stylo/color/to_css.rs +297 -0
- package/vendor/stylo/context.rs +716 -0
- package/vendor/stylo/counter_style/mod.rs +754 -0
- package/vendor/stylo/counter_style/predefined.rs +61 -0
- package/vendor/stylo/counter_style/update_predefined.py +35 -0
- package/vendor/stylo/custom_properties.rs +2023 -0
- package/vendor/stylo/custom_properties_map.rs +220 -0
- package/vendor/stylo/data.rs +693 -0
- package/vendor/stylo/device/gecko.rs +486 -0
- package/vendor/stylo/device/mod.rs +304 -0
- package/vendor/stylo/device/servo.rs +507 -0
- package/vendor/stylo/dom.rs +1164 -0
- package/vendor/stylo/dom_apis.rs +937 -0
- package/vendor/stylo/driver.rs +172 -0
- package/vendor/stylo/error_reporting.rs +484 -0
- package/vendor/stylo/font_face.rs +558 -0
- package/vendor/stylo/font_metrics.rs +124 -0
- package/vendor/stylo/gecko/anon_boxes.toml +113 -0
- package/vendor/stylo/gecko/arc_types.rs +211 -0
- package/vendor/stylo/gecko/conversions.rs +59 -0
- package/vendor/stylo/gecko/data.rs +222 -0
- package/vendor/stylo/gecko/media_features.rs +971 -0
- package/vendor/stylo/gecko/mod.rs +20 -0
- package/vendor/stylo/gecko/non_ts_pseudo_class_list.rs +119 -0
- package/vendor/stylo/gecko/pseudo_element.rs +640 -0
- package/vendor/stylo/gecko/pseudo_element_definition.mako.rs +298 -0
- package/vendor/stylo/gecko/pseudo_elements.py +137 -0
- package/vendor/stylo/gecko/pseudo_elements.toml +197 -0
- package/vendor/stylo/gecko/regen_pseudo_elements.py +33 -0
- package/vendor/stylo/gecko/restyle_damage.rs +127 -0
- package/vendor/stylo/gecko/selector_parser.rs +627 -0
- package/vendor/stylo/gecko/snapshot.rs +202 -0
- package/vendor/stylo/gecko/snapshot_helpers.rs +334 -0
- package/vendor/stylo/gecko/traversal.rs +52 -0
- package/vendor/stylo/gecko/wrapper.rs +2258 -0
- package/vendor/stylo/gecko_bindings/mod.rs +34 -0
- package/vendor/stylo/gecko_bindings/sugar/mod.rs +12 -0
- package/vendor/stylo/gecko_bindings/sugar/ns_com_ptr.rs +15 -0
- package/vendor/stylo/gecko_bindings/sugar/ns_compatibility.rs +19 -0
- package/vendor/stylo/gecko_bindings/sugar/ns_style_auto_array.rs +111 -0
- package/vendor/stylo/gecko_bindings/sugar/origin_flags.rs +31 -0
- package/vendor/stylo/gecko_bindings/sugar/ownership.rs +70 -0
- package/vendor/stylo/gecko_bindings/sugar/refptr.rs +299 -0
- package/vendor/stylo/gecko_string_cache/mod.rs +543 -0
- package/vendor/stylo/gecko_string_cache/namespace.rs +106 -0
- package/vendor/stylo/global_style_data.rs +224 -0
- package/vendor/stylo/invalidation/element/document_state.rs +156 -0
- package/vendor/stylo/invalidation/element/element_wrapper.rs +432 -0
- package/vendor/stylo/invalidation/element/invalidation_map.rs +1631 -0
- package/vendor/stylo/invalidation/element/invalidator.rs +1470 -0
- package/vendor/stylo/invalidation/element/mod.rs +13 -0
- package/vendor/stylo/invalidation/element/relative_selector.rs +1399 -0
- package/vendor/stylo/invalidation/element/restyle_hints.rs +226 -0
- package/vendor/stylo/invalidation/element/state_and_attributes.rs +756 -0
- package/vendor/stylo/invalidation/media_queries.rs +144 -0
- package/vendor/stylo/invalidation/mod.rs +10 -0
- package/vendor/stylo/invalidation/stylesheets.rs +745 -0
- package/vendor/stylo/invalidation/viewport_units.rs +71 -0
- package/vendor/stylo/lib.rs +336 -0
- package/vendor/stylo/logical_geometry.rs +1684 -0
- package/vendor/stylo/macros.rs +70 -0
- package/vendor/stylo/matching.rs +1226 -0
- package/vendor/stylo/media_queries/media_list.rs +168 -0
- package/vendor/stylo/media_queries/media_query.rs +190 -0
- package/vendor/stylo/media_queries/mod.rs +13 -0
- package/vendor/stylo/parallel.rs +205 -0
- package/vendor/stylo/parser.rs +276 -0
- package/vendor/stylo/piecewise_linear.rs +282 -0
- package/vendor/stylo/prefs.rs +33 -0
- package/vendor/stylo/properties/build.py +119 -0
- package/vendor/stylo/properties/cascade.rs +2704 -0
- package/vendor/stylo/properties/computed_value_flags.rs +206 -0
- package/vendor/stylo/properties/counted_unknown_properties.py +104 -0
- package/vendor/stylo/properties/counter_style_descriptors.toml +45 -0
- package/vendor/stylo/properties/data.py +1375 -0
- package/vendor/stylo/properties/declaration_block.rs +1788 -0
- package/vendor/stylo/properties/font_face_descriptors.toml +50 -0
- package/vendor/stylo/properties/gecko.mako.rs +1555 -0
- package/vendor/stylo/properties/helpers/animated_properties.mako.rs +800 -0
- package/vendor/stylo/properties/helpers.mako.rs +812 -0
- package/vendor/stylo/properties/longhands.toml +4305 -0
- package/vendor/stylo/properties/mod.rs +1857 -0
- package/vendor/stylo/properties/properties.html.mako +31 -0
- package/vendor/stylo/properties/properties.mako.rs +3103 -0
- package/vendor/stylo/properties/property_descriptors.toml +18 -0
- package/vendor/stylo/properties/shorthands.rs +4241 -0
- package/vendor/stylo/properties/shorthands.toml +575 -0
- package/vendor/stylo/properties/vendored_python/mako-1.3.10-py3-none-any.whl +0 -0
- package/vendor/stylo/properties/vendored_python/markupsafe/LICENSE.txt +28 -0
- package/vendor/stylo/properties/vendored_python/markupsafe/__init__.py +384 -0
- package/vendor/stylo/properties/vendored_python/toml-0.10.2-py2.py3-none-any.whl +0 -0
- package/vendor/stylo/properties/view_transition_descriptors.toml +11 -0
- package/vendor/stylo/properties_and_values/mod.rs +12 -0
- package/vendor/stylo/properties_and_values/registry.rs +65 -0
- package/vendor/stylo/properties_and_values/rule.rs +331 -0
- package/vendor/stylo/properties_and_values/syntax/ascii.rs +60 -0
- package/vendor/stylo/properties_and_values/syntax/data_type.rs +146 -0
- package/vendor/stylo/properties_and_values/syntax/mod.rs +437 -0
- package/vendor/stylo/properties_and_values/value.rs +758 -0
- package/vendor/stylo/queries/condition.rs +996 -0
- package/vendor/stylo/queries/feature.rs +199 -0
- package/vendor/stylo/queries/feature_expression.rs +1170 -0
- package/vendor/stylo/queries/mod.rs +19 -0
- package/vendor/stylo/queries/values.rs +46 -0
- package/vendor/stylo/rule_cache.rs +267 -0
- package/vendor/stylo/rule_collector.rs +554 -0
- package/vendor/stylo/rule_tree/core.rs +787 -0
- package/vendor/stylo/rule_tree/level.rs +396 -0
- package/vendor/stylo/rule_tree/map.rs +201 -0
- package/vendor/stylo/rule_tree/mod.rs +427 -0
- package/vendor/stylo/rule_tree/source.rs +80 -0
- package/vendor/stylo/rule_tree/unsafe_box.rs +78 -0
- package/vendor/stylo/scoped_tls.rs +80 -0
- package/vendor/stylo/selector_map.rs +1050 -0
- package/vendor/stylo/selector_parser.rs +305 -0
- package/vendor/stylo/servo/animation.rs +1922 -0
- package/vendor/stylo/servo/attr.rs +714 -0
- package/vendor/stylo/servo/encoding_support.rs +81 -0
- package/vendor/stylo/servo/media_features.rs +254 -0
- package/vendor/stylo/servo/mod.rs +16 -0
- package/vendor/stylo/servo/restyle_damage.rs +215 -0
- package/vendor/stylo/servo/selector_parser.rs +1036 -0
- package/vendor/stylo/servo/shadow_parts.rs +207 -0
- package/vendor/stylo/shared_lock.rs +271 -0
- package/vendor/stylo/sharing/checks.rs +281 -0
- package/vendor/stylo/sharing/mod.rs +1000 -0
- package/vendor/stylo/simple_buckets_map.rs +52 -0
- package/vendor/stylo/str.rs +168 -0
- package/vendor/stylo/style_adjuster.rs +1086 -0
- package/vendor/stylo/style_resolver.rs +658 -0
- package/vendor/stylo/stylesheet_set.rs +658 -0
- package/vendor/stylo/stylesheets/appearance_base_rule.rs +51 -0
- package/vendor/stylo/stylesheets/container_rule.rs +769 -0
- package/vendor/stylo/stylesheets/counter_style_rule.rs +7 -0
- package/vendor/stylo/stylesheets/document_rule.rs +272 -0
- package/vendor/stylo/stylesheets/font_face_rule.rs +7 -0
- package/vendor/stylo/stylesheets/font_feature_values_rule.rs +481 -0
- package/vendor/stylo/stylesheets/font_palette_values_rule.rs +304 -0
- package/vendor/stylo/stylesheets/import_rule.rs +259 -0
- package/vendor/stylo/stylesheets/keyframes_rule.rs +733 -0
- package/vendor/stylo/stylesheets/layer_rule.rs +221 -0
- package/vendor/stylo/stylesheets/loader.rs +29 -0
- package/vendor/stylo/stylesheets/margin_rule.rs +190 -0
- package/vendor/stylo/stylesheets/media_rule.rs +191 -0
- package/vendor/stylo/stylesheets/mod.rs +918 -0
- package/vendor/stylo/stylesheets/namespace_rule.rs +43 -0
- package/vendor/stylo/stylesheets/nested_declarations_rule.rs +51 -0
- package/vendor/stylo/stylesheets/origin.rs +249 -0
- package/vendor/stylo/stylesheets/page_rule.rs +354 -0
- package/vendor/stylo/stylesheets/position_try_rule.rs +68 -0
- package/vendor/stylo/stylesheets/property_rule.rs +5 -0
- package/vendor/stylo/stylesheets/rule_list.rs +167 -0
- package/vendor/stylo/stylesheets/rule_parser.rs +1189 -0
- package/vendor/stylo/stylesheets/rules_iterator.rs +397 -0
- package/vendor/stylo/stylesheets/scope_rule.rs +511 -0
- package/vendor/stylo/stylesheets/starting_style_rule.rs +54 -0
- package/vendor/stylo/stylesheets/style_rule.rs +80 -0
- package/vendor/stylo/stylesheets/stylesheet.rs +570 -0
- package/vendor/stylo/stylesheets/supports_rule.rs +486 -0
- package/vendor/stylo/stylesheets/view_transition_rule.rs +81 -0
- package/vendor/stylo/stylist.rs +5076 -0
- package/vendor/stylo/thread_state.rs +87 -0
- package/vendor/stylo/traversal.rs +765 -0
- package/vendor/stylo/traversal_flags.rs +68 -0
- package/vendor/stylo/typed_om/mod.rs +981 -0
- package/vendor/stylo/typed_om/numeric.rs +128 -0
- package/vendor/stylo/typed_om/numeric_declaration.rs +93 -0
- package/vendor/stylo/typed_om/numeric_type.rs +640 -0
- package/vendor/stylo/typed_om/sum_value.rs +426 -0
- package/vendor/stylo/url/gecko.rs +367 -0
- package/vendor/stylo/url/mod.rs +71 -0
- package/vendor/stylo/url/servo.rs +239 -0
- package/vendor/stylo/use_counters/mod.rs +137 -0
- package/vendor/stylo/values/animated/color.rs +103 -0
- package/vendor/stylo/values/animated/effects.rs +26 -0
- package/vendor/stylo/values/animated/font.rs +37 -0
- package/vendor/stylo/values/animated/grid.rs +161 -0
- package/vendor/stylo/values/animated/lists.rs +141 -0
- package/vendor/stylo/values/animated/mod.rs +550 -0
- package/vendor/stylo/values/animated/svg.rs +46 -0
- package/vendor/stylo/values/animated/text.rs +58 -0
- package/vendor/stylo/values/animated/transform.rs +1592 -0
- package/vendor/stylo/values/computed/align.rs +90 -0
- package/vendor/stylo/values/computed/angle.rs +130 -0
- package/vendor/stylo/values/computed/animation.rs +124 -0
- package/vendor/stylo/values/computed/background.rs +13 -0
- package/vendor/stylo/values/computed/basic_shape.rs +267 -0
- package/vendor/stylo/values/computed/border.rs +163 -0
- package/vendor/stylo/values/computed/box.rs +267 -0
- package/vendor/stylo/values/computed/calc.rs +334 -0
- package/vendor/stylo/values/computed/color.rs +161 -0
- package/vendor/stylo/values/computed/column.rs +11 -0
- package/vendor/stylo/values/computed/corner_shape.rs +155 -0
- package/vendor/stylo/values/computed/counters.rs +26 -0
- package/vendor/stylo/values/computed/easing.rs +109 -0
- package/vendor/stylo/values/computed/effects.rs +30 -0
- package/vendor/stylo/values/computed/flex.rs +19 -0
- package/vendor/stylo/values/computed/font.rs +1517 -0
- package/vendor/stylo/values/computed/image.rs +273 -0
- package/vendor/stylo/values/computed/length.rs +576 -0
- package/vendor/stylo/values/computed/length_percentage.rs +1055 -0
- package/vendor/stylo/values/computed/list.rs +16 -0
- package/vendor/stylo/values/computed/mod.rs +1141 -0
- package/vendor/stylo/values/computed/motion.rs +73 -0
- package/vendor/stylo/values/computed/outline.rs +7 -0
- package/vendor/stylo/values/computed/page.rs +77 -0
- package/vendor/stylo/values/computed/param.rs +9 -0
- package/vendor/stylo/values/computed/percentage.rs +143 -0
- package/vendor/stylo/values/computed/position.rs +273 -0
- package/vendor/stylo/values/computed/ratio.rs +88 -0
- package/vendor/stylo/values/computed/rect.rs +19 -0
- package/vendor/stylo/values/computed/resolution.rs +76 -0
- package/vendor/stylo/values/computed/svg.rs +66 -0
- package/vendor/stylo/values/computed/table.rs +7 -0
- package/vendor/stylo/values/computed/text.rs +199 -0
- package/vendor/stylo/values/computed/time.rs +83 -0
- package/vendor/stylo/values/computed/transform.rs +559 -0
- package/vendor/stylo/values/computed/tree_counting.rs +30 -0
- package/vendor/stylo/values/computed/ui.rs +23 -0
- package/vendor/stylo/values/computed/url.rs +12 -0
- package/vendor/stylo/values/distance.rs +139 -0
- package/vendor/stylo/values/generics/animation.rs +363 -0
- package/vendor/stylo/values/generics/background.rs +65 -0
- package/vendor/stylo/values/generics/basic_shape.rs +1389 -0
- package/vendor/stylo/values/generics/border.rs +303 -0
- package/vendor/stylo/values/generics/box.rs +552 -0
- package/vendor/stylo/values/generics/calc.rs +2986 -0
- package/vendor/stylo/values/generics/color.rs +318 -0
- package/vendor/stylo/values/generics/column.rs +44 -0
- package/vendor/stylo/values/generics/counters.rs +320 -0
- package/vendor/stylo/values/generics/easing.rs +132 -0
- package/vendor/stylo/values/generics/effects.rs +131 -0
- package/vendor/stylo/values/generics/flex.rs +34 -0
- package/vendor/stylo/values/generics/font.rs +376 -0
- package/vendor/stylo/values/generics/grid.rs +962 -0
- package/vendor/stylo/values/generics/image.rs +653 -0
- package/vendor/stylo/values/generics/length.rs +656 -0
- package/vendor/stylo/values/generics/mod.rs +303 -0
- package/vendor/stylo/values/generics/motion.rs +274 -0
- package/vendor/stylo/values/generics/page.rs +167 -0
- package/vendor/stylo/values/generics/position.rs +669 -0
- package/vendor/stylo/values/generics/ratio.rs +88 -0
- package/vendor/stylo/values/generics/rect.rs +147 -0
- package/vendor/stylo/values/generics/size.rs +102 -0
- package/vendor/stylo/values/generics/svg.rs +226 -0
- package/vendor/stylo/values/generics/text.rs +268 -0
- package/vendor/stylo/values/generics/transform.rs +1157 -0
- package/vendor/stylo/values/generics/ui.rs +147 -0
- package/vendor/stylo/values/generics/url.rs +51 -0
- package/vendor/stylo/values/mod.rs +820 -0
- package/vendor/stylo/values/resolved/animation.rs +33 -0
- package/vendor/stylo/values/resolved/color.rs +53 -0
- package/vendor/stylo/values/resolved/counters.rs +45 -0
- package/vendor/stylo/values/resolved/mod.rs +316 -0
- package/vendor/stylo/values/specified/align.rs +711 -0
- package/vendor/stylo/values/specified/angle.rs +407 -0
- package/vendor/stylo/values/specified/animation.rs +921 -0
- package/vendor/stylo/values/specified/background.rs +270 -0
- package/vendor/stylo/values/specified/basic_shape.rs +986 -0
- package/vendor/stylo/values/specified/border.rs +430 -0
- package/vendor/stylo/values/specified/box.rs +2231 -0
- package/vendor/stylo/values/specified/calc.rs +1657 -0
- package/vendor/stylo/values/specified/color.rs +1210 -0
- package/vendor/stylo/values/specified/column.rs +11 -0
- package/vendor/stylo/values/specified/corner_shape.rs +152 -0
- package/vendor/stylo/values/specified/counters.rs +242 -0
- package/vendor/stylo/values/specified/easing.rs +225 -0
- package/vendor/stylo/values/specified/effects.rs +421 -0
- package/vendor/stylo/values/specified/flex.rs +42 -0
- package/vendor/stylo/values/specified/font.rs +2103 -0
- package/vendor/stylo/values/specified/frequency.rs +39 -0
- package/vendor/stylo/values/specified/grid.rs +407 -0
- package/vendor/stylo/values/specified/image.rs +1385 -0
- package/vendor/stylo/values/specified/intersection_observer.rs +80 -0
- package/vendor/stylo/values/specified/length.rs +2024 -0
- package/vendor/stylo/values/specified/list.rs +190 -0
- package/vendor/stylo/values/specified/mod.rs +531 -0
- package/vendor/stylo/values/specified/motion.rs +316 -0
- package/vendor/stylo/values/specified/number.rs +603 -0
- package/vendor/stylo/values/specified/outline.rs +69 -0
- package/vendor/stylo/values/specified/page.rs +94 -0
- package/vendor/stylo/values/specified/param.rs +121 -0
- package/vendor/stylo/values/specified/percentage.rs +364 -0
- package/vendor/stylo/values/specified/position.rs +2247 -0
- package/vendor/stylo/values/specified/ratio.rs +29 -0
- package/vendor/stylo/values/specified/rect.rs +28 -0
- package/vendor/stylo/values/specified/resolution.rs +237 -0
- package/vendor/stylo/values/specified/source_size_list.rs +135 -0
- package/vendor/stylo/values/specified/svg.rs +427 -0
- package/vendor/stylo/values/specified/svg_path.rs +1115 -0
- package/vendor/stylo/values/specified/table.rs +38 -0
- package/vendor/stylo/values/specified/text.rs +1561 -0
- package/vendor/stylo/values/specified/time.rs +313 -0
- package/vendor/stylo/values/specified/transform.rs +599 -0
- package/vendor/stylo/values/specified/tree_counting.rs +32 -0
- package/vendor/stylo/values/specified/ui.rs +344 -0
- package/vendor/stylo/values/specified/url.rs +12 -0
- package/vendor/stylo/values/tagged_numeric.rs +253 -0
- package/wasm/blitz_pdf.d.ts +67 -0
- package/wasm/blitz_pdf.js +699 -0
- package/wasm/blitz_pdf_bg.wasm +0 -0
- package/wasm/blitz_pdf_bg.wasm.d.ts +20 -0
|
@@ -0,0 +1,384 @@
|
|
|
1
|
+
# Vendored from https://github.com/pallets/markupsafe/blob/1251593f6b0e3b45f2cc8aba662622bc22d6a5e2/src/markupsafe/__init__.py
|
|
2
|
+
# with patched section from https://github.com/pallets/markupsafe/blob/1251593f6b0e3b45f2cc8aba662622bc22d6a5e2/src/markupsafe/_native.py
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import collections.abc as cabc
|
|
6
|
+
import string
|
|
7
|
+
import typing as t
|
|
8
|
+
|
|
9
|
+
# BEGIN PATCHED SECTION
|
|
10
|
+
def _escape_inner(s: str, /) -> str:
|
|
11
|
+
return (
|
|
12
|
+
s.replace("&", "&")
|
|
13
|
+
.replace(">", ">")
|
|
14
|
+
.replace("<", "<")
|
|
15
|
+
.replace("'", "'")
|
|
16
|
+
.replace('"', """)
|
|
17
|
+
)
|
|
18
|
+
# BEGIN PATCHED SECTION
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
class _HasHTML(t.Protocol):
|
|
22
|
+
def __html__(self, /) -> str: ...
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
class _TPEscape(t.Protocol):
|
|
26
|
+
def __call__(self, s: t.Any, /) -> Markup: ...
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
def escape(s: t.Any, /) -> Markup:
|
|
30
|
+
"""Replace the characters ``&``, ``<``, ``>``, ``'``, and ``"`` in
|
|
31
|
+
the string with HTML-safe sequences. Use this if you need to display
|
|
32
|
+
text that might contain such characters in HTML.
|
|
33
|
+
|
|
34
|
+
If the object has an ``__html__`` method, it is called and the
|
|
35
|
+
return value is assumed to already be safe for HTML.
|
|
36
|
+
|
|
37
|
+
:param s: An object to be converted to a string and escaped.
|
|
38
|
+
:return: A :class:`Markup` string with the escaped text.
|
|
39
|
+
"""
|
|
40
|
+
# If the object is already a plain string, skip __html__ check and string
|
|
41
|
+
# conversion. This is the most common use case.
|
|
42
|
+
# Use type(s) instead of s.__class__ because a proxy object may be reporting
|
|
43
|
+
# the __class__ of the proxied value.
|
|
44
|
+
if type(s) is str:
|
|
45
|
+
return Markup(_escape_inner(s))
|
|
46
|
+
|
|
47
|
+
if hasattr(s, "__html__"):
|
|
48
|
+
return Markup(s.__html__())
|
|
49
|
+
|
|
50
|
+
return Markup(_escape_inner(str(s)))
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
def escape_silent(s: t.Any | None, /) -> Markup:
|
|
54
|
+
"""Like :func:`escape` but treats ``None`` as the empty string.
|
|
55
|
+
Useful with optional values, as otherwise you get the string
|
|
56
|
+
``'None'`` when the value is ``None``.
|
|
57
|
+
|
|
58
|
+
>>> escape(None)
|
|
59
|
+
Markup('None')
|
|
60
|
+
>>> escape_silent(None)
|
|
61
|
+
Markup('')
|
|
62
|
+
"""
|
|
63
|
+
if s is None:
|
|
64
|
+
return Markup()
|
|
65
|
+
|
|
66
|
+
return escape(s)
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
def soft_str(s: t.Any, /) -> str:
|
|
70
|
+
"""Convert an object to a string if it isn't already. This preserves
|
|
71
|
+
a :class:`Markup` string rather than converting it back to a basic
|
|
72
|
+
string, so it will still be marked as safe and won't be escaped
|
|
73
|
+
again.
|
|
74
|
+
|
|
75
|
+
>>> value = escape("<User 1>")
|
|
76
|
+
>>> value
|
|
77
|
+
Markup('<User 1>')
|
|
78
|
+
>>> escape(str(value))
|
|
79
|
+
Markup('&lt;User 1&gt;')
|
|
80
|
+
>>> escape(soft_str(value))
|
|
81
|
+
Markup('<User 1>')
|
|
82
|
+
"""
|
|
83
|
+
if not isinstance(s, str):
|
|
84
|
+
return str(s)
|
|
85
|
+
|
|
86
|
+
return s
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
class Markup(str):
|
|
90
|
+
"""A string that is ready to be safely inserted into an HTML or XML
|
|
91
|
+
document, either because it was escaped or because it was marked
|
|
92
|
+
safe.
|
|
93
|
+
|
|
94
|
+
Passing an object to the constructor converts it to text and wraps
|
|
95
|
+
it to mark it safe without escaping. To escape the text, use the
|
|
96
|
+
:meth:`escape` class method instead.
|
|
97
|
+
|
|
98
|
+
>>> Markup("Hello, <em>World</em>!")
|
|
99
|
+
Markup('Hello, <em>World</em>!')
|
|
100
|
+
>>> Markup(42)
|
|
101
|
+
Markup('42')
|
|
102
|
+
>>> Markup.escape("Hello, <em>World</em>!")
|
|
103
|
+
Markup('Hello <em>World</em>!')
|
|
104
|
+
|
|
105
|
+
This implements the ``__html__()`` interface that some frameworks
|
|
106
|
+
use. Passing an object that implements ``__html__()`` will wrap the
|
|
107
|
+
output of that method, marking it safe.
|
|
108
|
+
|
|
109
|
+
>>> class Foo:
|
|
110
|
+
... def __html__(self):
|
|
111
|
+
... return '<a href="/foo">foo</a>'
|
|
112
|
+
...
|
|
113
|
+
>>> Markup(Foo())
|
|
114
|
+
Markup('<a href="/foo">foo</a>')
|
|
115
|
+
|
|
116
|
+
This is a subclass of :class:`str`. It has the same methods, but
|
|
117
|
+
escapes their arguments and returns a ``Markup`` instance.
|
|
118
|
+
|
|
119
|
+
>>> Markup("<em>%s</em>") % ("foo & bar",)
|
|
120
|
+
Markup('<em>foo & bar</em>')
|
|
121
|
+
>>> Markup("<em>Hello</em> ") + "<foo>"
|
|
122
|
+
Markup('<em>Hello</em> <foo>')
|
|
123
|
+
"""
|
|
124
|
+
|
|
125
|
+
__slots__ = ()
|
|
126
|
+
|
|
127
|
+
def __new__(
|
|
128
|
+
cls, object: t.Any = "", encoding: str | None = None, errors: str = "strict"
|
|
129
|
+
) -> te.Self:
|
|
130
|
+
if hasattr(object, "__html__"):
|
|
131
|
+
object = object.__html__()
|
|
132
|
+
|
|
133
|
+
if encoding is None:
|
|
134
|
+
return super().__new__(cls, object)
|
|
135
|
+
|
|
136
|
+
return super().__new__(cls, object, encoding, errors)
|
|
137
|
+
|
|
138
|
+
def __html__(self, /) -> te.Self:
|
|
139
|
+
return self
|
|
140
|
+
|
|
141
|
+
def __add__(self, value: str | _HasHTML, /) -> te.Self:
|
|
142
|
+
if isinstance(value, str) or hasattr(value, "__html__"):
|
|
143
|
+
return self.__class__(super().__add__(self.escape(value)))
|
|
144
|
+
|
|
145
|
+
return NotImplemented
|
|
146
|
+
|
|
147
|
+
def __radd__(self, value: str | _HasHTML, /) -> te.Self:
|
|
148
|
+
if isinstance(value, str) or hasattr(value, "__html__"):
|
|
149
|
+
return self.escape(value).__add__(self)
|
|
150
|
+
|
|
151
|
+
return NotImplemented
|
|
152
|
+
|
|
153
|
+
def __mul__(self, value: t.SupportsIndex, /) -> te.Self:
|
|
154
|
+
return self.__class__(super().__mul__(value))
|
|
155
|
+
|
|
156
|
+
def __rmul__(self, value: t.SupportsIndex, /) -> te.Self:
|
|
157
|
+
return self.__class__(super().__mul__(value))
|
|
158
|
+
|
|
159
|
+
def __mod__(self, value: t.Any, /) -> te.Self:
|
|
160
|
+
if isinstance(value, tuple):
|
|
161
|
+
# a tuple of arguments, each wrapped
|
|
162
|
+
value = tuple(_MarkupEscapeHelper(x, self.escape) for x in value)
|
|
163
|
+
elif hasattr(type(value), "__getitem__") and not isinstance(value, str):
|
|
164
|
+
# a mapping of arguments, wrapped
|
|
165
|
+
value = _MarkupEscapeHelper(value, self.escape)
|
|
166
|
+
else:
|
|
167
|
+
# a single argument, wrapped with the helper and a tuple
|
|
168
|
+
value = (_MarkupEscapeHelper(value, self.escape),)
|
|
169
|
+
|
|
170
|
+
return self.__class__(super().__mod__(value))
|
|
171
|
+
|
|
172
|
+
def __repr__(self, /) -> str:
|
|
173
|
+
return f"{self.__class__.__name__}({super().__repr__()})"
|
|
174
|
+
|
|
175
|
+
def join(self, iterable: cabc.Iterable[str | _HasHTML], /) -> te.Self:
|
|
176
|
+
return self.__class__(super().join(map(self.escape, iterable)))
|
|
177
|
+
|
|
178
|
+
def split( # type: ignore[override]
|
|
179
|
+
self, /, sep: str | None = None, maxsplit: t.SupportsIndex = -1
|
|
180
|
+
) -> list[te.Self]:
|
|
181
|
+
return [self.__class__(v) for v in super().split(sep, maxsplit)]
|
|
182
|
+
|
|
183
|
+
def rsplit( # type: ignore[override]
|
|
184
|
+
self, /, sep: str | None = None, maxsplit: t.SupportsIndex = -1
|
|
185
|
+
) -> list[te.Self]:
|
|
186
|
+
return [self.__class__(v) for v in super().rsplit(sep, maxsplit)]
|
|
187
|
+
|
|
188
|
+
def splitlines( # type: ignore[override]
|
|
189
|
+
self, /, keepends: bool = False
|
|
190
|
+
) -> list[te.Self]:
|
|
191
|
+
return [self.__class__(v) for v in super().splitlines(keepends)]
|
|
192
|
+
|
|
193
|
+
def unescape(self, /) -> str:
|
|
194
|
+
"""Convert escaped markup back into a text string. This replaces
|
|
195
|
+
HTML entities with the characters they represent.
|
|
196
|
+
|
|
197
|
+
>>> Markup("Main » <em>About</em>").unescape()
|
|
198
|
+
'Main » <em>About</em>'
|
|
199
|
+
"""
|
|
200
|
+
from html import unescape
|
|
201
|
+
|
|
202
|
+
return unescape(str(self))
|
|
203
|
+
|
|
204
|
+
def striptags(self, /) -> str:
|
|
205
|
+
""":meth:`unescape` the markup, remove tags, and normalize
|
|
206
|
+
whitespace to single spaces.
|
|
207
|
+
|
|
208
|
+
>>> Markup("Main »\t<em>About</em>").striptags()
|
|
209
|
+
'Main » About'
|
|
210
|
+
"""
|
|
211
|
+
value = str(self)
|
|
212
|
+
|
|
213
|
+
# Look for comments then tags separately. Otherwise, a comment that
|
|
214
|
+
# contains a tag would end early, leaving some of the comment behind.
|
|
215
|
+
|
|
216
|
+
# keep finding comment start marks
|
|
217
|
+
while (start := value.find("<!--")) != -1:
|
|
218
|
+
# find a comment end mark beyond the start, otherwise stop
|
|
219
|
+
if (end := value.find("-->", start)) == -1:
|
|
220
|
+
break
|
|
221
|
+
|
|
222
|
+
value = f"{value[:start]}{value[end + 3 :]}"
|
|
223
|
+
|
|
224
|
+
# remove tags using the same method
|
|
225
|
+
while (start := value.find("<")) != -1:
|
|
226
|
+
if (end := value.find(">", start)) == -1:
|
|
227
|
+
break
|
|
228
|
+
|
|
229
|
+
value = f"{value[:start]}{value[end + 1 :]}"
|
|
230
|
+
|
|
231
|
+
# collapse spaces
|
|
232
|
+
value = " ".join(value.split())
|
|
233
|
+
return self.__class__(value).unescape()
|
|
234
|
+
|
|
235
|
+
@classmethod
|
|
236
|
+
def escape(cls, s: t.Any, /) -> te.Self:
|
|
237
|
+
"""Escape a string. Calls :func:`escape` and ensures that for
|
|
238
|
+
subclasses the correct type is returned.
|
|
239
|
+
"""
|
|
240
|
+
rv = escape(s)
|
|
241
|
+
|
|
242
|
+
if rv.__class__ is not cls:
|
|
243
|
+
return cls(rv)
|
|
244
|
+
|
|
245
|
+
return rv # type: ignore[return-value]
|
|
246
|
+
|
|
247
|
+
def __getitem__(self, key: t.SupportsIndex | slice, /) -> te.Self:
|
|
248
|
+
return self.__class__(super().__getitem__(key))
|
|
249
|
+
|
|
250
|
+
def capitalize(self, /) -> te.Self:
|
|
251
|
+
return self.__class__(super().capitalize())
|
|
252
|
+
|
|
253
|
+
def title(self, /) -> te.Self:
|
|
254
|
+
return self.__class__(super().title())
|
|
255
|
+
|
|
256
|
+
def lower(self, /) -> te.Self:
|
|
257
|
+
return self.__class__(super().lower())
|
|
258
|
+
|
|
259
|
+
def upper(self, /) -> te.Self:
|
|
260
|
+
return self.__class__(super().upper())
|
|
261
|
+
|
|
262
|
+
def replace(self, old: str, new: str, count: t.SupportsIndex = -1, /) -> te.Self:
|
|
263
|
+
return self.__class__(super().replace(old, self.escape(new), count))
|
|
264
|
+
|
|
265
|
+
def ljust(self, width: t.SupportsIndex, fillchar: str = " ", /) -> te.Self:
|
|
266
|
+
return self.__class__(super().ljust(width, self.escape(fillchar)))
|
|
267
|
+
|
|
268
|
+
def rjust(self, width: t.SupportsIndex, fillchar: str = " ", /) -> te.Self:
|
|
269
|
+
return self.__class__(super().rjust(width, self.escape(fillchar)))
|
|
270
|
+
|
|
271
|
+
def lstrip(self, chars: str | None = None, /) -> te.Self:
|
|
272
|
+
return self.__class__(super().lstrip(chars))
|
|
273
|
+
|
|
274
|
+
def rstrip(self, chars: str | None = None, /) -> te.Self:
|
|
275
|
+
return self.__class__(super().rstrip(chars))
|
|
276
|
+
|
|
277
|
+
def center(self, width: t.SupportsIndex, fillchar: str = " ", /) -> te.Self:
|
|
278
|
+
return self.__class__(super().center(width, self.escape(fillchar)))
|
|
279
|
+
|
|
280
|
+
def strip(self, chars: str | None = None, /) -> te.Self:
|
|
281
|
+
return self.__class__(super().strip(chars))
|
|
282
|
+
|
|
283
|
+
def translate(
|
|
284
|
+
self,
|
|
285
|
+
table: cabc.Mapping[int, str | int | None], # type: ignore[override]
|
|
286
|
+
/,
|
|
287
|
+
) -> str:
|
|
288
|
+
return self.__class__(super().translate(table))
|
|
289
|
+
|
|
290
|
+
def expandtabs(self, /, tabsize: t.SupportsIndex = 8) -> te.Self:
|
|
291
|
+
return self.__class__(super().expandtabs(tabsize))
|
|
292
|
+
|
|
293
|
+
def swapcase(self, /) -> te.Self:
|
|
294
|
+
return self.__class__(super().swapcase())
|
|
295
|
+
|
|
296
|
+
def zfill(self, width: t.SupportsIndex, /) -> te.Self:
|
|
297
|
+
return self.__class__(super().zfill(width))
|
|
298
|
+
|
|
299
|
+
def casefold(self, /) -> te.Self:
|
|
300
|
+
return self.__class__(super().casefold())
|
|
301
|
+
|
|
302
|
+
def removeprefix(self, prefix: str, /) -> te.Self:
|
|
303
|
+
return self.__class__(super().removeprefix(prefix))
|
|
304
|
+
|
|
305
|
+
def removesuffix(self, suffix: str) -> te.Self:
|
|
306
|
+
return self.__class__(super().removesuffix(suffix))
|
|
307
|
+
|
|
308
|
+
def partition(self, sep: str, /) -> tuple[te.Self, te.Self, te.Self]:
|
|
309
|
+
left, sep, right = super().partition(sep)
|
|
310
|
+
cls = self.__class__
|
|
311
|
+
return cls(left), cls(sep), cls(right)
|
|
312
|
+
|
|
313
|
+
def rpartition(self, sep: str, /) -> tuple[te.Self, te.Self, te.Self]:
|
|
314
|
+
left, sep, right = super().rpartition(sep)
|
|
315
|
+
cls = self.__class__
|
|
316
|
+
return cls(left), cls(sep), cls(right)
|
|
317
|
+
|
|
318
|
+
def format(self, *args: t.Any, **kwargs: t.Any) -> te.Self:
|
|
319
|
+
formatter = EscapeFormatter(self.escape)
|
|
320
|
+
return self.__class__(formatter.vformat(self, args, kwargs))
|
|
321
|
+
|
|
322
|
+
def format_map(
|
|
323
|
+
self,
|
|
324
|
+
mapping: cabc.Mapping[str, t.Any], # type: ignore[override]
|
|
325
|
+
/,
|
|
326
|
+
) -> te.Self:
|
|
327
|
+
formatter = EscapeFormatter(self.escape)
|
|
328
|
+
return self.__class__(formatter.vformat(self, (), mapping))
|
|
329
|
+
|
|
330
|
+
def __html_format__(self, format_spec: str, /) -> te.Self:
|
|
331
|
+
if format_spec:
|
|
332
|
+
raise ValueError("Unsupported format specification for Markup.")
|
|
333
|
+
|
|
334
|
+
return self
|
|
335
|
+
|
|
336
|
+
|
|
337
|
+
class EscapeFormatter(string.Formatter):
|
|
338
|
+
__slots__ = ("escape",)
|
|
339
|
+
|
|
340
|
+
def __init__(self, escape: _TPEscape) -> None:
|
|
341
|
+
self.escape: _TPEscape = escape
|
|
342
|
+
super().__init__()
|
|
343
|
+
|
|
344
|
+
def format_field(self, value: t.Any, format_spec: str) -> str:
|
|
345
|
+
if hasattr(value, "__html_format__"):
|
|
346
|
+
rv = value.__html_format__(format_spec)
|
|
347
|
+
elif hasattr(value, "__html__"):
|
|
348
|
+
if format_spec:
|
|
349
|
+
raise ValueError(
|
|
350
|
+
f"Format specifier {format_spec} given, but {type(value)} does not"
|
|
351
|
+
" define __html_format__. A class that defines __html__ must define"
|
|
352
|
+
" __html_format__ to work with format specifiers."
|
|
353
|
+
)
|
|
354
|
+
rv = value.__html__()
|
|
355
|
+
else:
|
|
356
|
+
# We need to make sure the format spec is str here as
|
|
357
|
+
# otherwise the wrong callback methods are invoked.
|
|
358
|
+
rv = super().format_field(value, str(format_spec))
|
|
359
|
+
return str(self.escape(rv))
|
|
360
|
+
|
|
361
|
+
|
|
362
|
+
class _MarkupEscapeHelper:
|
|
363
|
+
"""Helper for :meth:`Markup.__mod__`."""
|
|
364
|
+
|
|
365
|
+
__slots__ = ("obj", "escape")
|
|
366
|
+
|
|
367
|
+
def __init__(self, obj: t.Any, escape: _TPEscape) -> None:
|
|
368
|
+
self.obj: t.Any = obj
|
|
369
|
+
self.escape: _TPEscape = escape
|
|
370
|
+
|
|
371
|
+
def __getitem__(self, key: t.Any, /) -> te.Self:
|
|
372
|
+
return self.__class__(self.obj[key], self.escape)
|
|
373
|
+
|
|
374
|
+
def __str__(self, /) -> str:
|
|
375
|
+
return str(self.escape(self.obj))
|
|
376
|
+
|
|
377
|
+
def __repr__(self, /) -> str:
|
|
378
|
+
return str(self.escape(repr(self.obj)))
|
|
379
|
+
|
|
380
|
+
def __int__(self, /) -> int:
|
|
381
|
+
return int(self.obj)
|
|
382
|
+
|
|
383
|
+
def __float__(self, /) -> float:
|
|
384
|
+
return float(self.obj)
|
|
@@ -0,0 +1,11 @@
|
|
|
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 http://mozilla.org/MPL/2.0/.
|
|
4
|
+
|
|
5
|
+
# The descriptors of the @view-transition rule.
|
|
6
|
+
|
|
7
|
+
[navigation]
|
|
8
|
+
type = "NavigationType"
|
|
9
|
+
|
|
10
|
+
[types]
|
|
11
|
+
type = "TransitionTypes"
|
|
@@ -0,0 +1,12 @@
|
|
|
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
|
+
//! Properties and Values
|
|
6
|
+
//!
|
|
7
|
+
//! https://drafts.css-houdini.org/css-properties-values-api-1/
|
|
8
|
+
|
|
9
|
+
pub mod registry;
|
|
10
|
+
pub mod rule;
|
|
11
|
+
pub mod syntax;
|
|
12
|
+
pub mod value;
|
|
@@ -0,0 +1,65 @@
|
|
|
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
|
+
//! Registered custom properties.
|
|
6
|
+
|
|
7
|
+
use super::rule::{Descriptors, PropertyRuleName};
|
|
8
|
+
use crate::derives::*;
|
|
9
|
+
use crate::selector_map::PrecomputedHashMap;
|
|
10
|
+
use crate::stylesheets::UrlExtraData;
|
|
11
|
+
use crate::Atom;
|
|
12
|
+
use cssparser::SourceLocation;
|
|
13
|
+
|
|
14
|
+
/// A computed, already-validated property registration.
|
|
15
|
+
/// <https://drafts.css-houdini.org/css-properties-values-api-1/#custom-property-registration>
|
|
16
|
+
#[derive(Debug, Clone, MallocSizeOf)]
|
|
17
|
+
pub struct PropertyRegistration {
|
|
18
|
+
/// The custom property name.
|
|
19
|
+
pub name: PropertyRuleName,
|
|
20
|
+
/// The actual information about the property.
|
|
21
|
+
pub descriptors: Descriptors,
|
|
22
|
+
/// The url data that is used to parse and compute the registration's initial value. Note that
|
|
23
|
+
/// it's not the url data that should be used to parse other values. Other values should use
|
|
24
|
+
/// the data of the style sheet where they came from.
|
|
25
|
+
pub url_data: UrlExtraData,
|
|
26
|
+
/// The source location of this registration, if it comes from a CSS rule.
|
|
27
|
+
pub source_location: SourceLocation,
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/// The script registry of custom properties.
|
|
31
|
+
/// <https://drafts.css-houdini.org/css-properties-values-api-1/#dom-window-registeredpropertyset-slot>
|
|
32
|
+
#[derive(Default, MallocSizeOf)]
|
|
33
|
+
pub struct ScriptRegistry {
|
|
34
|
+
properties: PrecomputedHashMap<Atom, PropertyRegistration>,
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
impl ScriptRegistry {
|
|
38
|
+
/// Gets an already-registered custom property via script.
|
|
39
|
+
#[inline]
|
|
40
|
+
pub fn get(&self, name: &Atom) -> Option<&PropertyRegistration> {
|
|
41
|
+
self.properties.get(name)
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/// Gets already-registered custom properties via script.
|
|
45
|
+
#[inline]
|
|
46
|
+
pub fn properties(&self) -> &PrecomputedHashMap<Atom, PropertyRegistration> {
|
|
47
|
+
&self.properties
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/// Register a given property. As per
|
|
51
|
+
/// <https://drafts.css-houdini.org/css-properties-values-api-1/#the-registerproperty-function>
|
|
52
|
+
/// we don't allow overriding the registration.
|
|
53
|
+
#[inline]
|
|
54
|
+
pub fn register(&mut self, registration: PropertyRegistration) {
|
|
55
|
+
let name = registration.name.0.clone();
|
|
56
|
+
let old = self.properties.insert(name, registration);
|
|
57
|
+
debug_assert!(old.is_none(), "Already registered? Should be an error");
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/// Returns the properties hashmap.
|
|
61
|
+
#[inline]
|
|
62
|
+
pub fn get_all(&self) -> &PrecomputedHashMap<Atom, PropertyRegistration> {
|
|
63
|
+
&self.properties
|
|
64
|
+
}
|
|
65
|
+
}
|