lacci 0.2.2 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (78) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +2 -0
  3. data/Gemfile.lock +8 -1
  4. data/lib/lacci/scarpe_cli.rb +2 -2
  5. data/lib/lacci/scarpe_core.rb +2 -1
  6. data/lib/lacci/version.rb +1 -1
  7. data/lib/scarpe/niente/app.rb +23 -0
  8. data/lib/scarpe/niente/display_service.rb +66 -0
  9. data/lib/scarpe/niente/drawable.rb +59 -0
  10. data/lib/scarpe/niente/shoes_spec.rb +93 -0
  11. data/lib/scarpe/niente.rb +32 -0
  12. data/lib/shoes/app.rb +111 -72
  13. data/lib/shoes/background.rb +2 -2
  14. data/lib/shoes/border.rb +2 -2
  15. data/lib/shoes/builtins.rb +63 -0
  16. data/lib/shoes/changelog.rb +52 -0
  17. data/lib/shoes/colors.rb +3 -1
  18. data/lib/shoes/constants.rb +41 -2
  19. data/lib/shoes/display_service.rb +80 -18
  20. data/lib/shoes/download.rb +2 -2
  21. data/lib/shoes/drawable.rb +654 -0
  22. data/lib/shoes/drawables/arc.rb +27 -0
  23. data/lib/shoes/drawables/arrow.rb +21 -0
  24. data/lib/shoes/drawables/border.rb +28 -0
  25. data/lib/shoes/drawables/button.rb +57 -0
  26. data/lib/shoes/drawables/check.rb +33 -0
  27. data/lib/shoes/drawables/document_root.rb +20 -0
  28. data/lib/shoes/{widgets → drawables}/edit_box.rb +9 -8
  29. data/lib/shoes/{widgets → drawables}/edit_line.rb +8 -7
  30. data/lib/shoes/drawables/flow.rb +20 -0
  31. data/lib/shoes/drawables/font_helper.rb +62 -0
  32. data/lib/shoes/{widgets → drawables}/image.rb +7 -7
  33. data/lib/shoes/drawables/line.rb +17 -0
  34. data/lib/shoes/drawables/link.rb +31 -0
  35. data/lib/shoes/drawables/list_box.rb +59 -0
  36. data/lib/shoes/drawables/oval.rb +48 -0
  37. data/lib/shoes/drawables/para.rb +206 -0
  38. data/lib/shoes/drawables/progress.rb +15 -0
  39. data/lib/shoes/drawables/radio.rb +35 -0
  40. data/lib/shoes/drawables/rect.rb +18 -0
  41. data/lib/shoes/{widgets → drawables}/shape.rb +8 -8
  42. data/lib/shoes/drawables/slot.rb +178 -0
  43. data/lib/shoes/drawables/stack.rb +21 -0
  44. data/lib/shoes/drawables/star.rb +28 -0
  45. data/lib/shoes/drawables/subscription_item.rb +93 -0
  46. data/lib/shoes/drawables/text_drawable.rb +122 -0
  47. data/lib/shoes/drawables/video.rb +17 -0
  48. data/lib/shoes/drawables/widget.rb +74 -0
  49. data/lib/shoes/drawables.rb +32 -0
  50. data/lib/shoes/errors.rb +38 -0
  51. data/lib/shoes/log.rb +2 -2
  52. data/lib/shoes/margin_helper.rb +79 -0
  53. data/lib/shoes/ruby_extensions.rb +15 -0
  54. data/lib/shoes-spec.rb +93 -0
  55. data/lib/shoes.rb +31 -10
  56. metadata +58 -31
  57. data/lib/shoes/spacing.rb +0 -9
  58. data/lib/shoes/widget.rb +0 -218
  59. data/lib/shoes/widgets/alert.rb +0 -19
  60. data/lib/shoes/widgets/arc.rb +0 -51
  61. data/lib/shoes/widgets/button.rb +0 -35
  62. data/lib/shoes/widgets/check.rb +0 -28
  63. data/lib/shoes/widgets/document_root.rb +0 -20
  64. data/lib/shoes/widgets/flow.rb +0 -22
  65. data/lib/shoes/widgets/font.rb +0 -14
  66. data/lib/shoes/widgets/line.rb +0 -18
  67. data/lib/shoes/widgets/link.rb +0 -25
  68. data/lib/shoes/widgets/list_box.rb +0 -25
  69. data/lib/shoes/widgets/para.rb +0 -68
  70. data/lib/shoes/widgets/radio.rb +0 -35
  71. data/lib/shoes/widgets/slot.rb +0 -75
  72. data/lib/shoes/widgets/span.rb +0 -26
  73. data/lib/shoes/widgets/stack.rb +0 -24
  74. data/lib/shoes/widgets/star.rb +0 -44
  75. data/lib/shoes/widgets/subscription_item.rb +0 -60
  76. data/lib/shoes/widgets/text_widget.rb +0 -51
  77. data/lib/shoes/widgets/video.rb +0 -15
  78. data/lib/shoes/widgets.rb +0 -29
data/lib/shoes/widget.rb DELETED
@@ -1,218 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Shoes
4
- # Shoes::Widget
5
- #
6
- # This is the display-service portable Shoes Widget interface. Visible Shoes
7
- # widgets like buttons inherit from this. Compound widgets made of multiple
8
- # different smaller Widgets inherit from it in their various apps or libraries.
9
- # The Shoes Widget helps build a Shoes-side widget tree, with parents and
10
- # children. Any API that applies to all widgets (e.g. remove) should be
11
- # defined here.
12
- #
13
- class Widget < Shoes::Linkable
14
- include Shoes::Log
15
- include Shoes::Colors
16
-
17
- class << self
18
- attr_accessor :widget_classes
19
-
20
- def inherited(subclass)
21
- Shoes::Widget.widget_classes ||= []
22
- Shoes::Widget.widget_classes << subclass
23
- super
24
- end
25
-
26
- def dsl_name
27
- n = name.split("::").last.chomp("Widget")
28
- n.gsub(/(.)([A-Z])/, '\1_\2').downcase
29
- end
30
-
31
- def widget_class_by_name(name)
32
- widget_classes.detect { |k| k.dsl_name == name.to_s }
33
- end
34
-
35
- private
36
-
37
- def linkable_properties
38
- @linkable_properties ||= []
39
- end
40
-
41
- def linkable_properties_hash
42
- @linkable_properties_hash ||= {}
43
- end
44
-
45
- public
46
-
47
- # Display properties in Shoes Linkables are automatically sync'd with the display side objects.
48
- # TODO: do we want types or other modifiers on specific properties?
49
- def display_property(name)
50
- name = name.to_s
51
-
52
- return if linkable_properties_hash[name]
53
-
54
- linkable_properties << { name: name }
55
- linkable_properties_hash[name] = true
56
- end
57
-
58
- # Add these names as display properties
59
- def display_properties(*names)
60
- names.each { |n| display_property(n) }
61
- end
62
-
63
- def display_property_names
64
- parent_prop_names = self != Shoes::Widget ? self.superclass.display_property_names : []
65
-
66
- parent_prop_names | linkable_properties.map { |prop| prop[:name] }
67
- end
68
-
69
- def display_property_name?(name)
70
- linkable_properties_hash[name.to_s] ||
71
- (self != Shoes::Widget && superclass.display_property_name?(name))
72
- end
73
- end
74
-
75
- # Shoes uses a "hidden" style property for hide/show
76
- display_property :hidden
77
-
78
- def initialize(*args, **kwargs)
79
- log_init("Widget")
80
-
81
- self.class.display_property_names.each do |prop|
82
- if kwargs[prop.to_sym]
83
- instance_variable_set("@" + prop, kwargs[prop.to_sym])
84
- end
85
- end
86
-
87
- super() # linkable_id defaults to object_id
88
- end
89
-
90
- def inspect
91
- "#<#{self.class}:#{self.object_id} " +
92
- "@linkable_id=#{@linkable_id.inspect} @parent=#{@parent.inspect} " +
93
- "@children=#{@children.inspect} properties=#{display_property_values.inspect}>"
94
- end
95
-
96
- private
97
-
98
- def bind_self_event(event_name, &block)
99
- raise("Widget has no linkable_id! #{inspect}") unless linkable_id
100
-
101
- bind_shoes_event(event_name: event_name, target: linkable_id, &block)
102
- end
103
-
104
- def bind_no_target_event(event_name, &block)
105
- bind_shoes_event(event_name:, &block)
106
- end
107
-
108
- public
109
-
110
- def display_property_values
111
- all_property_names = self.class.display_property_names
112
-
113
- properties = {}
114
- all_property_names.each do |prop|
115
- properties[prop] = instance_variable_get("@" + prop)
116
- end
117
- properties["shoes_linkable_id"] = self.linkable_id
118
- properties
119
- end
120
-
121
- private
122
-
123
- def create_display_widget
124
- klass_name = self.class.name.delete_prefix("Scarpe::").delete_prefix("Shoes::")
125
-
126
- # Should we save a reference to widget for later reference?
127
- ::Shoes::DisplayService.display_service.create_display_widget_for(klass_name, self.linkable_id, display_property_values)
128
- end
129
-
130
- public
131
-
132
- attr_reader :parent
133
-
134
- def set_parent(new_parent)
135
- @parent&.remove_child(self)
136
- new_parent&.add_child(self)
137
- @parent = new_parent
138
- send_shoes_event(new_parent.linkable_id, event_name: "parent", target: linkable_id)
139
- end
140
-
141
- # Removes the element from the Shoes::Widget tree
142
- def destroy
143
- @parent&.remove_child(self)
144
- send_shoes_event(event_name: "destroy", target: linkable_id)
145
- end
146
- alias_method :remove, :destroy
147
-
148
- # Hide the widget.
149
- def hide
150
- self.hidden = true
151
- end
152
-
153
- # Show the widget.
154
- def show
155
- self.hidden = false
156
- end
157
-
158
- # Hide the widget if it is currently shown. Show it if it is currently hidden.
159
- def toggle
160
- self.hidden = !self.hidden
161
- end
162
-
163
- # We use method_missing for widget-creating methods like "button",
164
- # and also to auto-create display-property getters and setters.
165
- def method_missing(name, *args, **kwargs, &block)
166
- name_s = name.to_s
167
-
168
- if name_s[-1] == "="
169
- prop_name = name_s[0..-2]
170
- if self.class.display_property_name?(prop_name)
171
- self.class.define_method(name) do |new_value|
172
- raise "Trying to set display properties in an object with no linkable ID!" unless linkable_id
173
-
174
- instance_variable_set("@" + prop_name, new_value)
175
- send_shoes_event({ prop_name => new_value }, event_name: "prop_change", target: linkable_id)
176
- end
177
-
178
- return self.send(name, *args, **kwargs, &block)
179
- end
180
- end
181
-
182
- if self.class.display_property_name?(name_s)
183
- self.class.define_method(name) do
184
- raise "Trying to get display properties in an object with no linkable ID!" unless linkable_id
185
-
186
- instance_variable_get("@" + name_s)
187
- end
188
-
189
- return self.send(name, *args, **kwargs, &block)
190
- end
191
-
192
- klass = Widget.widget_class_by_name(name)
193
- return super unless klass
194
-
195
- ::Shoes::Widget.define_method(name) do |*args, **kwargs, &block|
196
- # Look up the Shoes widget and create it...
197
- widget_instance = klass.new(*args, **kwargs, &block)
198
-
199
- unless klass.ancestors.include?(Shoes::TextWidget)
200
- widget_instance.set_parent Shoes::App.instance.current_slot
201
- end
202
-
203
- widget_instance
204
- end
205
-
206
- send(name, *args, **kwargs, &block)
207
- end
208
-
209
- def respond_to_missing?(name, include_private = false)
210
- name_s = name.to_s
211
- return true if self.class.display_property_name?(name_s)
212
- return true if self.class.display_property_name?(name_s[0..-2]) && name_s[-1] == "="
213
- return true if Widget.widget_class_by_name(name_s)
214
-
215
- super
216
- end
217
- end
218
- end
@@ -1,19 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Shoes
4
- class Alert < Shoes::Widget
5
- display_property :text
6
-
7
- def initialize(text)
8
- @text = text
9
-
10
- super
11
-
12
- bind_self_event("click") do
13
- remove
14
- end
15
-
16
- create_display_widget
17
- end
18
- end
19
- end
@@ -1,51 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Shoes
4
- class InvalidAttributeValueError < Shoes::Error; end
5
-
6
- class Arc < Shoes::Widget
7
- display_properties :left, :top, :width, :height, :angle1, :angle2, :draw_context
8
-
9
- def initialize(*args)
10
- @left, @top, @width, @height, @angle1, @angle2 = args
11
-
12
- @left = convert_to_integer(@left, "left")
13
- @top = convert_to_integer(@top, "top")
14
- @width = convert_to_integer(@width, "width")
15
- @height = convert_to_integer(@height, "height")
16
- @angle1 = convert_to_float(@angle1, "angle1")
17
- @angle2 = convert_to_float(@angle2, "angle2")
18
-
19
- @draw_context = Shoes::App.instance.current_draw_context
20
-
21
- super
22
- create_display_widget
23
- end
24
-
25
- private
26
-
27
- def convert_to_integer(value, attribute_name)
28
- begin
29
- value = Integer(value)
30
- raise InvalidAttributeValueError, "Negative number '#{value}' not allowed for attribute '#{attribute_name}'" if value < 0
31
-
32
- value
33
- rescue ArgumentError
34
- error_message = "Invalid value '#{value}' provided for attribute '#{attribute_name}'. The value should be a number."
35
- raise InvalidAttributeValueError, error_message
36
- end
37
- end
38
-
39
- def convert_to_float(value, attribute_name)
40
- begin
41
- value = Float(value)
42
- raise InvalidAttributeValueError, "Negative number '#{value}' not allowed for attribute '#{attribute_name}'" if value < 0
43
-
44
- value
45
- rescue ArgumentError
46
- error_message = "Invalid value '#{value}' provided for attribute '#{attribute_name}'. The value should be a number."
47
- raise InvalidAttributeValueError, error_message
48
- end
49
- end
50
- end
51
- end
@@ -1,35 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Shoes
4
- class Button < Shoes::Widget
5
- include Shoes::Log
6
- display_properties :text, :width, :height, :top, :left, :color, :padding_top, :padding_bottom, :text_color, :size, :font_size
7
-
8
- def initialize(text, width: nil, height: nil, top: nil, left: nil, color: nil, padding_top: nil, padding_bottom: nil, size: 12, text_color: nil,
9
- font_size: nil, & block)
10
-
11
- log_init("Button")
12
-
13
- # Properties passed as positional args, not keywords, don't get auto-set
14
- @text = text
15
- @color = color
16
-
17
- @block = block
18
-
19
- super
20
-
21
- # Bind to a handler named "click"
22
- bind_self_event("click") do
23
- @log.debug("Button clicked, calling handler") if @block
24
- @block&.call
25
- end
26
-
27
- create_display_widget
28
- end
29
-
30
- # Set the click handler
31
- def click(&block)
32
- @block = block
33
- end
34
- end
35
- end
@@ -1,28 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Shoes
4
- class Check < Shoes::Widget
5
- display_properties :checked
6
-
7
- def initialize(checked = nil, &block)
8
- @block = block
9
- super
10
-
11
- bind_self_event("click") { click }
12
- create_display_widget
13
- end
14
-
15
- def click(&block)
16
- @block = block
17
- self.checked = !checked?
18
- end
19
-
20
- def checked?
21
- @checked ? true : false
22
- end
23
-
24
- def checked(value)
25
- self.checked = value
26
- end
27
- end
28
- end
@@ -1,20 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Shoes
4
- class DocumentRoot < Shoes::Flow
5
- def initialize
6
- @height = "100%"
7
- @width = @margin = @padding = nil
8
- @options = {}
9
-
10
- super
11
-
12
- create_display_widget
13
- end
14
-
15
- # The default inspect string can be absolutely huge in console output, and it's frequently printed.
16
- def inspect
17
- "<Shoes::DocumentRoot>"
18
- end
19
- end
20
- end
@@ -1,22 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Shoes
4
- class Flow < Shoes::Slot
5
- include Shoes::Background
6
- include Shoes::Border
7
- include Shoes::Spacing
8
-
9
- display_properties :width, :height, :margin, :padding
10
-
11
- def initialize(width: "100%", height: nil, margin: nil, padding: nil, **options, &block)
12
- @options = options
13
-
14
- super
15
-
16
- # Create the display-side widget *before* instance_eval, which will add child widgets with their display widgets
17
- create_display_widget
18
-
19
- Shoes::App.instance.with_slot(self, &block) if block_given?
20
- end
21
- end
22
- end
@@ -1,14 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Shoes
4
- class Font < Shoes::Widget
5
- display_properties :font
6
-
7
- def initialize(font)
8
- @font = font
9
- super
10
-
11
- create_display_widget
12
- end
13
- end
14
- end
@@ -1,18 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Shoes
4
- class Line < Shoes::Widget
5
- display_properties :left, :top, :x2, :y2, :draw_context
6
-
7
- def initialize(left, top, x2, y2)
8
- @left = left
9
- @top = top
10
- @x2 = x2
11
- @y2 = y2
12
- @draw_context = Shoes::App.instance.current_draw_context
13
-
14
- super
15
- create_display_widget
16
- end
17
- end
18
- end
@@ -1,25 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Shoes
4
- class Link < Shoes::TextWidget
5
- display_properties :text, :click, :has_block
6
-
7
- def initialize(text, click: nil, &block)
8
- @text = text
9
- @block = block
10
- # We can't send a block to the display widget, but we can send a boolean
11
- @has_block = !block.nil?
12
-
13
- super
14
-
15
- # The click property should be changed before it gets sent to the display widget
16
- @click ||= "#"
17
-
18
- bind_self_event("click") do
19
- @block&.call
20
- end
21
-
22
- create_display_widget
23
- end
24
- end
25
- end
@@ -1,25 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Shoes
4
- class ListBox < Shoes::Widget
5
- display_properties :selected_item, :items, :height, :width
6
-
7
- def initialize(args = {}, &block)
8
- @items = args[:items] || []
9
- @selected_item = args[:selected_item]
10
- super()
11
-
12
- bind_self_event("change") do |new_item|
13
- self.selected_item = new_item
14
- @callback&.call(new_item)
15
- end
16
-
17
- create_display_widget
18
- end
19
-
20
- def change(&block)
21
- @callback = block
22
- self # Allow chaining calls
23
- end
24
- end
25
- end
@@ -1,68 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Shoes
4
- class Para < Shoes::Widget
5
- display_properties :text_items, :stroke, :size, :font, :html_attributes, :hidden
6
-
7
- def initialize(*args, stroke: nil, size: :para, font: nil, hidden: false, **html_attributes)
8
- @text_children = args || []
9
- if hidden
10
- @hidden_text_items = text_children_to_items(@text_children)
11
- @text_items = []
12
- else
13
- # Text_children alternates strings and TextWidgets, so we can't just pass
14
- # it as a display property. It won't serialize.
15
- @text_items = text_children_to_items(@text_children)
16
- @hidden_text_items = []
17
- end
18
- stroke = to_rgb(stroke)
19
-
20
- @html_attributes = html_attributes || {}
21
-
22
- super
23
-
24
- create_display_widget
25
- end
26
-
27
- def text_children_to_items(text_children)
28
- text_children.map { |arg| arg.is_a?(String) ? arg : arg.linkable_id }
29
- end
30
-
31
- def replace(*children)
32
- @text_children = children
33
-
34
- # This should signal the display widget to change
35
- self.text_items = text_children_to_items(@text_children)
36
- end
37
- end
38
- end
39
-
40
- module Shoes
41
- class Widget
42
- def banner(*args, **kwargs)
43
- para(*args, **{ size: :banner }.merge(kwargs))
44
- end
45
-
46
- def title(*args, **kwargs)
47
- para(*args, **{ size: :title }.merge(kwargs))
48
- end
49
-
50
- def subtitle(*args, **kwargs)
51
- para(*args, **{ size: :subtitle }.merge(kwargs))
52
- end
53
-
54
- def tagline(*args, **kwargs)
55
- para(*args, **{ size: :tagline }.merge(kwargs))
56
- end
57
-
58
- def caption(*args, **kwargs)
59
- para(*args, **{ size: :caption }.merge(kwargs))
60
- end
61
-
62
- def inscription(*args, **kwargs)
63
- para(*args, **{ size: :inscription }.merge(kwargs))
64
- end
65
-
66
- alias_method :ins, :inscription
67
- end
68
- end
@@ -1,35 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Shoes
4
- class Radio < Shoes::Widget
5
- display_properties :group, :checked
6
-
7
- def initialize(group = nil, checked = nil, &block)
8
- @group = group
9
- @block = block
10
- super
11
-
12
- bind_self_event("click") { click }
13
- create_display_widget
14
- end
15
-
16
- def click(&block)
17
- @block = block
18
- self.checked = !checked?
19
- end
20
-
21
- def checked?
22
- @checked ? true : false
23
- end
24
-
25
- def checked(value)
26
- self.checked = value
27
- end
28
-
29
- private
30
-
31
- def group_name
32
- @group || @parent
33
- end
34
- end
35
- end
@@ -1,75 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- class Shoes::Slot < Shoes::Widget
4
- # @incompatibility Shoes uses #content, not #children, for this
5
- attr_reader :children
6
-
7
- # Do not call directly, use set_parent
8
- def remove_child(child)
9
- @children ||= []
10
- unless @children.include?(child)
11
- @log.warn("remove_child: no such child(#{child.inspect}) for parent(#{parent.inspect})!")
12
- end
13
- @children.delete(child)
14
- end
15
-
16
- # Do not call directly, use set_parent
17
- def add_child(child)
18
- @children ||= []
19
- @children << child
20
- end
21
-
22
- # Get a list of child widgets
23
- def contents
24
- @children ||= []
25
- @children.dup
26
- end
27
-
28
- # Calling stack.app or flow.app will execute the block
29
- # with the Shoes::App as self, and with that stack or
30
- # flow as the current slot.
31
- #
32
- # @incompatibility Shoes Classic will only change self
33
- # via this method, while Scarpe will also change self
34
- # with the other Slot Manipulation methods: #clear,
35
- # #append, #prepend, #before and #after.
36
- #
37
- # @return [Shoes::App] the Shoes app
38
- # @yield the block to call with the Shoes App as self
39
- def app(&block)
40
- Shoes::App.instance.with_slot(self, &block) if block_given?
41
- Shoes::App.instance
42
- end
43
-
44
- # Remove all children from this widget. If a block
45
- # is given, call the block to replace the children with
46
- # new contents from that block.
47
- #
48
- # Should only be called on Slots, which can
49
- # have children.
50
- #
51
- # @incompatibility Shoes Classic calls the clear block with current self, while Scarpe uses the Shoes::App as self
52
- #
53
- # @yield The block to call to replace the contents of the widget (optional)
54
- # @return [void]
55
- def clear(&block)
56
- @children.dup.each(&:destroy)
57
- append(&block) if block_given?
58
- nil
59
- end
60
-
61
- # Call the block to append new children to a Slot.
62
- #
63
- # Should only be called on a Slot, since only Slots can have children.
64
- #
65
- # @incompatibility Shoes Classic calls the append block with current self, while Scarpe uses the Shoes::App as self
66
- #
67
- # @yield the block to call to replace children; will be called on the Shoes::App, appending to the called Slot as the current slot
68
- # @return [void]
69
- def append(&block)
70
- raise("append requires a block!") unless block_given?
71
- raise("Don't append to something that isn't a slot!") unless self.is_a?(Shoes::Slot)
72
-
73
- Shoes::App.instance.with_slot(self, &block)
74
- end
75
- end
@@ -1,26 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Shoes
4
- class Span < Shoes::Widget
5
- display_properties :text, :stroke, :size, :font, :html_attributes
6
-
7
- def initialize(text, stroke: nil, size: :span, font: nil, **html_attributes)
8
- @text = text
9
- @stroke = stroke
10
- @size = size
11
- @font = font
12
- @html_attributes = html_attributes
13
-
14
- super
15
-
16
- create_display_widget
17
- end
18
-
19
- def replace(text)
20
- @text = text
21
-
22
- # This should signal the display widget to change
23
- self.text = @text
24
- end
25
- end
26
- end