glimmer-dsl-web 0.6.0 → 0.6.2
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/CHANGELOG.md +14 -0
- data/README.md +795 -11
- data/VERSION +1 -1
- data/glimmer-dsl-web.gemspec +6 -4
- data/lib/glimmer/dsl/web/component_expression.rb +21 -3
- data/lib/glimmer/dsl/web/component_slot_content_expression.rb +11 -5
- data/lib/glimmer/web/component.rb +27 -10
- data/lib/glimmer/web/element_proxy.rb +14 -10
- data/lib/glimmer-dsl-web/samples/hello/hello_component.rb +141 -177
- data/lib/glimmer-dsl-web/samples/hello/hello_component_listeners.rb +351 -0
- data/lib/glimmer-dsl-web/samples/hello/hello_component_listeners_default_slot.rb +349 -0
- data/lib/glimmer-dsl-web/samples/hello/hello_component_slots.rb +28 -68
- data/lib/glimmer-dsl-web/samples/hello/hello_content_data_binding.rb +3 -2
- data/lib/glimmer-dsl-web/samples/hello/hello_data_binding.rb +28 -71
- data/lib/glimmer-dsl-web/samples/hello/hello_style.rb +3 -3
- data/lib/glimmer-dsl-web/samples/regular/todo_mvc/views/new_todo_form.rb +1 -1
- data/lib/glimmer-dsl-web/samples/regular/todo_mvc/views/todo_input.rb +1 -1
- data/lib/glimmer-dsl-web/samples/regular/todo_mvc/views/todo_list.rb +3 -3
- data/lib/glimmer-dsl-web/samples/regular/todo_mvc/views/todo_list_item.rb +1 -3
- data/lib/glimmer-dsl-web/samples/regular/todo_mvc.rb +2 -2
- metadata +6 -4
@@ -21,75 +21,35 @@
|
|
21
21
|
|
22
22
|
require 'glimmer-dsl-web'
|
23
23
|
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
"LA"=>"Louisiana",
|
47
|
-
"MA"=>"Massachusetts",
|
48
|
-
"MD"=>"Maryland",
|
49
|
-
"ME"=>"Maine",
|
50
|
-
"MI"=>"Michigan",
|
51
|
-
"MN"=>"Minnesota",
|
52
|
-
"MO"=>"Missouri",
|
53
|
-
"MS"=>"Mississippi",
|
54
|
-
"MT"=>"Montana",
|
55
|
-
"NC"=>"North Carolina",
|
56
|
-
"ND"=>"North Dakota",
|
57
|
-
"NE"=>"Nebraska",
|
58
|
-
"NH"=>"New Hampshire",
|
59
|
-
"NJ"=>"New Jersey",
|
60
|
-
"NM"=>"New Mexico",
|
61
|
-
"NV"=>"Nevada",
|
62
|
-
"NY"=>"New York",
|
63
|
-
"OH"=>"Ohio",
|
64
|
-
"OK"=>"Oklahoma",
|
65
|
-
"OR"=>"Oregon",
|
66
|
-
"PA"=>"Pennsylvania",
|
67
|
-
"PR"=>"Puerto Rico",
|
68
|
-
"RI"=>"Rhode Island",
|
69
|
-
"SC"=>"South Carolina",
|
70
|
-
"SD"=>"South Dakota",
|
71
|
-
"TN"=>"Tennessee",
|
72
|
-
"TX"=>"Texas",
|
73
|
-
"UT"=>"Utah",
|
74
|
-
"VA"=>"Virginia",
|
75
|
-
"VI"=>"Virgin Islands",
|
76
|
-
"VT"=>"Vermont",
|
77
|
-
"WA"=>"Washington",
|
78
|
-
"WI"=>"Wisconsin",
|
79
|
-
"WV"=>"West Virginia",
|
80
|
-
"WY"=>"Wyoming"
|
81
|
-
}
|
82
|
-
|
83
|
-
def state_code
|
84
|
-
STATES.invert[state]
|
85
|
-
end
|
24
|
+
unless Object.const_defined?(:Address)
|
25
|
+
Address = Struct.new(:full_name, :street, :street2, :city, :state, :zip_code, :billing_and_shipping, keyword_init: true) do
|
26
|
+
STATES = {
|
27
|
+
"AK"=>"Alaska", "AL"=>"Alabama", "AR"=>"Arkansas", "AS"=>"American Samoa", "AZ"=>"Arizona",
|
28
|
+
"CA"=>"California", "CO"=>"Colorado", "CT"=>"Connecticut", "DC"=>"District of Columbia", "DE"=>"Delaware",
|
29
|
+
"FL"=>"Florida", "GA"=>"Georgia", "GU"=>"Guam", "HI"=>"Hawaii", "IA"=>"Iowa", "ID"=>"Idaho", "IL"=>"Illinois",
|
30
|
+
"IN"=>"Indiana", "KS"=>"Kansas", "KY"=>"Kentucky", "LA"=>"Louisiana", "MA"=>"Massachusetts", "MD"=>"Maryland",
|
31
|
+
"ME"=>"Maine", "MI"=>"Michigan", "MN"=>"Minnesota", "MO"=>"Missouri", "MS"=>"Mississippi", "MT"=>"Montana",
|
32
|
+
"NC"=>"North Carolina", "ND"=>"North Dakota", "NE"=>"Nebraska", "NH"=>"New Hampshire", "NJ"=>"New Jersey",
|
33
|
+
"NM"=>"New Mexico", "NV"=>"Nevada", "NY"=>"New York", "OH"=>"Ohio", "OK"=>"Oklahoma", "OR"=>"Oregon",
|
34
|
+
"PA"=>"Pennsylvania", "PR"=>"Puerto Rico", "RI"=>"Rhode Island", "SC"=>"South Carolina", "SD"=>"South Dakota",
|
35
|
+
"TN"=>"Tennessee", "TX"=>"Texas", "UT"=>"Utah", "VA"=>"Virginia", "VI"=>"Virgin Islands", "VT"=>"Vermont",
|
36
|
+
"WA"=>"Washington", "WI"=>"Wisconsin", "WV"=>"West Virginia", "WY"=>"Wyoming"
|
37
|
+
}
|
38
|
+
|
39
|
+
def state_code
|
40
|
+
STATES.invert[state]
|
41
|
+
end
|
42
|
+
|
43
|
+
def state_code=(value)
|
44
|
+
self.state = STATES[value]
|
45
|
+
end
|
86
46
|
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
47
|
+
def summary
|
48
|
+
string_attributes = to_h.except(:billing_and_shipping)
|
49
|
+
summary = string_attributes.values.map(&:to_s).reject(&:empty?).join(', ')
|
50
|
+
summary += " (Billing & Shipping)" if billing_and_shipping
|
51
|
+
summary
|
52
|
+
end
|
93
53
|
end
|
94
54
|
end
|
95
55
|
|
@@ -21,7 +21,8 @@
|
|
21
21
|
|
22
22
|
require 'glimmer-dsl-web'
|
23
23
|
|
24
|
-
|
24
|
+
# Note: named Address2 to avoid conflicting with other samples if loaded together
|
25
|
+
class Address2
|
25
26
|
attr_accessor :text
|
26
27
|
attr_reader :name, :street, :city, :state, :zip
|
27
28
|
|
@@ -78,7 +79,7 @@ class User
|
|
78
79
|
def update_addresses
|
79
80
|
address_count_change = address_count - addresses.size
|
80
81
|
if address_count_change > 0
|
81
|
-
address_count_change.times { addresses <<
|
82
|
+
address_count_change.times { addresses << Address2.new }
|
82
83
|
else
|
83
84
|
address_count_change.abs.times { addresses.pop }
|
84
85
|
end
|
@@ -21,78 +21,35 @@
|
|
21
21
|
|
22
22
|
require 'glimmer-dsl-web'
|
23
23
|
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
"LA"=>"Louisiana",
|
47
|
-
"MA"=>"Massachusetts",
|
48
|
-
"MD"=>"Maryland",
|
49
|
-
"ME"=>"Maine",
|
50
|
-
"MI"=>"Michigan",
|
51
|
-
"MN"=>"Minnesota",
|
52
|
-
"MO"=>"Missouri",
|
53
|
-
"MS"=>"Mississippi",
|
54
|
-
"MT"=>"Montana",
|
55
|
-
"NC"=>"North Carolina",
|
56
|
-
"ND"=>"North Dakota",
|
57
|
-
"NE"=>"Nebraska",
|
58
|
-
"NH"=>"New Hampshire",
|
59
|
-
"NJ"=>"New Jersey",
|
60
|
-
"NM"=>"New Mexico",
|
61
|
-
"NV"=>"Nevada",
|
62
|
-
"NY"=>"New York",
|
63
|
-
"OH"=>"Ohio",
|
64
|
-
"OK"=>"Oklahoma",
|
65
|
-
"OR"=>"Oregon",
|
66
|
-
"PA"=>"Pennsylvania",
|
67
|
-
"PR"=>"Puerto Rico",
|
68
|
-
"RI"=>"Rhode Island",
|
69
|
-
"SC"=>"South Carolina",
|
70
|
-
"SD"=>"South Dakota",
|
71
|
-
"TN"=>"Tennessee",
|
72
|
-
"TX"=>"Texas",
|
73
|
-
"UT"=>"Utah",
|
74
|
-
"VA"=>"Virginia",
|
75
|
-
"VI"=>"Virgin Islands",
|
76
|
-
"VT"=>"Vermont",
|
77
|
-
"WA"=>"Washington",
|
78
|
-
"WI"=>"Wisconsin",
|
79
|
-
"WV"=>"West Virginia",
|
80
|
-
"WY"=>"Wyoming"
|
81
|
-
}
|
82
|
-
|
83
|
-
def state_code
|
84
|
-
STATES.invert[state]
|
85
|
-
end
|
24
|
+
unless Object.const_defined?(:Address)
|
25
|
+
Address = Struct.new(:full_name, :street, :street2, :city, :state, :zip_code, :billing_and_shipping, keyword_init: true) do
|
26
|
+
STATES = {
|
27
|
+
"AK"=>"Alaska", "AL"=>"Alabama", "AR"=>"Arkansas", "AS"=>"American Samoa", "AZ"=>"Arizona",
|
28
|
+
"CA"=>"California", "CO"=>"Colorado", "CT"=>"Connecticut", "DC"=>"District of Columbia", "DE"=>"Delaware",
|
29
|
+
"FL"=>"Florida", "GA"=>"Georgia", "GU"=>"Guam", "HI"=>"Hawaii", "IA"=>"Iowa", "ID"=>"Idaho", "IL"=>"Illinois",
|
30
|
+
"IN"=>"Indiana", "KS"=>"Kansas", "KY"=>"Kentucky", "LA"=>"Louisiana", "MA"=>"Massachusetts", "MD"=>"Maryland",
|
31
|
+
"ME"=>"Maine", "MI"=>"Michigan", "MN"=>"Minnesota", "MO"=>"Missouri", "MS"=>"Mississippi", "MT"=>"Montana",
|
32
|
+
"NC"=>"North Carolina", "ND"=>"North Dakota", "NE"=>"Nebraska", "NH"=>"New Hampshire", "NJ"=>"New Jersey",
|
33
|
+
"NM"=>"New Mexico", "NV"=>"Nevada", "NY"=>"New York", "OH"=>"Ohio", "OK"=>"Oklahoma", "OR"=>"Oregon",
|
34
|
+
"PA"=>"Pennsylvania", "PR"=>"Puerto Rico", "RI"=>"Rhode Island", "SC"=>"South Carolina", "SD"=>"South Dakota",
|
35
|
+
"TN"=>"Tennessee", "TX"=>"Texas", "UT"=>"Utah", "VA"=>"Virginia", "VI"=>"Virgin Islands", "VT"=>"Vermont",
|
36
|
+
"WA"=>"Washington", "WI"=>"Wisconsin", "WV"=>"West Virginia", "WY"=>"Wyoming"
|
37
|
+
}
|
38
|
+
|
39
|
+
def state_code
|
40
|
+
STATES.invert[state]
|
41
|
+
end
|
42
|
+
|
43
|
+
def state_code=(value)
|
44
|
+
self.state = STATES[value]
|
45
|
+
end
|
86
46
|
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
summary = string_attributes.values.map(&:to_s).reject(&:empty?).join(', ')
|
94
|
-
summary += " (Billing & Shipping)" if billing_and_shipping
|
95
|
-
summary
|
47
|
+
def summary
|
48
|
+
string_attributes = to_h.except(:billing_and_shipping)
|
49
|
+
summary = string_attributes.values.map(&:to_s).reject(&:empty?).join(', ')
|
50
|
+
summary += " (Billing & Shipping)" if billing_and_shipping
|
51
|
+
summary
|
52
|
+
end
|
96
53
|
end
|
97
54
|
end
|
98
55
|
|
@@ -86,9 +86,9 @@ class StyledButton
|
|
86
86
|
class_name(:pushed) <= [button_model, :pushed]
|
87
87
|
class_name(:pulled) <= [button_model, :pushed, on_read: :!]
|
88
88
|
|
89
|
-
style(:width) <= [button_model, :width
|
90
|
-
style(:height) <= [button_model, :height
|
91
|
-
style(:font_size) <= [button_model, :font_size
|
89
|
+
style(:width) <= [button_model, :width]
|
90
|
+
style(:height) <= [button_model, :height]
|
91
|
+
style(:font_size) <= [button_model, :font_size]
|
92
92
|
style(:background_color) <= [button_model, :background_color]
|
93
93
|
style(:border_color) <= [button_model, :border_color, computed_by: :background_color]
|
94
94
|
|
@@ -14,8 +14,6 @@ class TodoListItem
|
|
14
14
|
end
|
15
15
|
|
16
16
|
markup {
|
17
|
-
|
18
|
-
|
19
17
|
li {
|
20
18
|
# Data-bind inclusion of `completed` in `li` `class` attribute unidirectionally to `todo` `completed` attribute,
|
21
19
|
# meaning inclusion/exclusion of `completed` class happens automatically when `todo.completed` boolean value changes.
|
@@ -149,7 +147,7 @@ class TodoListItem
|
|
149
147
|
r('.todo-list li .destroy:after') {
|
150
148
|
content '"×"'
|
151
149
|
display :block
|
152
|
-
height
|
150
|
+
height 100.%
|
153
151
|
line_height '1.1'
|
154
152
|
}
|
155
153
|
|
@@ -19,7 +19,7 @@ class TodoMvc
|
|
19
19
|
end
|
20
20
|
|
21
21
|
markup {
|
22
|
-
div
|
22
|
+
div {
|
23
23
|
section(class: 'todoapp') {
|
24
24
|
new_todo_form(presenter: @presenter)
|
25
25
|
|
@@ -50,7 +50,7 @@ class TodoMvc
|
|
50
50
|
border 0
|
51
51
|
color :inherit
|
52
52
|
font_family :inherit
|
53
|
-
font_size
|
53
|
+
font_size 100.%
|
54
54
|
font_weight :inherit
|
55
55
|
vertical_align :baseline
|
56
56
|
}
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: glimmer-dsl-web
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andy Maleh
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-09-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: glimmer
|
@@ -44,14 +44,14 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 1.5.
|
47
|
+
version: 1.5.2
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: 1.5.
|
54
|
+
version: 1.5.2
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: opal
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -267,6 +267,8 @@ files:
|
|
267
267
|
- lib/glimmer-dsl-web/ext/kernel.rb
|
268
268
|
- lib/glimmer-dsl-web/samples/hello/hello_button.rb
|
269
269
|
- lib/glimmer-dsl-web/samples/hello/hello_component.rb
|
270
|
+
- lib/glimmer-dsl-web/samples/hello/hello_component_listeners.rb
|
271
|
+
- lib/glimmer-dsl-web/samples/hello/hello_component_listeners_default_slot.rb
|
270
272
|
- lib/glimmer-dsl-web/samples/hello/hello_component_slots.rb
|
271
273
|
- lib/glimmer-dsl-web/samples/hello/hello_content_data_binding.rb
|
272
274
|
- lib/glimmer-dsl-web/samples/hello/hello_data_binding.rb
|