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,71 @@
|
|
|
1
|
+
#[magnus::wrap(class = "Yass::Declarations::ClipPath::ElementDependent")]
|
|
2
|
+
pub struct YClipPathElementDependent {}
|
|
3
|
+
|
|
4
|
+
impl YClipPathElementDependent {
|
|
5
|
+
pub fn new() -> Self {
|
|
6
|
+
Self {}
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
#[magnus::wrap(class = "Yass::Declarations::ClipPath::FillBox")]
|
|
11
|
+
pub struct YClipPathFillBox {}
|
|
12
|
+
|
|
13
|
+
impl YClipPathFillBox {
|
|
14
|
+
pub fn new() -> Self {
|
|
15
|
+
Self {}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
#[magnus::wrap(class = "Yass::Declarations::ClipPath::StrokeBox")]
|
|
20
|
+
pub struct YClipPathStrokeBox {}
|
|
21
|
+
|
|
22
|
+
impl YClipPathStrokeBox {
|
|
23
|
+
pub fn new() -> Self {
|
|
24
|
+
Self {}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
#[magnus::wrap(class = "Yass::Declarations::ClipPath::ViewBox")]
|
|
29
|
+
pub struct YClipPathViewBox {}
|
|
30
|
+
|
|
31
|
+
impl YClipPathViewBox {
|
|
32
|
+
pub fn new() -> Self {
|
|
33
|
+
Self {}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
#[magnus::wrap(class = "Yass::Declarations::ClipPath::MarginBox")]
|
|
38
|
+
pub struct YClipPathMarginBox {}
|
|
39
|
+
|
|
40
|
+
impl YClipPathMarginBox {
|
|
41
|
+
pub fn new() -> Self {
|
|
42
|
+
Self {}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
#[magnus::wrap(class = "Yass::Declarations::ClipPath::BorderBox")]
|
|
47
|
+
pub struct YClipPathBorderBox {}
|
|
48
|
+
|
|
49
|
+
impl YClipPathBorderBox {
|
|
50
|
+
pub fn new() -> Self {
|
|
51
|
+
Self {}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
#[magnus::wrap(class = "Yass::Declarations::ClipPath::PaddingBox")]
|
|
56
|
+
pub struct YClipPathPaddingBox {}
|
|
57
|
+
|
|
58
|
+
impl YClipPathPaddingBox {
|
|
59
|
+
pub fn new() -> Self {
|
|
60
|
+
Self {}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
#[magnus::wrap(class = "Yass::Declarations::ClipPath::ContentBox")]
|
|
65
|
+
pub struct YClipPathContentBox {}
|
|
66
|
+
|
|
67
|
+
impl YClipPathContentBox {
|
|
68
|
+
pub fn new() -> Self {
|
|
69
|
+
Self {}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
use magnus::{DataTypeFunctions, IntoValue, Ruby, TypedData, Value, gc, typed_data};
|
|
2
|
+
use style::{
|
|
3
|
+
color::AbsoluteColor,
|
|
4
|
+
values::specified::color::Absolute as SpecifiedAbsolute,
|
|
5
|
+
};
|
|
6
|
+
|
|
7
|
+
use crate::{cached_value::CachedValue, declarations::color::absolute_color::YAbsoluteColor};
|
|
8
|
+
|
|
9
|
+
#[derive(TypedData)]
|
|
10
|
+
#[magnus(class = "Yass::Declarations::Color::Absolute", mark)]
|
|
11
|
+
pub struct YAbsolute {
|
|
12
|
+
color: CachedValue<AbsoluteColor>,
|
|
13
|
+
authored: CachedValue<Option<String>>,
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
impl YAbsolute {
|
|
17
|
+
pub fn new(absolute: SpecifiedAbsolute) -> Self {
|
|
18
|
+
Self {
|
|
19
|
+
color: CachedValue::new(absolute.color, |absolute_color, ruby| {
|
|
20
|
+
YAbsoluteColor::new(*absolute_color).into_value_with(ruby)
|
|
21
|
+
}),
|
|
22
|
+
|
|
23
|
+
authored: CachedValue::new(absolute.authored.map(|authored| authored.to_string()), |authored, ruby| {
|
|
24
|
+
match authored {
|
|
25
|
+
Some(authored) => ruby.str_new(authored).into_value_with(ruby),
|
|
26
|
+
None => ruby.qnil().into_value_with(ruby),
|
|
27
|
+
}
|
|
28
|
+
}),
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
pub fn color(ruby: &Ruby, rb_self: typed_data::Obj<Self>) -> Value {
|
|
33
|
+
rb_self.color.get(ruby)
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
pub fn authored(ruby: &Ruby, rb_self: typed_data::Obj<Self>) -> Value {
|
|
37
|
+
rb_self.authored.get(ruby)
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
impl DataTypeFunctions for YAbsolute {
|
|
42
|
+
fn mark(&self, marker: &gc::Marker) {
|
|
43
|
+
self.color.mark(marker);
|
|
44
|
+
self.authored.mark(marker);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
use magnus::{DataTypeFunctions, IntoValue, Ruby, TypedData, Value, gc, typed_data, value::Id};
|
|
2
|
+
use style::color::{AbsoluteColor, ColorComponents};
|
|
3
|
+
|
|
4
|
+
use crate::{cached_value::CachedValue, declarations::{color::color_components::YColorComponents}};
|
|
5
|
+
|
|
6
|
+
use super::{color_space_to_id};
|
|
7
|
+
|
|
8
|
+
#[derive(TypedData)]
|
|
9
|
+
#[magnus(class = "Yass::Declarations::Color::AbsoluteColor", mark)]
|
|
10
|
+
pub struct YAbsoluteColor {
|
|
11
|
+
absolute_color: AbsoluteColor,
|
|
12
|
+
components: CachedValue<ColorComponents>,
|
|
13
|
+
alpha: Option<f32>,
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
impl YAbsoluteColor {
|
|
17
|
+
pub fn new(absolute_color: AbsoluteColor) -> Self {
|
|
18
|
+
Self {
|
|
19
|
+
components: CachedValue::new(absolute_color.components, |components, ruby| {
|
|
20
|
+
YColorComponents::new(*components).into_value_with(ruby)
|
|
21
|
+
}),
|
|
22
|
+
|
|
23
|
+
alpha: absolute_color.alpha(),
|
|
24
|
+
absolute_color,
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
pub fn components(ruby: &Ruby, rb_self: typed_data::Obj<Self>) -> Value {
|
|
29
|
+
rb_self.components.get(ruby)
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
pub fn alpha(_ruby: &Ruby, rb_self: typed_data::Obj<Self>) -> Option<f32> {
|
|
33
|
+
rb_self.alpha
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
pub fn color_space(ruby: &Ruby, rb_self: typed_data::Obj<Self>) -> Id {
|
|
37
|
+
color_space_to_id(rb_self.absolute_color.color_space, ruby)
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
pub fn legacy_syntax(_ruby: &Ruby, rb_self: typed_data::Obj<Self>) -> bool {
|
|
41
|
+
rb_self.absolute_color.is_legacy_syntax()
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
pub fn transparent(_ruby: &Ruby, rb_self: typed_data::Obj<Self>) -> bool {
|
|
45
|
+
rb_self.absolute_color.is_transparent()
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
impl DataTypeFunctions for YAbsoluteColor {
|
|
50
|
+
fn mark(&self, marker: &gc::Marker) {
|
|
51
|
+
self.components.mark(marker);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
use magnus::{IntoValue, Ruby, Value};
|
|
2
|
+
use style::values::{generics::color::ColorOrAuto, specified::Color};
|
|
3
|
+
|
|
4
|
+
use crate::declarations::color::{absolute::YAbsolute, auto::YAutoColor, color_function::YColorFunction, color_mix::YColorMix, current_color::YCurrentColor, light_dark::YLightDark, system_color::YSystemColor};
|
|
5
|
+
|
|
6
|
+
pub fn make_color(color: &Color, ruby: &Ruby) -> Value {
|
|
7
|
+
match &color {
|
|
8
|
+
Color::Absolute(absolute) => {
|
|
9
|
+
YAbsolute::new((**absolute).clone()).into_value_with(ruby)
|
|
10
|
+
},
|
|
11
|
+
Color::ColorFunction(color_function) => {
|
|
12
|
+
YColorFunction::new((**color_function).clone()).into_value_with(ruby)
|
|
13
|
+
},
|
|
14
|
+
Color::ColorMix(color_mix) => {
|
|
15
|
+
YColorMix::new((**color_mix).clone()).into_value_with(ruby)
|
|
16
|
+
},
|
|
17
|
+
Color::LightDark(light_dark) => {
|
|
18
|
+
YLightDark::new((**light_dark).clone()).into_value_with(ruby)
|
|
19
|
+
},
|
|
20
|
+
Color::ContrastColor(contrast_color) => {
|
|
21
|
+
make_color(contrast_color, ruby)
|
|
22
|
+
},
|
|
23
|
+
Color::CurrentColor => {
|
|
24
|
+
YCurrentColor::new().into_value_with(ruby)
|
|
25
|
+
},
|
|
26
|
+
Color::System(system_color) => {
|
|
27
|
+
YSystemColor::new(*system_color).into_value_with(ruby)
|
|
28
|
+
},
|
|
29
|
+
Color::InheritFromBodyQuirk => todo!(),
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
pub fn make_color_or_auto(color_or_auto: &ColorOrAuto<Color>, ruby: &Ruby) -> Value {
|
|
34
|
+
match color_or_auto {
|
|
35
|
+
ColorOrAuto::Color(c) => make_color(c, ruby),
|
|
36
|
+
ColorOrAuto::Auto => YAutoColor::new().into_value_with(ruby),
|
|
37
|
+
}
|
|
38
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
use magnus::{Ruby, typed_data};
|
|
2
|
+
use style::color::ColorComponents;
|
|
3
|
+
|
|
4
|
+
#[magnus::wrap(class = "Yass::Declarations::Color::ColorComponents")]
|
|
5
|
+
pub struct YColorComponents {
|
|
6
|
+
color_components: ColorComponents,
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
impl YColorComponents {
|
|
10
|
+
pub fn new(color_components: ColorComponents) -> Self {
|
|
11
|
+
Self { color_components }
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
pub fn c0(_ruby: &Ruby, rb_self: typed_data::Obj<Self>) -> f32 {
|
|
15
|
+
rb_self.color_components.0
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
pub fn c1(_ruby: &Ruby, rb_self: typed_data::Obj<Self>) -> f32 {
|
|
19
|
+
rb_self.color_components.1
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
pub fn c2(_ruby: &Ruby, rb_self: typed_data::Obj<Self>) -> f32 {
|
|
23
|
+
rb_self.color_components.2
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
use magnus::{DataTypeFunctions, Error, IntoValue, RArray, Ruby, TypedData, Value, gc, typed_data};
|
|
2
|
+
use style::{
|
|
3
|
+
color::ColorFunction,
|
|
4
|
+
values::specified::Color as SpecifiedColor,
|
|
5
|
+
};
|
|
6
|
+
|
|
7
|
+
use crate::{cached_value::CachedValue, cached_value_list::CachedValueList, declarations::color::{color::make_color, color_function_component::YColorFunctionComponent, stored_color_function_component::StoredColorFunctionComponent}};
|
|
8
|
+
|
|
9
|
+
use super::{color_space_to_id};
|
|
10
|
+
|
|
11
|
+
#[derive(TypedData)]
|
|
12
|
+
#[magnus(class = "Yass::Declarations::Color::ColorFunction", mark)]
|
|
13
|
+
pub struct YColorFunction {
|
|
14
|
+
color_function: ColorFunction<SpecifiedColor>,
|
|
15
|
+
origin_color: CachedValue<Option<SpecifiedColor>>,
|
|
16
|
+
components: CachedValueList<StoredColorFunctionComponent>,
|
|
17
|
+
alpha: CachedValue<StoredColorFunctionComponent>,
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
impl YColorFunction {
|
|
21
|
+
pub fn new(color_function: ColorFunction<SpecifiedColor>) -> Self {
|
|
22
|
+
let origin_color = color_function_origin(&color_function);
|
|
23
|
+
let components = color_function_components(&color_function);
|
|
24
|
+
let alpha = color_function_alpha(&color_function);
|
|
25
|
+
|
|
26
|
+
Self {
|
|
27
|
+
origin_color: CachedValue::new(origin_color, |color, ruby| {
|
|
28
|
+
maybe_specified_color_to_value(color.clone(), ruby)
|
|
29
|
+
}),
|
|
30
|
+
|
|
31
|
+
components: CachedValueList::new(components, |component, _ctx, ruby| {
|
|
32
|
+
YColorFunctionComponent::new(component.clone()).into_value_with(ruby)
|
|
33
|
+
}),
|
|
34
|
+
|
|
35
|
+
alpha: CachedValue::new(alpha, |component, ruby| {
|
|
36
|
+
YColorFunctionComponent::new(component.clone()).into_value_with(ruby)
|
|
37
|
+
}),
|
|
38
|
+
|
|
39
|
+
color_function,
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
pub fn has_origin_color(_ruby: &Ruby, rb_self: typed_data::Obj<Self>) -> bool {
|
|
44
|
+
rb_self.color_function.has_origin_color()
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
pub fn origin_color(ruby: &Ruby, rb_self: typed_data::Obj<Self>) -> Value {
|
|
48
|
+
rb_self.origin_color.get(ruby)
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
pub fn components(ruby: &Ruby, rb_self: typed_data::Obj<Self>) -> Result<RArray, Error> {
|
|
52
|
+
rb_self.components.to_a(ruby)
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
pub fn alpha(ruby: &Ruby, rb_self: typed_data::Obj<Self>) -> Value {
|
|
56
|
+
rb_self.alpha.get(ruby)
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
pub fn color_space(ruby: &Ruby, rb_self: typed_data::Obj<Self>) -> Value {
|
|
60
|
+
match rb_self.color_function {
|
|
61
|
+
ColorFunction::Color(.., color_space) => color_space_to_id(color_space, ruby).into_value_with(ruby),
|
|
62
|
+
_ => ruby.qnil().into_value_with(ruby),
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
impl DataTypeFunctions for YColorFunction {
|
|
68
|
+
fn mark(&self, marker: &gc::Marker) {
|
|
69
|
+
self.origin_color.mark(marker);
|
|
70
|
+
self.components.mark(marker);
|
|
71
|
+
self.alpha.mark(marker);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
fn maybe_specified_color_to_value(color: Option<SpecifiedColor>, ruby: &Ruby) -> Value {
|
|
76
|
+
match color {
|
|
77
|
+
Some(color) => make_color(&color, ruby),
|
|
78
|
+
None => ruby.qnil().into_value_with(ruby),
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
fn color_function_origin(color_function: &ColorFunction<SpecifiedColor>) -> Option<SpecifiedColor> {
|
|
83
|
+
match color_function {
|
|
84
|
+
ColorFunction::Rgb(origin_color, ..)
|
|
85
|
+
| ColorFunction::Hsl(origin_color, ..)
|
|
86
|
+
| ColorFunction::Hwb(origin_color, ..)
|
|
87
|
+
| ColorFunction::Lab(origin_color, ..)
|
|
88
|
+
| ColorFunction::Lch(origin_color, ..)
|
|
89
|
+
| ColorFunction::Oklab(origin_color, ..)
|
|
90
|
+
| ColorFunction::Oklch(origin_color, ..)
|
|
91
|
+
| ColorFunction::Color(origin_color, ..) => origin_color.as_ref().cloned(),
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
fn color_function_components(color_function: &ColorFunction<SpecifiedColor>) -> Vec<StoredColorFunctionComponent> {
|
|
96
|
+
match color_function {
|
|
97
|
+
ColorFunction::Rgb(_, c0, c1, c2, _) => vec![
|
|
98
|
+
StoredColorFunctionComponent::NumberOrPercentage(c0.clone()),
|
|
99
|
+
StoredColorFunctionComponent::NumberOrPercentage(c1.clone()),
|
|
100
|
+
StoredColorFunctionComponent::NumberOrPercentage(c2.clone()),
|
|
101
|
+
],
|
|
102
|
+
ColorFunction::Lab(_, c0, c1, c2, _) => vec![
|
|
103
|
+
StoredColorFunctionComponent::NumberOrPercentage(c0.clone()),
|
|
104
|
+
StoredColorFunctionComponent::NumberOrPercentage(c1.clone()),
|
|
105
|
+
StoredColorFunctionComponent::NumberOrPercentage(c2.clone()),
|
|
106
|
+
],
|
|
107
|
+
ColorFunction::Oklab(_, c0, c1, c2, _) => vec![
|
|
108
|
+
StoredColorFunctionComponent::NumberOrPercentage(c0.clone()),
|
|
109
|
+
StoredColorFunctionComponent::NumberOrPercentage(c1.clone()),
|
|
110
|
+
StoredColorFunctionComponent::NumberOrPercentage(c2.clone()),
|
|
111
|
+
],
|
|
112
|
+
ColorFunction::Color(_, c0, c1, c2, _, _) => vec![
|
|
113
|
+
StoredColorFunctionComponent::NumberOrPercentage(c0.clone()),
|
|
114
|
+
StoredColorFunctionComponent::NumberOrPercentage(c1.clone()),
|
|
115
|
+
StoredColorFunctionComponent::NumberOrPercentage(c2.clone()),
|
|
116
|
+
],
|
|
117
|
+
ColorFunction::Hsl(_, c0, c1, c2, _) => vec![
|
|
118
|
+
StoredColorFunctionComponent::NumberOrAngle(c0.clone()),
|
|
119
|
+
StoredColorFunctionComponent::NumberOrPercentage(c1.clone()),
|
|
120
|
+
StoredColorFunctionComponent::NumberOrPercentage(c2.clone()),
|
|
121
|
+
],
|
|
122
|
+
ColorFunction::Hwb(_, c0, c1, c2, _) => vec![
|
|
123
|
+
StoredColorFunctionComponent::NumberOrAngle(c0.clone()),
|
|
124
|
+
StoredColorFunctionComponent::NumberOrPercentage(c1.clone()),
|
|
125
|
+
StoredColorFunctionComponent::NumberOrPercentage(c2.clone()),
|
|
126
|
+
],
|
|
127
|
+
ColorFunction::Lch(_, c0, c1, c2, _) => vec![
|
|
128
|
+
StoredColorFunctionComponent::NumberOrPercentage(c0.clone()),
|
|
129
|
+
StoredColorFunctionComponent::NumberOrPercentage(c1.clone()),
|
|
130
|
+
StoredColorFunctionComponent::NumberOrAngle(c2.clone()),
|
|
131
|
+
],
|
|
132
|
+
ColorFunction::Oklch(_, c0, c1, c2, _) => vec![
|
|
133
|
+
StoredColorFunctionComponent::NumberOrPercentage(c0.clone()),
|
|
134
|
+
StoredColorFunctionComponent::NumberOrPercentage(c1.clone()),
|
|
135
|
+
StoredColorFunctionComponent::NumberOrAngle(c2.clone()),
|
|
136
|
+
],
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
fn color_function_alpha(color_function: &ColorFunction<SpecifiedColor>) -> StoredColorFunctionComponent {
|
|
141
|
+
match color_function {
|
|
142
|
+
ColorFunction::Rgb(_, _, _, _, alpha)
|
|
143
|
+
| ColorFunction::Hsl(_, _, _, _, alpha)
|
|
144
|
+
| ColorFunction::Hwb(_, _, _, _, alpha)
|
|
145
|
+
| ColorFunction::Lab(_, _, _, _, alpha)
|
|
146
|
+
| ColorFunction::Lch(_, _, _, _, alpha)
|
|
147
|
+
| ColorFunction::Oklab(_, _, _, _, alpha)
|
|
148
|
+
| ColorFunction::Oklch(_, _, _, _, alpha)
|
|
149
|
+
| ColorFunction::Color(_, _, _, _, alpha, _) => StoredColorFunctionComponent::NumberOrPercentage(alpha.clone()),
|
|
150
|
+
}
|
|
151
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
use magnus::{DataTypeFunctions, IntoValue, Ruby, TypedData, Value, gc, typed_data};
|
|
2
|
+
use style::{
|
|
3
|
+
color::{parsing::{ChannelKeyword}},
|
|
4
|
+
values::specified::{calc::CalcNode},
|
|
5
|
+
};
|
|
6
|
+
|
|
7
|
+
use crate::{
|
|
8
|
+
cached_value::CachedValue,
|
|
9
|
+
declarations::{calc::YCalc, channel_keyword::YChannelKeyword, color::stored_color_function_component::{StoredColorComponentValue, StoredColorFunctionComponent}},
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
#[derive(TypedData)]
|
|
13
|
+
#[magnus(class = "Yass::Declarations::Color::ColorFunctionComponent", mark)]
|
|
14
|
+
pub struct YColorFunctionComponent {
|
|
15
|
+
value: CachedValue<Option<StoredColorComponentValue>>,
|
|
16
|
+
channel_keyword: CachedValue<Option<ChannelKeyword>>,
|
|
17
|
+
calc: CachedValue<Option<CalcNode>>,
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
impl YColorFunctionComponent {
|
|
21
|
+
pub fn new(component: StoredColorFunctionComponent) -> Self {
|
|
22
|
+
Self {
|
|
23
|
+
value: CachedValue::new(component.value(), |value, ruby| match value {
|
|
24
|
+
Some(value) => value.to_value(ruby),
|
|
25
|
+
None => ruby.qnil().into_value_with(ruby),
|
|
26
|
+
}),
|
|
27
|
+
|
|
28
|
+
channel_keyword: CachedValue::new(component.channel_keyword(), |channel_keyword, ruby| {
|
|
29
|
+
match channel_keyword {
|
|
30
|
+
Some(channel_keyword) => YChannelKeyword::new(*channel_keyword).into_value_with(ruby),
|
|
31
|
+
None => ruby.qnil().into_value_with(ruby),
|
|
32
|
+
}
|
|
33
|
+
}),
|
|
34
|
+
|
|
35
|
+
calc: CachedValue::new(component.calc_node(), |calc_node, ruby| match calc_node {
|
|
36
|
+
Some(calc_node) => YCalc::make_node(calc_node, ruby),
|
|
37
|
+
None => ruby.qnil().into_value_with(ruby),
|
|
38
|
+
})
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
pub fn value(ruby: &Ruby, rb_self: typed_data::Obj<Self>) -> Value {
|
|
43
|
+
rb_self.value.get(ruby)
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
pub fn channel_keyword(ruby: &Ruby, rb_self: typed_data::Obj<Self>) -> Value {
|
|
47
|
+
rb_self.channel_keyword.get(ruby)
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
pub fn calc(ruby: &Ruby, rb_self: typed_data::Obj<Self>) -> Value {
|
|
51
|
+
rb_self.calc.get(ruby)
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
impl DataTypeFunctions for YColorFunctionComponent {
|
|
56
|
+
fn mark(&self, marker: &gc::Marker) {
|
|
57
|
+
self.value.mark(marker);
|
|
58
|
+
self.channel_keyword.mark(marker);
|
|
59
|
+
self.calc.mark(marker);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
use magnus::{Ruby, typed_data, value::Id};
|
|
2
|
+
use style::color::mix::{ColorInterpolationMethod, HueInterpolationMethod};
|
|
3
|
+
|
|
4
|
+
use super::color_space_to_id;
|
|
5
|
+
|
|
6
|
+
#[magnus::wrap(class = "Yass::Declarations::Color::ColorInterpolationMethod")]
|
|
7
|
+
pub struct YColorInterpolationMethod {
|
|
8
|
+
interpolation: ColorInterpolationMethod,
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
impl YColorInterpolationMethod {
|
|
12
|
+
pub fn new(interpolation: ColorInterpolationMethod) -> Self {
|
|
13
|
+
Self { interpolation }
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
pub fn space(ruby: &Ruby, rb_self: typed_data::Obj<Self>) -> Id {
|
|
17
|
+
color_space_to_id(rb_self.interpolation.space, ruby)
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
pub fn hue(ruby: &Ruby, rb_self: typed_data::Obj<Self>) -> Id {
|
|
21
|
+
match rb_self.interpolation.hue {
|
|
22
|
+
HueInterpolationMethod::Shorter => ruby.intern("shorter"),
|
|
23
|
+
HueInterpolationMethod::Longer => ruby.intern("longer"),
|
|
24
|
+
HueInterpolationMethod::Increasing => ruby.intern("increasing"),
|
|
25
|
+
HueInterpolationMethod::Decreasing => ruby.intern("decreasing"),
|
|
26
|
+
HueInterpolationMethod::Specified => ruby.intern("specified"),
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
use magnus::{DataTypeFunctions, Error, IntoValue, RArray, Ruby, TypedData, Value, gc, typed_data};
|
|
2
|
+
use style::values::generics::color::GenericColorMixItem;
|
|
3
|
+
use style::values::specified::Color;
|
|
4
|
+
use style::values::specified::percentage::Percentage;
|
|
5
|
+
use style::values::{
|
|
6
|
+
generics::color::ColorMixFlags,
|
|
7
|
+
specified::color::ColorMix as SpecifiedColorMix,
|
|
8
|
+
};
|
|
9
|
+
use style::color::mix::ColorInterpolationMethod;
|
|
10
|
+
|
|
11
|
+
use crate::declarations::color::color_interpolation_method::YColorInterpolationMethod;
|
|
12
|
+
use crate::declarations::color::color_mix_item::YColorMixItem;
|
|
13
|
+
use crate::{cached_value::CachedValue, cached_value_list::CachedValueList};
|
|
14
|
+
|
|
15
|
+
#[derive(TypedData)]
|
|
16
|
+
#[magnus(class = "Yass::Declarations::Color::ColorMix", mark)]
|
|
17
|
+
pub struct YColorMix {
|
|
18
|
+
flags: ColorMixFlags,
|
|
19
|
+
interpolation: CachedValue<ColorInterpolationMethod>,
|
|
20
|
+
items: CachedValueList<GenericColorMixItem<Color, Percentage>>,
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
impl YColorMix {
|
|
24
|
+
pub fn new(color_mix: SpecifiedColorMix) -> Self {
|
|
25
|
+
Self {
|
|
26
|
+
flags: color_mix.flags,
|
|
27
|
+
|
|
28
|
+
interpolation: CachedValue::new(color_mix.interpolation, |interpolation, ruby| {
|
|
29
|
+
YColorInterpolationMethod::new(*interpolation).into_value_with(ruby)
|
|
30
|
+
}),
|
|
31
|
+
|
|
32
|
+
items: CachedValueList::new(color_mix.items.to_vec(), |item, _ctx, ruby| {
|
|
33
|
+
YColorMixItem::new(item.clone()).into_value_with(ruby)
|
|
34
|
+
}),
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
pub fn interpolation(ruby: &Ruby, rb_self: typed_data::Obj<Self>) -> Value {
|
|
39
|
+
rb_self.interpolation.get(ruby)
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
pub fn items(ruby: &Ruby, rb_self: typed_data::Obj<Self>) -> Result<RArray, Error> {
|
|
43
|
+
rb_self.items.to_a(ruby)
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
pub fn normalize_weights(_ruby: &Ruby, rb_self: typed_data::Obj<Self>) -> bool {
|
|
47
|
+
rb_self.flags.contains(ColorMixFlags::NORMALIZE_WEIGHTS)
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
pub fn result_in_modern_syntax(_ruby: &Ruby, rb_self: typed_data::Obj<Self>) -> bool {
|
|
51
|
+
rb_self.flags.contains(ColorMixFlags::RESULT_IN_MODERN_SYNTAX)
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
impl DataTypeFunctions for YColorMix {
|
|
56
|
+
fn mark(&self, marker: &gc::Marker) {
|
|
57
|
+
self.interpolation.mark(marker);
|
|
58
|
+
self.items.mark(marker);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
use magnus::{DataTypeFunctions, IntoValue, Ruby, TypedData, Value, gc, typed_data};
|
|
2
|
+
use style::values::{
|
|
3
|
+
generics::color::GenericColorMixItem,
|
|
4
|
+
specified::{Color as SpecifiedColor, percentage::{Percentage, ToPercentage}},
|
|
5
|
+
};
|
|
6
|
+
|
|
7
|
+
use crate::{cached_value::CachedValue, declarations::{color::color::make_color, percentage::YPercentage}};
|
|
8
|
+
|
|
9
|
+
#[derive(TypedData)]
|
|
10
|
+
#[magnus(class = "Yass::Declarations::Color::ColorMixItem", mark)]
|
|
11
|
+
pub struct YColorMixItem {
|
|
12
|
+
color: CachedValue<SpecifiedColor>,
|
|
13
|
+
percentage: CachedValue<Percentage>,
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
impl YColorMixItem {
|
|
17
|
+
pub fn new(item: GenericColorMixItem<SpecifiedColor, Percentage>) -> Self {
|
|
18
|
+
Self {
|
|
19
|
+
color: CachedValue::new(item.color, |color, ruby| {
|
|
20
|
+
make_color(&color, ruby)
|
|
21
|
+
}),
|
|
22
|
+
|
|
23
|
+
percentage: CachedValue::new(item.percentage, |percentage, ruby| {
|
|
24
|
+
YPercentage::new(percentage.to_percentage()).into_value_with(ruby)
|
|
25
|
+
}),
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
pub fn color(ruby: &Ruby, rb_self: typed_data::Obj<Self>) -> Value {
|
|
30
|
+
rb_self.color.get(ruby)
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
pub fn percentage(ruby: &Ruby, rb_self: typed_data::Obj<Self>) -> Value {
|
|
34
|
+
rb_self.percentage.get(ruby)
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
impl DataTypeFunctions for YColorMixItem {
|
|
39
|
+
fn mark(&self, marker: &gc::Marker) {
|
|
40
|
+
self.color.mark(marker);
|
|
41
|
+
self.percentage.mark(marker);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
use magnus::{Error, Module, RClass, Ruby, method};
|
|
2
|
+
|
|
3
|
+
use crate::declarations::color::{absolute::YAbsolute, absolute_color::YAbsoluteColor, color_components::YColorComponents, color_function::YColorFunction, color_function_component::YColorFunctionComponent, color_interpolation_method::YColorInterpolationMethod, color_mix::YColorMix, color_mix_item::YColorMixItem, light_dark::YLightDark, system_color::YSystemColor};
|
|
4
|
+
|
|
5
|
+
pub fn init(ruby: &Ruby, color_class: &RClass) -> Result<(), Error> {
|
|
6
|
+
let absolute_class = color_class.define_class("Absolute", ruby.class_object())?;
|
|
7
|
+
absolute_class.define_method("color", method!(YAbsolute::color, 0))?;
|
|
8
|
+
absolute_class.define_method("authored", method!(YAbsolute::authored, 0))?;
|
|
9
|
+
|
|
10
|
+
let _auto_class = color_class.define_class("Auto", ruby.class_object())?;
|
|
11
|
+
|
|
12
|
+
let absolute_color_class = color_class.define_class("AbsoluteColor", ruby.class_object())?;
|
|
13
|
+
absolute_color_class.define_method("components", method!(YAbsoluteColor::components, 0))?;
|
|
14
|
+
absolute_color_class.define_method("alpha", method!(YAbsoluteColor::alpha, 0))?;
|
|
15
|
+
absolute_color_class.define_method("color_space", method!(YAbsoluteColor::color_space, 0))?;
|
|
16
|
+
absolute_color_class.define_method("legacy_syntax?", method!(YAbsoluteColor::legacy_syntax, 0))?;
|
|
17
|
+
absolute_color_class.define_method("transparent?", method!(YAbsoluteColor::transparent, 0))?;
|
|
18
|
+
|
|
19
|
+
let color_components_class = color_class.define_class("ColorComponents", ruby.class_object())?;
|
|
20
|
+
color_components_class.define_method("c0", method!(YColorComponents::c0, 0))?;
|
|
21
|
+
color_components_class.define_method("c1", method!(YColorComponents::c1, 0))?;
|
|
22
|
+
color_components_class.define_method("c2", method!(YColorComponents::c2, 0))?;
|
|
23
|
+
|
|
24
|
+
let color_function_class = color_class.define_class("ColorFunction", ruby.class_object())?;
|
|
25
|
+
color_function_class.define_method("has_origin_color?", method!(YColorFunction::has_origin_color, 0))?;
|
|
26
|
+
color_function_class.define_method("origin_color", method!(YColorFunction::origin_color, 0))?;
|
|
27
|
+
color_function_class.define_method("components", method!(YColorFunction::components, 0))?;
|
|
28
|
+
color_function_class.define_method("alpha", method!(YColorFunction::alpha, 0))?;
|
|
29
|
+
color_function_class.define_method("color_space", method!(YColorFunction::color_space, 0))?;
|
|
30
|
+
|
|
31
|
+
let color_function_component_class = color_class.define_class("ColorFunctionComponent", ruby.class_object())?;
|
|
32
|
+
color_function_component_class.define_method("value", method!(YColorFunctionComponent::value, 0))?;
|
|
33
|
+
color_function_component_class.define_method("channel_keyword", method!(YColorFunctionComponent::channel_keyword, 0))?;
|
|
34
|
+
color_function_component_class.define_method("calc", method!(YColorFunctionComponent::calc, 0))?;
|
|
35
|
+
|
|
36
|
+
let color_mix_class = color_class.define_class("ColorMix", ruby.class_object())?;
|
|
37
|
+
color_mix_class.define_method("interpolation", method!(YColorMix::interpolation, 0))?;
|
|
38
|
+
color_mix_class.define_method("items", method!(YColorMix::items, 0))?;
|
|
39
|
+
color_mix_class.define_method("normalize_weights?", method!(YColorMix::normalize_weights, 0))?;
|
|
40
|
+
color_mix_class.define_method("result_in_modern_syntax?", method!(YColorMix::result_in_modern_syntax, 0))?;
|
|
41
|
+
|
|
42
|
+
let color_mix_item_class = color_class.define_class("ColorMixItem", ruby.class_object())?;
|
|
43
|
+
color_mix_item_class.define_method("color", method!(YColorMixItem::color, 0))?;
|
|
44
|
+
color_mix_item_class.define_method("percentage", method!(YColorMixItem::percentage, 0))?;
|
|
45
|
+
|
|
46
|
+
let light_dark_class = color_class.define_class("LightDark", ruby.class_object())?;
|
|
47
|
+
light_dark_class.define_method("light", method!(YLightDark::light, 0))?;
|
|
48
|
+
light_dark_class.define_method("dark", method!(YLightDark::dark, 0))?;
|
|
49
|
+
|
|
50
|
+
let color_interpolation_method_class = color_class.define_class("ColorInterpolationMethod", ruby.class_object())?;
|
|
51
|
+
color_interpolation_method_class.define_method("space", method!(YColorInterpolationMethod::space, 0))?;
|
|
52
|
+
color_interpolation_method_class.define_method("hue", method!(YColorInterpolationMethod::hue, 0))?;
|
|
53
|
+
|
|
54
|
+
let system_color_class = color_class.define_class("SystemColor", ruby.class_object())?;
|
|
55
|
+
system_color_class.define_method("value", method!(YSystemColor::value, 0))?;
|
|
56
|
+
|
|
57
|
+
let _current_color_class = color_class.define_class("CurrentColor", ruby.class_object())?;
|
|
58
|
+
|
|
59
|
+
Ok(())
|
|
60
|
+
}
|