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
|
@@ -1,311 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module Ruflet
|
|
4
|
-
module UI
|
|
5
|
-
module Controls
|
|
6
|
-
module RufletComponents
|
|
7
|
-
module MapValueNormalizer
|
|
8
|
-
private
|
|
9
|
-
|
|
10
|
-
def normalize_map_coordinate(value)
|
|
11
|
-
case value
|
|
12
|
-
when Array
|
|
13
|
-
if value.length == 2 && value.all? { |item| item.is_a?(Numeric) }
|
|
14
|
-
{ "latitude" => value[0], "longitude" => value[1] }
|
|
15
|
-
else
|
|
16
|
-
value.map { |item| normalize_map_coordinate(item) }
|
|
17
|
-
end
|
|
18
|
-
when Hash
|
|
19
|
-
value.transform_keys(&:to_s).each_with_object({}) do |(key, item), result|
|
|
20
|
-
result[key] = normalize_map_coordinate(item)
|
|
21
|
-
end
|
|
22
|
-
else
|
|
23
|
-
value.respond_to?(:to_h) ? normalize_map_coordinate(value.to_h) : value
|
|
24
|
-
end
|
|
25
|
-
end
|
|
26
|
-
end
|
|
27
|
-
|
|
28
|
-
class MapControl < Ruflet::Control
|
|
29
|
-
include MapValueNormalizer
|
|
30
|
-
|
|
31
|
-
TYPE = "map".freeze
|
|
32
|
-
WIRE = "Map".freeze
|
|
33
|
-
|
|
34
|
-
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)
|
|
35
|
-
props = {}
|
|
36
|
-
props[:layers] = layers unless layers.nil?
|
|
37
|
-
props[:initial_center] = normalize_map_coordinate(initial_center) unless initial_center.nil?
|
|
38
|
-
props[:initial_zoom] = initial_zoom unless initial_zoom.nil?
|
|
39
|
-
props[:min_zoom] = min_zoom unless min_zoom.nil?
|
|
40
|
-
props[:max_zoom] = max_zoom unless max_zoom.nil?
|
|
41
|
-
props[:interaction_configuration] = interaction_configuration unless interaction_configuration.nil?
|
|
42
|
-
props[:keep_alive] = keep_alive unless keep_alive.nil?
|
|
43
|
-
props[:bgcolor] = bgcolor unless bgcolor.nil?
|
|
44
|
-
props[:data] = data unless data.nil?
|
|
45
|
-
props[:expand] = expand unless expand.nil?
|
|
46
|
-
props[:height] = height unless height.nil?
|
|
47
|
-
props[:key] = key unless key.nil?
|
|
48
|
-
props[:visible] = visible unless visible.nil?
|
|
49
|
-
props[:width] = width unless width.nil?
|
|
50
|
-
props[:on_init] = on_init unless on_init.nil?
|
|
51
|
-
props[:on_long_press] = on_long_press unless on_long_press.nil?
|
|
52
|
-
props[:on_position_change] = on_position_change unless on_position_change.nil?
|
|
53
|
-
props[:on_secondary_tap] = on_secondary_tap unless on_secondary_tap.nil?
|
|
54
|
-
props[:on_tap] = on_tap unless on_tap.nil?
|
|
55
|
-
super(type: TYPE, id: id, **props)
|
|
56
|
-
end
|
|
57
|
-
|
|
58
|
-
def center_on(point = nil, coordinates: nil, zoom: nil, duration: nil, curve: nil, cancel_ongoing_animations: nil, timeout: 10, on_result: nil)
|
|
59
|
-
point ||= coordinates
|
|
60
|
-
invoke_map(
|
|
61
|
-
"center_on",
|
|
62
|
-
args: compact_args(
|
|
63
|
-
"point" => normalize_map_coordinate(point),
|
|
64
|
-
"zoom" => zoom,
|
|
65
|
-
"duration" => duration,
|
|
66
|
-
"curve" => curve,
|
|
67
|
-
"cancel_ongoing_animations" => cancel_ongoing_animations
|
|
68
|
-
),
|
|
69
|
-
timeout: timeout,
|
|
70
|
-
on_result: on_result
|
|
71
|
-
)
|
|
72
|
-
end
|
|
73
|
-
|
|
74
|
-
def move_to(destination = nil, coordinates: nil, zoom: nil, rotation: nil, offset: nil, duration: nil, curve: nil, cancel_ongoing_animations: nil, timeout: 10, on_result: nil)
|
|
75
|
-
destination ||= coordinates
|
|
76
|
-
invoke_map(
|
|
77
|
-
"move_to",
|
|
78
|
-
args: compact_args(
|
|
79
|
-
"destination" => normalize_map_coordinate(destination),
|
|
80
|
-
"zoom" => zoom,
|
|
81
|
-
"rotation" => rotation,
|
|
82
|
-
"offset" => offset,
|
|
83
|
-
"duration" => duration,
|
|
84
|
-
"curve" => curve,
|
|
85
|
-
"cancel_ongoing_animations" => cancel_ongoing_animations
|
|
86
|
-
),
|
|
87
|
-
timeout: timeout,
|
|
88
|
-
on_result: on_result
|
|
89
|
-
)
|
|
90
|
-
end
|
|
91
|
-
|
|
92
|
-
def zoom_to(zoom, duration: nil, curve: nil, cancel_ongoing_animations: nil, timeout: 10, on_result: nil)
|
|
93
|
-
invoke_map(
|
|
94
|
-
"zoom_to",
|
|
95
|
-
args: compact_args(
|
|
96
|
-
"zoom" => zoom,
|
|
97
|
-
"duration" => duration,
|
|
98
|
-
"curve" => curve,
|
|
99
|
-
"cancel_ongoing_animations" => cancel_ongoing_animations
|
|
100
|
-
),
|
|
101
|
-
timeout: timeout,
|
|
102
|
-
on_result: on_result
|
|
103
|
-
)
|
|
104
|
-
end
|
|
105
|
-
|
|
106
|
-
def zoom_in(delta: nil, timeout: 10, on_result: nil)
|
|
107
|
-
invoke_map("zoom_in", args: compact_args("delta" => delta), timeout: timeout, on_result: on_result)
|
|
108
|
-
end
|
|
109
|
-
|
|
110
|
-
def zoom_out(delta: nil, timeout: 10, on_result: nil)
|
|
111
|
-
invoke_map("zoom_out", args: compact_args("delta" => delta), timeout: timeout, on_result: on_result)
|
|
112
|
-
end
|
|
113
|
-
|
|
114
|
-
def rotate_from(degree, timeout: 10, on_result: nil)
|
|
115
|
-
invoke_map("rotate_from", args: { "degree" => degree }, timeout: timeout, on_result: on_result)
|
|
116
|
-
end
|
|
117
|
-
|
|
118
|
-
def reset_rotation(timeout: 10, on_result: nil)
|
|
119
|
-
invoke_map("reset_rotation", timeout: timeout, on_result: on_result)
|
|
120
|
-
end
|
|
121
|
-
|
|
122
|
-
private
|
|
123
|
-
|
|
124
|
-
def invoke_map(method_name, args: nil, timeout:, on_result:)
|
|
125
|
-
runtime_page&.invoke(self, method_name, args: args, timeout: timeout, on_result: on_result)
|
|
126
|
-
end
|
|
127
|
-
|
|
128
|
-
def compact_args(hash)
|
|
129
|
-
hash.each_with_object({}) do |(key, value), result|
|
|
130
|
-
result[key] = normalize_service_value(value) unless value.nil?
|
|
131
|
-
end
|
|
132
|
-
end
|
|
133
|
-
|
|
134
|
-
def normalize_service_value(value)
|
|
135
|
-
case value
|
|
136
|
-
when Array
|
|
137
|
-
value.map { |item| normalize_service_value(item) }
|
|
138
|
-
when Hash
|
|
139
|
-
value.transform_keys(&:to_s).each_with_object({}) do |(key, item), result|
|
|
140
|
-
result[key] = normalize_service_value(item) unless item.nil?
|
|
141
|
-
end
|
|
142
|
-
else
|
|
143
|
-
value.respond_to?(:to_h) ? normalize_service_value(value.to_h) : value
|
|
144
|
-
end
|
|
145
|
-
end
|
|
146
|
-
end
|
|
147
|
-
|
|
148
|
-
class TileLayerControl < Ruflet::Control
|
|
149
|
-
TYPE = "tilelayer".freeze
|
|
150
|
-
WIRE = "TileLayer".freeze
|
|
151
|
-
|
|
152
|
-
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)
|
|
153
|
-
props = {}
|
|
154
|
-
props[:url_template] = url_template unless url_template.nil?
|
|
155
|
-
props[:fallback_url] = fallback_url unless fallback_url.nil?
|
|
156
|
-
props[:subdomains] = subdomains unless subdomains.nil?
|
|
157
|
-
props[:additional_options] = additional_options unless additional_options.nil?
|
|
158
|
-
props[:attribution] = attribution unless attribution.nil?
|
|
159
|
-
props[:max_zoom] = max_zoom unless max_zoom.nil?
|
|
160
|
-
props[:min_zoom] = min_zoom unless min_zoom.nil?
|
|
161
|
-
props[:retina_mode] = retina_mode unless retina_mode.nil?
|
|
162
|
-
props[:tile_bounds] = tile_bounds unless tile_bounds.nil?
|
|
163
|
-
props[:tile_size] = tile_size unless tile_size.nil?
|
|
164
|
-
props[:user_agent_package_name] = user_agent_package_name unless user_agent_package_name.nil?
|
|
165
|
-
props[:visible] = visible unless visible.nil?
|
|
166
|
-
super(type: TYPE, id: id, **props)
|
|
167
|
-
end
|
|
168
|
-
end
|
|
169
|
-
|
|
170
|
-
class MarkerLayerControl < Ruflet::Control
|
|
171
|
-
TYPE = "markerlayer".freeze
|
|
172
|
-
WIRE = "MarkerLayer".freeze
|
|
173
|
-
|
|
174
|
-
def initialize(id: nil, markers: nil, rotate: nil, visible: nil)
|
|
175
|
-
props = {}
|
|
176
|
-
props[:markers] = markers unless markers.nil?
|
|
177
|
-
props[:rotate] = rotate unless rotate.nil?
|
|
178
|
-
props[:visible] = visible unless visible.nil?
|
|
179
|
-
super(type: TYPE, id: id, **props)
|
|
180
|
-
end
|
|
181
|
-
end
|
|
182
|
-
|
|
183
|
-
class MarkerControl < Ruflet::Control
|
|
184
|
-
include MapValueNormalizer
|
|
185
|
-
|
|
186
|
-
TYPE = "marker".freeze
|
|
187
|
-
WIRE = "Marker".freeze
|
|
188
|
-
|
|
189
|
-
def initialize(id: nil, coordinates: nil, content: nil, height: nil, rotate: nil, width: nil, alignment: nil)
|
|
190
|
-
props = {}
|
|
191
|
-
props[:coordinates] = normalize_map_coordinate(coordinates) unless coordinates.nil?
|
|
192
|
-
props[:content] = content unless content.nil?
|
|
193
|
-
props[:height] = height unless height.nil?
|
|
194
|
-
props[:rotate] = rotate unless rotate.nil?
|
|
195
|
-
props[:width] = width unless width.nil?
|
|
196
|
-
props[:alignment] = alignment unless alignment.nil?
|
|
197
|
-
super(type: TYPE, id: id, **props)
|
|
198
|
-
end
|
|
199
|
-
end
|
|
200
|
-
|
|
201
|
-
class CircleLayerControl < Ruflet::Control
|
|
202
|
-
TYPE = "circlelayer".freeze
|
|
203
|
-
WIRE = "CircleLayer".freeze
|
|
204
|
-
|
|
205
|
-
def initialize(id: nil, circles: nil, visible: nil)
|
|
206
|
-
props = {}
|
|
207
|
-
props[:circles] = circles unless circles.nil?
|
|
208
|
-
props[:visible] = visible unless visible.nil?
|
|
209
|
-
super(type: TYPE, id: id, **props)
|
|
210
|
-
end
|
|
211
|
-
end
|
|
212
|
-
|
|
213
|
-
class CircleMarkerControl < Ruflet::Control
|
|
214
|
-
include MapValueNormalizer
|
|
215
|
-
|
|
216
|
-
TYPE = "circlemarker".freeze
|
|
217
|
-
WIRE = "CircleMarker".freeze
|
|
218
|
-
|
|
219
|
-
def initialize(id: nil, coordinates: nil, radius: nil, color: nil, border_color: nil, border_stroke_width: nil, use_radius_in_meter: nil)
|
|
220
|
-
props = {}
|
|
221
|
-
props[:coordinates] = normalize_map_coordinate(coordinates) unless coordinates.nil?
|
|
222
|
-
props[:radius] = radius unless radius.nil?
|
|
223
|
-
props[:color] = color unless color.nil?
|
|
224
|
-
props[:border_color] = border_color unless border_color.nil?
|
|
225
|
-
props[:border_stroke_width] = border_stroke_width unless border_stroke_width.nil?
|
|
226
|
-
props[:use_radius_in_meter] = use_radius_in_meter unless use_radius_in_meter.nil?
|
|
227
|
-
super(type: TYPE, id: id, **props)
|
|
228
|
-
end
|
|
229
|
-
end
|
|
230
|
-
|
|
231
|
-
class PolylineLayerControl < Ruflet::Control
|
|
232
|
-
TYPE = "polylinelayer".freeze
|
|
233
|
-
WIRE = "PolylineLayer".freeze
|
|
234
|
-
|
|
235
|
-
def initialize(id: nil, polylines: nil, visible: nil)
|
|
236
|
-
props = {}
|
|
237
|
-
props[:polylines] = polylines unless polylines.nil?
|
|
238
|
-
props[:visible] = visible unless visible.nil?
|
|
239
|
-
super(type: TYPE, id: id, **props)
|
|
240
|
-
end
|
|
241
|
-
end
|
|
242
|
-
|
|
243
|
-
class PolylineMarkerControl < Ruflet::Control
|
|
244
|
-
include MapValueNormalizer
|
|
245
|
-
|
|
246
|
-
TYPE = "polylinemarker".freeze
|
|
247
|
-
WIRE = "PolylineMarker".freeze
|
|
248
|
-
|
|
249
|
-
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)
|
|
250
|
-
props = {}
|
|
251
|
-
props[:coordinates] = normalize_map_coordinate(coordinates) unless coordinates.nil?
|
|
252
|
-
props[:color] = color unless color.nil?
|
|
253
|
-
props[:stroke_width] = stroke_width unless stroke_width.nil?
|
|
254
|
-
props[:border_color] = border_color unless border_color.nil?
|
|
255
|
-
props[:border_stroke_width] = border_stroke_width unless border_stroke_width.nil?
|
|
256
|
-
props[:gradient_colors] = gradient_colors unless gradient_colors.nil?
|
|
257
|
-
props[:stroke_cap] = stroke_cap unless stroke_cap.nil?
|
|
258
|
-
props[:stroke_join] = stroke_join unless stroke_join.nil?
|
|
259
|
-
super(type: TYPE, id: id, **props)
|
|
260
|
-
end
|
|
261
|
-
end
|
|
262
|
-
|
|
263
|
-
class PolygonLayerControl < Ruflet::Control
|
|
264
|
-
TYPE = "polygonlayer".freeze
|
|
265
|
-
WIRE = "PolygonLayer".freeze
|
|
266
|
-
|
|
267
|
-
def initialize(id: nil, polygons: nil, visible: nil)
|
|
268
|
-
props = {}
|
|
269
|
-
props[:polygons] = polygons unless polygons.nil?
|
|
270
|
-
props[:visible] = visible unless visible.nil?
|
|
271
|
-
super(type: TYPE, id: id, **props)
|
|
272
|
-
end
|
|
273
|
-
end
|
|
274
|
-
|
|
275
|
-
class PolygonMarkerControl < Ruflet::Control
|
|
276
|
-
include MapValueNormalizer
|
|
277
|
-
|
|
278
|
-
TYPE = "polygonmarker".freeze
|
|
279
|
-
WIRE = "PolygonMarker".freeze
|
|
280
|
-
|
|
281
|
-
def initialize(id: nil, coordinates: nil, color: nil, border_color: nil, border_stroke_width: nil, disable_holes_border: nil, label: nil)
|
|
282
|
-
props = {}
|
|
283
|
-
props[:coordinates] = normalize_map_coordinate(coordinates) unless coordinates.nil?
|
|
284
|
-
props[:color] = color unless color.nil?
|
|
285
|
-
props[:border_color] = border_color unless border_color.nil?
|
|
286
|
-
props[:border_stroke_width] = border_stroke_width unless border_stroke_width.nil?
|
|
287
|
-
props[:disable_holes_border] = disable_holes_border unless disable_holes_border.nil?
|
|
288
|
-
props[:label] = label unless label.nil?
|
|
289
|
-
super(type: TYPE, id: id, **props)
|
|
290
|
-
end
|
|
291
|
-
end
|
|
292
|
-
|
|
293
|
-
class SimpleAttributionControl < Ruflet::Control
|
|
294
|
-
TYPE = "simpleattribution".freeze
|
|
295
|
-
WIRE = "SimpleAttribution".freeze
|
|
296
|
-
|
|
297
|
-
def initialize(id: nil, text: nil, alignment: nil, bgcolor: nil, text_style: nil, url: nil, on_click: nil)
|
|
298
|
-
props = {}
|
|
299
|
-
props[:text] = text unless text.nil?
|
|
300
|
-
props[:alignment] = alignment unless alignment.nil?
|
|
301
|
-
props[:bgcolor] = bgcolor unless bgcolor.nil?
|
|
302
|
-
props[:text_style] = text_style unless text_style.nil?
|
|
303
|
-
props[:url] = url unless url.nil?
|
|
304
|
-
props[:on_click] = on_click unless on_click.nil?
|
|
305
|
-
super(type: TYPE, id: id, **props)
|
|
306
|
-
end
|
|
307
|
-
end
|
|
308
|
-
end
|
|
309
|
-
end
|
|
310
|
-
end
|
|
311
|
-
end
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module Ruflet
|
|
4
|
-
module UI
|
|
5
|
-
module Controls
|
|
6
|
-
module RufletComponents
|
|
7
|
-
# Rive control — parity with Flet's Rive extension
|
|
8
|
-
# (https://flet.dev/docs/controls/rive/). Renders a Rive
|
|
9
|
-
# (https://rive.app) animation from a `.riv` file.
|
|
10
|
-
#
|
|
11
|
-
# Properties: src, placeholder, artboard, alignment, enable_antialiasing,
|
|
12
|
-
# use_artboard_size, fit, speed_multiplier, animations, state_machines,
|
|
13
|
-
# headers, clip_rect, plus the usual layout props.
|
|
14
|
-
# No events or methods — playback is driven by `animations` /
|
|
15
|
-
# `state_machines` and `speed_multiplier`.
|
|
16
|
-
#
|
|
17
|
-
# `src` is required and may be a network URL (e.g.
|
|
18
|
-
# "https://cdn.rive.app/animations/vehicles.riv") or a bundled asset path.
|
|
19
|
-
#
|
|
20
|
-
# Note: the Flet API names the artboard property `artboard`, but the
|
|
21
|
-
# underlying renderer reads `art_board` / `use_art_board_size` on the wire.
|
|
22
|
-
# Both spellings are accepted here and normalized to the wire keys.
|
|
23
|
-
class RiveControl < Ruflet::Control
|
|
24
|
-
TYPE = "Rive".freeze
|
|
25
|
-
WIRE = "Rive".freeze
|
|
26
|
-
|
|
27
|
-
def initialize(id: nil, adaptive: nil, alignment: nil, animate_offset: nil,
|
|
28
|
-
animate_opacity: nil, animate_position: nil, animate_rotation: nil,
|
|
29
|
-
animate_scale: nil, animations: nil, art_board: nil, artboard: nil,
|
|
30
|
-
aspect_ratio: nil, badge: nil, bottom: nil, clip_rect: nil, col: nil,
|
|
31
|
-
data: nil, disabled: nil, enable_antialiasing: nil, expand: nil,
|
|
32
|
-
expand_loose: nil, fit: nil, headers: nil, height: nil, key: nil,
|
|
33
|
-
left: nil, offset: nil, opacity: nil, placeholder: nil, right: nil,
|
|
34
|
-
rotate: nil, rtl: nil, scale: nil, speed_multiplier: nil, src: nil,
|
|
35
|
-
state_machines: nil, tooltip: nil, top: nil, use_art_board_size: nil,
|
|
36
|
-
use_artboard_size: nil, visible: nil, width: nil)
|
|
37
|
-
# Accept both the Flet-style names and the wire keys.
|
|
38
|
-
art_board = artboard if art_board.nil?
|
|
39
|
-
use_art_board_size = use_artboard_size if use_art_board_size.nil?
|
|
40
|
-
|
|
41
|
-
props = {}
|
|
42
|
-
props[:adaptive] = adaptive unless adaptive.nil?
|
|
43
|
-
props[:alignment] = alignment unless alignment.nil?
|
|
44
|
-
props[:animate_offset] = animate_offset unless animate_offset.nil?
|
|
45
|
-
props[:animate_opacity] = animate_opacity unless animate_opacity.nil?
|
|
46
|
-
props[:animate_position] = animate_position unless animate_position.nil?
|
|
47
|
-
props[:animate_rotation] = animate_rotation unless animate_rotation.nil?
|
|
48
|
-
props[:animate_scale] = animate_scale unless animate_scale.nil?
|
|
49
|
-
props[:animations] = animations unless animations.nil?
|
|
50
|
-
props[:art_board] = art_board unless art_board.nil?
|
|
51
|
-
props[:aspect_ratio] = aspect_ratio unless aspect_ratio.nil?
|
|
52
|
-
props[:badge] = badge unless badge.nil?
|
|
53
|
-
props[:bottom] = bottom unless bottom.nil?
|
|
54
|
-
props[:clip_rect] = clip_rect unless clip_rect.nil?
|
|
55
|
-
props[:col] = col unless col.nil?
|
|
56
|
-
props[:data] = data unless data.nil?
|
|
57
|
-
props[:disabled] = disabled unless disabled.nil?
|
|
58
|
-
props[:enable_antialiasing] = enable_antialiasing unless enable_antialiasing.nil?
|
|
59
|
-
props[:expand] = expand unless expand.nil?
|
|
60
|
-
props[:expand_loose] = expand_loose unless expand_loose.nil?
|
|
61
|
-
props[:fit] = fit unless fit.nil?
|
|
62
|
-
props[:headers] = headers unless headers.nil?
|
|
63
|
-
props[:height] = height unless height.nil?
|
|
64
|
-
props[:key] = key unless key.nil?
|
|
65
|
-
props[:left] = left unless left.nil?
|
|
66
|
-
props[:offset] = offset unless offset.nil?
|
|
67
|
-
props[:opacity] = opacity unless opacity.nil?
|
|
68
|
-
props[:placeholder] = placeholder unless placeholder.nil?
|
|
69
|
-
props[:right] = right unless right.nil?
|
|
70
|
-
props[:rotate] = rotate unless rotate.nil?
|
|
71
|
-
props[:rtl] = rtl unless rtl.nil?
|
|
72
|
-
props[:scale] = scale unless scale.nil?
|
|
73
|
-
props[:speed_multiplier] = speed_multiplier unless speed_multiplier.nil?
|
|
74
|
-
props[:src] = src unless src.nil?
|
|
75
|
-
props[:state_machines] = state_machines unless state_machines.nil?
|
|
76
|
-
props[:tooltip] = tooltip unless tooltip.nil?
|
|
77
|
-
props[:top] = top unless top.nil?
|
|
78
|
-
props[:use_art_board_size] = use_art_board_size unless use_art_board_size.nil?
|
|
79
|
-
props[:visible] = visible unless visible.nil?
|
|
80
|
-
props[:width] = width unless width.nil?
|
|
81
|
-
super(type: TYPE, id: id, **props)
|
|
82
|
-
end
|
|
83
|
-
end
|
|
84
|
-
end
|
|
85
|
-
end
|
|
86
|
-
end
|
|
87
|
-
end
|
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module Ruflet
|
|
4
|
-
module UI
|
|
5
|
-
module Controls
|
|
6
|
-
module RufletComponents
|
|
7
|
-
# Base for every flet_spinkit variant (https://flet.dev/docs/controls/spinkit/).
|
|
8
|
-
# Each concrete spinner is a LayoutControl with its own wire name
|
|
9
|
-
# ("SpinKitRotatingCircle", "SpinKitWave", ...). The Dart widget reads
|
|
10
|
-
# color/size/duration for all of them plus the optional line_width /
|
|
11
|
-
# border_width / item_count / wave_type used by a few variants, so those
|
|
12
|
-
# are accepted on every spinner (the client ignores the ones a variant
|
|
13
|
-
# doesn't use, matching the upstream implementation).
|
|
14
|
-
class SpinKitControl < Ruflet::Control
|
|
15
|
-
def initialize(id: nil, align: nil, animate_align: nil, animate_offset: nil, animate_opacity: nil, animate_position: nil, animate_rotation: nil, animate_scale: nil, animate_size: nil, aspect_ratio: nil, badge: nil, border_width: nil, bottom: nil, col: nil, color: nil, data: nil, disabled: nil, duration: nil, expand: nil, expand_loose: nil, height: nil, item_count: nil, key: nil, left: nil, line_width: nil, offset: nil, opacity: nil, right: nil, rotate: nil, rtl: nil, scale: nil, size: nil, tooltip: nil, top: nil, visible: nil, wave_type: nil, width: nil, on_animation_end: nil)
|
|
16
|
-
raise ArgumentError, "spinkit size must be greater than or equal to 0" unless size.nil? || size >= 0
|
|
17
|
-
|
|
18
|
-
props = {}
|
|
19
|
-
props[:align] = align unless align.nil?
|
|
20
|
-
props[:animate_align] = animate_align unless animate_align.nil?
|
|
21
|
-
props[:animate_offset] = animate_offset unless animate_offset.nil?
|
|
22
|
-
props[:animate_opacity] = animate_opacity unless animate_opacity.nil?
|
|
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[:badge] = badge unless badge.nil?
|
|
29
|
-
props[:border_width] = border_width unless border_width.nil?
|
|
30
|
-
props[:bottom] = bottom unless bottom.nil?
|
|
31
|
-
props[:col] = col unless col.nil?
|
|
32
|
-
props[:color] = color unless color.nil?
|
|
33
|
-
props[:data] = data unless data.nil?
|
|
34
|
-
props[:disabled] = disabled unless disabled.nil?
|
|
35
|
-
props[:duration] = duration unless duration.nil?
|
|
36
|
-
props[:expand] = expand unless expand.nil?
|
|
37
|
-
props[:expand_loose] = expand_loose unless expand_loose.nil?
|
|
38
|
-
props[:height] = height unless height.nil?
|
|
39
|
-
props[:item_count] = item_count unless item_count.nil?
|
|
40
|
-
props[:key] = key unless key.nil?
|
|
41
|
-
props[:left] = left unless left.nil?
|
|
42
|
-
props[:line_width] = line_width unless line_width.nil?
|
|
43
|
-
props[:offset] = offset unless offset.nil?
|
|
44
|
-
props[:opacity] = opacity unless opacity.nil?
|
|
45
|
-
props[:right] = right unless right.nil?
|
|
46
|
-
props[:rotate] = rotate unless rotate.nil?
|
|
47
|
-
props[:rtl] = rtl unless rtl.nil?
|
|
48
|
-
props[:scale] = scale unless scale.nil?
|
|
49
|
-
props[:size] = size unless size.nil?
|
|
50
|
-
props[:tooltip] = tooltip unless tooltip.nil?
|
|
51
|
-
props[:top] = top unless top.nil?
|
|
52
|
-
props[:visible] = visible unless visible.nil?
|
|
53
|
-
props[:wave_type] = wave_type unless wave_type.nil?
|
|
54
|
-
props[:width] = width unless width.nil?
|
|
55
|
-
props[:on_animation_end] = on_animation_end unless on_animation_end.nil?
|
|
56
|
-
super(type: self.class::TYPE, id: id, **props)
|
|
57
|
-
end
|
|
58
|
-
end
|
|
59
|
-
|
|
60
|
-
# wire name ("_c") => ruflet type key. Mirrors flet_spinkit's 30 controls.
|
|
61
|
-
SPINKIT_WIRE_TO_TYPE = {
|
|
62
|
-
"SpinKitRotatingCircle" => "spinkit_rotating_circle",
|
|
63
|
-
"SpinKitRotatingPlain" => "spinkit_rotating_plain",
|
|
64
|
-
"SpinKitDoubleBounce" => "spinkit_double_bounce",
|
|
65
|
-
"SpinKitWave" => "spinkit_wave",
|
|
66
|
-
"SpinKitWanderingCubes" => "spinkit_wandering_cubes",
|
|
67
|
-
"SpinKitFadingFour" => "spinkit_fading_four",
|
|
68
|
-
"SpinKitFadingCube" => "spinkit_fading_cube",
|
|
69
|
-
"SpinKitPulse" => "spinkit_pulse",
|
|
70
|
-
"SpinKitChasingDots" => "spinkit_chasing_dots",
|
|
71
|
-
"SpinKitThreeBounce" => "spinkit_three_bounce",
|
|
72
|
-
"SpinKitCircle" => "spinkit_circle",
|
|
73
|
-
"SpinKitCubeGrid" => "spinkit_cube_grid",
|
|
74
|
-
"SpinKitFadingCircle" => "spinkit_fading_circle",
|
|
75
|
-
"SpinKitFoldingCube" => "spinkit_folding_cube",
|
|
76
|
-
"SpinKitPumpingHeart" => "spinkit_pumping_heart",
|
|
77
|
-
"SpinKitHourGlass" => "spinkit_hour_glass",
|
|
78
|
-
"SpinKitPouringHourGlass" => "spinkit_pouring_hour_glass",
|
|
79
|
-
"SpinKitPouringHourGlassRefined" => "spinkit_pouring_hour_glass_refined",
|
|
80
|
-
"SpinKitFadingGrid" => "spinkit_fading_grid",
|
|
81
|
-
"SpinKitRing" => "spinkit_ring",
|
|
82
|
-
"SpinKitRipple" => "spinkit_ripple",
|
|
83
|
-
"SpinKitDualRing" => "spinkit_dual_ring",
|
|
84
|
-
"SpinKitSpinningCircle" => "spinkit_spinning_circle",
|
|
85
|
-
"SpinKitSpinningLines" => "spinkit_spinning_lines",
|
|
86
|
-
"SpinKitSquareCircle" => "spinkit_square_circle",
|
|
87
|
-
"SpinKitThreeInOut" => "spinkit_three_in_out",
|
|
88
|
-
"SpinKitDancingSquare" => "spinkit_dancing_square",
|
|
89
|
-
"SpinKitPianoWave" => "spinkit_piano_wave",
|
|
90
|
-
"SpinKitPulsingGrid" => "spinkit_pulsing_grid",
|
|
91
|
-
"SpinKitWaveSpinner" => "spinkit_wave_spinner"
|
|
92
|
-
}.freeze
|
|
93
|
-
|
|
94
|
-
# type key => control class, e.g. "spinkit_wave" => SpinKitWaveControl.
|
|
95
|
-
SPINKIT_CONTROLS = {}
|
|
96
|
-
|
|
97
|
-
SPINKIT_WIRE_TO_TYPE.each do |wire, type_key|
|
|
98
|
-
klass = Class.new(SpinKitControl)
|
|
99
|
-
klass.const_set(:TYPE, type_key)
|
|
100
|
-
klass.const_set(:WIRE, wire)
|
|
101
|
-
const_set("#{wire}Control", klass)
|
|
102
|
-
SPINKIT_CONTROLS[type_key] = klass
|
|
103
|
-
end
|
|
104
|
-
|
|
105
|
-
SPINKIT_CONTROLS.freeze
|
|
106
|
-
end
|
|
107
|
-
end
|
|
108
|
-
end
|
|
109
|
-
end
|
|
@@ -1,126 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module Ruflet
|
|
4
|
-
module UI
|
|
5
|
-
module Services
|
|
6
|
-
module RufletServicesComponents
|
|
7
|
-
class TesterControl < Ruflet::Control
|
|
8
|
-
TYPE = "tester".freeze
|
|
9
|
-
WIRE = "Tester".freeze
|
|
10
|
-
|
|
11
|
-
def initialize(id: nil, data: nil, key: nil)
|
|
12
|
-
props = {}
|
|
13
|
-
props[:data] = data unless data.nil?
|
|
14
|
-
props[:key] = key unless key.nil?
|
|
15
|
-
super(type: TYPE, id: id, **props)
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
def pump(duration: nil, timeout: 10, on_result: nil)
|
|
19
|
-
invoke_tester("pump", args: compact_args("duration" => duration), timeout: timeout, on_result: on_result)
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
def pump_and_settle(duration: nil, timeout: 10, on_result: nil)
|
|
23
|
-
invoke_tester("pump_and_settle", args: compact_args("duration" => duration), timeout: timeout, on_result: on_result)
|
|
24
|
-
end
|
|
25
|
-
|
|
26
|
-
def find_by_text(text, timeout: 10, on_result: nil)
|
|
27
|
-
invoke_tester("find_by_text", args: { "text" => text }, timeout: timeout, on_result: on_result)
|
|
28
|
-
end
|
|
29
|
-
|
|
30
|
-
def find_by_text_containing(pattern, timeout: 10, on_result: nil)
|
|
31
|
-
invoke_tester("find_by_text_containing", args: { "pattern" => pattern }, timeout: timeout, on_result: on_result)
|
|
32
|
-
end
|
|
33
|
-
|
|
34
|
-
def find_by_key(key, timeout: 10, on_result: nil)
|
|
35
|
-
invoke_tester("find_by_key", args: { "key" => key }, timeout: timeout, on_result: on_result)
|
|
36
|
-
end
|
|
37
|
-
|
|
38
|
-
def find_by_tooltip(value, timeout: 10, on_result: nil)
|
|
39
|
-
invoke_tester("find_by_tooltip", args: { "value" => value }, timeout: timeout, on_result: on_result)
|
|
40
|
-
end
|
|
41
|
-
|
|
42
|
-
def find_by_icon(icon, timeout: 10, on_result: nil)
|
|
43
|
-
invoke_tester("find_by_icon", args: { "icon" => normalize_service_value(icon) }, timeout: timeout, on_result: on_result)
|
|
44
|
-
end
|
|
45
|
-
|
|
46
|
-
def take_screenshot(name, timeout: 10, on_result: nil)
|
|
47
|
-
invoke_tester("take_screenshot", args: { "name" => name }, timeout: timeout, on_result: on_result)
|
|
48
|
-
end
|
|
49
|
-
|
|
50
|
-
%w[tap mouse_click mouse_double_click right_mouse_click long_press mouse_hover].each do |method_name|
|
|
51
|
-
define_method(method_name) do |finder_id = nil, finder_index: nil, timeout: 10, on_result: nil|
|
|
52
|
-
invoke_tester(
|
|
53
|
-
method_name,
|
|
54
|
-
args: compact_args("finder_id" => finder_id, "finder_index" => finder_index),
|
|
55
|
-
timeout: timeout,
|
|
56
|
-
on_result: on_result
|
|
57
|
-
)
|
|
58
|
-
end
|
|
59
|
-
end
|
|
60
|
-
|
|
61
|
-
%w[tap_at mouse_click_at mouse_double_click_at right_mouse_click_at].each do |method_name|
|
|
62
|
-
define_method(method_name) do |offset = nil, timeout: 10, on_result: nil|
|
|
63
|
-
invoke_tester(method_name, args: compact_args("offset" => offset), timeout: timeout, on_result: on_result)
|
|
64
|
-
end
|
|
65
|
-
end
|
|
66
|
-
|
|
67
|
-
def drag(finder_id, offset, finder_index: nil, timeout: 10, on_result: nil)
|
|
68
|
-
invoke_tester(
|
|
69
|
-
"drag",
|
|
70
|
-
args: compact_args("finder_id" => finder_id, "finder_index" => finder_index, "offset" => offset),
|
|
71
|
-
timeout: timeout,
|
|
72
|
-
on_result: on_result
|
|
73
|
-
)
|
|
74
|
-
end
|
|
75
|
-
|
|
76
|
-
def drag_from(start, offset, timeout: 10, on_result: nil)
|
|
77
|
-
invoke_tester(
|
|
78
|
-
"drag_from",
|
|
79
|
-
args: compact_args("start" => start, "offset" => offset),
|
|
80
|
-
timeout: timeout,
|
|
81
|
-
on_result: on_result
|
|
82
|
-
)
|
|
83
|
-
end
|
|
84
|
-
|
|
85
|
-
def enter_text(finder_id, text, finder_index: nil, timeout: 10, on_result: nil)
|
|
86
|
-
invoke_tester(
|
|
87
|
-
"enter_text",
|
|
88
|
-
args: compact_args("finder_id" => finder_id, "finder_index" => finder_index, "text" => text),
|
|
89
|
-
timeout: timeout,
|
|
90
|
-
on_result: on_result
|
|
91
|
-
)
|
|
92
|
-
end
|
|
93
|
-
|
|
94
|
-
def teardown(timeout: 10, on_result: nil)
|
|
95
|
-
invoke_tester("teardown", timeout: timeout, on_result: on_result)
|
|
96
|
-
end
|
|
97
|
-
|
|
98
|
-
private
|
|
99
|
-
|
|
100
|
-
def invoke_tester(method_name, args: nil, timeout:, on_result:)
|
|
101
|
-
runtime_page&.invoke(self, method_name, args: args, timeout: timeout, on_result: on_result)
|
|
102
|
-
end
|
|
103
|
-
|
|
104
|
-
def compact_args(hash)
|
|
105
|
-
hash.each_with_object({}) do |(key, value), result|
|
|
106
|
-
result[key] = normalize_service_value(value) unless value.nil?
|
|
107
|
-
end
|
|
108
|
-
end
|
|
109
|
-
|
|
110
|
-
def normalize_service_value(value)
|
|
111
|
-
case value
|
|
112
|
-
when Array
|
|
113
|
-
value.map { |item| normalize_service_value(item) }
|
|
114
|
-
when Hash
|
|
115
|
-
value.transform_keys(&:to_s).each_with_object({}) do |(key, item), result|
|
|
116
|
-
result[key] = normalize_service_value(item) unless item.nil?
|
|
117
|
-
end
|
|
118
|
-
else
|
|
119
|
-
value.respond_to?(:to_h) ? normalize_service_value(value.to_h) : value
|
|
120
|
-
end
|
|
121
|
-
end
|
|
122
|
-
end
|
|
123
|
-
end
|
|
124
|
-
end
|
|
125
|
-
end
|
|
126
|
-
end
|