ruflet_core 0.0.17 → 0.0.18
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 +4 -4
- data/README.md +2 -30
- data/lib/ruflet/version.rb +1 -1
- data/lib/ruflet_core.rb +9 -7
- data/lib/ruflet_protocol/ruflet/protocol.rb +28 -54
- data/lib/ruflet_ui/ruflet/app.rb +1 -1
- data/lib/ruflet_ui/ruflet/colors.rb +4 -50
- data/lib/ruflet_ui/ruflet/control.rb +69 -64
- data/lib/ruflet_ui/ruflet/dsl.rb +10 -3
- data/lib/ruflet_ui/ruflet/icons/cupertino/cupertino_icons.rb +2 -2
- data/lib/ruflet_ui/ruflet/icons/cupertino_icon_lookup.rb +1 -0
- data/lib/ruflet_ui/ruflet/icons/icon_constant_names.rb +29 -0
- data/lib/ruflet_ui/ruflet/icons/material/material_icons.rb +2 -2
- data/lib/ruflet_ui/ruflet/icons/material_icon_lookup.rb +1 -0
- data/lib/ruflet_ui/ruflet/page.rb +308 -526
- data/lib/ruflet_ui/ruflet/ui/control_factory.rb +68 -12
- data/lib/ruflet_ui/ruflet/ui/control_registry.rb +13 -6
- data/lib/ruflet_ui/ruflet/ui/controls/cupertinos/cupertinoactionsheet_control.rb +8 -45
- data/lib/ruflet_ui/ruflet/ui/controls/cupertinos/cupertinoactionsheetaction_control.rb +45 -2
- data/lib/ruflet_ui/ruflet/ui/controls/cupertinos/cupertinoactivityindicator_control.rb +43 -2
- data/lib/ruflet_ui/ruflet/ui/controls/cupertinos/cupertinoalertdialog_control.rb +0 -5
- data/lib/ruflet_ui/ruflet/ui/controls/cupertinos/cupertinobutton_control.rb +59 -4
- data/lib/ruflet_ui/ruflet/ui/controls/cupertinos/cupertinocheckbox_control.rb +56 -1
- data/lib/ruflet_ui/ruflet/ui/controls/cupertinos/cupertinocontextmenu_control.rb +1 -3
- data/lib/ruflet_ui/ruflet/ui/controls/cupertinos/cupertinocontextmenuaction_control.rb +1 -1
- data/lib/ruflet_ui/ruflet/ui/controls/cupertinos/cupertinodatepicker_control.rb +53 -8
- data/lib/ruflet_ui/ruflet/ui/controls/cupertinos/cupertinodialogaction_control.rb +1 -1
- data/lib/ruflet_ui/ruflet/ui/controls/cupertinos/cupertinofilledbutton_control.rb +59 -4
- data/lib/ruflet_ui/ruflet/ui/controls/cupertinos/cupertinolisttile_control.rb +54 -9
- data/lib/ruflet_ui/ruflet/ui/controls/cupertinos/cupertinonavigationbar_control.rb +47 -9
- data/lib/ruflet_ui/ruflet/ui/controls/cupertinos/cupertinopicker_control.rb +52 -10
- data/lib/ruflet_ui/ruflet/ui/controls/cupertinos/cupertinoradio_control.rb +52 -1
- data/lib/ruflet_ui/ruflet/ui/controls/cupertinos/cupertinosegmentedbutton_control.rb +49 -1
- data/lib/ruflet_ui/ruflet/ui/controls/cupertinos/cupertinoslider_control.rb +50 -5
- data/lib/ruflet_ui/ruflet/ui/controls/cupertinos/cupertinoslidingsegmentedbutton_control.rb +46 -1
- data/lib/ruflet_ui/ruflet/ui/controls/cupertinos/cupertinoswitch_control.rb +61 -1
- data/lib/ruflet_ui/ruflet/ui/controls/cupertinos/cupertinotextfield_control.rb +145 -1
- data/lib/ruflet_ui/ruflet/ui/controls/cupertinos/cupertinotimerpicker_control.rb +47 -12
- data/lib/ruflet_ui/ruflet/ui/controls/cupertinos/cupertinotintedbutton_control.rb +59 -4
- data/lib/ruflet_ui/ruflet/ui/controls/materials/alertdialog_control.rb +8 -45
- data/lib/ruflet_ui/ruflet/ui/controls/materials/appbar_control.rb +8 -40
- data/lib/ruflet_ui/ruflet/ui/controls/materials/audio_control.rb +16 -5
- data/lib/ruflet_ui/ruflet/ui/controls/materials/autocomplete_control.rb +44 -1
- data/lib/ruflet_ui/ruflet/ui/controls/materials/badge_control.rb +0 -7
- data/lib/ruflet_ui/ruflet/ui/controls/materials/banner_control.rb +0 -7
- data/lib/ruflet_ui/ruflet/ui/controls/materials/bottomappbar_control.rb +8 -47
- data/lib/ruflet_ui/ruflet/ui/controls/materials/bottomsheet_control.rb +0 -3
- data/lib/ruflet_ui/ruflet/ui/controls/materials/button_control.rb +8 -54
- data/lib/ruflet_ui/ruflet/ui/controls/materials/card_control.rb +8 -50
- data/lib/ruflet_ui/ruflet/ui/controls/materials/chart_controls.rb +19 -0
- data/lib/ruflet_ui/ruflet/ui/controls/materials/checkbox_control.rb +9 -60
- data/lib/ruflet_ui/ruflet/ui/controls/materials/chip_control.rb +7 -81
- data/lib/ruflet_ui/ruflet/ui/controls/materials/circleavatar_control.rb +7 -56
- data/lib/ruflet_ui/ruflet/ui/controls/materials/container_control.rb +9 -65
- data/lib/ruflet_ui/ruflet/ui/controls/materials/contextmenu_control.rb +50 -4
- data/lib/ruflet_ui/ruflet/ui/controls/materials/datacell_control.rb +1 -3
- data/lib/ruflet_ui/ruflet/ui/controls/materials/datacolumn_control.rb +1 -3
- data/lib/ruflet_ui/ruflet/ui/controls/materials/datatable_control.rb +7 -88
- data/lib/ruflet_ui/ruflet/ui/controls/materials/datepicker_control.rb +9 -55
- data/lib/ruflet_ui/ruflet/ui/controls/materials/daterangepicker_control.rb +8 -58
- data/lib/ruflet_ui/ruflet/ui/controls/materials/divider_control.rb +0 -9
- data/lib/ruflet_ui/ruflet/ui/controls/materials/dropdown_control.rb +8 -93
- data/lib/ruflet_ui/ruflet/ui/controls/materials/dropdownm2_control.rb +9 -103
- data/lib/ruflet_ui/ruflet/ui/controls/materials/dropdownoption_control.rb +0 -2
- data/lib/ruflet_ui/ruflet/ui/controls/materials/expansionpanel_control.rb +7 -51
- data/lib/ruflet_ui/ruflet/ui/controls/materials/expansionpanellist_control.rb +46 -5
- data/lib/ruflet_ui/ruflet/ui/controls/materials/expansiontile_control.rb +69 -3
- data/lib/ruflet_ui/ruflet/ui/controls/materials/filledbutton_control.rb +54 -2
- data/lib/ruflet_ui/ruflet/ui/controls/materials/fillediconbutton_control.rb +67 -5
- data/lib/ruflet_ui/ruflet/ui/controls/materials/filledtonalbutton_control.rb +54 -2
- data/lib/ruflet_ui/ruflet/ui/controls/materials/filledtonaliconbutton_control.rb +67 -5
- data/lib/ruflet_ui/ruflet/ui/controls/materials/floatingactionbutton_control.rb +7 -69
- data/lib/ruflet_ui/ruflet/ui/controls/materials/iconbutton_control.rb +8 -68
- data/lib/ruflet_ui/ruflet/ui/controls/materials/listtile_control.rb +8 -74
- data/lib/ruflet_ui/ruflet/ui/controls/materials/map_control.rb +99 -0
- data/lib/ruflet_ui/ruflet/ui/controls/materials/menuitembutton_control.rb +8 -56
- data/lib/ruflet_ui/ruflet/ui/controls/materials/navigationbar_control.rb +7 -59
- data/lib/ruflet_ui/ruflet/ui/controls/materials/navigationdrawer_control.rb +0 -7
- data/lib/ruflet_ui/ruflet/ui/controls/materials/navigationrail_control.rb +7 -73
- data/lib/ruflet_ui/ruflet/ui/controls/materials/outlinedbutton_control.rb +51 -2
- data/lib/ruflet_ui/ruflet/ui/controls/materials/outlinediconbutton_control.rb +67 -5
- data/lib/ruflet_ui/ruflet/ui/controls/materials/popupmenubutton_control.rb +8 -61
- data/lib/ruflet_ui/ruflet/ui/controls/materials/popupmenuitem_control.rb +0 -6
- data/lib/ruflet_ui/ruflet/ui/controls/materials/progressbar_control.rb +8 -56
- data/lib/ruflet_ui/ruflet/ui/controls/materials/progressring_control.rb +8 -56
- data/lib/ruflet_ui/ruflet/ui/controls/materials/radio_control.rb +9 -54
- data/lib/ruflet_ui/ruflet/ui/controls/materials/rangeslider_control.rb +7 -62
- data/lib/ruflet_ui/ruflet/ui/controls/materials/reorderablelistview_control.rb +9 -64
- data/lib/ruflet_ui/ruflet/ui/controls/materials/ruflet_controls.rb +5 -26
- data/lib/ruflet_ui/ruflet/ui/controls/materials/searchbar_control.rb +80 -11
- data/lib/ruflet_ui/ruflet/ui/controls/materials/segment_control.rb +0 -3
- data/lib/ruflet_ui/ruflet/ui/controls/materials/segmentedbutton_control.rb +7 -64
- data/lib/ruflet_ui/ruflet/ui/controls/materials/selectionarea_control.rb +1 -3
- data/lib/ruflet_ui/ruflet/ui/controls/materials/slider_control.rb +9 -60
- data/lib/ruflet_ui/ruflet/ui/controls/materials/snackbar_control.rb +37 -4
- data/lib/ruflet_ui/ruflet/ui/controls/materials/snackbaraction_control.rb +38 -0
- data/lib/ruflet_ui/ruflet/ui/controls/materials/spinkit_control.rb +25 -0
- data/lib/ruflet_ui/ruflet/ui/controls/materials/submenubutton_control.rb +52 -7
- data/lib/ruflet_ui/ruflet/ui/controls/materials/switch_control.rb +9 -61
- data/lib/ruflet_ui/ruflet/ui/controls/materials/tab_control.rb +0 -7
- data/lib/ruflet_ui/ruflet/ui/controls/materials/tabbar_control.rb +8 -64
- data/lib/ruflet_ui/ruflet/ui/controls/materials/tabbarview_control.rb +43 -5
- data/lib/ruflet_ui/ruflet/ui/controls/materials/tabs_control.rb +7 -47
- data/lib/ruflet_ui/ruflet/ui/controls/materials/textbutton_control.rb +51 -2
- data/lib/ruflet_ui/ruflet/ui/controls/materials/textfield_control.rb +9 -132
- data/lib/ruflet_ui/ruflet/ui/controls/materials/timepicker_control.rb +10 -34
- data/lib/ruflet_ui/ruflet/ui/controls/materials/verticaldivider_control.rb +0 -9
- data/lib/ruflet_ui/ruflet/ui/controls/materials/video_control.rb +9 -42
- data/lib/ruflet_ui/ruflet/ui/controls/materials/webview_control.rb +1 -114
- data/lib/ruflet_ui/ruflet/ui/controls/ruflet_controls.rb +13 -28
- data/lib/ruflet_ui/ruflet/ui/controls/shared/animatedswitcher_control.rb +46 -4
- data/lib/ruflet_ui/ruflet/ui/controls/shared/arc_control.rb +1 -0
- data/lib/ruflet_ui/ruflet/ui/controls/shared/browsercontextmenu_control.rb +1 -12
- data/lib/ruflet_ui/ruflet/ui/controls/shared/canvas_control.rb +8 -54
- data/lib/ruflet_ui/ruflet/ui/controls/shared/circle_control.rb +1 -0
- data/lib/ruflet_ui/ruflet/ui/controls/shared/column_control.rb +9 -51
- data/lib/ruflet_ui/ruflet/ui/controls/shared/dismissible_control.rb +52 -12
- data/lib/ruflet_ui/ruflet/ui/controls/shared/draggable_control.rb +1 -7
- data/lib/ruflet_ui/ruflet/ui/controls/shared/dragtarget_control.rb +1 -3
- data/lib/ruflet_ui/ruflet/ui/controls/shared/fletapp_control.rb +9 -46
- data/lib/ruflet_ui/ruflet/ui/controls/shared/gesturedetector_control.rb +9 -113
- data/lib/ruflet_ui/ruflet/ui/controls/shared/gridview_control.rb +57 -13
- data/lib/ruflet_ui/ruflet/ui/controls/shared/hero_control.rb +9 -40
- data/lib/ruflet_ui/ruflet/ui/controls/shared/icon_control.rb +9 -48
- data/lib/ruflet_ui/ruflet/ui/controls/shared/interactiveviewer_control.rb +9 -53
- data/lib/ruflet_ui/ruflet/ui/controls/shared/line_control.rb +1 -0
- data/lib/ruflet_ui/ruflet/ui/controls/shared/listview_control.rb +57 -11
- data/lib/ruflet_ui/ruflet/ui/controls/shared/markdown_control.rb +9 -54
- data/lib/ruflet_ui/ruflet/ui/controls/shared/oval_control.rb +1 -0
- data/lib/ruflet_ui/ruflet/ui/controls/shared/page_control.rb +9 -58
- data/lib/ruflet_ui/ruflet/ui/controls/shared/pagelet_control.rb +9 -48
- data/lib/ruflet_ui/ruflet/ui/controls/shared/pageview_control.rb +50 -4
- data/lib/ruflet_ui/ruflet/ui/controls/shared/path_control.rb +1 -0
- data/lib/ruflet_ui/ruflet/ui/controls/shared/placeholder_control.rb +44 -9
- data/lib/ruflet_ui/ruflet/ui/controls/shared/points_control.rb +1 -0
- data/lib/ruflet_ui/ruflet/ui/controls/shared/rect_control.rb +1 -0
- data/lib/ruflet_ui/ruflet/ui/controls/shared/reorderabledraghandle_control.rb +43 -4
- data/lib/ruflet_ui/ruflet/ui/controls/shared/responsiverow_control.rb +47 -15
- data/lib/ruflet_ui/ruflet/ui/controls/shared/rotatedbox_control.rb +97 -0
- data/lib/ruflet_ui/ruflet/ui/controls/shared/row_control.rb +9 -51
- data/lib/ruflet_ui/ruflet/ui/controls/shared/ruflet_controls.rb +5 -0
- data/lib/ruflet_ui/ruflet/ui/controls/shared/safearea_control.rb +48 -4
- data/lib/ruflet_ui/ruflet/ui/{services/ruflet → controls/shared}/screenshot_control.rb +18 -2
- data/lib/ruflet_ui/ruflet/ui/controls/shared/semantics_control.rb +65 -1
- data/lib/ruflet_ui/ruflet/ui/controls/shared/shadermask_control.rb +9 -41
- data/lib/ruflet_ui/ruflet/ui/controls/shared/shimmer_control.rb +9 -44
- data/lib/ruflet_ui/ruflet/ui/controls/shared/stack_control.rb +44 -1
- data/lib/ruflet_ui/ruflet/ui/controls/shared/text_control.rb +9 -35
- data/lib/ruflet_ui/ruflet/ui/controls/shared/transparentpointer_control.rb +9 -38
- data/lib/ruflet_ui/ruflet/ui/controls/shared/view_control.rb +63 -1
- data/lib/ruflet_ui/ruflet/ui/controls/shared/window_control.rb +40 -66
- data/lib/ruflet_ui/ruflet/ui/controls/shared/windowdragarea_control.rb +45 -4
- data/lib/ruflet_ui/ruflet/ui/material_control_methods.rb +61 -17
- data/lib/ruflet_ui/ruflet/ui/material_control_registry.rb +22 -0
- data/lib/ruflet_ui/ruflet/ui/services/ruflet/accelerometer_control.rb +1 -0
- data/lib/ruflet_ui/ruflet/ui/services/ruflet/audio_recorder_control.rb +14 -36
- data/lib/ruflet_ui/ruflet/ui/services/ruflet/barometer_control.rb +1 -0
- data/lib/ruflet_ui/ruflet/ui/services/ruflet/battery_control.rb +1 -0
- data/lib/ruflet_ui/ruflet/ui/services/ruflet/camera_control.rb +9 -42
- data/lib/ruflet_ui/ruflet/ui/services/ruflet/clipboard_control.rb +31 -0
- data/lib/ruflet_ui/ruflet/ui/services/ruflet/connectivity_control.rb +1 -0
- data/lib/ruflet_ui/ruflet/ui/services/ruflet/filepicker_control.rb +1 -0
- data/lib/ruflet_ui/ruflet/ui/services/ruflet/flashlight_control.rb +1 -0
- data/lib/ruflet_ui/ruflet/ui/services/ruflet/geolocator_control.rb +14 -30
- data/lib/ruflet_ui/ruflet/ui/services/ruflet/gyroscope_control.rb +1 -0
- data/lib/ruflet_ui/ruflet/ui/services/ruflet/hapticfeedback_control.rb +1 -0
- data/lib/ruflet_ui/ruflet/ui/services/ruflet/magnetometer_control.rb +1 -0
- data/lib/ruflet_ui/ruflet/ui/services/ruflet/permissionhandler_control.rb +5 -20
- data/lib/ruflet_ui/ruflet/ui/services/ruflet/screenbrightness_control.rb +1 -0
- data/lib/ruflet_ui/ruflet/ui/services/ruflet/securestorage_control.rb +22 -49
- data/lib/ruflet_ui/ruflet/ui/services/ruflet/semanticsservice_control.rb +20 -15
- data/lib/ruflet_ui/ruflet/ui/services/ruflet/shakedetector_control.rb +1 -0
- data/lib/ruflet_ui/ruflet/ui/services/ruflet/share_control.rb +1 -0
- data/lib/ruflet_ui/ruflet/ui/services/ruflet/sharedpreferences_control.rb +1 -0
- data/lib/ruflet_ui/ruflet/ui/services/ruflet/storagepaths_control.rb +1 -0
- data/lib/ruflet_ui/ruflet/ui/services/ruflet/urllauncher_control.rb +1 -0
- data/lib/ruflet_ui/ruflet/ui/services/ruflet/useraccelerometer_control.rb +1 -0
- data/lib/ruflet_ui/ruflet/ui/services/ruflet/wakelock_control.rb +1 -0
- data/lib/ruflet_ui/ruflet/ui/services/ruflet_services.rb +0 -7
- data/lib/ruflet_ui/ruflet/ui/shared_control_forwarders.rb +20 -1
- data/lib/ruflet_ui.rb +12 -10
- metadata +7 -8
- data/lib/ruflet_ui/ruflet/types/animation.rb +0 -110
- data/lib/ruflet_ui/ruflet/ui/controls/materials/codeeditor_control.rb +0 -93
- data/lib/ruflet_ui/ruflet/ui/controls/materials/map_controls.rb +0 -311
- data/lib/ruflet_ui/ruflet/ui/controls/materials/rive_control.rb +0 -87
- data/lib/ruflet_ui/ruflet/ui/controls/materials/spinkit_controls.rb +0 -109
- data/lib/ruflet_ui/ruflet/ui/services/ruflet/tester_control.rb +0 -126
|
@@ -8,15 +8,77 @@ module Ruflet
|
|
|
8
8
|
TYPE = "filledtonaliconbutton".freeze
|
|
9
9
|
WIRE = "FilledTonalIconButton".freeze
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
KEYWORDS = [:adaptive, :align, :alignment, :animate_align, :animate_margin, :animate_offset, :animate_opacity, :animate_position, :animate_rotation, :animate_scale, :animate_size, :aspect_ratio, :autofocus, :badge, :bgcolor, :bottom, :col, :data, :disabled, :disabled_color, :enable_feedback, :expand, :expand_loose, :focus_color, :height, :highlight_color, :hover_color, :icon, :icon_color, :icon_size, :key, :left, :margin, :mouse_cursor, :offset, :opacity, :padding, :right, :rotate, :rtl, :scale, :selected, :selected_icon, :selected_icon_color, :size_change_interval, :size_constraints, :splash_color, :splash_radius, :style, :tooltip, :top, :url, :visible, :visual_density, :width, :on_animation_end, :on_blur, :on_click, :on_focus, :on_hover, :on_long_press, :on_size_change].freeze
|
|
12
|
+
|
|
13
|
+
def initialize(id: nil, **props)
|
|
14
|
+
unknown = props.keys.reject { |key| KEYWORDS.include?(key) }
|
|
15
|
+
raise ArgumentError, "unknown keywords: #{unknown.join(', ')}" unless unknown.empty?
|
|
16
|
+
adaptive = props[:adaptive]
|
|
17
|
+
align = props[:align]
|
|
18
|
+
alignment = props[:alignment]
|
|
19
|
+
animate_align = props[:animate_align]
|
|
20
|
+
animate_margin = props[:animate_margin]
|
|
21
|
+
animate_offset = props[:animate_offset]
|
|
22
|
+
animate_opacity = props[:animate_opacity]
|
|
23
|
+
animate_position = props[:animate_position]
|
|
24
|
+
animate_rotation = props[:animate_rotation]
|
|
25
|
+
animate_scale = props[:animate_scale]
|
|
26
|
+
animate_size = props[:animate_size]
|
|
27
|
+
aspect_ratio = props[:aspect_ratio]
|
|
28
|
+
autofocus = props[:autofocus]
|
|
29
|
+
badge = props[:badge]
|
|
30
|
+
bgcolor = props[:bgcolor]
|
|
31
|
+
bottom = props[:bottom]
|
|
32
|
+
col = props[:col]
|
|
33
|
+
data = props[:data]
|
|
34
|
+
disabled = props[:disabled]
|
|
35
|
+
disabled_color = props[:disabled_color]
|
|
36
|
+
enable_feedback = props[:enable_feedback]
|
|
37
|
+
expand = props[:expand]
|
|
38
|
+
expand_loose = props[:expand_loose]
|
|
39
|
+
focus_color = props[:focus_color]
|
|
40
|
+
height = props[:height]
|
|
41
|
+
highlight_color = props[:highlight_color]
|
|
42
|
+
hover_color = props[:hover_color]
|
|
43
|
+
icon = props[:icon]
|
|
44
|
+
icon_color = props[:icon_color]
|
|
45
|
+
icon_size = props[:icon_size]
|
|
46
|
+
key = props[:key]
|
|
47
|
+
left = props[:left]
|
|
48
|
+
margin = props[:margin]
|
|
49
|
+
mouse_cursor = props[:mouse_cursor]
|
|
50
|
+
offset = props[:offset]
|
|
51
|
+
opacity = props[:opacity]
|
|
52
|
+
padding = props[:padding]
|
|
53
|
+
right = props[:right]
|
|
54
|
+
rotate = props[:rotate]
|
|
55
|
+
rtl = props[:rtl]
|
|
56
|
+
scale = props[:scale]
|
|
57
|
+
selected = props[:selected]
|
|
58
|
+
selected_icon = props[:selected_icon]
|
|
59
|
+
selected_icon_color = props[:selected_icon_color]
|
|
60
|
+
size_change_interval = props[:size_change_interval]
|
|
61
|
+
size_constraints = props[:size_constraints]
|
|
62
|
+
splash_color = props[:splash_color]
|
|
63
|
+
splash_radius = props[:splash_radius]
|
|
64
|
+
style = props[:style]
|
|
65
|
+
tooltip = props[:tooltip]
|
|
66
|
+
top = props[:top]
|
|
67
|
+
url = props[:url]
|
|
68
|
+
visible = props[:visible]
|
|
69
|
+
visual_density = props[:visual_density]
|
|
70
|
+
width = props[:width]
|
|
71
|
+
on_animation_end = props[:on_animation_end]
|
|
72
|
+
on_blur = props[:on_blur]
|
|
73
|
+
on_click = props[:on_click]
|
|
74
|
+
on_focus = props[:on_focus]
|
|
75
|
+
on_hover = props[:on_hover]
|
|
76
|
+
on_long_press = props[:on_long_press]
|
|
77
|
+
on_size_change = props[:on_size_change]
|
|
12
78
|
alignment = "center" if alignment.nil?
|
|
13
79
|
autofocus = false if autofocus.nil?
|
|
14
80
|
icon_size = 24 if icon_size.nil?
|
|
15
81
|
padding = { "all" => 8 } if padding.nil?
|
|
16
|
-
unless splash_radius.nil? || splash_radius.positive?
|
|
17
|
-
raise ArgumentError, "filled_tonal_icon_button splash_radius must be greater than 0"
|
|
18
|
-
end
|
|
19
|
-
|
|
20
82
|
props = {}
|
|
21
83
|
props[:adaptive] = adaptive unless adaptive.nil?
|
|
22
84
|
props[:align] = align unless align.nil?
|
|
@@ -8,77 +8,15 @@ module Ruflet
|
|
|
8
8
|
TYPE = "floatingactionbutton".freeze
|
|
9
9
|
WIRE = "FloatingActionButton".freeze
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
if icon.nil? && blank_content?(content)
|
|
13
|
-
raise ArgumentError, "floating_action_button requires icon or non-empty content"
|
|
14
|
-
end
|
|
11
|
+
KEYWORDS = [:align, :animate_align, :animate_margin, :animate_offset, :animate_opacity, :animate_position, :animate_rotation, :animate_scale, :animate_size, :aspect_ratio, :autofocus, :badge, :bgcolor, :bottom, :clip_behavior, :col, :content, :data, :disabled, :disabled_elevation, :elevation, :enable_feedback, :expand, :expand_loose, :focus_color, :focus_elevation, :foreground_color, :height, :highlight_elevation, :hover_color, :hover_elevation, :icon, :key, :left, :margin, :mini, :mouse_cursor, :offset, :opacity, :right, :rotate, :rtl, :scale, :shape, :size_change_interval, :splash_color, :tooltip, :top, :url, :visible, :width, :on_animation_end, :on_click, :on_size_change].freeze
|
|
15
12
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
hover_elevation: hover_elevation
|
|
22
|
-
}.each do |name, value|
|
|
23
|
-
raise ArgumentError, "floating_action_button #{name} must be greater than or equal to 0" unless value.nil? || value >= 0
|
|
13
|
+
def initialize(id: nil, **props)
|
|
14
|
+
compact = {}
|
|
15
|
+
props.each do |key, value|
|
|
16
|
+
raise ArgumentError, "unknown keyword: :#{key}" unless KEYWORDS.include?(key)
|
|
17
|
+
compact[key] = value unless value.nil?
|
|
24
18
|
end
|
|
25
|
-
|
|
26
|
-
props = {}
|
|
27
|
-
props[:align] = align unless align.nil?
|
|
28
|
-
props[:animate_align] = animate_align unless animate_align.nil?
|
|
29
|
-
props[:animate_margin] = animate_margin unless animate_margin.nil?
|
|
30
|
-
props[:animate_offset] = animate_offset unless animate_offset.nil?
|
|
31
|
-
props[:animate_opacity] = animate_opacity unless animate_opacity.nil?
|
|
32
|
-
props[:animate_position] = animate_position unless animate_position.nil?
|
|
33
|
-
props[:animate_rotation] = animate_rotation unless animate_rotation.nil?
|
|
34
|
-
props[:animate_scale] = animate_scale unless animate_scale.nil?
|
|
35
|
-
props[:animate_size] = animate_size unless animate_size.nil?
|
|
36
|
-
props[:aspect_ratio] = aspect_ratio unless aspect_ratio.nil?
|
|
37
|
-
props[:autofocus] = autofocus unless autofocus.nil?
|
|
38
|
-
props[:badge] = badge unless badge.nil?
|
|
39
|
-
props[:bgcolor] = bgcolor unless bgcolor.nil?
|
|
40
|
-
props[:bottom] = bottom unless bottom.nil?
|
|
41
|
-
props[:clip_behavior] = clip_behavior unless clip_behavior.nil?
|
|
42
|
-
props[:col] = col unless col.nil?
|
|
43
|
-
props[:content] = content unless content.nil?
|
|
44
|
-
props[:data] = data unless data.nil?
|
|
45
|
-
props[:disabled] = disabled unless disabled.nil?
|
|
46
|
-
props[:disabled_elevation] = disabled_elevation unless disabled_elevation.nil?
|
|
47
|
-
props[:elevation] = elevation unless elevation.nil?
|
|
48
|
-
props[:enable_feedback] = enable_feedback unless enable_feedback.nil?
|
|
49
|
-
props[:expand] = expand unless expand.nil?
|
|
50
|
-
props[:expand_loose] = expand_loose unless expand_loose.nil?
|
|
51
|
-
props[:focus_color] = focus_color unless focus_color.nil?
|
|
52
|
-
props[:focus_elevation] = focus_elevation unless focus_elevation.nil?
|
|
53
|
-
props[:foreground_color] = foreground_color unless foreground_color.nil?
|
|
54
|
-
props[:height] = height unless height.nil?
|
|
55
|
-
props[:highlight_elevation] = highlight_elevation unless highlight_elevation.nil?
|
|
56
|
-
props[:hover_color] = hover_color unless hover_color.nil?
|
|
57
|
-
props[:hover_elevation] = hover_elevation unless hover_elevation.nil?
|
|
58
|
-
props[:icon] = icon unless icon.nil?
|
|
59
|
-
props[:key] = key unless key.nil?
|
|
60
|
-
props[:left] = left unless left.nil?
|
|
61
|
-
props[:margin] = margin unless margin.nil?
|
|
62
|
-
props[:mini] = mini unless mini.nil?
|
|
63
|
-
props[:mouse_cursor] = mouse_cursor unless mouse_cursor.nil?
|
|
64
|
-
props[:offset] = offset unless offset.nil?
|
|
65
|
-
props[:opacity] = opacity unless opacity.nil?
|
|
66
|
-
props[:right] = right unless right.nil?
|
|
67
|
-
props[:rotate] = rotate unless rotate.nil?
|
|
68
|
-
props[:rtl] = rtl unless rtl.nil?
|
|
69
|
-
props[:scale] = scale unless scale.nil?
|
|
70
|
-
props[:shape] = shape unless shape.nil?
|
|
71
|
-
props[:size_change_interval] = size_change_interval unless size_change_interval.nil?
|
|
72
|
-
props[:splash_color] = splash_color unless splash_color.nil?
|
|
73
|
-
props[:tooltip] = tooltip unless tooltip.nil?
|
|
74
|
-
props[:top] = top unless top.nil?
|
|
75
|
-
props[:url] = url unless url.nil?
|
|
76
|
-
props[:visible] = visible unless visible.nil?
|
|
77
|
-
props[:width] = width unless width.nil?
|
|
78
|
-
props[:on_animation_end] = on_animation_end unless on_animation_end.nil?
|
|
79
|
-
props[:on_click] = on_click unless on_click.nil?
|
|
80
|
-
props[:on_size_change] = on_size_change unless on_size_change.nil?
|
|
81
|
-
super(type: TYPE, id: id, **props)
|
|
19
|
+
super(type: TYPE, id: id, **compact)
|
|
82
20
|
end
|
|
83
21
|
|
|
84
22
|
private
|
|
@@ -8,75 +8,15 @@ module Ruflet
|
|
|
8
8
|
TYPE = "iconbutton".freeze
|
|
9
9
|
WIRE = "IconButton".freeze
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
unless splash_radius.nil? || splash_radius >= 0
|
|
13
|
-
raise ArgumentError, "icon_button splash_radius must be greater than or equal to 0"
|
|
14
|
-
end
|
|
11
|
+
KEYWORDS = [:adaptive, :align, :alignment, :animate_align, :animate_margin, :animate_offset, :animate_opacity, :animate_position, :animate_rotation, :animate_scale, :animate_size, :aspect_ratio, :autofocus, :badge, :bgcolor, :bottom, :col, :data, :disabled, :disabled_color, :enable_feedback, :expand, :expand_loose, :focus_color, :height, :highlight_color, :hover_color, :icon, :icon_color, :icon_size, :key, :left, :margin, :mouse_cursor, :offset, :opacity, :padding, :right, :rotate, :rtl, :scale, :selected, :selected_icon, :selected_icon_color, :size_change_interval, :size_constraints, :splash_color, :splash_radius, :style, :tooltip, :top, :url, :visible, :visual_density, :width, :on_animation_end, :on_blur, :on_click, :on_focus, :on_hover, :on_long_press, :on_size_change].freeze
|
|
15
12
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
props
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
props[:animate_opacity] = animate_opacity unless animate_opacity.nil?
|
|
24
|
-
props[:animate_position] = animate_position unless animate_position.nil?
|
|
25
|
-
props[:animate_rotation] = animate_rotation unless animate_rotation.nil?
|
|
26
|
-
props[:animate_scale] = animate_scale unless animate_scale.nil?
|
|
27
|
-
props[:animate_size] = animate_size unless animate_size.nil?
|
|
28
|
-
props[:aspect_ratio] = aspect_ratio unless aspect_ratio.nil?
|
|
29
|
-
props[:autofocus] = autofocus unless autofocus.nil?
|
|
30
|
-
props[:badge] = badge unless badge.nil?
|
|
31
|
-
props[:bgcolor] = bgcolor unless bgcolor.nil?
|
|
32
|
-
props[:bottom] = bottom unless bottom.nil?
|
|
33
|
-
props[:col] = col unless col.nil?
|
|
34
|
-
props[:data] = data unless data.nil?
|
|
35
|
-
props[:disabled] = disabled unless disabled.nil?
|
|
36
|
-
props[:disabled_color] = disabled_color unless disabled_color.nil?
|
|
37
|
-
props[:enable_feedback] = enable_feedback unless enable_feedback.nil?
|
|
38
|
-
props[:expand] = expand unless expand.nil?
|
|
39
|
-
props[:expand_loose] = expand_loose unless expand_loose.nil?
|
|
40
|
-
props[:focus_color] = focus_color unless focus_color.nil?
|
|
41
|
-
props[:height] = height unless height.nil?
|
|
42
|
-
props[:highlight_color] = highlight_color unless highlight_color.nil?
|
|
43
|
-
props[:hover_color] = hover_color unless hover_color.nil?
|
|
44
|
-
props[:icon] = icon unless icon.nil?
|
|
45
|
-
props[:icon_color] = icon_color unless icon_color.nil?
|
|
46
|
-
props[:icon_size] = icon_size unless icon_size.nil?
|
|
47
|
-
props[:key] = key unless key.nil?
|
|
48
|
-
props[:left] = left unless left.nil?
|
|
49
|
-
props[:margin] = margin unless margin.nil?
|
|
50
|
-
props[:mouse_cursor] = mouse_cursor unless mouse_cursor.nil?
|
|
51
|
-
props[:offset] = offset unless offset.nil?
|
|
52
|
-
props[:opacity] = opacity unless opacity.nil?
|
|
53
|
-
props[:padding] = padding unless padding.nil?
|
|
54
|
-
props[:right] = right unless right.nil?
|
|
55
|
-
props[:rotate] = rotate unless rotate.nil?
|
|
56
|
-
props[:rtl] = rtl unless rtl.nil?
|
|
57
|
-
props[:scale] = scale unless scale.nil?
|
|
58
|
-
props[:selected] = selected unless selected.nil?
|
|
59
|
-
props[:selected_icon] = selected_icon unless selected_icon.nil?
|
|
60
|
-
props[:selected_icon_color] = selected_icon_color unless selected_icon_color.nil?
|
|
61
|
-
props[:size_change_interval] = size_change_interval unless size_change_interval.nil?
|
|
62
|
-
props[:size_constraints] = size_constraints unless size_constraints.nil?
|
|
63
|
-
props[:splash_color] = splash_color unless splash_color.nil?
|
|
64
|
-
props[:splash_radius] = splash_radius unless splash_radius.nil?
|
|
65
|
-
props[:style] = style unless style.nil?
|
|
66
|
-
props[:tooltip] = tooltip unless tooltip.nil?
|
|
67
|
-
props[:top] = top unless top.nil?
|
|
68
|
-
props[:url] = url unless url.nil?
|
|
69
|
-
props[:visible] = visible unless visible.nil?
|
|
70
|
-
props[:visual_density] = visual_density unless visual_density.nil?
|
|
71
|
-
props[:width] = width unless width.nil?
|
|
72
|
-
props[:on_animation_end] = on_animation_end unless on_animation_end.nil?
|
|
73
|
-
props[:on_blur] = on_blur unless on_blur.nil?
|
|
74
|
-
props[:on_click] = on_click unless on_click.nil?
|
|
75
|
-
props[:on_focus] = on_focus unless on_focus.nil?
|
|
76
|
-
props[:on_hover] = on_hover unless on_hover.nil?
|
|
77
|
-
props[:on_long_press] = on_long_press unless on_long_press.nil?
|
|
78
|
-
props[:on_size_change] = on_size_change unless on_size_change.nil?
|
|
79
|
-
super(type: TYPE, id: id, **props)
|
|
13
|
+
def initialize(id: nil, **props)
|
|
14
|
+
compact = {}
|
|
15
|
+
props.each do |key, value|
|
|
16
|
+
raise ArgumentError, "unknown keyword: :#{key}" unless KEYWORDS.include?(key)
|
|
17
|
+
compact[key] = value unless value.nil?
|
|
18
|
+
end
|
|
19
|
+
super(type: TYPE, id: id, **compact)
|
|
80
20
|
end
|
|
81
21
|
end
|
|
82
22
|
end
|
|
@@ -8,81 +8,15 @@ module Ruflet
|
|
|
8
8
|
TYPE = "listtile".freeze
|
|
9
9
|
WIRE = "ListTile".freeze
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
if is_three_line == true && subtitle.nil?
|
|
13
|
-
raise ArgumentError, "list_tile subtitle is required when is_three_line is true"
|
|
14
|
-
end
|
|
11
|
+
KEYWORDS = [:adaptive, :align, :animate_align, :animate_margin, :animate_offset, :animate_opacity, :animate_position, :animate_rotation, :animate_scale, :animate_size, :aspect_ratio, :autofocus, :badge, :bgcolor, :bottom, :col, :content_padding, :data, :dense, :disabled, :enable_feedback, :expand, :expand_loose, :height, :horizontal_spacing, :hover_color, :icon_color, :is_three_line, :key, :leading, :leading_and_trailing_text_style, :left, :margin, :min_height, :min_leading_width, :min_vertical_padding, :mouse_cursor, :offset, :opacity, :right, :rotate, :rtl, :scale, :selected, :selected_color, :selected_tile_color, :shape, :size_change_interval, :splash_color, :style, :subtitle, :subtitle_text_style, :text_color, :title, :title_alignment, :title_text_style, :toggle_inputs, :tooltip, :top, :trailing, :url, :visible, :visual_density, :width, :on_animation_end, :on_click, :on_long_press, :on_size_change].freeze
|
|
15
12
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
props
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
props[:animate_position] = animate_position unless animate_position.nil?
|
|
24
|
-
props[:animate_rotation] = animate_rotation unless animate_rotation.nil?
|
|
25
|
-
props[:animate_scale] = animate_scale unless animate_scale.nil?
|
|
26
|
-
props[:animate_size] = animate_size unless animate_size.nil?
|
|
27
|
-
props[:aspect_ratio] = aspect_ratio unless aspect_ratio.nil?
|
|
28
|
-
props[:autofocus] = autofocus unless autofocus.nil?
|
|
29
|
-
props[:badge] = badge unless badge.nil?
|
|
30
|
-
props[:bgcolor] = bgcolor unless bgcolor.nil?
|
|
31
|
-
props[:bottom] = bottom unless bottom.nil?
|
|
32
|
-
props[:col] = col unless col.nil?
|
|
33
|
-
props[:content_padding] = content_padding unless content_padding.nil?
|
|
34
|
-
props[:data] = data unless data.nil?
|
|
35
|
-
props[:dense] = dense unless dense.nil?
|
|
36
|
-
props[:disabled] = disabled unless disabled.nil?
|
|
37
|
-
props[:enable_feedback] = enable_feedback unless enable_feedback.nil?
|
|
38
|
-
props[:expand] = expand unless expand.nil?
|
|
39
|
-
props[:expand_loose] = expand_loose unless expand_loose.nil?
|
|
40
|
-
props[:height] = height unless height.nil?
|
|
41
|
-
props[:horizontal_spacing] = horizontal_spacing unless horizontal_spacing.nil?
|
|
42
|
-
props[:hover_color] = hover_color unless hover_color.nil?
|
|
43
|
-
props[:icon_color] = icon_color unless icon_color.nil?
|
|
44
|
-
props[:is_three_line] = is_three_line unless is_three_line.nil?
|
|
45
|
-
props[:key] = key unless key.nil?
|
|
46
|
-
props[:leading] = leading unless leading.nil?
|
|
47
|
-
props[:leading_and_trailing_text_style] = leading_and_trailing_text_style unless leading_and_trailing_text_style.nil?
|
|
48
|
-
props[:left] = left unless left.nil?
|
|
49
|
-
props[:margin] = margin unless margin.nil?
|
|
50
|
-
props[:min_height] = min_height unless min_height.nil?
|
|
51
|
-
props[:min_leading_width] = min_leading_width unless min_leading_width.nil?
|
|
52
|
-
props[:min_vertical_padding] = min_vertical_padding unless min_vertical_padding.nil?
|
|
53
|
-
props[:mouse_cursor] = mouse_cursor unless mouse_cursor.nil?
|
|
54
|
-
props[:offset] = offset unless offset.nil?
|
|
55
|
-
props[:opacity] = opacity unless opacity.nil?
|
|
56
|
-
props[:right] = right unless right.nil?
|
|
57
|
-
props[:rotate] = rotate unless rotate.nil?
|
|
58
|
-
props[:rtl] = rtl unless rtl.nil?
|
|
59
|
-
props[:scale] = scale unless scale.nil?
|
|
60
|
-
props[:selected] = selected unless selected.nil?
|
|
61
|
-
props[:selected_color] = selected_color unless selected_color.nil?
|
|
62
|
-
props[:selected_tile_color] = selected_tile_color unless selected_tile_color.nil?
|
|
63
|
-
props[:shape] = shape unless shape.nil?
|
|
64
|
-
props[:size_change_interval] = size_change_interval unless size_change_interval.nil?
|
|
65
|
-
props[:splash_color] = splash_color unless splash_color.nil?
|
|
66
|
-
props[:style] = style unless style.nil?
|
|
67
|
-
props[:subtitle] = subtitle unless subtitle.nil?
|
|
68
|
-
props[:subtitle_text_style] = subtitle_text_style unless subtitle_text_style.nil?
|
|
69
|
-
props[:text_color] = text_color unless text_color.nil?
|
|
70
|
-
props[:title] = title unless title.nil?
|
|
71
|
-
props[:title_alignment] = title_alignment unless title_alignment.nil?
|
|
72
|
-
props[:title_text_style] = title_text_style unless title_text_style.nil?
|
|
73
|
-
props[:toggle_inputs] = toggle_inputs unless toggle_inputs.nil?
|
|
74
|
-
props[:tooltip] = tooltip unless tooltip.nil?
|
|
75
|
-
props[:top] = top unless top.nil?
|
|
76
|
-
props[:trailing] = trailing unless trailing.nil?
|
|
77
|
-
props[:url] = url unless url.nil?
|
|
78
|
-
props[:visible] = visible unless visible.nil?
|
|
79
|
-
props[:visual_density] = visual_density unless visual_density.nil?
|
|
80
|
-
props[:width] = width unless width.nil?
|
|
81
|
-
props[:on_animation_end] = on_animation_end unless on_animation_end.nil?
|
|
82
|
-
props[:on_click] = on_click unless on_click.nil?
|
|
83
|
-
props[:on_long_press] = on_long_press unless on_long_press.nil?
|
|
84
|
-
props[:on_size_change] = on_size_change unless on_size_change.nil?
|
|
85
|
-
super(type: TYPE, id: id, **props)
|
|
13
|
+
def initialize(id: nil, **props)
|
|
14
|
+
compact = {}
|
|
15
|
+
props.each do |key, value|
|
|
16
|
+
raise ArgumentError, "unknown keyword: :#{key}" unless KEYWORDS.include?(key)
|
|
17
|
+
compact[key] = value unless value.nil?
|
|
18
|
+
end
|
|
19
|
+
super(type: TYPE, id: id, **compact)
|
|
86
20
|
end
|
|
87
21
|
end
|
|
88
22
|
end
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Ruflet
|
|
4
|
+
module UI
|
|
5
|
+
module Controls
|
|
6
|
+
module RufletComponents
|
|
7
|
+
class MapControl < Ruflet::Control
|
|
8
|
+
TYPE = "map".freeze
|
|
9
|
+
WIRE = "Map".freeze
|
|
10
|
+
# Map accepts the extension's evolving property surface through
|
|
11
|
+
# **props. An explicit empty schema keeps mruby from mistaking the
|
|
12
|
+
# keyrest parameter itself for a property named `props`.
|
|
13
|
+
KEYWORDS = [].freeze
|
|
14
|
+
|
|
15
|
+
def initialize(id: nil, **props)
|
|
16
|
+
mapped = props.dup
|
|
17
|
+
mapped[:initial_center] = normalize_coordinates(mapped[:initial_center]) if mapped.key?(:initial_center)
|
|
18
|
+
super(type: TYPE, id: id, **mapped)
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def rotate_from(degree, **options)
|
|
22
|
+
invoke_map("rotate_from", options.merge(degree: degree))
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def reset_rotation(**options)
|
|
26
|
+
invoke_map("reset_rotation", options)
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def zoom_in(**options)
|
|
30
|
+
invoke_map("zoom_in", options)
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def zoom_out(**options)
|
|
34
|
+
invoke_map("zoom_out", options)
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def zoom_to(zoom, **options)
|
|
38
|
+
invoke_map("zoom_to", options.merge(zoom: zoom))
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def move_to(destination: nil, zoom: nil, rotation: nil, offset: nil, **options)
|
|
42
|
+
invoke_map(
|
|
43
|
+
"move_to",
|
|
44
|
+
options.merge(
|
|
45
|
+
destination: normalize_coordinates(destination),
|
|
46
|
+
zoom: zoom,
|
|
47
|
+
rotation: rotation,
|
|
48
|
+
offset: offset
|
|
49
|
+
)
|
|
50
|
+
)
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
def center_on(point, zoom: nil, **options)
|
|
54
|
+
invoke_map("center_on", options.merge(point: normalize_coordinates(point), zoom: zoom))
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
private
|
|
58
|
+
|
|
59
|
+
def invoke_map(name, options)
|
|
60
|
+
timeout = options.delete(:timeout) || 10
|
|
61
|
+
on_result = options.delete(:on_result)
|
|
62
|
+
args = options.each_with_object({}) do |(key, value), result|
|
|
63
|
+
next if value.nil?
|
|
64
|
+
|
|
65
|
+
wire_key = case key.to_s
|
|
66
|
+
when "animation_curve" then "curve"
|
|
67
|
+
when "animation_duration" then "duration"
|
|
68
|
+
else key.to_s
|
|
69
|
+
end
|
|
70
|
+
result[wire_key] = normalize_map_value(value)
|
|
71
|
+
end
|
|
72
|
+
runtime_page&.invoke(self, name, args: args, timeout: timeout, on_result: on_result)
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
def normalize_coordinates(value)
|
|
76
|
+
case value
|
|
77
|
+
when Array
|
|
78
|
+
return { "latitude" => value[0], "longitude" => value[1] } if value.length >= 2
|
|
79
|
+
when Hash
|
|
80
|
+
latitude = value["latitude"] || value[:latitude] || value["lat"] || value[:lat]
|
|
81
|
+
longitude = value["longitude"] || value[:longitude] || value["lon"] || value[:lon] || value["lng"] || value[:lng]
|
|
82
|
+
return { "latitude" => latitude, "longitude" => longitude } unless latitude.nil? || longitude.nil?
|
|
83
|
+
end
|
|
84
|
+
value.respond_to?(:to_h) ? normalize_coordinates(value.to_h) : value
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
def normalize_map_value(value)
|
|
88
|
+
case value
|
|
89
|
+
when Array then value.map { |item| normalize_map_value(item) }
|
|
90
|
+
when Hash then value.each_with_object({}) { |(key, item), result| result[key.to_s] = normalize_map_value(item) unless item.nil? }
|
|
91
|
+
when Symbol then value.to_s
|
|
92
|
+
else value.respond_to?(:to_h) ? normalize_map_value(value.to_h) : value
|
|
93
|
+
end
|
|
94
|
+
end
|
|
95
|
+
end
|
|
96
|
+
end
|
|
97
|
+
end
|
|
98
|
+
end
|
|
99
|
+
end
|
|
@@ -8,63 +8,15 @@ module Ruflet
|
|
|
8
8
|
TYPE = "menuitembutton".freeze
|
|
9
9
|
WIRE = "MenuItemButton".freeze
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
if content.nil? || (content.respond_to?(:props) && content.props["visible"] == false)
|
|
13
|
-
raise ArgumentError, "menu_item_button requires visible content"
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
raise ArgumentError, "menu_item_button height must be greater than or equal to 0" unless height.nil? || height >= 0
|
|
11
|
+
KEYWORDS = [:align, :animate_align, :animate_margin, :animate_offset, :animate_opacity, :animate_position, :animate_rotation, :animate_scale, :animate_size, :aspect_ratio, :autofocus, :badge, :bottom, :clip_behavior, :close_on_click, :col, :content, :data, :disabled, :expand, :expand_loose, :focus_on_hover, :height, :key, :leading, :left, :margin, :offset, :opacity, :overflow_axis, :right, :rotate, :rtl, :scale, :semantic_label, :size_change_interval, :style, :tooltip, :top, :trailing, :visible, :width, :on_animation_end, :on_blur, :on_click, :on_focus, :on_hover, :on_size_change].freeze
|
|
17
12
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
props
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
props[:animate_rotation] = animate_rotation unless animate_rotation.nil?
|
|
26
|
-
props[:animate_scale] = animate_scale unless animate_scale.nil?
|
|
27
|
-
props[:animate_size] = animate_size unless animate_size.nil?
|
|
28
|
-
props[:aspect_ratio] = aspect_ratio unless aspect_ratio.nil?
|
|
29
|
-
props[:autofocus] = autofocus unless autofocus.nil?
|
|
30
|
-
props[:badge] = badge unless badge.nil?
|
|
31
|
-
props[:bottom] = bottom unless bottom.nil?
|
|
32
|
-
props[:clip_behavior] = clip_behavior unless clip_behavior.nil?
|
|
33
|
-
props[:close_on_click] = close_on_click unless close_on_click.nil?
|
|
34
|
-
props[:col] = col unless col.nil?
|
|
35
|
-
props[:content] = content unless content.nil?
|
|
36
|
-
props[:data] = data unless data.nil?
|
|
37
|
-
props[:disabled] = disabled unless disabled.nil?
|
|
38
|
-
props[:expand] = expand unless expand.nil?
|
|
39
|
-
props[:expand_loose] = expand_loose unless expand_loose.nil?
|
|
40
|
-
props[:focus_on_hover] = focus_on_hover unless focus_on_hover.nil?
|
|
41
|
-
props[:height] = height unless height.nil?
|
|
42
|
-
props[:key] = key unless key.nil?
|
|
43
|
-
props[:leading] = leading unless leading.nil?
|
|
44
|
-
props[:left] = left unless left.nil?
|
|
45
|
-
props[:margin] = margin unless margin.nil?
|
|
46
|
-
props[:offset] = offset unless offset.nil?
|
|
47
|
-
props[:opacity] = opacity unless opacity.nil?
|
|
48
|
-
props[:overflow_axis] = overflow_axis unless overflow_axis.nil?
|
|
49
|
-
props[:right] = right unless right.nil?
|
|
50
|
-
props[:rotate] = rotate unless rotate.nil?
|
|
51
|
-
props[:rtl] = rtl unless rtl.nil?
|
|
52
|
-
props[:scale] = scale unless scale.nil?
|
|
53
|
-
props[:semantic_label] = semantic_label unless semantic_label.nil?
|
|
54
|
-
props[:size_change_interval] = size_change_interval unless size_change_interval.nil?
|
|
55
|
-
props[:style] = style unless style.nil?
|
|
56
|
-
props[:tooltip] = tooltip unless tooltip.nil?
|
|
57
|
-
props[:top] = top unless top.nil?
|
|
58
|
-
props[:trailing] = trailing unless trailing.nil?
|
|
59
|
-
props[:visible] = visible unless visible.nil?
|
|
60
|
-
props[:width] = width unless width.nil?
|
|
61
|
-
props[:on_animation_end] = on_animation_end unless on_animation_end.nil?
|
|
62
|
-
props[:on_blur] = on_blur unless on_blur.nil?
|
|
63
|
-
props[:on_click] = on_click unless on_click.nil?
|
|
64
|
-
props[:on_focus] = on_focus unless on_focus.nil?
|
|
65
|
-
props[:on_hover] = on_hover unless on_hover.nil?
|
|
66
|
-
props[:on_size_change] = on_size_change unless on_size_change.nil?
|
|
67
|
-
super(type: TYPE, id: id, **props)
|
|
13
|
+
def initialize(id: nil, **props)
|
|
14
|
+
compact = {}
|
|
15
|
+
props.each do |key, value|
|
|
16
|
+
raise ArgumentError, "unknown keyword: :#{key}" unless KEYWORDS.include?(key)
|
|
17
|
+
compact[key] = value unless value.nil?
|
|
18
|
+
end
|
|
19
|
+
super(type: TYPE, id: id, **compact)
|
|
68
20
|
end
|
|
69
21
|
end
|
|
70
22
|
end
|
|
@@ -8,67 +8,15 @@ module Ruflet
|
|
|
8
8
|
TYPE = "navigationbar".freeze
|
|
9
9
|
WIRE = "NavigationBar".freeze
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
visible_destinations = Array(destinations).reject { |destination| destination.respond_to?(:props) && destination.props["visible"] == false }
|
|
13
|
-
unless destinations.nil? || visible_destinations.length >= 2
|
|
14
|
-
raise ArgumentError, "navigation_bar destinations must include at least two visible destinations"
|
|
15
|
-
end
|
|
11
|
+
KEYWORDS = [:adaptive, :align, :animate_align, :animate_margin, :animate_offset, :animate_opacity, :animate_position, :animate_rotation, :animate_scale, :animate_size, :animation_duration, :aspect_ratio, :badge, :bgcolor, :border, :bottom, :col, :data, :destinations, :disabled, :elevation, :expand, :expand_loose, :height, :indicator_color, :indicator_shape, :key, :label_behavior, :label_padding, :left, :margin, :offset, :opacity, :overlay_color, :right, :rotate, :rtl, :scale, :selected_index, :shadow_color, :size_change_interval, :surface_tint_color, :tooltip, :top, :visible, :width, :on_animation_end, :on_change, :on_size_change].freeze
|
|
16
12
|
|
|
17
|
-
|
|
18
|
-
|
|
13
|
+
def initialize(id: nil, **props)
|
|
14
|
+
compact = {}
|
|
15
|
+
props.each do |key, value|
|
|
16
|
+
raise ArgumentError, "unknown keyword: :#{key}" unless KEYWORDS.include?(key)
|
|
17
|
+
compact[key] = value unless value.nil?
|
|
19
18
|
end
|
|
20
|
-
|
|
21
|
-
props = {}
|
|
22
|
-
props[:adaptive] = adaptive unless adaptive.nil?
|
|
23
|
-
props[:align] = align unless align.nil?
|
|
24
|
-
props[:animate_align] = animate_align unless animate_align.nil?
|
|
25
|
-
props[:animate_margin] = animate_margin unless animate_margin.nil?
|
|
26
|
-
props[:animate_offset] = animate_offset unless animate_offset.nil?
|
|
27
|
-
props[:animate_opacity] = animate_opacity unless animate_opacity.nil?
|
|
28
|
-
props[:animate_position] = animate_position unless animate_position.nil?
|
|
29
|
-
props[:animate_rotation] = animate_rotation unless animate_rotation.nil?
|
|
30
|
-
props[:animate_scale] = animate_scale unless animate_scale.nil?
|
|
31
|
-
props[:animate_size] = animate_size unless animate_size.nil?
|
|
32
|
-
props[:animation_duration] = animation_duration unless animation_duration.nil?
|
|
33
|
-
props[:aspect_ratio] = aspect_ratio unless aspect_ratio.nil?
|
|
34
|
-
props[:badge] = badge unless badge.nil?
|
|
35
|
-
props[:bgcolor] = bgcolor unless bgcolor.nil?
|
|
36
|
-
props[:border] = border unless border.nil?
|
|
37
|
-
props[:bottom] = bottom unless bottom.nil?
|
|
38
|
-
props[:col] = col unless col.nil?
|
|
39
|
-
props[:data] = data unless data.nil?
|
|
40
|
-
props[:destinations] = destinations unless destinations.nil?
|
|
41
|
-
props[:disabled] = disabled unless disabled.nil?
|
|
42
|
-
props[:elevation] = elevation unless elevation.nil?
|
|
43
|
-
props[:expand] = expand unless expand.nil?
|
|
44
|
-
props[:expand_loose] = expand_loose unless expand_loose.nil?
|
|
45
|
-
props[:height] = height unless height.nil?
|
|
46
|
-
props[:indicator_color] = indicator_color unless indicator_color.nil?
|
|
47
|
-
props[:indicator_shape] = indicator_shape unless indicator_shape.nil?
|
|
48
|
-
props[:key] = key unless key.nil?
|
|
49
|
-
props[:label_behavior] = label_behavior unless label_behavior.nil?
|
|
50
|
-
props[:label_padding] = label_padding unless label_padding.nil?
|
|
51
|
-
props[:left] = left unless left.nil?
|
|
52
|
-
props[:margin] = margin unless margin.nil?
|
|
53
|
-
props[:offset] = offset unless offset.nil?
|
|
54
|
-
props[:opacity] = opacity unless opacity.nil?
|
|
55
|
-
props[:overlay_color] = overlay_color unless overlay_color.nil?
|
|
56
|
-
props[:right] = right unless right.nil?
|
|
57
|
-
props[:rotate] = rotate unless rotate.nil?
|
|
58
|
-
props[:rtl] = rtl unless rtl.nil?
|
|
59
|
-
props[:scale] = scale unless scale.nil?
|
|
60
|
-
props[:selected_index] = selected_index unless selected_index.nil?
|
|
61
|
-
props[:shadow_color] = shadow_color unless shadow_color.nil?
|
|
62
|
-
props[:size_change_interval] = size_change_interval unless size_change_interval.nil?
|
|
63
|
-
props[:surface_tint_color] = surface_tint_color unless surface_tint_color.nil?
|
|
64
|
-
props[:tooltip] = tooltip unless tooltip.nil?
|
|
65
|
-
props[:top] = top unless top.nil?
|
|
66
|
-
props[:visible] = visible unless visible.nil?
|
|
67
|
-
props[:width] = width unless width.nil?
|
|
68
|
-
props[:on_animation_end] = on_animation_end unless on_animation_end.nil?
|
|
69
|
-
props[:on_change] = on_change unless on_change.nil?
|
|
70
|
-
props[:on_size_change] = on_size_change unless on_size_change.nil?
|
|
71
|
-
super(type: TYPE, id: id, **props)
|
|
19
|
+
super(type: TYPE, id: id, **compact)
|
|
72
20
|
end
|
|
73
21
|
end
|
|
74
22
|
end
|
|
@@ -11,13 +11,6 @@ module Ruflet
|
|
|
11
11
|
def initialize(id: nil, adaptive: nil, badge: nil, bgcolor: nil, col: nil, controls: nil, data: nil, disabled: nil, elevation: nil, expand: nil, expand_loose: nil, indicator_color: nil, indicator_shape: nil, key: nil, opacity: nil, rtl: nil, selected_index: nil, shadow_color: nil, surface_tint_color: nil, tile_padding: nil, tooltip: nil, visible: nil, width: nil, on_change: nil, on_dismiss: nil)
|
|
12
12
|
selected_index = 0 if selected_index.nil?
|
|
13
13
|
|
|
14
|
-
{
|
|
15
|
-
elevation: elevation,
|
|
16
|
-
width: width
|
|
17
|
-
}.each do |name, value|
|
|
18
|
-
raise ArgumentError, "navigation_drawer #{name} must be greater than or equal to 0" unless value.nil? || value >= 0
|
|
19
|
-
end
|
|
20
|
-
|
|
21
14
|
props = {}
|
|
22
15
|
props[:adaptive] = adaptive unless adaptive.nil?
|
|
23
16
|
props[:badge] = badge unless badge.nil?
|