ruflet 0.0.7 → 0.0.9
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/bin/ruflet +6 -0
- data/lib/ruflet/cli/build_command.rb +372 -0
- data/lib/ruflet/cli/extra_command.rb +146 -0
- data/lib/ruflet/cli/flutter_sdk.rb +359 -0
- data/lib/ruflet/cli/new_command.rb +221 -0
- data/lib/ruflet/cli/run_command.rb +699 -0
- data/lib/ruflet/cli/templates.rb +68 -0
- data/lib/ruflet/cli/update_command.rb +111 -0
- data/lib/ruflet/cli.rb +85 -0
- data/lib/ruflet/version.rb +1 -1
- data/lib/ruflet_cli.rb +3 -0
- metadata +59 -75
- data/lib/ruflet/manifest_compiler.rb +0 -62
- data/lib/ruflet.rb +0 -40
- data/lib/ruflet_protocol/ruflet/protocol.rb +0 -62
- data/lib/ruflet_protocol.rb +0 -4
- data/lib/ruflet_ui/ruflet/app.rb +0 -31
- data/lib/ruflet_ui/ruflet/colors.rb +0 -234
- data/lib/ruflet_ui/ruflet/control.rb +0 -168
- data/lib/ruflet_ui/ruflet/dsl.rb +0 -227
- data/lib/ruflet_ui/ruflet/event.rb +0 -28
- data/lib/ruflet_ui/ruflet/icon_data.rb +0 -62
- data/lib/ruflet_ui/ruflet/icons/cupertino/cupertino_icons.rb +0 -54
- data/lib/ruflet_ui/ruflet/icons/cupertino_icon_lookup.rb +0 -112
- data/lib/ruflet_ui/ruflet/icons/material_icon_lookup.rb +0 -112
- data/lib/ruflet_ui/ruflet/icons/material_icons.rb +0 -55
- data/lib/ruflet_ui/ruflet/page.rb +0 -741
- data/lib/ruflet_ui/ruflet/ui/control_factory.rb +0 -23
- data/lib/ruflet_ui/ruflet/ui/control_methods.rb +0 -16
- data/lib/ruflet_ui/ruflet/ui/control_registry.rb +0 -13
- data/lib/ruflet_ui/ruflet/ui/controls/cupertino/cupertino_action_sheet_control.rb +0 -13
- data/lib/ruflet_ui/ruflet/ui/controls/cupertino/cupertino_alert_dialog_control.rb +0 -13
- data/lib/ruflet_ui/ruflet/ui/controls/cupertino/cupertino_button_control.rb +0 -13
- data/lib/ruflet_ui/ruflet/ui/controls/cupertino/cupertino_dialog_action_control.rb +0 -24
- data/lib/ruflet_ui/ruflet/ui/controls/cupertino/cupertino_filled_button_control.rb +0 -13
- data/lib/ruflet_ui/ruflet/ui/controls/cupertino/cupertino_navigation_bar_control.rb +0 -13
- data/lib/ruflet_ui/ruflet/ui/controls/cupertino/cupertino_slider_control.rb +0 -13
- data/lib/ruflet_ui/ruflet/ui/controls/cupertino/cupertino_switch_control.rb +0 -13
- data/lib/ruflet_ui/ruflet/ui/controls/cupertino/cupertino_text_field_control.rb +0 -13
- data/lib/ruflet_ui/ruflet/ui/controls/material/alert_dialog_control.rb +0 -13
- data/lib/ruflet_ui/ruflet/ui/controls/material/app_bar_control.rb +0 -13
- data/lib/ruflet_ui/ruflet/ui/controls/material/bottom_sheet_control.rb +0 -13
- data/lib/ruflet_ui/ruflet/ui/controls/material/button_control.rb +0 -24
- data/lib/ruflet_ui/ruflet/ui/controls/material/checkbox_control.rb +0 -13
- data/lib/ruflet_ui/ruflet/ui/controls/material/column_control.rb +0 -13
- data/lib/ruflet_ui/ruflet/ui/controls/material/container_control.rb +0 -13
- data/lib/ruflet_ui/ruflet/ui/controls/material/drag_target_control.rb +0 -13
- data/lib/ruflet_ui/ruflet/ui/controls/material/draggable_control.rb +0 -13
- data/lib/ruflet_ui/ruflet/ui/controls/material/elevated_button_control.rb +0 -13
- data/lib/ruflet_ui/ruflet/ui/controls/material/filled_button_control.rb +0 -13
- data/lib/ruflet_ui/ruflet/ui/controls/material/floating_action_button_control.rb +0 -28
- data/lib/ruflet_ui/ruflet/ui/controls/material/gesture_detector_control.rb +0 -13
- data/lib/ruflet_ui/ruflet/ui/controls/material/grid_view_control.rb +0 -13
- data/lib/ruflet_ui/ruflet/ui/controls/material/icon_button_control.rb +0 -13
- data/lib/ruflet_ui/ruflet/ui/controls/material/icon_control.rb +0 -24
- data/lib/ruflet_ui/ruflet/ui/controls/material/image_control.rb +0 -13
- data/lib/ruflet_ui/ruflet/ui/controls/material/markdown_control.rb +0 -13
- data/lib/ruflet_ui/ruflet/ui/controls/material/navigation_bar_control.rb +0 -13
- data/lib/ruflet_ui/ruflet/ui/controls/material/navigation_bar_destination_control.rb +0 -13
- data/lib/ruflet_ui/ruflet/ui/controls/material/radio_control.rb +0 -13
- data/lib/ruflet_ui/ruflet/ui/controls/material/radio_group_control.rb +0 -13
- data/lib/ruflet_ui/ruflet/ui/controls/material/row_control.rb +0 -13
- data/lib/ruflet_ui/ruflet/ui/controls/material/snack_bar_control.rb +0 -68
- data/lib/ruflet_ui/ruflet/ui/controls/material/stack_control.rb +0 -13
- data/lib/ruflet_ui/ruflet/ui/controls/material/tab_bar_control.rb +0 -13
- data/lib/ruflet_ui/ruflet/ui/controls/material/tab_bar_view_control.rb +0 -13
- data/lib/ruflet_ui/ruflet/ui/controls/material/tab_control.rb +0 -13
- data/lib/ruflet_ui/ruflet/ui/controls/material/tabs_control.rb +0 -63
- data/lib/ruflet_ui/ruflet/ui/controls/material/text_button_control.rb +0 -13
- data/lib/ruflet_ui/ruflet/ui/controls/material/text_control.rb +0 -13
- data/lib/ruflet_ui/ruflet/ui/controls/material/text_field_control.rb +0 -13
- data/lib/ruflet_ui/ruflet/ui/controls/material/view_control.rb +0 -13
- data/lib/ruflet_ui/ruflet/ui/cupertino_control_factory.rb +0 -40
- data/lib/ruflet_ui/ruflet/ui/cupertino_control_methods.rb +0 -26
- data/lib/ruflet_ui/ruflet/ui/cupertino_control_registry.rb +0 -49
- data/lib/ruflet_ui/ruflet/ui/material_control_factory.rb +0 -97
- data/lib/ruflet_ui/ruflet/ui/material_control_methods.rb +0 -128
- data/lib/ruflet_ui/ruflet/ui/material_control_registry.rb +0 -154
- data/lib/ruflet_ui/ruflet/ui/shared_control_forwarders.rb +0 -89
- data/lib/ruflet_ui/ruflet/ui/widget_builder.rb +0 -55
- data/lib/ruflet_ui.rb +0 -111
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require_relative "material_control_factory"
|
|
4
|
-
require_relative "cupertino_control_factory"
|
|
5
|
-
require_relative "../control"
|
|
6
|
-
|
|
7
|
-
module Ruflet
|
|
8
|
-
module UI
|
|
9
|
-
module ControlFactory
|
|
10
|
-
module_function
|
|
11
|
-
|
|
12
|
-
CLASS_MAP = MaterialControlFactory::CLASS_MAP.merge(CupertinoControlFactory::CLASS_MAP).freeze
|
|
13
|
-
|
|
14
|
-
def build(type, id: nil, **props)
|
|
15
|
-
normalized_type = type.to_s.downcase
|
|
16
|
-
klass = CLASS_MAP[normalized_type]
|
|
17
|
-
return klass.new(id: id, **props) if klass
|
|
18
|
-
|
|
19
|
-
Ruflet::Control.new(type: normalized_type, id: id, **props)
|
|
20
|
-
end
|
|
21
|
-
end
|
|
22
|
-
end
|
|
23
|
-
end
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require_relative "material_control_methods"
|
|
4
|
-
require_relative "cupertino_control_methods"
|
|
5
|
-
|
|
6
|
-
module Ruflet
|
|
7
|
-
module UI
|
|
8
|
-
module ControlMethods
|
|
9
|
-
include MaterialControlMethods
|
|
10
|
-
include CupertinoControlMethods
|
|
11
|
-
|
|
12
|
-
def control(type, **props, &block) = build_widget(type, **props, &block)
|
|
13
|
-
def widget(type, **props, &block) = build_widget(type, **props, &block)
|
|
14
|
-
end
|
|
15
|
-
end
|
|
16
|
-
end
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module Ruflet
|
|
4
|
-
module UI
|
|
5
|
-
module ControlRegistry
|
|
6
|
-
require_relative "material_control_registry"
|
|
7
|
-
require_relative "cupertino_control_registry"
|
|
8
|
-
|
|
9
|
-
TYPE_MAP = MaterialControlRegistry::TYPE_MAP.merge(CupertinoControlRegistry::TYPE_MAP).freeze
|
|
10
|
-
EVENT_PROPS = MaterialControlRegistry::EVENT_PROPS.merge(CupertinoControlRegistry::EVENT_PROPS).freeze
|
|
11
|
-
end
|
|
12
|
-
end
|
|
13
|
-
end
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module Ruflet
|
|
4
|
-
module UI
|
|
5
|
-
module Controls
|
|
6
|
-
class CupertinoActionSheetControl < Ruflet::Control
|
|
7
|
-
def initialize(id: nil, **props)
|
|
8
|
-
super(type: "cupertino_action_sheet", id: id, **props)
|
|
9
|
-
end
|
|
10
|
-
end
|
|
11
|
-
end
|
|
12
|
-
end
|
|
13
|
-
end
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module Ruflet
|
|
4
|
-
module UI
|
|
5
|
-
module Controls
|
|
6
|
-
class CupertinoAlertDialogControl < Ruflet::Control
|
|
7
|
-
def initialize(id: nil, **props)
|
|
8
|
-
super(type: "cupertino_alert_dialog", id: id, **props)
|
|
9
|
-
end
|
|
10
|
-
end
|
|
11
|
-
end
|
|
12
|
-
end
|
|
13
|
-
end
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module Ruflet
|
|
4
|
-
module UI
|
|
5
|
-
module Controls
|
|
6
|
-
class CupertinoDialogActionControl < Ruflet::Control
|
|
7
|
-
def initialize(id: nil, **props)
|
|
8
|
-
super(type: "cupertino_dialog_action", id: id, **props)
|
|
9
|
-
end
|
|
10
|
-
|
|
11
|
-
private
|
|
12
|
-
|
|
13
|
-
def preprocess_props(props)
|
|
14
|
-
mapped = props.dup
|
|
15
|
-
if mapped.key?(:text) || mapped.key?("text")
|
|
16
|
-
value = mapped.key?(:text) ? mapped.delete(:text) : mapped.delete("text")
|
|
17
|
-
mapped[:content] = value unless mapped.key?(:content) || mapped.key?("content")
|
|
18
|
-
end
|
|
19
|
-
mapped
|
|
20
|
-
end
|
|
21
|
-
end
|
|
22
|
-
end
|
|
23
|
-
end
|
|
24
|
-
end
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module Ruflet
|
|
4
|
-
module UI
|
|
5
|
-
module Controls
|
|
6
|
-
class CupertinoFilledButtonControl < Ruflet::Control
|
|
7
|
-
def initialize(id: nil, **props)
|
|
8
|
-
super(type: "cupertino_filled_button", id: id, **props)
|
|
9
|
-
end
|
|
10
|
-
end
|
|
11
|
-
end
|
|
12
|
-
end
|
|
13
|
-
end
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module Ruflet
|
|
4
|
-
module UI
|
|
5
|
-
module Controls
|
|
6
|
-
class CupertinoNavigationBarControl < Ruflet::Control
|
|
7
|
-
def initialize(id: nil, **props)
|
|
8
|
-
super(type: "cupertino_navigation_bar", id: id, **props)
|
|
9
|
-
end
|
|
10
|
-
end
|
|
11
|
-
end
|
|
12
|
-
end
|
|
13
|
-
end
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module Ruflet
|
|
4
|
-
module UI
|
|
5
|
-
module Controls
|
|
6
|
-
class ButtonControl < Ruflet::Control
|
|
7
|
-
def initialize(id: nil, type: "button", **props)
|
|
8
|
-
super(type: type, id: id, **props)
|
|
9
|
-
end
|
|
10
|
-
|
|
11
|
-
private
|
|
12
|
-
|
|
13
|
-
def preprocess_props(props)
|
|
14
|
-
mapped = props.dup
|
|
15
|
-
if mapped.key?(:text) || mapped.key?("text")
|
|
16
|
-
value = mapped.delete(:text) || mapped.delete("text")
|
|
17
|
-
mapped[:content] = value unless mapped.key?(:content) || mapped.key?("content")
|
|
18
|
-
end
|
|
19
|
-
mapped
|
|
20
|
-
end
|
|
21
|
-
end
|
|
22
|
-
end
|
|
23
|
-
end
|
|
24
|
-
end
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module Ruflet
|
|
4
|
-
module UI
|
|
5
|
-
module Controls
|
|
6
|
-
class FloatingActionButtonControl < Ruflet::Control
|
|
7
|
-
def initialize(id: nil, **props)
|
|
8
|
-
super(type: "floatingactionbutton", id: id, **props)
|
|
9
|
-
end
|
|
10
|
-
|
|
11
|
-
private
|
|
12
|
-
|
|
13
|
-
def preprocess_props(props)
|
|
14
|
-
normalized = props.dup
|
|
15
|
-
|
|
16
|
-
# Accept both correct and common-misspelled foreground color keys.
|
|
17
|
-
if !normalized.key?(:color) && !normalized.key?("color")
|
|
18
|
-
fg = normalized.delete(:foreground_color) || normalized.delete("foreground_color")
|
|
19
|
-
fg ||= normalized.delete(:forground_color) || normalized.delete("forground_color")
|
|
20
|
-
normalized[:color] = fg if fg
|
|
21
|
-
end
|
|
22
|
-
|
|
23
|
-
normalized
|
|
24
|
-
end
|
|
25
|
-
end
|
|
26
|
-
end
|
|
27
|
-
end
|
|
28
|
-
end
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module Ruflet
|
|
4
|
-
module UI
|
|
5
|
-
module Controls
|
|
6
|
-
class IconControl < Ruflet::Control
|
|
7
|
-
def initialize(id: nil, **props)
|
|
8
|
-
super(type: "icon", id: id, **props)
|
|
9
|
-
end
|
|
10
|
-
|
|
11
|
-
private
|
|
12
|
-
|
|
13
|
-
def preprocess_props(props)
|
|
14
|
-
mapped = props.dup
|
|
15
|
-
if mapped.key?(:name) || mapped.key?("name")
|
|
16
|
-
value = mapped.delete(:name) || mapped.delete("name")
|
|
17
|
-
mapped[:icon] = value unless mapped.key?(:icon) || mapped.key?("icon")
|
|
18
|
-
end
|
|
19
|
-
mapped
|
|
20
|
-
end
|
|
21
|
-
end
|
|
22
|
-
end
|
|
23
|
-
end
|
|
24
|
-
end
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module Ruflet
|
|
4
|
-
module UI
|
|
5
|
-
module Controls
|
|
6
|
-
class NavigationBarDestinationControl < Ruflet::Control
|
|
7
|
-
def initialize(id: nil, **props)
|
|
8
|
-
super(type: "navigationbardestination", id: id, **props)
|
|
9
|
-
end
|
|
10
|
-
end
|
|
11
|
-
end
|
|
12
|
-
end
|
|
13
|
-
end
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module Ruflet
|
|
4
|
-
module UI
|
|
5
|
-
module Controls
|
|
6
|
-
class SnackBarControl < Ruflet::Control
|
|
7
|
-
def initialize(id: nil, **props)
|
|
8
|
-
super(type: "snackbar", id: id, **props)
|
|
9
|
-
end
|
|
10
|
-
|
|
11
|
-
private
|
|
12
|
-
|
|
13
|
-
def preprocess_props(props)
|
|
14
|
-
mapped = props.dup
|
|
15
|
-
key = if mapped.key?(:duration)
|
|
16
|
-
:duration
|
|
17
|
-
elsif mapped.key?("duration")
|
|
18
|
-
"duration"
|
|
19
|
-
end
|
|
20
|
-
return mapped unless key
|
|
21
|
-
|
|
22
|
-
mapped[key] = normalize_duration_ms(mapped[key])
|
|
23
|
-
mapped
|
|
24
|
-
end
|
|
25
|
-
|
|
26
|
-
def normalize_duration_ms(value)
|
|
27
|
-
return value.to_i if value.is_a?(Numeric)
|
|
28
|
-
return value.to_i if value.is_a?(String) && value.match?(/\A\d+(\.\d+)?\z/)
|
|
29
|
-
|
|
30
|
-
parts =
|
|
31
|
-
if value.is_a?(Hash)
|
|
32
|
-
value
|
|
33
|
-
elsif value.respond_to?(:to_h)
|
|
34
|
-
value.to_h
|
|
35
|
-
else
|
|
36
|
-
nil
|
|
37
|
-
end
|
|
38
|
-
return value unless parts.is_a?(Hash)
|
|
39
|
-
|
|
40
|
-
days = read_number(parts, "days")
|
|
41
|
-
hours = read_number(parts, "hours")
|
|
42
|
-
minutes = read_number(parts, "minutes")
|
|
43
|
-
seconds = read_number(parts, "seconds")
|
|
44
|
-
milliseconds = read_number(parts, "milliseconds")
|
|
45
|
-
microseconds = read_number(parts, "microseconds")
|
|
46
|
-
|
|
47
|
-
total_ms = 0.0
|
|
48
|
-
total_ms += days * 86_400_000.0
|
|
49
|
-
total_ms += hours * 3_600_000.0
|
|
50
|
-
total_ms += minutes * 60_000.0
|
|
51
|
-
total_ms += seconds * 1_000.0
|
|
52
|
-
total_ms += milliseconds
|
|
53
|
-
total_ms += microseconds / 1000.0
|
|
54
|
-
total_ms.round
|
|
55
|
-
end
|
|
56
|
-
|
|
57
|
-
def read_number(parts, key)
|
|
58
|
-
raw = parts[key] || parts[key.to_sym]
|
|
59
|
-
return 0.0 if raw.nil?
|
|
60
|
-
return raw.to_f if raw.is_a?(Numeric)
|
|
61
|
-
return raw.to_f if raw.is_a?(String) && raw.match?(/\A-?\d+(\.\d+)?\z/)
|
|
62
|
-
|
|
63
|
-
0.0
|
|
64
|
-
end
|
|
65
|
-
end
|
|
66
|
-
end
|
|
67
|
-
end
|
|
68
|
-
end
|