yass-css 0.2.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.
- checksums.yaml +7 -0
- data/CHANGELOG.md +11 -0
- data/CODE_OF_CONDUCT.md +132 -0
- data/Cargo.lock +1447 -0
- data/Cargo.toml +7 -0
- data/LICENSE.txt +21 -0
- data/README.md +139 -0
- data/Rakefile +130 -0
- data/codegen/ruby_module_tree.rb +178 -0
- data/codegen/rust_file_set.rb +84 -0
- data/codegen/utils.rb +27 -0
- data/dockerfiles/windows.dockerfile +3 -0
- data/examples/basic_example.rb +32 -0
- data/examples/font_example.rb +19 -0
- data/examples/media_example.rb +31 -0
- data/examples/visitor_example.rb +41 -0
- data/ext/.DS_Store +0 -0
- data/ext/yass/Cargo.toml +24 -0
- data/ext/yass/extconf.rb +6 -0
- data/ext/yass/src/.DS_Store +0 -0
- data/ext/yass/src/cached_value.rs +48 -0
- data/ext/yass/src/cached_value_list.rs +63 -0
- data/ext/yass/src/declarations/.DS_Store +0 -0
- data/ext/yass/src/declarations/align_content.rs +19 -0
- data/ext/yass/src/declarations/align_flags.rs +26 -0
- data/ext/yass/src/declarations/align_items.rs +37 -0
- data/ext/yass/src/declarations/align_self.rs +19 -0
- data/ext/yass/src/declarations/alignment_baseline.rs +27 -0
- data/ext/yass/src/declarations/angle.rs +25 -0
- data/ext/yass/src/declarations/animation/auto.rs +8 -0
- data/ext/yass/src/declarations/animation/init.rs +40 -0
- data/ext/yass/src/declarations/animation/inset.rs +50 -0
- data/ext/yass/src/declarations/animation/length_auto.rs +8 -0
- data/ext/yass/src/declarations/animation/mod.rs +11 -0
- data/ext/yass/src/declarations/animation/range_value.rs +47 -0
- data/ext/yass/src/declarations/animation/scroll_axis.rs +22 -0
- data/ext/yass/src/declarations/animation/scroll_function.rs +40 -0
- data/ext/yass/src/declarations/animation/scroller.rs +21 -0
- data/ext/yass/src/declarations/animation/timeline_name.rs +16 -0
- data/ext/yass/src/declarations/animation/timing_function/cubic_bezier.rs +60 -0
- data/ext/yass/src/declarations/animation/timing_function/init.rs +29 -0
- data/ext/yass/src/declarations/animation/timing_function/keyword.rs +23 -0
- data/ext/yass/src/declarations/animation/timing_function/mod.rs +5 -0
- data/ext/yass/src/declarations/animation/timing_function/piecewise_linear_function.rs +49 -0
- data/ext/yass/src/declarations/animation/timing_function/steps.rs +30 -0
- data/ext/yass/src/declarations/animation/view_function.rs +40 -0
- data/ext/yass/src/declarations/animation_composition.rs +29 -0
- data/ext/yass/src/declarations/animation_delay.rs +30 -0
- data/ext/yass/src/declarations/animation_direction.rs +30 -0
- data/ext/yass/src/declarations/animation_duration.rs +67 -0
- data/ext/yass/src/declarations/animation_fill_mode.rs +30 -0
- data/ext/yass/src/declarations/animation_iteration_count.rs +33 -0
- data/ext/yass/src/declarations/animation_name.rs +23 -0
- data/ext/yass/src/declarations/animation_play_state.rs +28 -0
- data/ext/yass/src/declarations/animation_range_end.rs +30 -0
- data/ext/yass/src/declarations/animation_range_start.rs +30 -0
- data/ext/yass/src/declarations/animation_timeline.rs +42 -0
- data/ext/yass/src/declarations/animation_timing_function.rs +46 -0
- data/ext/yass/src/declarations/aspect_ratio.rs +43 -0
- data/ext/yass/src/declarations/backdrop_filter.rs +30 -0
- data/ext/yass/src/declarations/backface_visibility.rs +20 -0
- data/ext/yass/src/declarations/background_attachment.rs +25 -0
- data/ext/yass/src/declarations/background_blend_mode.rs +42 -0
- data/ext/yass/src/declarations/background_clip.rs +25 -0
- data/ext/yass/src/declarations/background_color.rs +30 -0
- data/ext/yass/src/declarations/background_image.rs +30 -0
- data/ext/yass/src/declarations/background_origin.rs +29 -0
- data/ext/yass/src/declarations/background_position_x.rs +30 -0
- data/ext/yass/src/declarations/background_position_y.rs +30 -0
- data/ext/yass/src/declarations/background_repeat.rs +58 -0
- data/ext/yass/src/declarations/background_size.rs +120 -0
- data/ext/yass/src/declarations/baseline_shift.rs +63 -0
- data/ext/yass/src/declarations/baseline_source.rs +21 -0
- data/ext/yass/src/declarations/block_size.rs +30 -0
- data/ext/yass/src/declarations/border_block_end_color.rs +30 -0
- data/ext/yass/src/declarations/border_block_end_style.rs +19 -0
- data/ext/yass/src/declarations/border_block_end_width.rs +24 -0
- data/ext/yass/src/declarations/border_block_start_color.rs +30 -0
- data/ext/yass/src/declarations/border_block_start_style.rs +19 -0
- data/ext/yass/src/declarations/border_block_start_width.rs +24 -0
- data/ext/yass/src/declarations/border_bottom_color.rs +30 -0
- data/ext/yass/src/declarations/border_bottom_left_radius.rs +40 -0
- data/ext/yass/src/declarations/border_bottom_right_radius.rs +40 -0
- data/ext/yass/src/declarations/border_bottom_style.rs +19 -0
- data/ext/yass/src/declarations/border_bottom_width.rs +24 -0
- data/ext/yass/src/declarations/border_collapse.rs +20 -0
- data/ext/yass/src/declarations/border_end_end_radius.rs +40 -0
- data/ext/yass/src/declarations/border_end_start_radius.rs +40 -0
- data/ext/yass/src/declarations/border_image_outset.rs +73 -0
- data/ext/yass/src/declarations/border_image_repeat.rs +30 -0
- data/ext/yass/src/declarations/border_image_slice.rs +78 -0
- data/ext/yass/src/declarations/border_image_source.rs +28 -0
- data/ext/yass/src/declarations/border_image_width.rs +85 -0
- data/ext/yass/src/declarations/border_inline_end_color.rs +30 -0
- data/ext/yass/src/declarations/border_inline_end_style.rs +19 -0
- data/ext/yass/src/declarations/border_inline_end_width.rs +24 -0
- data/ext/yass/src/declarations/border_inline_start_color.rs +30 -0
- data/ext/yass/src/declarations/border_inline_start_style.rs +19 -0
- data/ext/yass/src/declarations/border_inline_start_width.rs +24 -0
- data/ext/yass/src/declarations/border_left_color.rs +30 -0
- data/ext/yass/src/declarations/border_left_style.rs +19 -0
- data/ext/yass/src/declarations/border_left_width.rs +24 -0
- data/ext/yass/src/declarations/border_right_color.rs +30 -0
- data/ext/yass/src/declarations/border_right_style.rs +19 -0
- data/ext/yass/src/declarations/border_right_width.rs +24 -0
- data/ext/yass/src/declarations/border_spacing.rs +51 -0
- data/ext/yass/src/declarations/border_start_end_radius.rs +40 -0
- data/ext/yass/src/declarations/border_start_start_radius.rs +40 -0
- data/ext/yass/src/declarations/border_style.rs +17 -0
- data/ext/yass/src/declarations/border_top_color.rs +30 -0
- data/ext/yass/src/declarations/border_top_left_radius.rs +40 -0
- data/ext/yass/src/declarations/border_top_right_radius.rs +40 -0
- data/ext/yass/src/declarations/border_top_style.rs +19 -0
- data/ext/yass/src/declarations/border_top_width.rs +24 -0
- data/ext/yass/src/declarations/bottom.rs +28 -0
- data/ext/yass/src/declarations/box_shadow.rs +113 -0
- data/ext/yass/src/declarations/box_sizing.rs +20 -0
- data/ext/yass/src/declarations/calc/abs.rs +32 -0
- data/ext/yass/src/declarations/calc/anchor_function.rs +96 -0
- data/ext/yass/src/declarations/calc/anchor_size_function.rs +84 -0
- data/ext/yass/src/declarations/calc/clamp.rs +58 -0
- data/ext/yass/src/declarations/calc/hypot.rs +30 -0
- data/ext/yass/src/declarations/calc/init.rs +72 -0
- data/ext/yass/src/declarations/calc/invert.rs +32 -0
- data/ext/yass/src/declarations/calc/leaf.rs +36 -0
- data/ext/yass/src/declarations/calc/min_max.rs +40 -0
- data/ext/yass/src/declarations/calc/mod.rs +118 -0
- data/ext/yass/src/declarations/calc/mod_rem.rs +57 -0
- data/ext/yass/src/declarations/calc/negate.rs +32 -0
- data/ext/yass/src/declarations/calc/product.rs +30 -0
- data/ext/yass/src/declarations/calc/round.rs +59 -0
- data/ext/yass/src/declarations/calc/sign.rs +32 -0
- data/ext/yass/src/declarations/calc/sum.rs +30 -0
- data/ext/yass/src/declarations/caption_side.rs +20 -0
- data/ext/yass/src/declarations/caret_color.rs +32 -0
- data/ext/yass/src/declarations/channel_keyword.rs +31 -0
- data/ext/yass/src/declarations/clear.rs +24 -0
- data/ext/yass/src/declarations/clip.rs +135 -0
- data/ext/yass/src/declarations/clip_path/circle_ellipse.rs +168 -0
- data/ext/yass/src/declarations/clip_path/init.rs +267 -0
- data/ext/yass/src/declarations/clip_path/mod.rs +419 -0
- data/ext/yass/src/declarations/clip_path/path.rs +734 -0
- data/ext/yass/src/declarations/clip_path/rect.rs +288 -0
- data/ext/yass/src/declarations/clip_path/shape.rs +672 -0
- data/ext/yass/src/declarations/clip_path/shape_box.rs +71 -0
- data/ext/yass/src/declarations/color/absolute.rs +46 -0
- data/ext/yass/src/declarations/color/absolute_color.rs +53 -0
- data/ext/yass/src/declarations/color/auto.rs +8 -0
- data/ext/yass/src/declarations/color/color.rs +38 -0
- data/ext/yass/src/declarations/color/color_components.rs +25 -0
- data/ext/yass/src/declarations/color/color_function.rs +151 -0
- data/ext/yass/src/declarations/color/color_function_component.rs +61 -0
- data/ext/yass/src/declarations/color/color_interpolation_method.rs +29 -0
- data/ext/yass/src/declarations/color/color_mix.rs +60 -0
- data/ext/yass/src/declarations/color/color_mix_item.rs +43 -0
- data/ext/yass/src/declarations/color/current_color.rs +8 -0
- data/ext/yass/src/declarations/color/init.rs +60 -0
- data/ext/yass/src/declarations/color/light_dark.rs +43 -0
- data/ext/yass/src/declarations/color/mod.rs +69 -0
- data/ext/yass/src/declarations/color/stored_color_function_component.rs +70 -0
- data/ext/yass/src/declarations/color/system_color.rs +60 -0
- data/ext/yass/src/declarations/color_scheme.rs +26 -0
- data/ext/yass/src/declarations/column_count.rs +37 -0
- data/ext/yass/src/declarations/column_gap.rs +74 -0
- data/ext/yass/src/declarations/column_span.rs +20 -0
- data/ext/yass/src/declarations/column_width.rs +70 -0
- data/ext/yass/src/declarations/contain.rs +106 -0
- data/ext/yass/src/declarations/container_name.rs +32 -0
- data/ext/yass/src/declarations/container_type.rs +52 -0
- data/ext/yass/src/declarations/content.rs +309 -0
- data/ext/yass/src/declarations/counter_increment.rs +60 -0
- data/ext/yass/src/declarations/counter_reset.rs +60 -0
- data/ext/yass/src/declarations/csswide_keyword.rs +28 -0
- data/ext/yass/src/declarations/cursor.rs +125 -0
- data/ext/yass/src/declarations/custom.rs +108 -0
- data/ext/yass/src/declarations/declaration.rs +716 -0
- data/ext/yass/src/declarations/direction.rs +20 -0
- data/ext/yass/src/declarations/display.rs +74 -0
- data/ext/yass/src/declarations/empty_cells.rs +20 -0
- data/ext/yass/src/declarations/filter/blur.rs +28 -0
- data/ext/yass/src/declarations/filter/brightness.rs +30 -0
- data/ext/yass/src/declarations/filter/contrast.rs +30 -0
- data/ext/yass/src/declarations/filter/drop_shadow.rs +68 -0
- data/ext/yass/src/declarations/filter/grayscale.rs +30 -0
- data/ext/yass/src/declarations/filter/hue_rotate.rs +28 -0
- data/ext/yass/src/declarations/filter/init.rs +43 -0
- data/ext/yass/src/declarations/filter/invert.rs +30 -0
- data/ext/yass/src/declarations/filter/mod.rs +80 -0
- data/ext/yass/src/declarations/filter/opacity.rs +30 -0
- data/ext/yass/src/declarations/filter/saturate.rs +30 -0
- data/ext/yass/src/declarations/filter/sepia.rs +30 -0
- data/ext/yass/src/declarations/flex_basis.rs +71 -0
- data/ext/yass/src/declarations/flex_direction.rs +22 -0
- data/ext/yass/src/declarations/flex_grow.rs +30 -0
- data/ext/yass/src/declarations/flex_shrink.rs +30 -0
- data/ext/yass/src/declarations/flex_wrap.rs +21 -0
- data/ext/yass/src/declarations/float.rs +23 -0
- data/ext/yass/src/declarations/font_family.rs +28 -0
- data/ext/yass/src/declarations/font_language_override.rs +30 -0
- data/ext/yass/src/declarations/font_optical_sizing.rs +20 -0
- data/ext/yass/src/declarations/font_size.rs +126 -0
- data/ext/yass/src/declarations/font_stretch.rs +102 -0
- data/ext/yass/src/declarations/font_style.rs +101 -0
- data/ext/yass/src/declarations/font_synthesis_weight.rs +20 -0
- data/ext/yass/src/declarations/font_variant_caps.rs +20 -0
- data/ext/yass/src/declarations/font_variation_settings.rs +54 -0
- data/ext/yass/src/declarations/font_weight.rs +85 -0
- data/ext/yass/src/declarations/grid_auto_columns.rs +32 -0
- data/ext/yass/src/declarations/grid_auto_flow.rs +35 -0
- data/ext/yass/src/declarations/grid_auto_rows.rs +33 -0
- data/ext/yass/src/declarations/grid_column_end.rs +39 -0
- data/ext/yass/src/declarations/grid_column_start.rs +39 -0
- data/ext/yass/src/declarations/grid_row_end.rs +39 -0
- data/ext/yass/src/declarations/grid_row_start.rs +39 -0
- data/ext/yass/src/declarations/grid_template.rs +355 -0
- data/ext/yass/src/declarations/grid_template_areas.rs +131 -0
- data/ext/yass/src/declarations/grid_template_columns.rs +31 -0
- data/ext/yass/src/declarations/grid_template_rows.rs +31 -0
- data/ext/yass/src/declarations/height.rs +30 -0
- data/ext/yass/src/declarations/horizontal_position_component.rs +93 -0
- data/ext/yass/src/declarations/image_rendering.rs +21 -0
- data/ext/yass/src/declarations/images/angle_or_percentage.rs +35 -0
- data/ext/yass/src/declarations/images/circle.rs +72 -0
- data/ext/yass/src/declarations/images/conic_gradient.rs +80 -0
- data/ext/yass/src/declarations/images/cross_fade.rs +33 -0
- data/ext/yass/src/declarations/images/cross_fade_element.rs +44 -0
- data/ext/yass/src/declarations/images/cross_fade_image.rs +68 -0
- data/ext/yass/src/declarations/images/ellipse.rs +67 -0
- data/ext/yass/src/declarations/images/ending_shape.rs +38 -0
- data/ext/yass/src/declarations/images/gradient_angle_or_percentage_item.rs +103 -0
- data/ext/yass/src/declarations/images/gradient_length_percentage_item.rs +106 -0
- data/ext/yass/src/declarations/images/image_set.rs +30 -0
- data/ext/yass/src/declarations/images/image_set_item.rs +53 -0
- data/ext/yass/src/declarations/images/init.rs +145 -0
- data/ext/yass/src/declarations/images/light_dark.rs +40 -0
- data/ext/yass/src/declarations/images/line_direction.rs +100 -0
- data/ext/yass/src/declarations/images/linear_gradient.rs +75 -0
- data/ext/yass/src/declarations/images/mod.rs +93 -0
- data/ext/yass/src/declarations/images/none.rs +8 -0
- data/ext/yass/src/declarations/images/position.rs +40 -0
- data/ext/yass/src/declarations/images/radial_gradient.rs +86 -0
- data/ext/yass/src/declarations/images/url.rs +28 -0
- data/ext/yass/src/declarations/init.rs +1620 -0
- data/ext/yass/src/declarations/inline_size.rs +30 -0
- data/ext/yass/src/declarations/inset.rs +114 -0
- data/ext/yass/src/declarations/inset_block_end.rs +28 -0
- data/ext/yass/src/declarations/inset_block_start.rs +28 -0
- data/ext/yass/src/declarations/inset_inline_end.rs +28 -0
- data/ext/yass/src/declarations/inset_inline_start.rs +28 -0
- data/ext/yass/src/declarations/isolation.rs +20 -0
- data/ext/yass/src/declarations/justify_content.rs +19 -0
- data/ext/yass/src/declarations/justify_items.rs +37 -0
- data/ext/yass/src/declarations/justify_self.rs +19 -0
- data/ext/yass/src/declarations/left.rs +28 -0
- data/ext/yass/src/declarations/length.rs +230 -0
- data/ext/yass/src/declarations/letter_spacing.rs +47 -0
- data/ext/yass/src/declarations/line_break.rs +23 -0
- data/ext/yass/src/declarations/line_height.rs +51 -0
- data/ext/yass/src/declarations/list_style_image.rs +28 -0
- data/ext/yass/src/declarations/list_style_position.rs +20 -0
- data/ext/yass/src/declarations/list_style_type.rs +132 -0
- data/ext/yass/src/declarations/margin.rs +103 -0
- data/ext/yass/src/declarations/margin_block_end.rs +28 -0
- data/ext/yass/src/declarations/margin_block_start.rs +28 -0
- data/ext/yass/src/declarations/margin_bottom.rs +28 -0
- data/ext/yass/src/declarations/margin_inline_end.rs +28 -0
- data/ext/yass/src/declarations/margin_inline_start.rs +28 -0
- data/ext/yass/src/declarations/margin_left.rs +28 -0
- data/ext/yass/src/declarations/margin_right.rs +28 -0
- data/ext/yass/src/declarations/margin_top.rs +28 -0
- data/ext/yass/src/declarations/mask_image.rs +30 -0
- data/ext/yass/src/declarations/max_block_size.rs +30 -0
- data/ext/yass/src/declarations/max_height.rs +30 -0
- data/ext/yass/src/declarations/max_inline_size.rs +30 -0
- data/ext/yass/src/declarations/max_width.rs +30 -0
- data/ext/yass/src/declarations/min_block_size.rs +30 -0
- data/ext/yass/src/declarations/min_height.rs +30 -0
- data/ext/yass/src/declarations/min_inline_size.rs +30 -0
- data/ext/yass/src/declarations/min_width.rs +30 -0
- data/ext/yass/src/declarations/mix_blend_mode.rs +35 -0
- data/ext/yass/src/declarations/mod.rs +257 -0
- data/ext/yass/src/declarations/number.rs +16 -0
- data/ext/yass/src/declarations/object_fit.rs +23 -0
- data/ext/yass/src/declarations/object_position.rs +40 -0
- data/ext/yass/src/declarations/offset_path.rs +275 -0
- data/ext/yass/src/declarations/opacity.rs +39 -0
- data/ext/yass/src/declarations/order.rs +17 -0
- data/ext/yass/src/declarations/outline_color.rs +30 -0
- data/ext/yass/src/declarations/outline_offset.rs +22 -0
- data/ext/yass/src/declarations/outline_style.rs +22 -0
- data/ext/yass/src/declarations/outline_width.rs +24 -0
- data/ext/yass/src/declarations/overflow.rs +12 -0
- data/ext/yass/src/declarations/overflow_block.rs +19 -0
- data/ext/yass/src/declarations/overflow_clip_margin.rs +40 -0
- data/ext/yass/src/declarations/overflow_inline.rs +19 -0
- data/ext/yass/src/declarations/overflow_wrap.rs +21 -0
- data/ext/yass/src/declarations/overflow_x.rs +19 -0
- data/ext/yass/src/declarations/overflow_y.rs +19 -0
- data/ext/yass/src/declarations/padding_block_end.rs +30 -0
- data/ext/yass/src/declarations/padding_block_start.rs +30 -0
- data/ext/yass/src/declarations/padding_bottom.rs +30 -0
- data/ext/yass/src/declarations/padding_inline_end.rs +30 -0
- data/ext/yass/src/declarations/padding_inline_start.rs +30 -0
- data/ext/yass/src/declarations/padding_left.rs +30 -0
- data/ext/yass/src/declarations/padding_right.rs +30 -0
- data/ext/yass/src/declarations/padding_top.rs +30 -0
- data/ext/yass/src/declarations/percentage.rs +16 -0
- data/ext/yass/src/declarations/perspective.rs +72 -0
- data/ext/yass/src/declarations/perspective_origin.rs +41 -0
- data/ext/yass/src/declarations/pointer_events.rs +20 -0
- data/ext/yass/src/declarations/position.rs +23 -0
- data/ext/yass/src/declarations/position_area.rs +82 -0
- data/ext/yass/src/declarations/position_try_fallbacks.rs +175 -0
- data/ext/yass/src/declarations/quotes.rs +107 -0
- data/ext/yass/src/declarations/resolution.rs +17 -0
- data/ext/yass/src/declarations/right.rs +28 -0
- data/ext/yass/src/declarations/rotate.rs +103 -0
- data/ext/yass/src/declarations/row_gap.rs +74 -0
- data/ext/yass/src/declarations/scale.rs +90 -0
- data/ext/yass/src/declarations/servo_overflow_clip_box.rs +20 -0
- data/ext/yass/src/declarations/servo_top_layer.rs +20 -0
- data/ext/yass/src/declarations/size/anchor_max_size_function.rs +53 -0
- data/ext/yass/src/declarations/size/anchor_size_function.rs +56 -0
- data/ext/yass/src/declarations/size/anchor_size_keyword.rs +25 -0
- data/ext/yass/src/declarations/size/init.rs +45 -0
- data/ext/yass/src/declarations/size/mod.rs +227 -0
- data/ext/yass/src/declarations/table_layout.rs +20 -0
- data/ext/yass/src/declarations/text_align.rs +31 -0
- data/ext/yass/src/declarations/text_align_last.rs +25 -0
- data/ext/yass/src/declarations/text_decoration_color.rs +30 -0
- data/ext/yass/src/declarations/text_decoration_line.rs +77 -0
- data/ext/yass/src/declarations/text_decoration_style.rs +24 -0
- data/ext/yass/src/declarations/text_indent.rs +40 -0
- data/ext/yass/src/declarations/text_justify.rs +22 -0
- data/ext/yass/src/declarations/text_overflow.rs +86 -0
- data/ext/yass/src/declarations/text_rendering.rs +22 -0
- data/ext/yass/src/declarations/text_shadow.rs +98 -0
- data/ext/yass/src/declarations/text_transform.rs +50 -0
- data/ext/yass/src/declarations/text_wrap_mode.rs +20 -0
- data/ext/yass/src/declarations/time.rs +21 -0
- data/ext/yass/src/declarations/top.rs +28 -0
- data/ext/yass/src/declarations/track_breadth.rs +88 -0
- data/ext/yass/src/declarations/track_size.rs +71 -0
- data/ext/yass/src/declarations/transform.rs +844 -0
- data/ext/yass/src/declarations/transform_origin.rs +99 -0
- data/ext/yass/src/declarations/transform_style.rs +20 -0
- data/ext/yass/src/declarations/transition_behavior.rs +28 -0
- data/ext/yass/src/declarations/transition_delay.rs +30 -0
- data/ext/yass/src/declarations/transition_duration.rs +30 -0
- data/ext/yass/src/declarations/transition_property.rs +122 -0
- data/ext/yass/src/declarations/transition_timing_function.rs +46 -0
- data/ext/yass/src/declarations/translate.rs +84 -0
- data/ext/yass/src/declarations/unicode_bidi.rs +24 -0
- data/ext/yass/src/declarations/vertical_position_component.rs +93 -0
- data/ext/yass/src/declarations/view_transition_class.rs +31 -0
- data/ext/yass/src/declarations/view_transition_name.rs +18 -0
- data/ext/yass/src/declarations/visibility.rs +21 -0
- data/ext/yass/src/declarations/webkit_text_security.rs +22 -0
- data/ext/yass/src/declarations/white_space_collapse.rs +22 -0
- data/ext/yass/src/declarations/width.rs +30 -0
- data/ext/yass/src/declarations/will_change.rs +83 -0
- data/ext/yass/src/declarations/with_variables.rs +35 -0
- data/ext/yass/src/declarations/word_break.rs +21 -0
- data/ext/yass/src/declarations/word_spacing.rs +47 -0
- data/ext/yass/src/declarations/writing_mode.rs +21 -0
- data/ext/yass/src/declarations/xlang.rs +21 -0
- data/ext/yass/src/declarations/zindex.rs +61 -0
- data/ext/yass/src/declarations/zoom.rs +87 -0
- data/ext/yass/src/general/init.rs +15 -0
- data/ext/yass/src/general/mod.rs +43 -0
- data/ext/yass/src/lib.rs +72 -0
- data/ext/yass/src/optional_cached_value.rs +33 -0
- data/ext/yass/src/rules/font_face_rule.rs +206 -0
- data/ext/yass/src/rules/fonts/family.rs +98 -0
- data/ext/yass/src/rules/fonts/init.rs +81 -0
- data/ext/yass/src/rules/fonts/metrics.rs +26 -0
- data/ext/yass/src/rules/fonts/mod.rs +7 -0
- data/ext/yass/src/rules/fonts/source.rs +126 -0
- data/ext/yass/src/rules/fonts/stretch.rs +96 -0
- data/ext/yass/src/rules/fonts/style.rs +59 -0
- data/ext/yass/src/rules/fonts/weight.rs +74 -0
- data/ext/yass/src/rules/init.rs +89 -0
- data/ext/yass/src/rules/media_rule.rs +474 -0
- data/ext/yass/src/rules/mod.rs +6 -0
- data/ext/yass/src/rules/rule.rs +33 -0
- data/ext/yass/src/rules/style_rule.rs +82 -0
- data/ext/yass/src/selectors/an_plus_b.rs +21 -0
- data/ext/yass/src/selectors/attribute_in_no_namespace.rs +34 -0
- data/ext/yass/src/selectors/attribute_in_no_namespace_exists.rs +16 -0
- data/ext/yass/src/selectors/attribute_other.rs +41 -0
- data/ext/yass/src/selectors/class.rs +16 -0
- data/ext/yass/src/selectors/combinator.rs +49 -0
- data/ext/yass/src/selectors/default_namespace.rs +16 -0
- data/ext/yass/src/selectors/has.rs +31 -0
- data/ext/yass/src/selectors/host.rs +35 -0
- data/ext/yass/src/selectors/id.rs +16 -0
- data/ext/yass/src/selectors/init.rs +146 -0
- data/ext/yass/src/selectors/is.rs +27 -0
- data/ext/yass/src/selectors/local_name.rs +18 -0
- data/ext/yass/src/selectors/mod.rs +54 -0
- data/ext/yass/src/selectors/namespace.rs +21 -0
- data/ext/yass/src/selectors/negation.rs +27 -0
- data/ext/yass/src/selectors/non_ts_pseudo_class.rs +63 -0
- data/ext/yass/src/selectors/nth.rs +51 -0
- data/ext/yass/src/selectors/nth_of.rs +43 -0
- data/ext/yass/src/selectors/part.rs +22 -0
- data/ext/yass/src/selectors/relative_selector.rs +40 -0
- data/ext/yass/src/selectors/selector.rs +230 -0
- data/ext/yass/src/selectors/selector_child.rs +460 -0
- data/ext/yass/src/selectors/selector_list.rs +27 -0
- data/ext/yass/src/selectors/slotted.rs +28 -0
- data/ext/yass/src/selectors/specific_namespace_constraint.rs +21 -0
- data/ext/yass/src/selectors/unit_selectors.rs +87 -0
- data/ext/yass/src/selectors/where.rs +27 -0
- data/ext/yass/src/sheet.rs +42 -0
- data/ext/yass/src/utils.rs +9 -0
- data/lib/yass/declarations.rb +7975 -0
- data/lib/yass/general.rb +31 -0
- data/lib/yass/node.rb +9 -0
- data/lib/yass/rules.rb +515 -0
- data/lib/yass/selectors.rb +325 -0
- data/lib/yass/stylesheet.rb +13 -0
- data/lib/yass/version.rb +5 -0
- data/lib/yass/visitor.rb +2463 -0
- data/lib/yass.rb +49 -0
- data/scripts/build_all.sh +44 -0
- data/scripts/detect.rb +39 -0
- data/scripts/wpt.rb +20 -0
- metadata +486 -0
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
use magnus::{DataTypeFunctions, Error, IntoValue, RArray, Ruby, TypedData, Value, gc, typed_data};
|
|
2
|
+
use style::{
|
|
3
|
+
properties::longhands::box_shadow::{SingleSpecifiedValue, SpecifiedValue},
|
|
4
|
+
values::specified::{Color, Length, NonNegativeLength},
|
|
5
|
+
};
|
|
6
|
+
|
|
7
|
+
use crate::{
|
|
8
|
+
cached_value::CachedValue,
|
|
9
|
+
cached_value_list::CachedValueList,
|
|
10
|
+
declarations::{color::color::make_color, length::length_to_value},
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
#[derive(TypedData)]
|
|
14
|
+
#[magnus(class = "Yass::Declarations::BoxShadow", mark)]
|
|
15
|
+
pub struct YBoxShadow {
|
|
16
|
+
values: CachedValueList<SingleSpecifiedValue>,
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
impl YBoxShadow {
|
|
20
|
+
pub fn new(specified_value: SpecifiedValue) -> Self {
|
|
21
|
+
Self {
|
|
22
|
+
values: CachedValueList::new(specified_value.0.to_vec(), |value, _ctx, ruby| {
|
|
23
|
+
YBoxShadowShadow::new(value.clone()).into_value_with(ruby)
|
|
24
|
+
}),
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
pub fn values(ruby: &Ruby, rb_self: typed_data::Obj<Self>) -> Result<RArray, Error> {
|
|
29
|
+
rb_self.values.to_a(ruby)
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
impl DataTypeFunctions for YBoxShadow {
|
|
34
|
+
fn mark(&self, marker: &gc::Marker) {
|
|
35
|
+
self.values.mark(marker);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
#[derive(TypedData)]
|
|
40
|
+
#[magnus(class = "Yass::Declarations::BoxShadow::Shadow", mark)]
|
|
41
|
+
pub struct YBoxShadowShadow {
|
|
42
|
+
color: CachedValue<Option<Color>>,
|
|
43
|
+
horizontal: CachedValue<Length>,
|
|
44
|
+
vertical: CachedValue<Length>,
|
|
45
|
+
blur: CachedValue<Option<NonNegativeLength>>,
|
|
46
|
+
spread: CachedValue<Option<Length>>,
|
|
47
|
+
inset: bool,
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
impl YBoxShadowShadow {
|
|
51
|
+
pub fn new(value: SingleSpecifiedValue) -> Self {
|
|
52
|
+
Self {
|
|
53
|
+
color: CachedValue::new(value.base.color, |color, ruby| match color {
|
|
54
|
+
Some(color) => make_color(color, ruby),
|
|
55
|
+
None => ruby.qnil().into_value_with(ruby),
|
|
56
|
+
}),
|
|
57
|
+
|
|
58
|
+
horizontal: CachedValue::new(value.base.horizontal, |length, ruby| {
|
|
59
|
+
length_to_value(length, ruby)
|
|
60
|
+
}),
|
|
61
|
+
|
|
62
|
+
vertical: CachedValue::new(value.base.vertical, |length, ruby| {
|
|
63
|
+
length_to_value(length, ruby)
|
|
64
|
+
}),
|
|
65
|
+
|
|
66
|
+
blur: CachedValue::new(value.base.blur, |blur, ruby| match blur {
|
|
67
|
+
Some(blur) => length_to_value(&blur.0, ruby),
|
|
68
|
+
None => ruby.qnil().into_value_with(ruby),
|
|
69
|
+
}),
|
|
70
|
+
|
|
71
|
+
spread: CachedValue::new(value.spread, |spread, ruby| match spread {
|
|
72
|
+
Some(spread) => length_to_value(spread, ruby),
|
|
73
|
+
None => ruby.qnil().into_value_with(ruby),
|
|
74
|
+
}),
|
|
75
|
+
|
|
76
|
+
inset: value.inset,
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
pub fn color(ruby: &Ruby, rb_self: typed_data::Obj<Self>) -> Value {
|
|
81
|
+
rb_self.color.get(ruby)
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
pub fn horizontal(ruby: &Ruby, rb_self: typed_data::Obj<Self>) -> Value {
|
|
85
|
+
rb_self.horizontal.get(ruby)
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
pub fn vertical(ruby: &Ruby, rb_self: typed_data::Obj<Self>) -> Value {
|
|
89
|
+
rb_self.vertical.get(ruby)
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
pub fn blur(ruby: &Ruby, rb_self: typed_data::Obj<Self>) -> Value {
|
|
93
|
+
rb_self.blur.get(ruby)
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
pub fn spread(ruby: &Ruby, rb_self: typed_data::Obj<Self>) -> Value {
|
|
97
|
+
rb_self.spread.get(ruby)
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
pub fn is_inset(_ruby: &Ruby, rb_self: typed_data::Obj<Self>) -> bool {
|
|
101
|
+
rb_self.inset
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
impl DataTypeFunctions for YBoxShadowShadow {
|
|
106
|
+
fn mark(&self, marker: &gc::Marker) {
|
|
107
|
+
self.color.mark(marker);
|
|
108
|
+
self.horizontal.mark(marker);
|
|
109
|
+
self.vertical.mark(marker);
|
|
110
|
+
self.blur.mark(marker);
|
|
111
|
+
self.spread.mark(marker);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
use magnus::{Ruby, typed_data, value::Id};
|
|
2
|
+
use style::properties::longhands::box_sizing::SpecifiedValue;
|
|
3
|
+
|
|
4
|
+
#[magnus::wrap(class = "Yass::Declarations::BoxSizing")]
|
|
5
|
+
pub struct YBoxSizing {
|
|
6
|
+
specified_value: SpecifiedValue
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
impl YBoxSizing {
|
|
10
|
+
pub fn new(specified_value: SpecifiedValue) -> Self {
|
|
11
|
+
Self { specified_value }
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
pub fn value(ruby: &Ruby, rb_self: typed_data::Obj<Self>) -> Id {
|
|
15
|
+
match rb_self.specified_value {
|
|
16
|
+
SpecifiedValue::ContentBox => ruby.intern("content_box"),
|
|
17
|
+
SpecifiedValue::BorderBox => ruby.intern("border_box"),
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
use magnus::{DataTypeFunctions, Error, RArray, Ruby, TypedData, gc, typed_data};
|
|
2
|
+
use style::values::specified::calc::CalcNode;
|
|
3
|
+
|
|
4
|
+
use crate::{cached_value::CachedValue, declarations::calc::YCalc};
|
|
5
|
+
|
|
6
|
+
#[derive(TypedData)]
|
|
7
|
+
#[magnus(class = "Yass::Declarations::Calc::Abs", mark)]
|
|
8
|
+
pub struct YAbs {
|
|
9
|
+
child: CachedValue<CalcNode>
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
impl YAbs {
|
|
13
|
+
pub fn new(child: CalcNode) -> Self {
|
|
14
|
+
Self {
|
|
15
|
+
child: CachedValue::new(child, |calc_node, ruby| {
|
|
16
|
+
YCalc::make_node(calc_node, ruby)
|
|
17
|
+
})
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
pub fn children(ruby: &Ruby, rb_self: typed_data::Obj<Self>) -> Result<RArray, Error> {
|
|
22
|
+
let result = ruby.ary_new_capa(1);
|
|
23
|
+
result.push(rb_self.child.get(ruby))?;
|
|
24
|
+
Ok(result)
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
impl DataTypeFunctions for YAbs {
|
|
29
|
+
fn mark(&self, marker: &gc::Marker) {
|
|
30
|
+
self.child.mark(marker);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
use magnus::{DataTypeFunctions, Error, IntoValue, RArray, Ruby, TypedData, Value, gc, typed_data, value::Id};
|
|
2
|
+
use style::values::{generics::{Optional, position::{AnchorSideKeyword, GenericAnchorFunction, GenericAnchorSide}}, specified::calc::CalcNode};
|
|
3
|
+
|
|
4
|
+
use crate::{cached_value::CachedValue, declarations::calc::YCalc};
|
|
5
|
+
|
|
6
|
+
#[derive(TypedData)]
|
|
7
|
+
#[magnus(class = "Yass::Declarations::Calc::AnchorFunction", mark)]
|
|
8
|
+
pub struct YAnchorFunction {
|
|
9
|
+
target_element: CachedValue<String>,
|
|
10
|
+
side: CachedValue<GenericAnchorSide<Box<CalcNode>>>,
|
|
11
|
+
fallback: CachedValue<Optional<Box<CalcNode>>>
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
impl YAnchorFunction {
|
|
15
|
+
pub fn new(anchor_function: GenericAnchorFunction<Box<CalcNode>, Box<CalcNode>>) -> Self {
|
|
16
|
+
Self {
|
|
17
|
+
target_element: CachedValue::new(anchor_function.target_element.value.0.to_string(), |el, ruby| {
|
|
18
|
+
ruby.str_new(el).into_value_with(ruby)
|
|
19
|
+
}),
|
|
20
|
+
|
|
21
|
+
side: CachedValue::new(anchor_function.side, |side, ruby| {
|
|
22
|
+
match side {
|
|
23
|
+
GenericAnchorSide::Percentage(p) => {
|
|
24
|
+
YCalc::make_node(p, ruby)
|
|
25
|
+
},
|
|
26
|
+
|
|
27
|
+
GenericAnchorSide::Keyword(k) => {
|
|
28
|
+
YAnchorSideKeyword::new(k.clone()).into_value_with(ruby)
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}),
|
|
32
|
+
|
|
33
|
+
fallback: CachedValue::new(anchor_function.fallback, |fallback, ruby| {
|
|
34
|
+
match fallback {
|
|
35
|
+
Optional::Some(fb) => YCalc::make_node(fb, ruby),
|
|
36
|
+
Optional::None => ruby.qnil().into_value_with(ruby)
|
|
37
|
+
}
|
|
38
|
+
})
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
pub fn target_element(ruby: &Ruby, rb_self: typed_data::Obj<Self>) -> Value {
|
|
43
|
+
rb_self.target_element.get(ruby)
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
pub fn side(ruby: &Ruby, rb_self: typed_data::Obj<Self>) -> Value {
|
|
47
|
+
rb_self.side.get(ruby)
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
pub fn fallback(ruby: &Ruby, rb_self: typed_data::Obj<Self>) -> Value {
|
|
51
|
+
rb_self.fallback.get(ruby)
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
pub fn children(ruby: &Ruby, rb_self: typed_data::Obj<Self>) -> Result<RArray, Error> {
|
|
55
|
+
let result = ruby.ary_new_capa(3);
|
|
56
|
+
result.push(rb_self.target_element.get(ruby))?;
|
|
57
|
+
result.push(rb_self.side.get(ruby))?;
|
|
58
|
+
result.push(rb_self.fallback.get(ruby))?;
|
|
59
|
+
Ok(result)
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
impl DataTypeFunctions for YAnchorFunction {
|
|
64
|
+
fn mark(&self, marker: &gc::Marker) {
|
|
65
|
+
self.target_element.mark(marker);
|
|
66
|
+
self.side.mark(marker);
|
|
67
|
+
self.fallback.mark(marker);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
#[magnus::wrap(class = "Yass::Declarations::Calc::AnchorSideKeyword")]
|
|
72
|
+
pub struct YAnchorSideKeyword {
|
|
73
|
+
anchor_side_keyword: AnchorSideKeyword
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
impl YAnchorSideKeyword {
|
|
77
|
+
pub fn new(anchor_side_keyword: AnchorSideKeyword) -> Self {
|
|
78
|
+
Self { anchor_side_keyword }
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
pub fn value(ruby: &Ruby, rb_self: typed_data::Obj<Self>) -> Id {
|
|
82
|
+
match rb_self.anchor_side_keyword {
|
|
83
|
+
AnchorSideKeyword::Inside => ruby.intern("inside"),
|
|
84
|
+
AnchorSideKeyword::Outside => ruby.intern("outside"),
|
|
85
|
+
AnchorSideKeyword::Top => ruby.intern("top"),
|
|
86
|
+
AnchorSideKeyword::Left => ruby.intern("left"),
|
|
87
|
+
AnchorSideKeyword::Right => ruby.intern("right"),
|
|
88
|
+
AnchorSideKeyword::Bottom => ruby.intern("bottom"),
|
|
89
|
+
AnchorSideKeyword::Start => ruby.intern("start"),
|
|
90
|
+
AnchorSideKeyword::End => ruby.intern("end"),
|
|
91
|
+
AnchorSideKeyword::SelfStart => ruby.intern("self_start"),
|
|
92
|
+
AnchorSideKeyword::SelfEnd => ruby.intern("self_end"),
|
|
93
|
+
AnchorSideKeyword::Center => ruby.intern("center"),
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
use magnus::{DataTypeFunctions, Error, IntoValue, RArray, Ruby, TypedData, Value, gc, typed_data, value::Id};
|
|
2
|
+
use style::values::{generics::{Optional, length::{AnchorSizeKeyword, GenericAnchorSizeFunction}}, specified::calc::CalcNode};
|
|
3
|
+
|
|
4
|
+
use crate::{cached_value::CachedValue, declarations::calc::YCalc};
|
|
5
|
+
|
|
6
|
+
#[derive(TypedData)]
|
|
7
|
+
#[magnus(class = "Yass::Declarations::Calc::AnchorSizeFunction", mark)]
|
|
8
|
+
pub struct YAnchorSizeFunction {
|
|
9
|
+
target_element: CachedValue<String>,
|
|
10
|
+
size: CachedValue<AnchorSizeKeyword>,
|
|
11
|
+
fallback: CachedValue<Optional<Box<CalcNode>>>
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
impl YAnchorSizeFunction {
|
|
15
|
+
pub fn new(anchor_size: GenericAnchorSizeFunction<Box<CalcNode>>) -> Self {
|
|
16
|
+
Self {
|
|
17
|
+
target_element: CachedValue::new(anchor_size.target_element.value.0.to_string(), |el, ruby| {
|
|
18
|
+
ruby.str_new(el).into_value_with(ruby)
|
|
19
|
+
}),
|
|
20
|
+
|
|
21
|
+
size: CachedValue::new(anchor_size.size, |size, ruby| {
|
|
22
|
+
YAnchorSizeKeyword::new(*size).into_value_with(ruby)
|
|
23
|
+
}),
|
|
24
|
+
|
|
25
|
+
fallback: CachedValue::new(anchor_size.fallback, |fallback, ruby| {
|
|
26
|
+
match fallback {
|
|
27
|
+
Optional::Some(fb) => YCalc::make_node(fb, ruby),
|
|
28
|
+
Optional::None => ruby.qnil().into_value_with(ruby)
|
|
29
|
+
}
|
|
30
|
+
})
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
pub fn target_element(ruby: &Ruby, rb_self: typed_data::Obj<Self>) -> Value {
|
|
35
|
+
rb_self.target_element.get(ruby)
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
pub fn size(ruby: &Ruby, rb_self: typed_data::Obj<Self>) -> Value {
|
|
39
|
+
rb_self.size.get(ruby)
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
pub fn fallback(ruby: &Ruby, rb_self: typed_data::Obj<Self>) -> Value {
|
|
43
|
+
rb_self.fallback.get(ruby)
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
pub fn children(ruby: &Ruby, rb_self: typed_data::Obj<Self>) -> Result<RArray, Error> {
|
|
47
|
+
let result = ruby.ary_new_capa(3);
|
|
48
|
+
result.push(rb_self.target_element.get(ruby))?;
|
|
49
|
+
result.push(rb_self.size.get(ruby))?;
|
|
50
|
+
result.push(rb_self.fallback.get(ruby))?;
|
|
51
|
+
Ok(result)
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
impl DataTypeFunctions for YAnchorSizeFunction {
|
|
56
|
+
fn mark(&self, marker: &gc::Marker) {
|
|
57
|
+
self.target_element.mark(marker);
|
|
58
|
+
self.size.mark(marker);
|
|
59
|
+
self.fallback.mark(marker);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
#[magnus::wrap(class = "Yass::Declarations::Calc::AnchorSizeKeyword")]
|
|
64
|
+
pub struct YAnchorSizeKeyword {
|
|
65
|
+
anchor_size_keyword: AnchorSizeKeyword
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
impl YAnchorSizeKeyword {
|
|
69
|
+
pub fn new(anchor_size_keyword: AnchorSizeKeyword) -> Self {
|
|
70
|
+
Self { anchor_size_keyword }
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
pub fn value(ruby: &Ruby, rb_self: typed_data::Obj<Self>) -> Id {
|
|
74
|
+
match rb_self.anchor_size_keyword {
|
|
75
|
+
AnchorSizeKeyword::None => unreachable!(),
|
|
76
|
+
AnchorSizeKeyword::Width => ruby.intern("width"),
|
|
77
|
+
AnchorSizeKeyword::Height => ruby.intern("height"),
|
|
78
|
+
AnchorSizeKeyword::Block => ruby.intern("block"),
|
|
79
|
+
AnchorSizeKeyword::Inline => ruby.intern("inline"),
|
|
80
|
+
AnchorSizeKeyword::SelfBlock => ruby.intern("self_block"),
|
|
81
|
+
AnchorSizeKeyword::SelfInline => ruby.intern("self_inline"),
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
use magnus::{DataTypeFunctions, Error, RArray, Ruby, TypedData, Value, gc, typed_data};
|
|
2
|
+
use style::values::specified::calc::CalcNode;
|
|
3
|
+
|
|
4
|
+
use crate::{cached_value::CachedValue, declarations::calc::YCalc};
|
|
5
|
+
|
|
6
|
+
#[derive(TypedData)]
|
|
7
|
+
#[magnus(class = "Yass::Declarations::Calc::Clamp", mark)]
|
|
8
|
+
pub struct YClamp {
|
|
9
|
+
min: CachedValue<CalcNode>,
|
|
10
|
+
center: CachedValue<CalcNode>,
|
|
11
|
+
max: CachedValue<CalcNode>
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
impl YClamp {
|
|
15
|
+
pub fn new(min: CalcNode, center: CalcNode, max: CalcNode) -> Self {
|
|
16
|
+
Self {
|
|
17
|
+
min: CachedValue::new(min, |calc_node, ruby| {
|
|
18
|
+
YCalc::make_node(calc_node, ruby)
|
|
19
|
+
}),
|
|
20
|
+
|
|
21
|
+
center: CachedValue::new(center, |calc_node, ruby| {
|
|
22
|
+
YCalc::make_node(calc_node, ruby)
|
|
23
|
+
}),
|
|
24
|
+
|
|
25
|
+
max: CachedValue::new(max, |calc_node, ruby| {
|
|
26
|
+
YCalc::make_node(calc_node, ruby)
|
|
27
|
+
})
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
pub fn children(ruby: &Ruby, rb_self: typed_data::Obj<Self>) -> Result<RArray, Error> {
|
|
32
|
+
let result = ruby.ary_new_capa(3);
|
|
33
|
+
result.push(rb_self.min.get(ruby))?;
|
|
34
|
+
result.push(rb_self.center.get(ruby))?;
|
|
35
|
+
result.push(rb_self.max.get(ruby))?;
|
|
36
|
+
Ok(result)
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
pub fn min(ruby: &Ruby, rb_self: typed_data::Obj<Self>) -> Value {
|
|
40
|
+
rb_self.min.get(ruby)
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
pub fn center(ruby: &Ruby, rb_self: typed_data::Obj<Self>) -> Value {
|
|
44
|
+
rb_self.center.get(ruby)
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
pub fn max(ruby: &Ruby, rb_self: typed_data::Obj<Self>) -> Value {
|
|
48
|
+
rb_self.max.get(ruby)
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
impl DataTypeFunctions for YClamp {
|
|
53
|
+
fn mark(&self, marker: &gc::Marker) {
|
|
54
|
+
self.min.mark(marker);
|
|
55
|
+
self.center.mark(marker);
|
|
56
|
+
self.max.mark(marker);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
use magnus::{DataTypeFunctions, Error, RArray, Ruby, TypedData, gc, typed_data};
|
|
2
|
+
use style::{OwnedSlice, values::specified::calc::CalcNode};
|
|
3
|
+
|
|
4
|
+
use crate::{declarations::calc::YCalc, cached_value_list::CachedValueList};
|
|
5
|
+
|
|
6
|
+
#[derive(TypedData)]
|
|
7
|
+
#[magnus(class = "Yass::Declarations::Calc::Hypot", mark)]
|
|
8
|
+
pub struct YHypot {
|
|
9
|
+
children: CachedValueList<CalcNode>
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
impl YHypot {
|
|
13
|
+
pub fn new(children: &OwnedSlice<CalcNode>) -> Self {
|
|
14
|
+
Self {
|
|
15
|
+
children: CachedValueList::new(children.to_vec(), |calc_node, _ctx, ruby| {
|
|
16
|
+
YCalc::make_node(calc_node, ruby)
|
|
17
|
+
})
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
pub fn children(ruby: &Ruby, rb_self: typed_data::Obj<Self>) -> Result<RArray, Error> {
|
|
22
|
+
rb_self.children.to_a(ruby)
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
impl DataTypeFunctions for YHypot {
|
|
27
|
+
fn mark(&self, marker: &gc::Marker) {
|
|
28
|
+
self.children.mark(marker);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
use magnus::{Error, Module, RModule, Ruby, method};
|
|
2
|
+
|
|
3
|
+
use crate::declarations::calc::{YCalc, abs::YAbs, anchor_function::{YAnchorFunction, YAnchorSideKeyword}, anchor_size_function::{YAnchorSizeFunction, YAnchorSizeKeyword}, clamp::YClamp, hypot::YHypot, invert::YInvert, min_max::YMinMax, mod_rem::YModRem, negate::YNegate, product::YProduct, round::YRound, sign::YSign, sum::YSum};
|
|
4
|
+
|
|
5
|
+
pub fn init(ruby: &Ruby, _yass_module: &RModule, declarations_module: &RModule) -> Result<(), Error> {
|
|
6
|
+
let calc_class = declarations_module.define_class("Calc", ruby.class_object())?;
|
|
7
|
+
calc_class.define_method("clamping_mode", method!(YCalc::clamping_mode, 0))?;
|
|
8
|
+
calc_class.define_method("root", method!(YCalc::root, 0))?;
|
|
9
|
+
|
|
10
|
+
let abs_class = calc_class.define_class("Abs", ruby.class_object())?;
|
|
11
|
+
abs_class.define_method("children", method!(YAbs::children, 0))?;
|
|
12
|
+
|
|
13
|
+
let anchor_function_class = calc_class.define_class("AnchorFunction", ruby.class_object())?;
|
|
14
|
+
anchor_function_class.define_method("children", method!(YAnchorFunction::children, 0))?;
|
|
15
|
+
anchor_function_class.define_method("target_element", method!(YAnchorFunction::target_element, 0))?;
|
|
16
|
+
anchor_function_class.define_method("side", method!(YAnchorFunction::side, 0))?;
|
|
17
|
+
anchor_function_class.define_method("fallback", method!(YAnchorFunction::fallback, 0))?;
|
|
18
|
+
|
|
19
|
+
let anchor_side_keyword_class = calc_class.define_class("AnchorSideKeyword", ruby.class_object())?;
|
|
20
|
+
anchor_side_keyword_class.define_method("value", method!(YAnchorSideKeyword::value, 0))?;
|
|
21
|
+
|
|
22
|
+
let anchor_size_function_class = calc_class.define_class("AnchorSizeFunction", ruby.class_object())?;
|
|
23
|
+
anchor_size_function_class.define_method("children", method!(YAnchorSizeFunction::children, 0))?;
|
|
24
|
+
anchor_size_function_class.define_method("target_element", method!(YAnchorSizeFunction::target_element, 0))?;
|
|
25
|
+
anchor_size_function_class.define_method("size", method!(YAnchorSizeFunction::size, 0))?;
|
|
26
|
+
anchor_size_function_class.define_method("fallback", method!(YAnchorSizeFunction::fallback, 0))?;
|
|
27
|
+
|
|
28
|
+
let anchor_size_keyword_class = calc_class.define_class("AnchorSizeKeyword", ruby.class_object())?;
|
|
29
|
+
anchor_size_keyword_class.define_method("value", method!(YAnchorSizeKeyword::value, 0))?;
|
|
30
|
+
|
|
31
|
+
let clamp_class = calc_class.define_class("Clamp", ruby.class_object())?;
|
|
32
|
+
clamp_class.define_method("children", method!(YClamp::children, 0))?;
|
|
33
|
+
clamp_class.define_method("min", method!(YClamp::min, 0))?;
|
|
34
|
+
clamp_class.define_method("center", method!(YClamp::center, 0))?;
|
|
35
|
+
clamp_class.define_method("max", method!(YClamp::max, 0))?;
|
|
36
|
+
|
|
37
|
+
let hypot_class = calc_class.define_class("Hypot", ruby.class_object())?;
|
|
38
|
+
hypot_class.define_method("children", method!(YHypot::children, 0))?;
|
|
39
|
+
|
|
40
|
+
let invert_class = calc_class.define_class("Invert", ruby.class_object())?;
|
|
41
|
+
invert_class.define_method("children", method!(YInvert::children, 0))?;
|
|
42
|
+
|
|
43
|
+
let min_max_class = calc_class.define_class("MinMax", ruby.class_object())?;
|
|
44
|
+
min_max_class.define_method("children", method!(YMinMax::children, 0))?;
|
|
45
|
+
min_max_class.define_method("op", method!(YMinMax::op, 0))?;
|
|
46
|
+
|
|
47
|
+
let mod_rem_class = calc_class.define_class("ModRem", ruby.class_object())?;
|
|
48
|
+
mod_rem_class.define_method("children", method!(YModRem::children, 0))?;
|
|
49
|
+
mod_rem_class.define_method("dividend", method!(YModRem::dividend, 0))?;
|
|
50
|
+
mod_rem_class.define_method("divisor", method!(YModRem::divisor, 0))?;
|
|
51
|
+
mod_rem_class.define_method("op", method!(YModRem::op, 0))?;
|
|
52
|
+
|
|
53
|
+
let negate_class = calc_class.define_class("Negate", ruby.class_object())?;
|
|
54
|
+
negate_class.define_method("children", method!(YNegate::children, 0))?;
|
|
55
|
+
|
|
56
|
+
let product_class = calc_class.define_class("Product", ruby.class_object())?;
|
|
57
|
+
product_class.define_method("children", method!(YProduct::children, 0))?;
|
|
58
|
+
|
|
59
|
+
let round_class = calc_class.define_class("Round", ruby.class_object())?;
|
|
60
|
+
round_class.define_method("children", method!(YRound::children, 0))?;
|
|
61
|
+
round_class.define_method("value", method!(YRound::value, 0))?;
|
|
62
|
+
round_class.define_method("step", method!(YRound::step, 0))?;
|
|
63
|
+
round_class.define_method("rounding_strategy", method!(YRound::rounding_strategy, 0))?;
|
|
64
|
+
|
|
65
|
+
let sign_class = calc_class.define_class("Sign", ruby.class_object())?;
|
|
66
|
+
sign_class.define_method("children", method!(YSign::children, 0))?;
|
|
67
|
+
|
|
68
|
+
let sum_class = calc_class.define_class("Sum", ruby.class_object())?;
|
|
69
|
+
sum_class.define_method("children", method!(YSum::children, 0))?;
|
|
70
|
+
|
|
71
|
+
Ok(())
|
|
72
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
use magnus::{DataTypeFunctions, Error, RArray, Ruby, TypedData, gc, typed_data};
|
|
2
|
+
use style::values::specified::calc::CalcNode;
|
|
3
|
+
|
|
4
|
+
use crate::{cached_value::CachedValue, declarations::calc::YCalc};
|
|
5
|
+
|
|
6
|
+
#[derive(TypedData)]
|
|
7
|
+
#[magnus(class = "Yass::Declarations::Calc::Invert", mark)]
|
|
8
|
+
pub struct YInvert {
|
|
9
|
+
child: CachedValue<CalcNode>
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
impl YInvert {
|
|
13
|
+
pub fn new(child: CalcNode) -> Self {
|
|
14
|
+
Self {
|
|
15
|
+
child: CachedValue::new(child, |calc_node, ruby| {
|
|
16
|
+
YCalc::make_node(calc_node, ruby)
|
|
17
|
+
})
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
pub fn children(ruby: &Ruby, rb_self: typed_data::Obj<Self>) -> Result<RArray, Error> {
|
|
22
|
+
let result = ruby.ary_new_capa(1);
|
|
23
|
+
result.push(rb_self.child.get(ruby))?;
|
|
24
|
+
Ok(result)
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
impl DataTypeFunctions for YInvert {
|
|
29
|
+
fn mark(&self, marker: &gc::Marker) {
|
|
30
|
+
self.child.mark(marker);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
use magnus::{IntoValue, Ruby, Value};
|
|
2
|
+
use style::values::specified::calc::Leaf;
|
|
3
|
+
|
|
4
|
+
use crate::declarations::{angle::YAngle, channel_keyword::YChannelKeyword, length::no_calc_length_to_value, number::YNumber, percentage::YPercentage, resolution::YResolution, time::YTime};
|
|
5
|
+
|
|
6
|
+
pub fn make_leaf(leaf: &Leaf, ruby: &Ruby) -> Value {
|
|
7
|
+
match leaf {
|
|
8
|
+
Leaf::Length(no_calc_length) => {
|
|
9
|
+
no_calc_length_to_value(&no_calc_length, ruby)
|
|
10
|
+
},
|
|
11
|
+
|
|
12
|
+
Leaf::Angle(angle) => {
|
|
13
|
+
YAngle::new(angle.clone()).into_value_with(ruby)
|
|
14
|
+
},
|
|
15
|
+
|
|
16
|
+
Leaf::Time(time) => {
|
|
17
|
+
YTime::new(time.clone()).into_value_with(ruby)
|
|
18
|
+
},
|
|
19
|
+
|
|
20
|
+
Leaf::Resolution(resolution) => {
|
|
21
|
+
YResolution::new(resolution.clone()).into_value_with(ruby)
|
|
22
|
+
},
|
|
23
|
+
|
|
24
|
+
Leaf::ColorComponent(channel_keyword) => {
|
|
25
|
+
YChannelKeyword::new(channel_keyword.clone()).into_value_with(ruby)
|
|
26
|
+
},
|
|
27
|
+
|
|
28
|
+
Leaf::Percentage(percentage) => {
|
|
29
|
+
YPercentage::new(percentage.clone()).into_value_with(ruby)
|
|
30
|
+
},
|
|
31
|
+
|
|
32
|
+
Leaf::Number(number) => {
|
|
33
|
+
YNumber::new(number.clone()).into_value_with(ruby)
|
|
34
|
+
},
|
|
35
|
+
}
|
|
36
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
use magnus::{DataTypeFunctions, Error, RArray, Ruby, TypedData, gc, typed_data, value::Id};
|
|
2
|
+
use style::{OwnedSlice, values::{generics::calc::MinMaxOp, specified::calc::CalcNode}};
|
|
3
|
+
|
|
4
|
+
use crate::{declarations::calc::YCalc, cached_value_list::CachedValueList};
|
|
5
|
+
|
|
6
|
+
#[derive(TypedData)]
|
|
7
|
+
#[magnus(class = "Yass::Declarations::Calc::MinMax", mark)]
|
|
8
|
+
pub struct YMinMax {
|
|
9
|
+
op: MinMaxOp,
|
|
10
|
+
children: CachedValueList<CalcNode>
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
impl YMinMax {
|
|
14
|
+
pub fn new(children: &OwnedSlice<CalcNode>, op: MinMaxOp) -> Self {
|
|
15
|
+
Self {
|
|
16
|
+
children: CachedValueList::new(children.to_vec(), |calc_node, _ctx, ruby| {
|
|
17
|
+
YCalc::make_node(calc_node, ruby)
|
|
18
|
+
}),
|
|
19
|
+
|
|
20
|
+
op
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
pub fn children(ruby: &Ruby, rb_self: typed_data::Obj<Self>) -> Result<RArray, Error> {
|
|
25
|
+
rb_self.children.to_a(ruby)
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
pub fn op(ruby: &Ruby, rb_self: typed_data::Obj<Self>) -> Id {
|
|
29
|
+
match rb_self.op {
|
|
30
|
+
MinMaxOp::Min => ruby.intern("min"),
|
|
31
|
+
MinMaxOp::Max => ruby.intern("max"),
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
impl DataTypeFunctions for YMinMax {
|
|
37
|
+
fn mark(&self, marker: &gc::Marker) {
|
|
38
|
+
self.children.mark(marker);
|
|
39
|
+
}
|
|
40
|
+
}
|