Repository navigation
feat: add CarouselView control - #51
Merged
Merged
Conversation
Add carousel_view/carouselview helpers and the CarouselView wire type with item_extent/flex_weights layouts, surface keywords, on_item_click and an animate_to_item method. horizontal defaults to true.
2 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds the Ruby side of
CarouselView(Work Package F, item F2, P2).Engine counterpart (renderer): AdamMusa/ruflet-engine#38
Usage
API
controls/materials/carouselview_control.rb:CarouselViewControl, TYPEcarouselview, WIRECarouselView.bgcolor consume_max_weight controls elevation enable_splash flex_weights horizontal initial_item item_clip_behavior item_extent item_snapping overlay_color padding reverse shape shrink_extentplus the common layout keywords.on_item_click, which firesitem_clickwith the tapped index, pluson_animation_endandon_size_change.horizontal = true.animate_to_item(index, duration: 300, curve: "ease", timeout: 10, on_result: nil)invokesanimate_to_itemwith{"index", "duration", "curve"}. It is a no-op before the control is on a page.carousel_viewandcarouselviewin the materials and top-level registries.carousel_view(children = nil, **props, &block)andcarouselvieware inmaterial_control_methods.rb,shared_control_forwarders.rbanddsl.rb.item_extentorflex_weightsis required. The renderer shows anErrorControlwhen both are missing, so a carousel built before its data arrives does not raise in Ruby.Tests
test/carousel_view_compatibility_test.rb(7 runs). It covers:_c, positional,controls:and block children, and every keyword serialized (colours normalized, state maps kept);Ruflet.control(:carousel_view)and theRuflet::DSLhelpers;page.dispatch_eventforitem_clickreaches the handler withe.value;animate_to_itemsends the invoke payload with defaults and with explicit duration and curve;animate_to_itemwithout a page returns nil;verify_pr.sh: withRUBY_PKGS="ruflet_core ruflet_rails": ruflet_core 146/146 files, 625 runs; ruflet_rails 15/15 files, 278 runs. The engine pair passes too (+722 tests, analyze clean). The wire-key audit shows 0 new findings.