Module: Ruflet::UI::PlatformControlContracts
- Defined in:
- lib/ruflet_ui/ruflet/ui/platform_control_contracts.rb
Overview
One Ruby protocol contract for controls whose visual implementation is selected by the Flet client. These schemas deliberately accept the union of the Material and Cupertino properties: Ruby describes intent and the platform renderer decides how that intent looks.
Defined Under Namespace
Modules: Components
Constant Summary collapse
- CANONICAL_CLASS_MAP =
{ %w[button elevated_button elevatedbutton] => Components::ButtonControl, %w[filled_button filledbutton] => Components::FilledButtonControl, %w[filled_tonal_button filledtonalbutton] => Components::FilledTonalButtonControl, %w[outlined_button outlinedbutton] => Components::OutlinedButtonControl, %w[text_button textbutton] => Components::TextButtonControl, %w[text_field textfield] => Components::TextFieldControl, %w[checkbox] => Components::CheckboxControl, %w[radio] => Components::RadioControl, %w[slider] => Components::SliderControl, %w[switch] => Components::SwitchControl, %w[alert_dialog alertdialog] => Components::AlertDialogControl, %w[bottom_sheet bottomsheet] => Components::BottomSheetControl, %w[app_bar appbar] => Components::AppBarControl, %w[list_tile listtile] => Components::ListTileControl, %w[navigation_bar navigationbar] => Components::, %w[progress_ring progressring] => Components::ProgressRingControl, %w[segmented_button segmentedbutton] => Components::SegmentedButtonControl, %w[context_menu contextmenu] => Components::ContextMenuControl, %w[context_menu_action contextmenuaction] => Components::ContextMenuActionControl, %w[action_sheet actionsheet] => Components::ActionSheetControl, %w[action_sheet_action actionsheetaction] => Components::ActionSheetActionControl, %w[date_picker datepicker] => Components::DatePickerControl, %w[picker] => Components::PickerControl, %w[timer_picker timerpicker] => Components::TimerPickerControl, %w[dropdown dropdown_m2 dropdownm2] => Components::DropdownControl, }.each_with_object({}) do |(names, klass), map| names.each { |name| map[name] = klass } end.freeze
- LEGACY_CLASS_MAP =
{ %w[cupertino_button cupertinobutton] => Controls::RufletComponents::CupertinoButtonControl, %w[cupertino_filled_button cupertinofilledbutton] => Controls::RufletComponents::CupertinoFilledButtonControl, %w[cupertino_tinted_button cupertinotintedbutton] => Controls::RufletComponents::CupertinoTintedButtonControl, %w[cupertino_text_field cupertinotextfield] => Controls::RufletComponents::CupertinoTextFieldControl, %w[cupertino_checkbox cupertinocheckbox] => Controls::RufletComponents::CupertinoCheckboxControl, %w[cupertino_radio cupertinoradio] => Controls::RufletComponents::CupertinoRadioControl, %w[cupertino_slider cupertinoslider] => Controls::RufletComponents::CupertinoSliderControl, %w[cupertino_switch cupertinoswitch] => Controls::RufletComponents::CupertinoSwitchControl, %w[cupertino_alert_dialog cupertinoalertdialog] => Controls::RufletComponents::CupertinoAlertDialogControl, %w[cupertino_bottom_sheet cupertinobottomsheet] => Controls::RufletComponents::CupertinoBottomSheetControl, %w[cupertino_app_bar cupertinoappbar] => Controls::RufletComponents::CupertinoAppBarControl, %w[cupertino_list_tile cupertinolisttile] => Controls::RufletComponents::CupertinoListTileControl, %w[cupertino_navigation_bar cupertinonavigationbar] => Controls::RufletComponents::, %w[cupertino_activity_indicator cupertinoactivityindicator] => Controls::RufletComponents::CupertinoActivityIndicatorControl, %w[cupertino_segmented_button cupertinosegmentedbutton] => Controls::RufletComponents::CupertinoSegmentedButtonControl, %w[cupertino_sliding_segmented_button cupertinoslidingsegmentedbutton] => Controls::RufletComponents::CupertinoSlidingSegmentedButtonControl, %w[cupertino_context_menu cupertinocontextmenu] => Controls::RufletComponents::CupertinoContextMenuControl, %w[cupertino_context_menu_action cupertinocontextmenuaction] => Controls::RufletComponents::CupertinoContextMenuActionControl, %w[cupertino_action_sheet cupertinoactionsheet] => Controls::RufletComponents::CupertinoActionSheetControl, %w[cupertino_action_sheet_action cupertinoactionsheetaction] => Controls::RufletComponents::CupertinoActionSheetActionControl, %w[cupertino_date_picker cupertinodatepicker] => Controls::RufletComponents::CupertinoDatePickerControl, %w[cupertino_picker cupertinopicker] => Controls::RufletComponents::CupertinoPickerControl, %w[cupertino_timer_picker cupertinotimerpicker] => Controls::RufletComponents::CupertinoTimerPickerControl, %w[cupertino_dialog_action cupertinodialogaction] => Controls::RufletComponents::CupertinoDialogActionControl, %w[popup_menu_item popupmenuitem] => Controls::RufletComponents::PopupMenuItemControl }.each_with_object({}) do |(names, klass), map| names.each { |name| map[name] = klass } end.freeze
- CLASS_MAP =
CANONICAL_CLASS_MAP.merge(LEGACY_CLASS_MAP).freeze
- TYPE_MAP =
CLASS_MAP.each_with_object({}) do |(name, klass), map| map[name] = klass::WIRE end.freeze