ruflet 0.0.5 → 0.0.6
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_ui/ruflet/dsl.rb +11 -1
- data/lib/ruflet_ui/ruflet/page.rb +43 -1
- data/lib/ruflet_ui/ruflet/ui/controls/material/grid_view_control.rb +13 -0
- data/lib/ruflet_ui/ruflet/ui/material_control_factory.rb +3 -0
- data/lib/ruflet_ui/ruflet/ui/material_control_methods.rb +3 -0
- data/lib/ruflet_ui/ruflet/ui/material_control_registry.rb +3 -0
- data/lib/ruflet_ui/ruflet/ui/shared_control_forwarders.rb +3 -0
- data/lib/ruflet_ui/ruflet/ui/widget_builder.rb +8 -1
- metadata +2 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 71ccb066d48adaf26ea46834bd630001c3a144aca86d5891f1f5c4646755029c
|
|
4
|
+
data.tar.gz: 133976a5d04e617e8faefba38b42d802d308df2d6c920c23d04d906508f0a040
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e26a8c097c5f85de3fa2e56655503b19a2f54da7b1a285d0b5e7c5094c6d4cc4b6ce3f452460531a958ae915c2408f6a8ccc185d773a4d148e4f3c2b9356e70f
|
|
7
|
+
data.tar.gz: 2fb16bbdd819e73446492e188dc371383387b26a37306512256a431722dabce9695b88d6d66f0f02852e59918e5e7e75e5b4b6a776637718ff0f326eca3d6a4d
|
data/lib/ruflet/version.rb
CHANGED
data/lib/ruflet_ui/ruflet/dsl.rb
CHANGED
|
@@ -40,6 +40,8 @@ module Ruflet
|
|
|
40
40
|
def center(**props, &block) = _pending_app.center(**props, &block)
|
|
41
41
|
def row(**props, &block) = _pending_app.row(**props, &block)
|
|
42
42
|
def stack(**props, &block) = _pending_app.stack(**props, &block)
|
|
43
|
+
def grid_view(**props, &block) = _pending_app.grid_view(**props, &block)
|
|
44
|
+
def gridview(**props, &block) = _pending_app.gridview(**props, &block)
|
|
43
45
|
def container(**props, &block) = _pending_app.container(**props, &block)
|
|
44
46
|
def gesture_detector(**props, &block) = _pending_app.gesture_detector(**props, &block)
|
|
45
47
|
def gesturedetector(**props, &block) = _pending_app.gesturedetector(**props, &block)
|
|
@@ -58,6 +60,7 @@ module Ruflet
|
|
|
58
60
|
def iconbutton(**props) = _pending_app.iconbutton(**props)
|
|
59
61
|
def app_bar(**props) = _pending_app.app_bar(**props)
|
|
60
62
|
def appbar(**props) = _pending_app.appbar(**props)
|
|
63
|
+
def clipboard(**props) = _pending_app.clipboard(**props)
|
|
61
64
|
def text_button(**props) = _pending_app.text_button(**props)
|
|
62
65
|
def textbutton(**props) = _pending_app.textbutton(**props)
|
|
63
66
|
def filled_button(**props) = _pending_app.filled_button(**props)
|
|
@@ -137,7 +140,7 @@ module Ruflet
|
|
|
137
140
|
|
|
138
141
|
def control(type, **props, &block)
|
|
139
142
|
mapped_props = props.dup
|
|
140
|
-
prop_children =
|
|
143
|
+
prop_children = extract_children_prop(mapped_props)
|
|
141
144
|
|
|
142
145
|
id = mapped_props.delete(:id)&.to_s || next_id(type)
|
|
143
146
|
c = Ruflet::UI::ControlFactory.build(type.to_s, id: id, **normalize_props(mapped_props))
|
|
@@ -186,6 +189,13 @@ module Ruflet
|
|
|
186
189
|
hash.transform_keys(&:to_s).transform_values { |v| v.is_a?(Symbol) ? v.to_s : v }
|
|
187
190
|
end
|
|
188
191
|
|
|
192
|
+
def extract_children_prop(props)
|
|
193
|
+
props.delete(:children) ||
|
|
194
|
+
props.delete("children") ||
|
|
195
|
+
props.delete(:controls) ||
|
|
196
|
+
props.delete("controls")
|
|
197
|
+
end
|
|
198
|
+
|
|
189
199
|
def next_id(type)
|
|
190
200
|
@seq += 1
|
|
191
201
|
"#{type}_#{@seq}"
|
|
@@ -265,6 +265,36 @@ module Ruflet
|
|
|
265
265
|
invoke(launcher, "can_launch_url", args: { "url" => url }, timeout: timeout)
|
|
266
266
|
end
|
|
267
267
|
|
|
268
|
+
def set_clipboard(value, timeout: 10)
|
|
269
|
+
clipboard = ensure_clipboard_service
|
|
270
|
+
invoke(clipboard, "set", args: { "data" => value.to_s }, timeout: timeout)
|
|
271
|
+
end
|
|
272
|
+
|
|
273
|
+
def get_clipboard(timeout: 10)
|
|
274
|
+
clipboard = ensure_clipboard_service
|
|
275
|
+
invoke(clipboard, "get", timeout: timeout)
|
|
276
|
+
end
|
|
277
|
+
|
|
278
|
+
def set_clipboard_files(files, timeout: 10)
|
|
279
|
+
clipboard = ensure_clipboard_service
|
|
280
|
+
invoke(clipboard, "set_files", args: { "files" => Array(files).map(&:to_s) }, timeout: timeout)
|
|
281
|
+
end
|
|
282
|
+
|
|
283
|
+
def get_clipboard_files(timeout: 10)
|
|
284
|
+
clipboard = ensure_clipboard_service
|
|
285
|
+
invoke(clipboard, "get_files", timeout: timeout)
|
|
286
|
+
end
|
|
287
|
+
|
|
288
|
+
def set_clipboard_image(value, timeout: 10)
|
|
289
|
+
clipboard = ensure_clipboard_service
|
|
290
|
+
invoke(clipboard, "set_image", args: { "data" => value }, timeout: timeout)
|
|
291
|
+
end
|
|
292
|
+
|
|
293
|
+
def get_clipboard_image(timeout: 10)
|
|
294
|
+
clipboard = ensure_clipboard_service
|
|
295
|
+
invoke(clipboard, "get_image", timeout: timeout)
|
|
296
|
+
end
|
|
297
|
+
|
|
268
298
|
def pop_dialog
|
|
269
299
|
dialog_control = latest_open_dialog
|
|
270
300
|
return nil unless dialog_control
|
|
@@ -295,7 +325,10 @@ module Ruflet
|
|
|
295
325
|
patch["content"] = patch.delete("text")
|
|
296
326
|
end
|
|
297
327
|
|
|
298
|
-
|
|
328
|
+
visited = Set.new
|
|
329
|
+
patch.each_value { |value| register_embedded_value(value, visited) }
|
|
330
|
+
|
|
331
|
+
patch_ops = patch.map { |k, v| [0, 0, k, serialize_patch_value(v)] }
|
|
299
332
|
|
|
300
333
|
send_message(Protocol::ACTIONS[:patch_control], {
|
|
301
334
|
"id" => control.wire_id,
|
|
@@ -649,5 +682,14 @@ module Ruflet
|
|
|
649
682
|
add_service(launcher)
|
|
650
683
|
launcher
|
|
651
684
|
end
|
|
685
|
+
|
|
686
|
+
def ensure_clipboard_service
|
|
687
|
+
clipboard = services.find { |service| service.is_a?(Control) && service.type == "clipboard" }
|
|
688
|
+
return clipboard if clipboard
|
|
689
|
+
|
|
690
|
+
clipboard = build_widget(:clipboard)
|
|
691
|
+
add_service(clipboard)
|
|
692
|
+
clipboard
|
|
693
|
+
end
|
|
652
694
|
end
|
|
653
695
|
end
|
|
@@ -6,6 +6,7 @@ require_relative "controls/material/container_control"
|
|
|
6
6
|
require_relative "controls/material/column_control"
|
|
7
7
|
require_relative "controls/material/row_control"
|
|
8
8
|
require_relative "controls/material/stack_control"
|
|
9
|
+
require_relative "controls/material/grid_view_control"
|
|
9
10
|
require_relative "controls/material/gesture_detector_control"
|
|
10
11
|
require_relative "controls/material/draggable_control"
|
|
11
12
|
require_relative "controls/material/drag_target_control"
|
|
@@ -44,6 +45,8 @@ module Ruflet
|
|
|
44
45
|
"column" => Controls::ColumnControl,
|
|
45
46
|
"row" => Controls::RowControl,
|
|
46
47
|
"stack" => Controls::StackControl,
|
|
48
|
+
"gridview" => Controls::GridViewControl,
|
|
49
|
+
"grid_view" => Controls::GridViewControl,
|
|
47
50
|
"container" => Controls::ContainerControl,
|
|
48
51
|
"gesturedetector" => Controls::GestureDetectorControl,
|
|
49
52
|
"gesture_detector" => Controls::GestureDetectorControl,
|
|
@@ -27,6 +27,8 @@ module Ruflet
|
|
|
27
27
|
|
|
28
28
|
def row(**props, &block) = build_widget(:row, **props, &block)
|
|
29
29
|
def stack(**props, &block) = build_widget(:stack, **props, &block)
|
|
30
|
+
def grid_view(**props, &block) = build_widget(:gridview, **props, &block)
|
|
31
|
+
def gridview(**props, &block) = grid_view(**props, &block)
|
|
30
32
|
def container(**props, &block) = build_widget(:container, **normalize_container_props(props), &block)
|
|
31
33
|
def gesture_detector(**props, &block) = build_widget(:gesturedetector, **props, &block)
|
|
32
34
|
def gesturedetector(**props, &block) = gesture_detector(**props, &block)
|
|
@@ -82,6 +84,7 @@ module Ruflet
|
|
|
82
84
|
def app_bar(**props) = build_widget(:appbar, **props)
|
|
83
85
|
def appbar(**props) = app_bar(**props)
|
|
84
86
|
def url_launcher(**props) = build_widget(:url_launcher, **props)
|
|
87
|
+
def clipboard(**props) = build_widget(:clipboard, **props)
|
|
85
88
|
def floating_action_button(**props) = build_widget(:floatingactionbutton, **props)
|
|
86
89
|
def floatingactionbutton(**props) = floating_action_button(**props)
|
|
87
90
|
def tabs(**props, &block) = build_widget(:tabs, **props, &block)
|
|
@@ -8,6 +8,8 @@ module Ruflet
|
|
|
8
8
|
"column" => "Column",
|
|
9
9
|
"row" => "Row",
|
|
10
10
|
"stack" => "Stack",
|
|
11
|
+
"gridview" => "GridView",
|
|
12
|
+
"grid_view" => "GridView",
|
|
11
13
|
"view" => "View",
|
|
12
14
|
"container" => "Container",
|
|
13
15
|
"checkbox" => "Checkbox",
|
|
@@ -79,6 +81,7 @@ module Ruflet
|
|
|
79
81
|
"line" => "Line",
|
|
80
82
|
"service_registry" => "ServiceRegistry",
|
|
81
83
|
"url_launcher" => "UrlLauncher",
|
|
84
|
+
"clipboard" => "Clipboard",
|
|
82
85
|
"audio" => "Audio",
|
|
83
86
|
"video" => "Video",
|
|
84
87
|
"flashlight" => "Flashlight",
|
|
@@ -10,6 +10,8 @@ module Ruflet
|
|
|
10
10
|
def center(**props, &block) = control_delegate.center(**props, &block)
|
|
11
11
|
def row(**props, &block) = control_delegate.row(**props, &block)
|
|
12
12
|
def stack(**props, &block) = control_delegate.stack(**props, &block)
|
|
13
|
+
def grid_view(**props, &block) = control_delegate.grid_view(**props, &block)
|
|
14
|
+
def gridview(**props, &block) = control_delegate.gridview(**props, &block)
|
|
13
15
|
def container(**props, &block) = control_delegate.container(**props, &block)
|
|
14
16
|
def gesture_detector(**props, &block) = control_delegate.gesture_detector(**props, &block)
|
|
15
17
|
def gesturedetector(**props, &block) = control_delegate.gesturedetector(**props, &block)
|
|
@@ -44,6 +46,7 @@ module Ruflet
|
|
|
44
46
|
def fab(content = nil, **props) = control_delegate.fab(content, **props)
|
|
45
47
|
def app_bar(**props) = control_delegate.app_bar(**props)
|
|
46
48
|
def appbar(**props) = control_delegate.appbar(**props)
|
|
49
|
+
def clipboard(**props) = control_delegate.clipboard(**props)
|
|
47
50
|
def floating_action_button(**props) = control_delegate.floating_action_button(**props)
|
|
48
51
|
def floatingactionbutton(**props) = control_delegate.floatingactionbutton(**props)
|
|
49
52
|
def tabs(**props, &block) = control_delegate.tabs(**props, &block)
|
|
@@ -19,7 +19,7 @@ module Ruflet
|
|
|
19
19
|
|
|
20
20
|
def control(type, **props, &block)
|
|
21
21
|
mapped_props = props.dup
|
|
22
|
-
prop_children =
|
|
22
|
+
prop_children = extract_children_prop(mapped_props)
|
|
23
23
|
|
|
24
24
|
node = UI::ControlFactory.build(type, **mapped_props)
|
|
25
25
|
if block
|
|
@@ -44,5 +44,12 @@ module Ruflet
|
|
|
44
44
|
def build_widget(type, **props, &block) = control(type, **props, &block)
|
|
45
45
|
|
|
46
46
|
private
|
|
47
|
+
|
|
48
|
+
def extract_children_prop(props)
|
|
49
|
+
props.delete(:children) ||
|
|
50
|
+
props.delete("children") ||
|
|
51
|
+
props.delete(:controls) ||
|
|
52
|
+
props.delete("controls")
|
|
53
|
+
end
|
|
47
54
|
end
|
|
48
55
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: ruflet
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.6
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- AdamMusa
|
|
@@ -60,6 +60,7 @@ files:
|
|
|
60
60
|
- lib/ruflet_ui/ruflet/ui/controls/material/filled_button_control.rb
|
|
61
61
|
- lib/ruflet_ui/ruflet/ui/controls/material/floating_action_button_control.rb
|
|
62
62
|
- lib/ruflet_ui/ruflet/ui/controls/material/gesture_detector_control.rb
|
|
63
|
+
- lib/ruflet_ui/ruflet/ui/controls/material/grid_view_control.rb
|
|
63
64
|
- lib/ruflet_ui/ruflet/ui/controls/material/icon_button_control.rb
|
|
64
65
|
- lib/ruflet_ui/ruflet/ui/controls/material/icon_control.rb
|
|
65
66
|
- lib/ruflet_ui/ruflet/ui/controls/material/image_control.rb
|