ruflet_core 0.0.12 → 0.0.13
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/lib/ruflet/version.rb +1 -1
- data/lib/ruflet_protocol/ruflet/protocol.rb +50 -4
- data/lib/ruflet_ui/ruflet/control.rb +11 -4
- data/lib/ruflet_ui/ruflet/dsl.rb +229 -37
- data/lib/ruflet_ui/ruflet/events/gesture_events.rb +113 -9
- data/lib/ruflet_ui/ruflet/page.rb +820 -145
- data/lib/ruflet_ui/ruflet/types/animation.rb +110 -0
- data/lib/ruflet_ui/ruflet/ui/control_registry.rb +1 -0
- data/lib/ruflet_ui/ruflet/ui/controls/cupertinos/cupertinoactionsheet_control.rb +13 -0
- data/lib/ruflet_ui/ruflet/ui/controls/cupertinos/cupertinoactionsheetaction_control.rb +4 -0
- data/lib/ruflet_ui/ruflet/ui/controls/cupertinos/cupertinoactivityindicator_control.rb +4 -0
- data/lib/ruflet_ui/ruflet/ui/controls/cupertinos/cupertinoalertdialog_control.rb +17 -0
- data/lib/ruflet_ui/ruflet/ui/controls/cupertinos/cupertinoappbar_control.rb +3 -0
- data/lib/ruflet_ui/ruflet/ui/controls/cupertinos/cupertinobottomsheet_control.rb +4 -0
- data/lib/ruflet_ui/ruflet/ui/controls/cupertinos/cupertinobutton_control.rb +9 -0
- data/lib/ruflet_ui/ruflet/ui/controls/cupertinos/cupertinocheckbox_control.rb +6 -0
- data/lib/ruflet_ui/ruflet/ui/controls/cupertinos/cupertinocontextmenu_control.rb +11 -0
- data/lib/ruflet_ui/ruflet/ui/controls/cupertinos/cupertinocontextmenuaction_control.rb +4 -0
- data/lib/ruflet_ui/ruflet/ui/controls/cupertinos/cupertinodatepicker_control.rb +14 -0
- data/lib/ruflet_ui/ruflet/ui/controls/cupertinos/cupertinodialogaction_control.rb +4 -0
- data/lib/ruflet_ui/ruflet/ui/controls/cupertinos/cupertinofilledbutton_control.rb +9 -0
- data/lib/ruflet_ui/ruflet/ui/controls/cupertinos/cupertinolisttile_control.rb +12 -0
- data/lib/ruflet_ui/ruflet/ui/controls/cupertinos/cupertinonavigationbar_control.rb +11 -0
- data/lib/ruflet_ui/ruflet/ui/controls/cupertinos/cupertinopicker_control.rb +18 -0
- data/lib/ruflet_ui/ruflet/ui/controls/cupertinos/cupertinoradio_control.rb +6 -0
- data/lib/ruflet_ui/ruflet/ui/controls/cupertinos/cupertinosegmentedbutton_control.rb +2 -0
- data/lib/ruflet_ui/ruflet/ui/controls/cupertinos/cupertinoslider_control.rb +7 -0
- data/lib/ruflet_ui/ruflet/ui/controls/cupertinos/cupertinoslidingsegmentedbutton_control.rb +3 -0
- data/lib/ruflet_ui/ruflet/ui/controls/cupertinos/cupertinoswitch_control.rb +7 -1
- data/lib/ruflet_ui/ruflet/ui/controls/cupertinos/cupertinotextfield_control.rb +7 -0
- data/lib/ruflet_ui/ruflet/ui/controls/cupertinos/cupertinotimerpicker_control.rb +18 -0
- data/lib/ruflet_ui/ruflet/ui/controls/cupertinos/cupertinotintedbutton_control.rb +9 -0
- data/lib/ruflet_ui/ruflet/ui/controls/materials/alertdialog_control.rb +4 -0
- data/lib/ruflet_ui/ruflet/ui/controls/materials/appbar_control.rb +4 -0
- data/lib/ruflet_ui/ruflet/ui/controls/materials/audio_control.rb +35 -1
- data/lib/ruflet_ui/ruflet/ui/controls/materials/autocomplete_control.rb +4 -0
- data/lib/ruflet_ui/ruflet/ui/controls/materials/autocompletesuggestion_control.rb +26 -0
- data/lib/ruflet_ui/ruflet/ui/controls/materials/badge_control.rb +7 -0
- data/lib/ruflet_ui/ruflet/ui/controls/materials/banner_control.rb +11 -1
- data/lib/ruflet_ui/ruflet/ui/controls/materials/bottomappbar_control.rb +2 -0
- data/lib/ruflet_ui/ruflet/ui/controls/materials/bottomsheet_control.rb +5 -0
- data/lib/ruflet_ui/ruflet/ui/controls/materials/button_control.rb +2 -0
- data/lib/ruflet_ui/ruflet/ui/controls/materials/card_control.rb +4 -0
- data/lib/ruflet_ui/ruflet/ui/controls/materials/chip_control.rb +11 -0
- data/lib/ruflet_ui/ruflet/ui/controls/materials/circleavatar_control.rb +12 -0
- data/lib/ruflet_ui/ruflet/ui/controls/materials/contextmenu_control.rb +19 -0
- data/lib/ruflet_ui/ruflet/ui/controls/materials/datacell_control.rb +4 -0
- data/lib/ruflet_ui/ruflet/ui/controls/materials/datacolumn_control.rb +4 -0
- data/lib/ruflet_ui/ruflet/ui/controls/materials/datatable_control.rb +34 -0
- data/lib/ruflet_ui/ruflet/ui/controls/materials/datepicker_control.rb +18 -0
- data/lib/ruflet_ui/ruflet/ui/controls/materials/daterangepicker_control.rb +20 -0
- data/lib/ruflet_ui/ruflet/ui/controls/materials/divider_control.rb +9 -0
- data/lib/ruflet_ui/ruflet/ui/controls/materials/dropdown_control.rb +11 -0
- data/lib/ruflet_ui/ruflet/ui/controls/materials/dropdownoption_control.rb +5 -0
- data/lib/ruflet_ui/ruflet/ui/controls/materials/expansionpanel_control.rb +8 -0
- data/lib/ruflet_ui/ruflet/ui/controls/materials/expansionpanellist_control.rb +6 -0
- data/lib/ruflet_ui/ruflet/ui/controls/materials/expansiontile_control.rb +6 -0
- data/lib/ruflet_ui/ruflet/ui/controls/materials/filledbutton_control.rb +5 -0
- data/lib/ruflet_ui/ruflet/ui/controls/materials/fillediconbutton_control.rb +8 -0
- data/lib/ruflet_ui/ruflet/ui/controls/materials/filledtonalbutton_control.rb +5 -0
- data/lib/ruflet_ui/ruflet/ui/controls/materials/filledtonaliconbutton_control.rb +8 -0
- data/lib/ruflet_ui/ruflet/ui/controls/materials/floatingactionbutton_control.rb +20 -0
- data/lib/ruflet_ui/ruflet/ui/controls/materials/iconbutton_control.rb +4 -0
- data/lib/ruflet_ui/ruflet/ui/controls/materials/listtile_control.rb +4 -0
- data/lib/ruflet_ui/ruflet/ui/controls/materials/map_controls.rb +240 -0
- data/lib/ruflet_ui/ruflet/ui/controls/materials/menubar_control.rb +2 -0
- data/lib/ruflet_ui/ruflet/ui/controls/materials/menuitembutton_control.rb +6 -0
- data/lib/ruflet_ui/ruflet/ui/controls/materials/navigationbar_control.rb +11 -1
- data/lib/ruflet_ui/ruflet/ui/controls/materials/navigationbardestination_control.rb +2 -0
- data/lib/ruflet_ui/ruflet/ui/controls/materials/navigationdrawer_control.rb +12 -1
- data/lib/ruflet_ui/ruflet/ui/controls/materials/navigationdrawerdestination_control.rb +2 -0
- data/lib/ruflet_ui/ruflet/ui/controls/materials/navigationrail_control.rb +21 -0
- data/lib/ruflet_ui/ruflet/ui/controls/materials/navigationraildestination_control.rb +2 -0
- data/lib/ruflet_ui/ruflet/ui/controls/materials/outlinedbutton_control.rb +5 -0
- data/lib/ruflet_ui/ruflet/ui/controls/materials/outlinediconbutton_control.rb +8 -0
- data/lib/ruflet_ui/ruflet/ui/controls/materials/popupmenubutton_control.rb +4 -0
- data/lib/ruflet_ui/ruflet/ui/controls/materials/popupmenuitem_control.rb +6 -0
- data/lib/ruflet_ui/ruflet/ui/controls/materials/progressbar_control.rb +9 -0
- data/lib/ruflet_ui/ruflet/ui/controls/materials/progressring_control.rb +8 -0
- data/lib/ruflet_ui/ruflet/ui/controls/materials/rangeslider_control.rb +13 -0
- data/lib/ruflet_ui/ruflet/ui/controls/materials/ruflet_controls.rb +24 -0
- data/lib/ruflet_ui/ruflet/ui/controls/materials/searchbar_control.rb +28 -0
- data/lib/ruflet_ui/ruflet/ui/controls/materials/segment_control.rb +5 -0
- data/lib/ruflet_ui/ruflet/ui/controls/materials/segmentedbutton_control.rb +19 -0
- data/lib/ruflet_ui/ruflet/ui/controls/materials/selectionarea_control.rb +4 -0
- data/lib/ruflet_ui/ruflet/ui/controls/materials/snackbar_control.rb +5 -0
- data/lib/ruflet_ui/ruflet/ui/controls/materials/submenubutton_control.rb +8 -0
- data/lib/ruflet_ui/ruflet/ui/controls/materials/tab_control.rb +7 -0
- data/lib/ruflet_ui/ruflet/ui/controls/materials/tabbar_control.rb +4 -0
- data/lib/ruflet_ui/ruflet/ui/controls/materials/tabbarview_control.rb +7 -0
- data/lib/ruflet_ui/ruflet/ui/controls/materials/tabs_control.rb +6 -0
- data/lib/ruflet_ui/ruflet/ui/controls/materials/textbutton_control.rb +5 -0
- data/lib/ruflet_ui/ruflet/ui/controls/materials/verticaldivider_control.rb +9 -0
- data/lib/ruflet_ui/ruflet/ui/controls/materials/video_control.rb +86 -1
- data/lib/ruflet_ui/ruflet/ui/controls/ruflet_controls.rb +24 -0
- data/lib/ruflet_ui/ruflet/ui/controls/shared/animatedswitcher_control.rb +10 -0
- data/lib/ruflet_ui/ruflet/ui/controls/shared/browsercontextmenu_control.rb +12 -1
- data/lib/ruflet_ui/ruflet/ui/controls/shared/canvas_control.rb +14 -0
- data/lib/ruflet_ui/ruflet/ui/controls/shared/dismissible_control.rb +19 -0
- data/lib/ruflet_ui/ruflet/ui/controls/shared/draggable_control.rb +9 -0
- data/lib/ruflet_ui/ruflet/ui/controls/shared/dragtarget_control.rb +6 -0
- data/lib/ruflet_ui/ruflet/ui/controls/shared/gridview_control.rb +20 -0
- data/lib/ruflet_ui/ruflet/ui/controls/shared/image_control.rb +19 -1
- data/lib/ruflet_ui/ruflet/ui/controls/shared/interactiveviewer_control.rb +37 -0
- data/lib/ruflet_ui/ruflet/ui/controls/shared/listview_control.rb +17 -0
- data/lib/ruflet_ui/ruflet/ui/controls/shared/pageview_control.rb +13 -0
- data/lib/ruflet_ui/ruflet/ui/controls/shared/placeholder_control.rb +12 -0
- data/lib/ruflet_ui/ruflet/ui/controls/shared/reorderabledraghandle_control.rb +4 -0
- data/lib/ruflet_ui/ruflet/ui/controls/shared/responsiverow_control.rb +22 -0
- data/lib/ruflet_ui/ruflet/ui/controls/shared/safearea_control.rb +11 -0
- data/lib/ruflet_ui/ruflet/ui/controls/shared/semantics_control.rb +2 -0
- data/lib/ruflet_ui/ruflet/ui/controls/shared/stack_control.rb +3 -0
- data/lib/ruflet_ui/ruflet/ui/controls/shared/text_control.rb +20 -1
- data/lib/ruflet_ui/ruflet/ui/controls/shared/view_control.rb +8 -0
- data/lib/ruflet_ui/ruflet/ui/controls/shared/window_control.rb +16 -0
- data/lib/ruflet_ui/ruflet/ui/controls/shared/windowdragarea_control.rb +6 -0
- data/lib/ruflet_ui/ruflet/ui/cupertino_control_methods.rb +83 -6
- data/lib/ruflet_ui/ruflet/ui/material_control_methods.rb +513 -33
- data/lib/ruflet_ui/ruflet/ui/material_control_registry.rb +2 -0
- data/lib/ruflet_ui/ruflet/ui/services/ruflet/audio_recorder_control.rb +87 -0
- data/lib/ruflet_ui/ruflet/ui/services/ruflet/geolocator_control.rb +85 -0
- data/lib/ruflet_ui/ruflet/ui/services/ruflet/permissionhandler_control.rb +53 -0
- data/lib/ruflet_ui/ruflet/ui/services/ruflet/securestorage_control.rb +89 -0
- data/lib/ruflet_ui/ruflet/ui/services/ruflet/semanticsservice_control.rb +28 -0
- data/lib/ruflet_ui/ruflet/ui/services/ruflet/tester_control.rb +126 -0
- data/lib/ruflet_ui/ruflet/ui/services/ruflet_services.rb +16 -0
- data/lib/ruflet_ui/ruflet/ui/shared_control_forwarders.rb +230 -38
- data/lib/ruflet_ui.rb +4 -0
- metadata +9 -1
|
@@ -0,0 +1,240 @@
|
|
|
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
|
+
|
|
11
|
+
def initialize(id: nil, layers: nil, initial_center: nil, initial_zoom: nil, min_zoom: nil, max_zoom: nil, interaction_configuration: nil, keep_alive: nil, bgcolor: nil, data: nil, expand: nil, height: nil, key: nil, visible: nil, width: nil, on_init: nil, on_long_press: nil, on_position_change: nil, on_secondary_tap: nil, on_tap: nil)
|
|
12
|
+
props = {}
|
|
13
|
+
props[:layers] = layers unless layers.nil?
|
|
14
|
+
props[:initial_center] = initial_center unless initial_center.nil?
|
|
15
|
+
props[:initial_zoom] = initial_zoom unless initial_zoom.nil?
|
|
16
|
+
props[:min_zoom] = min_zoom unless min_zoom.nil?
|
|
17
|
+
props[:max_zoom] = max_zoom unless max_zoom.nil?
|
|
18
|
+
props[:interaction_configuration] = interaction_configuration unless interaction_configuration.nil?
|
|
19
|
+
props[:keep_alive] = keep_alive unless keep_alive.nil?
|
|
20
|
+
props[:bgcolor] = bgcolor unless bgcolor.nil?
|
|
21
|
+
props[:data] = data unless data.nil?
|
|
22
|
+
props[:expand] = expand unless expand.nil?
|
|
23
|
+
props[:height] = height unless height.nil?
|
|
24
|
+
props[:key] = key unless key.nil?
|
|
25
|
+
props[:visible] = visible unless visible.nil?
|
|
26
|
+
props[:width] = width unless width.nil?
|
|
27
|
+
props[:on_init] = on_init unless on_init.nil?
|
|
28
|
+
props[:on_long_press] = on_long_press unless on_long_press.nil?
|
|
29
|
+
props[:on_position_change] = on_position_change unless on_position_change.nil?
|
|
30
|
+
props[:on_secondary_tap] = on_secondary_tap unless on_secondary_tap.nil?
|
|
31
|
+
props[:on_tap] = on_tap unless on_tap.nil?
|
|
32
|
+
super(type: TYPE, id: id, **props)
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def center_on(coordinates, zoom: nil, timeout: 10, on_result: nil)
|
|
36
|
+
invoke_map("center_on", args: compact_args("coordinates" => coordinates, "zoom" => zoom), timeout: timeout, on_result: on_result)
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
def move_to(coordinates, zoom: nil, timeout: 10, on_result: nil)
|
|
40
|
+
invoke_map("move_to", args: compact_args("coordinates" => coordinates, "zoom" => zoom), timeout: timeout, on_result: on_result)
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
def zoom_in(delta: nil, timeout: 10, on_result: nil)
|
|
44
|
+
invoke_map("zoom_in", args: compact_args("delta" => delta), timeout: timeout, on_result: on_result)
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
def zoom_out(delta: nil, timeout: 10, on_result: nil)
|
|
48
|
+
invoke_map("zoom_out", args: compact_args("delta" => delta), timeout: timeout, on_result: on_result)
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
def rotate_from(degree, timeout: 10, on_result: nil)
|
|
52
|
+
invoke_map("rotate_from", args: { "degree" => degree }, timeout: timeout, on_result: on_result)
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
def reset_rotation(timeout: 10, on_result: nil)
|
|
56
|
+
invoke_map("reset_rotation", timeout: timeout, on_result: on_result)
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
private
|
|
60
|
+
|
|
61
|
+
def invoke_map(method_name, args: nil, timeout:, on_result:)
|
|
62
|
+
runtime_page&.invoke(self, method_name, args: args, timeout: timeout, on_result: on_result)
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
def compact_args(hash)
|
|
66
|
+
hash.each_with_object({}) do |(key, value), result|
|
|
67
|
+
result[key] = normalize_service_value(value) unless value.nil?
|
|
68
|
+
end
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
def normalize_service_value(value)
|
|
72
|
+
case value
|
|
73
|
+
when Array
|
|
74
|
+
value.map { |item| normalize_service_value(item) }
|
|
75
|
+
when Hash
|
|
76
|
+
value.transform_keys(&:to_s).each_with_object({}) do |(key, item), result|
|
|
77
|
+
result[key] = normalize_service_value(item) unless item.nil?
|
|
78
|
+
end
|
|
79
|
+
else
|
|
80
|
+
value.respond_to?(:to_h) ? normalize_service_value(value.to_h) : value
|
|
81
|
+
end
|
|
82
|
+
end
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
class TileLayerControl < Ruflet::Control
|
|
86
|
+
TYPE = "tilelayer".freeze
|
|
87
|
+
WIRE = "TileLayer".freeze
|
|
88
|
+
|
|
89
|
+
def initialize(id: nil, url_template: nil, fallback_url: nil, subdomains: nil, additional_options: nil, attribution: nil, max_zoom: nil, min_zoom: nil, retina_mode: nil, tile_bounds: nil, tile_size: nil, user_agent_package_name: nil, visible: nil)
|
|
90
|
+
props = {}
|
|
91
|
+
props[:url_template] = url_template unless url_template.nil?
|
|
92
|
+
props[:fallback_url] = fallback_url unless fallback_url.nil?
|
|
93
|
+
props[:subdomains] = subdomains unless subdomains.nil?
|
|
94
|
+
props[:additional_options] = additional_options unless additional_options.nil?
|
|
95
|
+
props[:attribution] = attribution unless attribution.nil?
|
|
96
|
+
props[:max_zoom] = max_zoom unless max_zoom.nil?
|
|
97
|
+
props[:min_zoom] = min_zoom unless min_zoom.nil?
|
|
98
|
+
props[:retina_mode] = retina_mode unless retina_mode.nil?
|
|
99
|
+
props[:tile_bounds] = tile_bounds unless tile_bounds.nil?
|
|
100
|
+
props[:tile_size] = tile_size unless tile_size.nil?
|
|
101
|
+
props[:user_agent_package_name] = user_agent_package_name unless user_agent_package_name.nil?
|
|
102
|
+
props[:visible] = visible unless visible.nil?
|
|
103
|
+
super(type: TYPE, id: id, **props)
|
|
104
|
+
end
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
class MarkerLayerControl < Ruflet::Control
|
|
108
|
+
TYPE = "markerlayer".freeze
|
|
109
|
+
WIRE = "MarkerLayer".freeze
|
|
110
|
+
|
|
111
|
+
def initialize(id: nil, markers: nil, rotate: nil, visible: nil)
|
|
112
|
+
props = {}
|
|
113
|
+
props[:markers] = markers unless markers.nil?
|
|
114
|
+
props[:rotate] = rotate unless rotate.nil?
|
|
115
|
+
props[:visible] = visible unless visible.nil?
|
|
116
|
+
super(type: TYPE, id: id, **props)
|
|
117
|
+
end
|
|
118
|
+
end
|
|
119
|
+
|
|
120
|
+
class MarkerControl < Ruflet::Control
|
|
121
|
+
TYPE = "marker".freeze
|
|
122
|
+
WIRE = "Marker".freeze
|
|
123
|
+
|
|
124
|
+
def initialize(id: nil, coordinates: nil, content: nil, height: nil, rotate: nil, width: nil, alignment: nil)
|
|
125
|
+
props = {}
|
|
126
|
+
props[:coordinates] = coordinates unless coordinates.nil?
|
|
127
|
+
props[:content] = content unless content.nil?
|
|
128
|
+
props[:height] = height unless height.nil?
|
|
129
|
+
props[:rotate] = rotate unless rotate.nil?
|
|
130
|
+
props[:width] = width unless width.nil?
|
|
131
|
+
props[:alignment] = alignment unless alignment.nil?
|
|
132
|
+
super(type: TYPE, id: id, **props)
|
|
133
|
+
end
|
|
134
|
+
end
|
|
135
|
+
|
|
136
|
+
class CircleLayerControl < Ruflet::Control
|
|
137
|
+
TYPE = "circlelayer".freeze
|
|
138
|
+
WIRE = "CircleLayer".freeze
|
|
139
|
+
|
|
140
|
+
def initialize(id: nil, circles: nil, visible: nil)
|
|
141
|
+
props = {}
|
|
142
|
+
props[:circles] = circles unless circles.nil?
|
|
143
|
+
props[:visible] = visible unless visible.nil?
|
|
144
|
+
super(type: TYPE, id: id, **props)
|
|
145
|
+
end
|
|
146
|
+
end
|
|
147
|
+
|
|
148
|
+
class CircleMarkerControl < Ruflet::Control
|
|
149
|
+
TYPE = "circlemarker".freeze
|
|
150
|
+
WIRE = "CircleMarker".freeze
|
|
151
|
+
|
|
152
|
+
def initialize(id: nil, coordinates: nil, radius: nil, color: nil, border_color: nil, border_stroke_width: nil, use_radius_in_meter: nil)
|
|
153
|
+
props = {}
|
|
154
|
+
props[:coordinates] = coordinates unless coordinates.nil?
|
|
155
|
+
props[:radius] = radius unless radius.nil?
|
|
156
|
+
props[:color] = color unless color.nil?
|
|
157
|
+
props[:border_color] = border_color unless border_color.nil?
|
|
158
|
+
props[:border_stroke_width] = border_stroke_width unless border_stroke_width.nil?
|
|
159
|
+
props[:use_radius_in_meter] = use_radius_in_meter unless use_radius_in_meter.nil?
|
|
160
|
+
super(type: TYPE, id: id, **props)
|
|
161
|
+
end
|
|
162
|
+
end
|
|
163
|
+
|
|
164
|
+
class PolylineLayerControl < Ruflet::Control
|
|
165
|
+
TYPE = "polylinelayer".freeze
|
|
166
|
+
WIRE = "PolylineLayer".freeze
|
|
167
|
+
|
|
168
|
+
def initialize(id: nil, polylines: nil, visible: nil)
|
|
169
|
+
props = {}
|
|
170
|
+
props[:polylines] = polylines unless polylines.nil?
|
|
171
|
+
props[:visible] = visible unless visible.nil?
|
|
172
|
+
super(type: TYPE, id: id, **props)
|
|
173
|
+
end
|
|
174
|
+
end
|
|
175
|
+
|
|
176
|
+
class PolylineMarkerControl < Ruflet::Control
|
|
177
|
+
TYPE = "polylinemarker".freeze
|
|
178
|
+
WIRE = "PolylineMarker".freeze
|
|
179
|
+
|
|
180
|
+
def initialize(id: nil, coordinates: nil, color: nil, stroke_width: nil, border_color: nil, border_stroke_width: nil, gradient_colors: nil, stroke_cap: nil, stroke_join: nil)
|
|
181
|
+
props = {}
|
|
182
|
+
props[:coordinates] = coordinates unless coordinates.nil?
|
|
183
|
+
props[:color] = color unless color.nil?
|
|
184
|
+
props[:stroke_width] = stroke_width unless stroke_width.nil?
|
|
185
|
+
props[:border_color] = border_color unless border_color.nil?
|
|
186
|
+
props[:border_stroke_width] = border_stroke_width unless border_stroke_width.nil?
|
|
187
|
+
props[:gradient_colors] = gradient_colors unless gradient_colors.nil?
|
|
188
|
+
props[:stroke_cap] = stroke_cap unless stroke_cap.nil?
|
|
189
|
+
props[:stroke_join] = stroke_join unless stroke_join.nil?
|
|
190
|
+
super(type: TYPE, id: id, **props)
|
|
191
|
+
end
|
|
192
|
+
end
|
|
193
|
+
|
|
194
|
+
class PolygonLayerControl < Ruflet::Control
|
|
195
|
+
TYPE = "polygonlayer".freeze
|
|
196
|
+
WIRE = "PolygonLayer".freeze
|
|
197
|
+
|
|
198
|
+
def initialize(id: nil, polygons: nil, visible: nil)
|
|
199
|
+
props = {}
|
|
200
|
+
props[:polygons] = polygons unless polygons.nil?
|
|
201
|
+
props[:visible] = visible unless visible.nil?
|
|
202
|
+
super(type: TYPE, id: id, **props)
|
|
203
|
+
end
|
|
204
|
+
end
|
|
205
|
+
|
|
206
|
+
class PolygonMarkerControl < Ruflet::Control
|
|
207
|
+
TYPE = "polygonmarker".freeze
|
|
208
|
+
WIRE = "PolygonMarker".freeze
|
|
209
|
+
|
|
210
|
+
def initialize(id: nil, coordinates: nil, color: nil, border_color: nil, border_stroke_width: nil, disable_holes_border: nil, label: nil)
|
|
211
|
+
props = {}
|
|
212
|
+
props[:coordinates] = coordinates unless coordinates.nil?
|
|
213
|
+
props[:color] = color unless color.nil?
|
|
214
|
+
props[:border_color] = border_color unless border_color.nil?
|
|
215
|
+
props[:border_stroke_width] = border_stroke_width unless border_stroke_width.nil?
|
|
216
|
+
props[:disable_holes_border] = disable_holes_border unless disable_holes_border.nil?
|
|
217
|
+
props[:label] = label unless label.nil?
|
|
218
|
+
super(type: TYPE, id: id, **props)
|
|
219
|
+
end
|
|
220
|
+
end
|
|
221
|
+
|
|
222
|
+
class SimpleAttributionControl < Ruflet::Control
|
|
223
|
+
TYPE = "simpleattribution".freeze
|
|
224
|
+
WIRE = "SimpleAttribution".freeze
|
|
225
|
+
|
|
226
|
+
def initialize(id: nil, text: nil, alignment: nil, bgcolor: nil, text_style: nil, url: nil, on_click: nil)
|
|
227
|
+
props = {}
|
|
228
|
+
props[:text] = text unless text.nil?
|
|
229
|
+
props[:alignment] = alignment unless alignment.nil?
|
|
230
|
+
props[:bgcolor] = bgcolor unless bgcolor.nil?
|
|
231
|
+
props[:text_style] = text_style unless text_style.nil?
|
|
232
|
+
props[:url] = url unless url.nil?
|
|
233
|
+
props[:on_click] = on_click unless on_click.nil?
|
|
234
|
+
super(type: TYPE, id: id, **props)
|
|
235
|
+
end
|
|
236
|
+
end
|
|
237
|
+
end
|
|
238
|
+
end
|
|
239
|
+
end
|
|
240
|
+
end
|
|
@@ -9,6 +9,8 @@ module Ruflet
|
|
|
9
9
|
WIRE = "MenuBar".freeze
|
|
10
10
|
|
|
11
11
|
def initialize(id: nil, badge: nil, clip_behavior: nil, col: nil, controls: nil, data: nil, disabled: nil, expand: nil, expand_loose: nil, key: nil, opacity: nil, rtl: nil, style: nil, tooltip: nil, visible: nil)
|
|
12
|
+
clip_behavior = "none" if clip_behavior.nil?
|
|
13
|
+
|
|
12
14
|
props = {}
|
|
13
15
|
props[:badge] = badge unless badge.nil?
|
|
14
16
|
props[:clip_behavior] = clip_behavior unless clip_behavior.nil?
|
|
@@ -9,6 +9,12 @@ module Ruflet
|
|
|
9
9
|
WIRE = "MenuItemButton".freeze
|
|
10
10
|
|
|
11
11
|
def initialize(id: nil, align: nil, animate_align: nil, animate_margin: nil, animate_offset: nil, animate_opacity: nil, animate_position: nil, animate_rotation: nil, animate_scale: nil, animate_size: nil, aspect_ratio: nil, autofocus: nil, badge: nil, bottom: nil, clip_behavior: nil, close_on_click: nil, col: nil, content: nil, data: nil, disabled: nil, expand: nil, expand_loose: nil, focus_on_hover: nil, height: nil, key: nil, leading: nil, left: nil, margin: nil, offset: nil, opacity: nil, overflow_axis: nil, right: nil, rotate: nil, rtl: nil, scale: nil, semantic_label: nil, size_change_interval: nil, style: nil, tooltip: nil, top: nil, trailing: nil, visible: nil, width: nil, on_animation_end: nil, on_blur: nil, on_click: nil, on_focus: nil, on_hover: nil, on_size_change: nil)
|
|
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
|
|
17
|
+
|
|
12
18
|
props = {}
|
|
13
19
|
props[:align] = align unless align.nil?
|
|
14
20
|
props[:animate_align] = animate_align unless animate_align.nil?
|
|
@@ -8,7 +8,16 @@ module Ruflet
|
|
|
8
8
|
TYPE = "navigationbar".freeze
|
|
9
9
|
WIRE = "NavigationBar".freeze
|
|
10
10
|
|
|
11
|
-
def initialize(id: nil, adaptive: nil, align: nil, animate_align: nil, animate_margin: nil, animate_offset: nil, animate_opacity: nil, animate_position: nil, animate_rotation: nil, animate_scale: nil, animate_size: nil, animation_duration: nil, aspect_ratio: nil, badge: nil, bgcolor: nil, border: nil, bottom: nil, col: nil, data: nil, destinations: nil, disabled: nil, elevation: nil, expand: nil, expand_loose: nil, height: nil, indicator_color: nil, indicator_shape: nil, key: nil, label_behavior: nil, label_padding: nil, left: nil, margin: nil, offset: nil, opacity: nil, overlay_color: nil, right: nil, rotate: nil, rtl: nil, scale: nil, selected_index: nil, shadow_color: nil, size_change_interval: nil, tooltip: nil, top: nil, visible: nil, width: nil, on_animation_end: nil, on_change: nil, on_size_change: nil)
|
|
11
|
+
def initialize(id: nil, adaptive: nil, align: nil, animate_align: nil, animate_margin: nil, animate_offset: nil, animate_opacity: nil, animate_position: nil, animate_rotation: nil, animate_scale: nil, animate_size: nil, animation_duration: nil, aspect_ratio: nil, badge: nil, bgcolor: nil, border: nil, bottom: nil, col: nil, data: nil, destinations: nil, disabled: nil, elevation: nil, expand: nil, expand_loose: nil, height: nil, indicator_color: nil, indicator_shape: nil, key: nil, label_behavior: nil, label_padding: nil, left: nil, margin: nil, offset: nil, opacity: nil, overlay_color: nil, right: nil, rotate: nil, rtl: nil, scale: nil, selected_index: nil, shadow_color: nil, size_change_interval: nil, surface_tint_color: nil, tooltip: nil, top: nil, visible: nil, width: nil, on_animation_end: nil, on_change: nil, on_size_change: nil)
|
|
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
|
|
16
|
+
|
|
17
|
+
unless selected_index.nil? || destinations.nil? || (0...visible_destinations.length).cover?(selected_index)
|
|
18
|
+
raise IndexError, "navigation_bar selected_index is out of range"
|
|
19
|
+
end
|
|
20
|
+
|
|
12
21
|
props = {}
|
|
13
22
|
props[:adaptive] = adaptive unless adaptive.nil?
|
|
14
23
|
props[:align] = align unless align.nil?
|
|
@@ -51,6 +60,7 @@ module Ruflet
|
|
|
51
60
|
props[:selected_index] = selected_index unless selected_index.nil?
|
|
52
61
|
props[:shadow_color] = shadow_color unless shadow_color.nil?
|
|
53
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?
|
|
54
64
|
props[:tooltip] = tooltip unless tooltip.nil?
|
|
55
65
|
props[:top] = top unless top.nil?
|
|
56
66
|
props[:visible] = visible unless visible.nil?
|
|
@@ -9,6 +9,8 @@ module Ruflet
|
|
|
9
9
|
WIRE = "NavigationBarDestination".freeze
|
|
10
10
|
|
|
11
11
|
def initialize(id: nil, adaptive: nil, badge: nil, bgcolor: nil, col: nil, data: nil, disabled: nil, expand: nil, expand_loose: nil, icon: nil, key: nil, label: nil, opacity: nil, rtl: nil, selected_icon: nil, tooltip: nil, visible: nil)
|
|
12
|
+
raise ArgumentError, "navigation_bar_destination requires icon" if icon.nil?
|
|
13
|
+
|
|
12
14
|
props = {}
|
|
13
15
|
props[:adaptive] = adaptive unless adaptive.nil?
|
|
14
16
|
props[:badge] = badge unless badge.nil?
|
|
@@ -8,7 +8,16 @@ module Ruflet
|
|
|
8
8
|
TYPE = "navigationdrawer".freeze
|
|
9
9
|
WIRE = "NavigationDrawer".freeze
|
|
10
10
|
|
|
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, tile_padding: nil, tooltip: nil, visible: nil, on_change: nil, on_dismiss: nil)
|
|
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
|
+
selected_index = 0 if selected_index.nil?
|
|
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
|
+
|
|
12
21
|
props = {}
|
|
13
22
|
props[:adaptive] = adaptive unless adaptive.nil?
|
|
14
23
|
props[:badge] = badge unless badge.nil?
|
|
@@ -27,9 +36,11 @@ module Ruflet
|
|
|
27
36
|
props[:rtl] = rtl unless rtl.nil?
|
|
28
37
|
props[:selected_index] = selected_index unless selected_index.nil?
|
|
29
38
|
props[:shadow_color] = shadow_color unless shadow_color.nil?
|
|
39
|
+
props[:surface_tint_color] = surface_tint_color unless surface_tint_color.nil?
|
|
30
40
|
props[:tile_padding] = tile_padding unless tile_padding.nil?
|
|
31
41
|
props[:tooltip] = tooltip unless tooltip.nil?
|
|
32
42
|
props[:visible] = visible unless visible.nil?
|
|
43
|
+
props[:width] = width unless width.nil?
|
|
33
44
|
props[:on_change] = on_change unless on_change.nil?
|
|
34
45
|
props[:on_dismiss] = on_dismiss unless on_dismiss.nil?
|
|
35
46
|
super(type: TYPE, id: id, **props)
|
|
@@ -9,6 +9,8 @@ module Ruflet
|
|
|
9
9
|
WIRE = "NavigationDrawerDestination".freeze
|
|
10
10
|
|
|
11
11
|
def initialize(id: nil, badge: nil, bgcolor: nil, col: nil, data: nil, disabled: nil, expand: nil, expand_loose: nil, icon: nil, key: nil, label: nil, opacity: nil, rtl: nil, selected_icon: nil, tooltip: nil, visible: nil)
|
|
12
|
+
raise ArgumentError, "navigation_drawer_destination requires icon" if icon.nil?
|
|
13
|
+
|
|
12
14
|
props = {}
|
|
13
15
|
props[:badge] = badge unless badge.nil?
|
|
14
16
|
props[:bgcolor] = bgcolor unless bgcolor.nil?
|
|
@@ -9,6 +9,27 @@ module Ruflet
|
|
|
9
9
|
WIRE = "NavigationRail".freeze
|
|
10
10
|
|
|
11
11
|
def initialize(id: nil, align: nil, animate_align: nil, animate_margin: nil, animate_offset: nil, animate_opacity: nil, animate_position: nil, animate_rotation: nil, animate_scale: nil, animate_size: nil, aspect_ratio: nil, badge: nil, bgcolor: nil, bottom: nil, col: nil, data: nil, destinations: nil, disabled: nil, elevation: nil, expand: nil, expand_loose: nil, extended: nil, group_alignment: nil, height: nil, indicator_color: nil, indicator_shape: nil, key: nil, label_type: nil, leading: nil, left: nil, margin: nil, min_extended_width: nil, min_width: nil, offset: nil, opacity: nil, right: nil, rotate: nil, rtl: nil, scale: nil, selected_index: nil, selected_label_text_style: nil, size_change_interval: nil, tooltip: nil, top: nil, trailing: nil, unselected_label_text_style: nil, use_indicator: nil, visible: nil, width: nil, on_animation_end: nil, on_change: nil, on_size_change: nil)
|
|
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_rail destinations must include at least two visible destinations"
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
unless selected_index.nil? || destinations.nil? || (0...visible_destinations.length).cover?(selected_index)
|
|
18
|
+
raise IndexError, "navigation_rail selected_index is out of range"
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
unless group_alignment.nil? || (-1.0..1.0).cover?(group_alignment)
|
|
22
|
+
raise ArgumentError, "navigation_rail group_alignment must be between -1.0 and 1.0"
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
{
|
|
26
|
+
elevation: elevation,
|
|
27
|
+
min_extended_width: min_extended_width,
|
|
28
|
+
min_width: min_width
|
|
29
|
+
}.each do |name, value|
|
|
30
|
+
raise ArgumentError, "navigation_rail #{name} must be greater than or equal to 0" unless value.nil? || value >= 0
|
|
31
|
+
end
|
|
32
|
+
|
|
12
33
|
props = {}
|
|
13
34
|
props[:align] = align unless align.nil?
|
|
14
35
|
props[:animate_align] = animate_align unless animate_align.nil?
|
|
@@ -9,6 +9,8 @@ module Ruflet
|
|
|
9
9
|
WIRE = "NavigationRailDestination".freeze
|
|
10
10
|
|
|
11
11
|
def initialize(id: nil, badge: nil, col: nil, data: nil, disabled: nil, expand: nil, expand_loose: nil, icon: nil, indicator_color: nil, indicator_shape: nil, key: nil, label: nil, opacity: nil, padding: nil, rtl: nil, selected_icon: nil, tooltip: nil, visible: nil)
|
|
12
|
+
raise ArgumentError, "navigation_rail_destination requires icon" if icon.nil?
|
|
13
|
+
|
|
12
14
|
props = {}
|
|
13
15
|
props[:badge] = badge unless badge.nil?
|
|
14
16
|
props[:col] = col unless col.nil?
|
|
@@ -9,6 +9,11 @@ module Ruflet
|
|
|
9
9
|
WIRE = "OutlinedButton".freeze
|
|
10
10
|
|
|
11
11
|
def initialize(id: nil, adaptive: nil, align: nil, animate_align: nil, animate_margin: nil, animate_offset: nil, animate_opacity: nil, animate_position: nil, animate_rotation: nil, animate_scale: nil, animate_size: nil, aspect_ratio: nil, autofocus: nil, badge: nil, bottom: nil, clip_behavior: nil, col: nil, content: nil, data: nil, disabled: nil, expand: nil, expand_loose: nil, height: nil, icon: nil, icon_color: nil, key: nil, left: nil, margin: nil, offset: nil, opacity: nil, right: nil, rotate: nil, rtl: nil, scale: nil, size_change_interval: nil, style: nil, tooltip: nil, top: nil, url: nil, visible: nil, width: nil, on_animation_end: nil, on_blur: nil, on_click: nil, on_focus: nil, on_hover: nil, on_long_press: nil, on_size_change: nil)
|
|
12
|
+
raise ArgumentError, "outlined_button requires content or icon" if content.nil? && icon.nil?
|
|
13
|
+
|
|
14
|
+
autofocus = false if autofocus.nil?
|
|
15
|
+
clip_behavior = "none" if clip_behavior.nil?
|
|
16
|
+
|
|
12
17
|
props = {}
|
|
13
18
|
props[:adaptive] = adaptive unless adaptive.nil?
|
|
14
19
|
props[:align] = align unless align.nil?
|
|
@@ -9,6 +9,14 @@ module Ruflet
|
|
|
9
9
|
WIRE = "OutlinedIconButton".freeze
|
|
10
10
|
|
|
11
11
|
def initialize(id: nil, adaptive: nil, align: nil, alignment: nil, animate_align: nil, animate_margin: nil, animate_offset: nil, animate_opacity: nil, animate_position: nil, animate_rotation: nil, animate_scale: nil, animate_size: nil, aspect_ratio: nil, autofocus: nil, badge: nil, bgcolor: nil, bottom: nil, col: nil, data: nil, disabled: nil, disabled_color: nil, enable_feedback: nil, expand: nil, expand_loose: nil, focus_color: nil, height: nil, highlight_color: nil, hover_color: nil, icon: nil, icon_color: nil, icon_size: nil, key: nil, left: nil, margin: nil, mouse_cursor: nil, offset: nil, opacity: nil, padding: nil, right: nil, rotate: nil, rtl: nil, scale: nil, selected: nil, selected_icon: nil, selected_icon_color: nil, size_change_interval: nil, size_constraints: nil, splash_color: nil, splash_radius: nil, style: nil, tooltip: nil, top: nil, url: nil, visible: nil, visual_density: nil, width: nil, on_animation_end: nil, on_blur: nil, on_click: nil, on_focus: nil, on_hover: nil, on_long_press: nil, on_size_change: nil)
|
|
12
|
+
alignment = "center" if alignment.nil?
|
|
13
|
+
autofocus = false if autofocus.nil?
|
|
14
|
+
icon_size = 24 if icon_size.nil?
|
|
15
|
+
padding = { "all" => 8 } if padding.nil?
|
|
16
|
+
unless splash_radius.nil? || splash_radius.positive?
|
|
17
|
+
raise ArgumentError, "outlined_icon_button splash_radius must be greater than 0"
|
|
18
|
+
end
|
|
19
|
+
|
|
12
20
|
props = {}
|
|
13
21
|
props[:adaptive] = adaptive unless adaptive.nil?
|
|
14
22
|
props[:align] = align unless align.nil?
|
|
@@ -9,6 +9,10 @@ module Ruflet
|
|
|
9
9
|
WIRE = "PopupMenuButton".freeze
|
|
10
10
|
|
|
11
11
|
def initialize(id: nil, align: nil, animate_align: nil, animate_margin: nil, animate_offset: nil, animate_opacity: nil, animate_position: nil, animate_rotation: nil, animate_scale: nil, animate_size: nil, aspect_ratio: nil, badge: nil, bgcolor: nil, bottom: nil, clip_behavior: nil, col: nil, content: nil, data: nil, disabled: nil, elevation: nil, enable_feedback: nil, expand: nil, expand_loose: nil, height: nil, icon: nil, icon_color: nil, icon_size: nil, items: nil, key: nil, left: nil, margin: nil, menu_padding: nil, menu_position: nil, offset: nil, opacity: nil, padding: nil, popup_animation_style: nil, right: nil, rotate: nil, rtl: nil, scale: nil, shadow_color: nil, shape: nil, size_change_interval: nil, size_constraints: nil, splash_radius: nil, style: nil, tooltip: nil, top: nil, visible: nil, width: nil, on_animation_end: nil, on_cancel: nil, on_open: nil, on_select: nil, on_size_change: nil)
|
|
12
|
+
{ elevation: elevation, icon_size: icon_size, splash_radius: splash_radius }.each do |name, value|
|
|
13
|
+
raise ArgumentError, "popup_menu_button #{name} must be greater than or equal to 0" unless value.nil? || value >= 0
|
|
14
|
+
end
|
|
15
|
+
|
|
12
16
|
props = {}
|
|
13
17
|
props[:align] = align unless align.nil?
|
|
14
18
|
props[:animate_align] = animate_align unless animate_align.nil?
|
|
@@ -9,6 +9,12 @@ module Ruflet
|
|
|
9
9
|
WIRE = "PopupMenuItem".freeze
|
|
10
10
|
|
|
11
11
|
def initialize(id: nil, badge: nil, checked: nil, col: nil, content: nil, data: nil, disabled: nil, expand: nil, expand_loose: nil, height: nil, icon: nil, key: nil, label_text_style: nil, mouse_cursor: nil, opacity: nil, padding: nil, rtl: nil, tooltip: nil, visible: nil, on_click: nil)
|
|
12
|
+
if content.nil? || (content.respond_to?(:props) && content.props["visible"] == false)
|
|
13
|
+
raise ArgumentError, "popup_menu_item requires visible content"
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
raise ArgumentError, "popup_menu_item height must be greater than or equal to 0" unless height.nil? || height >= 0
|
|
17
|
+
|
|
12
18
|
props = {}
|
|
13
19
|
props[:badge] = badge unless badge.nil?
|
|
14
20
|
props[:checked] = checked unless checked.nil?
|
|
@@ -9,6 +9,15 @@ module Ruflet
|
|
|
9
9
|
WIRE = "ProgressBar".freeze
|
|
10
10
|
|
|
11
11
|
def initialize(id: nil, align: nil, animate_align: nil, animate_margin: nil, animate_offset: nil, animate_opacity: nil, animate_position: nil, animate_rotation: nil, animate_scale: nil, animate_size: nil, aspect_ratio: nil, badge: nil, bar_height: nil, bgcolor: nil, border_radius: nil, bottom: nil, col: nil, color: nil, data: nil, disabled: nil, expand: nil, expand_loose: nil, height: nil, key: nil, left: nil, margin: nil, offset: nil, opacity: nil, right: nil, rotate: nil, rtl: nil, scale: nil, semantics_label: nil, semantics_value: nil, size_change_interval: nil, stop_indicator_color: nil, stop_indicator_radius: nil, tooltip: nil, top: nil, track_gap: nil, value: nil, visible: nil, width: nil, year_2023: nil, on_animation_end: nil, on_size_change: nil)
|
|
12
|
+
{
|
|
13
|
+
bar_height: bar_height,
|
|
14
|
+
semantics_value: semantics_value,
|
|
15
|
+
stop_indicator_radius: stop_indicator_radius,
|
|
16
|
+
track_gap: track_gap
|
|
17
|
+
}.each do |name, numeric_value|
|
|
18
|
+
raise ArgumentError, "progress_bar #{name} must be greater than or equal to 0" unless numeric_value.nil? || numeric_value >= 0
|
|
19
|
+
end
|
|
20
|
+
|
|
12
21
|
props = {}
|
|
13
22
|
props[:align] = align unless align.nil?
|
|
14
23
|
props[:animate_align] = animate_align unless animate_align.nil?
|
|
@@ -9,6 +9,14 @@ module Ruflet
|
|
|
9
9
|
WIRE = "ProgressRing".freeze
|
|
10
10
|
|
|
11
11
|
def initialize(id: nil, align: nil, animate_align: nil, animate_margin: nil, animate_offset: nil, animate_opacity: nil, animate_position: nil, animate_rotation: nil, animate_scale: nil, animate_size: nil, aspect_ratio: nil, badge: nil, bgcolor: nil, bottom: nil, col: nil, color: nil, data: nil, disabled: nil, expand: nil, expand_loose: nil, height: nil, key: nil, left: nil, margin: nil, offset: nil, opacity: nil, padding: nil, right: nil, rotate: nil, rtl: nil, scale: nil, semantics_label: nil, semantics_value: nil, size_change_interval: nil, size_constraints: nil, stroke_align: nil, stroke_cap: nil, stroke_width: nil, tooltip: nil, top: nil, track_gap: nil, value: nil, visible: nil, width: nil, year_2023: nil, on_animation_end: nil, on_size_change: nil)
|
|
12
|
+
{
|
|
13
|
+
semantics_value: semantics_value,
|
|
14
|
+
stroke_width: stroke_width,
|
|
15
|
+
track_gap: track_gap
|
|
16
|
+
}.each do |name, numeric_value|
|
|
17
|
+
raise ArgumentError, "progress_ring #{name} must be greater than or equal to 0" unless numeric_value.nil? || numeric_value >= 0
|
|
18
|
+
end
|
|
19
|
+
|
|
12
20
|
props = {}
|
|
13
21
|
props[:align] = align unless align.nil?
|
|
14
22
|
props[:animate_align] = animate_align unless animate_align.nil?
|
|
@@ -9,6 +9,19 @@ module Ruflet
|
|
|
9
9
|
WIRE = "RangeSlider".freeze
|
|
10
10
|
|
|
11
11
|
def initialize(id: nil, active_color: nil, align: nil, animate_align: nil, animate_margin: nil, animate_offset: nil, animate_opacity: nil, animate_position: nil, animate_rotation: nil, animate_scale: nil, animate_size: nil, aspect_ratio: nil, badge: nil, bottom: nil, col: nil, data: nil, disabled: nil, divisions: nil, end_value: nil, expand: nil, expand_loose: nil, height: nil, inactive_color: nil, key: nil, label: nil, left: nil, margin: nil, max: nil, min: nil, mouse_cursor: nil, offset: nil, opacity: nil, overlay_color: nil, right: nil, rotate: nil, round: nil, rtl: nil, scale: nil, size_change_interval: nil, start_value: nil, tooltip: nil, top: nil, visible: nil, width: nil, on_animation_end: nil, on_change: nil, on_change_end: nil, on_change_start: nil, on_size_change: nil)
|
|
12
|
+
min_value = min.nil? ? 0.0 : min
|
|
13
|
+
max_value = max.nil? ? 1.0 : max
|
|
14
|
+
|
|
15
|
+
raise ArgumentError, "range_slider min must be less than or equal to max" if min_value > max_value
|
|
16
|
+
raise ArgumentError, "range_slider divisions must be greater than 0" unless divisions.nil? || divisions > 0
|
|
17
|
+
raise ArgumentError, "range_slider round must be between 0 and 20" unless round.nil? || (0..20).cover?(round)
|
|
18
|
+
raise ArgumentError, "range_slider start_value must be greater than or equal to min" unless start_value.nil? || start_value >= min_value
|
|
19
|
+
raise ArgumentError, "range_slider end_value must be less than or equal to max" unless end_value.nil? || end_value <= max_value
|
|
20
|
+
|
|
21
|
+
unless start_value.nil? || end_value.nil? || start_value <= end_value
|
|
22
|
+
raise ArgumentError, "range_slider start_value must be less than or equal to end_value"
|
|
23
|
+
end
|
|
24
|
+
|
|
12
25
|
props = {}
|
|
13
26
|
props[:active_color] = active_color unless active_color.nil?
|
|
14
27
|
props[:align] = align unless align.nil?
|
|
@@ -4,6 +4,7 @@ require_relative "alertdialog_control"
|
|
|
4
4
|
require_relative "audio_control"
|
|
5
5
|
require_relative "appbar_control"
|
|
6
6
|
require_relative "autocomplete_control"
|
|
7
|
+
require_relative "autocompletesuggestion_control"
|
|
7
8
|
require_relative "badge_control"
|
|
8
9
|
require_relative "banner_control"
|
|
9
10
|
require_relative "chart_controls"
|
|
@@ -36,6 +37,7 @@ require_relative "filledtonaliconbutton_control"
|
|
|
36
37
|
require_relative "floatingactionbutton_control"
|
|
37
38
|
require_relative "iconbutton_control"
|
|
38
39
|
require_relative "listtile_control"
|
|
40
|
+
require_relative "map_controls"
|
|
39
41
|
require_relative "menubar_control"
|
|
40
42
|
require_relative "menuitembutton_control"
|
|
41
43
|
require_relative "navigationbar_control"
|
|
@@ -87,7 +89,9 @@ module Ruflet
|
|
|
87
89
|
"app_bar" => RufletComponents::AppBarControl,
|
|
88
90
|
"appbar" => RufletComponents::AppBarControl,
|
|
89
91
|
"auto_complete" => RufletComponents::AutoCompleteControl,
|
|
92
|
+
"auto_complete_suggestion" => RufletComponents::AutoCompleteSuggestionControl,
|
|
90
93
|
"autocomplete" => RufletComponents::AutoCompleteControl,
|
|
94
|
+
"autocompletesuggestion" => RufletComponents::AutoCompleteSuggestionControl,
|
|
91
95
|
"badge" => RufletComponents::BadgeControl,
|
|
92
96
|
"banner" => RufletComponents::BannerControl,
|
|
93
97
|
"bottom_app_bar" => RufletComponents::BottomAppBarControl,
|
|
@@ -163,6 +167,26 @@ module Ruflet
|
|
|
163
167
|
"linechartdatapoint" => RufletComponents::LineChartDataPointControl,
|
|
164
168
|
"list_tile" => RufletComponents::ListTileControl,
|
|
165
169
|
"listtile" => RufletComponents::ListTileControl,
|
|
170
|
+
"map" => RufletComponents::MapControl,
|
|
171
|
+
"tile_layer" => RufletComponents::TileLayerControl,
|
|
172
|
+
"tilelayer" => RufletComponents::TileLayerControl,
|
|
173
|
+
"marker_layer" => RufletComponents::MarkerLayerControl,
|
|
174
|
+
"markerlayer" => RufletComponents::MarkerLayerControl,
|
|
175
|
+
"marker" => RufletComponents::MarkerControl,
|
|
176
|
+
"circle_layer" => RufletComponents::CircleLayerControl,
|
|
177
|
+
"circlelayer" => RufletComponents::CircleLayerControl,
|
|
178
|
+
"circle_marker" => RufletComponents::CircleMarkerControl,
|
|
179
|
+
"circlemarker" => RufletComponents::CircleMarkerControl,
|
|
180
|
+
"polyline_layer" => RufletComponents::PolylineLayerControl,
|
|
181
|
+
"polylinelayer" => RufletComponents::PolylineLayerControl,
|
|
182
|
+
"polyline_marker" => RufletComponents::PolylineMarkerControl,
|
|
183
|
+
"polylinemarker" => RufletComponents::PolylineMarkerControl,
|
|
184
|
+
"polygon_layer" => RufletComponents::PolygonLayerControl,
|
|
185
|
+
"polygonlayer" => RufletComponents::PolygonLayerControl,
|
|
186
|
+
"polygon_marker" => RufletComponents::PolygonMarkerControl,
|
|
187
|
+
"polygonmarker" => RufletComponents::PolygonMarkerControl,
|
|
188
|
+
"simple_attribution" => RufletComponents::SimpleAttributionControl,
|
|
189
|
+
"simpleattribution" => RufletComponents::SimpleAttributionControl,
|
|
166
190
|
"menu_bar" => RufletComponents::MenuBarControl,
|
|
167
191
|
"menu_item_button" => RufletComponents::MenuItemButtonControl,
|
|
168
192
|
"menubar" => RufletComponents::MenuBarControl,
|
|
@@ -9,6 +9,20 @@ module Ruflet
|
|
|
9
9
|
WIRE = "SearchBar".freeze
|
|
10
10
|
|
|
11
11
|
def initialize(id: nil, align: nil, animate_align: nil, animate_margin: nil, animate_offset: nil, animate_opacity: nil, animate_position: nil, animate_rotation: nil, animate_scale: nil, animate_size: nil, aspect_ratio: nil, autofocus: nil, badge: nil, bar_bgcolor: nil, bar_border_side: nil, bar_elevation: nil, bar_hint_text: nil, bar_hint_text_style: nil, bar_leading: nil, bar_overlay_color: nil, bar_padding: nil, bar_scroll_padding: nil, bar_shadow_color: nil, bar_shape: nil, bar_size_constraints: nil, bar_text_style: nil, bar_trailing: nil, bottom: nil, capitalization: nil, col: nil, controls: nil, data: nil, disabled: nil, divider_color: nil, expand: nil, expand_loose: nil, full_screen: nil, height: nil, key: nil, keyboard_type: nil, left: nil, margin: nil, offset: nil, opacity: nil, right: nil, rotate: nil, rtl: nil, scale: nil, shrink_wrap: nil, size_change_interval: nil, tooltip: nil, top: nil, value: nil, view_bar_padding: nil, view_bgcolor: nil, view_elevation: nil, view_header_height: nil, view_header_text_style: nil, view_hint_text: nil, view_hint_text_style: nil, view_leading: nil, view_padding: nil, view_shape: nil, view_side: nil, view_size_constraints: nil, view_trailing: nil, visible: nil, width: nil, on_animation_end: nil, on_blur: nil, on_change: nil, on_focus: nil, on_size_change: nil, on_submit: nil, on_tap: nil, on_tap_outside_bar: nil)
|
|
12
|
+
autofocus = false if autofocus.nil?
|
|
13
|
+
full_screen = false if full_screen.nil?
|
|
14
|
+
value = "" if value.nil?
|
|
15
|
+
|
|
16
|
+
{
|
|
17
|
+
bar_elevation: bar_elevation,
|
|
18
|
+
view_elevation: view_elevation,
|
|
19
|
+
view_header_height: view_header_height
|
|
20
|
+
}.each do |name, value|
|
|
21
|
+
next unless value.is_a?(Numeric)
|
|
22
|
+
|
|
23
|
+
raise ArgumentError, "search_bar #{name} must be greater than or equal to 0" if value.negative?
|
|
24
|
+
end
|
|
25
|
+
|
|
12
26
|
props = {}
|
|
13
27
|
props[:align] = align unless align.nil?
|
|
14
28
|
props[:animate_align] = animate_align unless animate_align.nil?
|
|
@@ -87,6 +101,20 @@ module Ruflet
|
|
|
87
101
|
props[:on_tap_outside_bar] = on_tap_outside_bar unless on_tap_outside_bar.nil?
|
|
88
102
|
super(type: TYPE, id: id, **props)
|
|
89
103
|
end
|
|
104
|
+
|
|
105
|
+
def open_view(timeout: 10, on_result: nil)
|
|
106
|
+
runtime_page&.invoke(self, "open_view", timeout: timeout, on_result: on_result)
|
|
107
|
+
end
|
|
108
|
+
|
|
109
|
+
def close_view(text = nil, timeout: 10, on_result: nil)
|
|
110
|
+
args = {}
|
|
111
|
+
args["text"] = text unless text.nil?
|
|
112
|
+
runtime_page&.invoke(self, "close_view", args: args, timeout: timeout, on_result: on_result)
|
|
113
|
+
end
|
|
114
|
+
|
|
115
|
+
def focus(timeout: 10, on_result: nil)
|
|
116
|
+
runtime_page&.invoke(self, "focus", timeout: timeout, on_result: on_result)
|
|
117
|
+
end
|
|
90
118
|
end
|
|
91
119
|
end
|
|
92
120
|
end
|
|
@@ -9,6 +9,11 @@ module Ruflet
|
|
|
9
9
|
WIRE = "Segment".freeze
|
|
10
10
|
|
|
11
11
|
def initialize(id: nil, badge: nil, col: nil, data: nil, disabled: nil, expand: nil, expand_loose: nil, icon: nil, key: nil, label: nil, opacity: nil, rtl: nil, tooltip: nil, value: nil, visible: nil)
|
|
12
|
+
raise ArgumentError, "segment requires value" if value.nil?
|
|
13
|
+
|
|
14
|
+
visible_label = label && (!label.respond_to?(:props) || label.props["visible"] != false)
|
|
15
|
+
raise ArgumentError, "segment requires visible label or icon" if !visible_label && icon.nil?
|
|
16
|
+
|
|
12
17
|
props = {}
|
|
13
18
|
props[:badge] = badge unless badge.nil?
|
|
14
19
|
props[:col] = col unless col.nil?
|
|
@@ -9,6 +9,25 @@ module Ruflet
|
|
|
9
9
|
WIRE = "SegmentedButton".freeze
|
|
10
10
|
|
|
11
11
|
def initialize(id: nil, align: nil, allow_empty_selection: nil, allow_multiple_selection: nil, animate_align: nil, animate_margin: nil, animate_offset: nil, animate_opacity: nil, animate_position: nil, animate_rotation: nil, animate_scale: nil, animate_size: nil, aspect_ratio: nil, badge: nil, bottom: nil, col: nil, data: nil, direction: nil, disabled: nil, expand: nil, expand_loose: nil, height: nil, key: nil, left: nil, margin: nil, offset: nil, opacity: nil, padding: nil, right: nil, rotate: nil, rtl: nil, scale: nil, segments: nil, selected: nil, selected_icon: nil, show_selected_icon: nil, size_change_interval: nil, style: nil, tooltip: nil, top: nil, visible: nil, width: nil, on_animation_end: nil, on_change: nil, on_size_change: nil)
|
|
12
|
+
visible_segments = Array(segments).reject { |segment| segment.respond_to?(:props) && segment.props["visible"] == false }
|
|
13
|
+
raise ArgumentError, "segmented_button requires at least one visible segment" if visible_segments.empty?
|
|
14
|
+
|
|
15
|
+
selected_values = selected.nil? ? [] : Array(selected)
|
|
16
|
+
if selected_values.empty? && allow_empty_selection != true
|
|
17
|
+
raise ArgumentError, "segmented_button selected cannot be empty unless allow_empty_selection is true"
|
|
18
|
+
end
|
|
19
|
+
if selected_values.size > 1 && allow_multiple_selection != true
|
|
20
|
+
raise ArgumentError, "segmented_button selected cannot contain multiple values unless allow_multiple_selection is true"
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
segment_values = visible_segments.filter_map do |segment|
|
|
24
|
+
segment.respond_to?(:props) ? segment.props["value"] : nil
|
|
25
|
+
end
|
|
26
|
+
missing_values = selected_values - segment_values
|
|
27
|
+
unless missing_values.empty?
|
|
28
|
+
raise ArgumentError, "segmented_button selected values must match segment values"
|
|
29
|
+
end
|
|
30
|
+
|
|
12
31
|
props = {}
|
|
13
32
|
props[:align] = align unless align.nil?
|
|
14
33
|
props[:allow_empty_selection] = allow_empty_selection unless allow_empty_selection.nil?
|