glimmer-dsl-web 0.0.8 → 0.0.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -0
- data/README.md +541 -161
- data/VERSION +1 -1
- data/glimmer-dsl-web.gemspec +6 -3
- data/lib/glimmer/dsl/web/component_expression.rb +30 -0
- data/lib/glimmer/dsl/web/dsl.rb +2 -0
- data/lib/glimmer/web/component.rb +317 -0
- data/lib/glimmer/web/element_proxy.rb +8 -2
- data/lib/glimmer-dsl-web/samples/hello/hello_component.rb +223 -0
- data/lib/glimmer-dsl-web/samples/hello/hello_content_data_binding.rb +46 -42
- metadata +5 -2
@@ -87,51 +87,55 @@ end
|
|
87
87
|
|
88
88
|
@user = User.new
|
89
89
|
|
90
|
-
|
90
|
+
include Glimmer
|
91
|
+
|
92
|
+
Document.ready? do
|
91
93
|
div {
|
92
|
-
|
93
|
-
|
94
|
-
|
94
|
+
div {
|
95
|
+
label('Number of addresses: ', for: 'address-count-field')
|
96
|
+
input(id: 'address-count-field', type: 'number', min: 1, max: 3) {
|
97
|
+
value <=> [@user, :address_count]
|
98
|
+
}
|
95
99
|
}
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
value <=> [address, attribute]
|
109
|
-
}
|
110
|
-
end
|
111
|
-
|
112
|
-
div(style: 'grid-column: 1 / span 2;') {
|
113
|
-
inner_text <= [address, :text]
|
114
|
-
}
|
115
|
-
|
116
|
-
style {
|
117
|
-
<<~CSS
|
118
|
-
#{address_div.selector} {
|
119
|
-
margin: 10px 0;
|
120
|
-
}
|
121
|
-
#{address_div.selector} * {
|
122
|
-
margin: 5px;
|
123
|
-
}
|
124
|
-
#{address_div.selector} label {
|
125
|
-
grid-column: 1;
|
100
|
+
|
101
|
+
div {
|
102
|
+
# Content Data-Binding is used to dynamically (re)generate content of div
|
103
|
+
# based on changes to @user.addresses, replacing older content on every change
|
104
|
+
content(@user, :addresses) do
|
105
|
+
@user.addresses.each do |address|
|
106
|
+
div {
|
107
|
+
div(style: 'display: grid; grid-auto-columns: 80px 280px;') { |address_div|
|
108
|
+
[:name, :street, :city, :state, :zip].each do |attribute|
|
109
|
+
label(attribute.to_s.capitalize, for: "#{attribute}-field")
|
110
|
+
input(id: "#{attribute}-field", type: 'text') {
|
111
|
+
value <=> [address, attribute]
|
126
112
|
}
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
113
|
+
end
|
114
|
+
|
115
|
+
div(style: 'grid-column: 1 / span 2;') {
|
116
|
+
inner_text <= [address, :text]
|
117
|
+
}
|
118
|
+
|
119
|
+
style {
|
120
|
+
<<~CSS
|
121
|
+
#{address_div.selector} {
|
122
|
+
margin: 10px 0;
|
123
|
+
}
|
124
|
+
#{address_div.selector} * {
|
125
|
+
margin: 5px;
|
126
|
+
}
|
127
|
+
#{address_div.selector} label {
|
128
|
+
grid-column: 1;
|
129
|
+
}
|
130
|
+
#{address_div.selector} input, #{address_div.selector} select {
|
131
|
+
grid-column: 2;
|
132
|
+
}
|
133
|
+
CSS
|
134
|
+
}
|
131
135
|
}
|
132
136
|
}
|
133
|
-
|
137
|
+
end
|
134
138
|
end
|
135
|
-
|
136
|
-
}
|
137
|
-
|
139
|
+
}
|
140
|
+
}.render
|
141
|
+
end
|
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.0.
|
4
|
+
version: 0.0.9
|
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-01-
|
11
|
+
date: 2024-01-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: glimmer
|
@@ -253,6 +253,7 @@ files:
|
|
253
253
|
- lib/glimmer-dsl-web/ext/date.rb
|
254
254
|
- lib/glimmer-dsl-web/ext/exception.rb
|
255
255
|
- lib/glimmer-dsl-web/samples/hello/hello_button.rb
|
256
|
+
- lib/glimmer-dsl-web/samples/hello/hello_component.rb
|
256
257
|
- lib/glimmer-dsl-web/samples/hello/hello_content_data_binding.rb
|
257
258
|
- lib/glimmer-dsl-web/samples/hello/hello_data_binding.rb
|
258
259
|
- lib/glimmer-dsl-web/samples/hello/hello_form.rb
|
@@ -262,6 +263,7 @@ files:
|
|
262
263
|
- lib/glimmer/config/opal_logger.rb
|
263
264
|
- lib/glimmer/data_binding/element_binding.rb
|
264
265
|
- lib/glimmer/dsl/web/bind_expression.rb
|
266
|
+
- lib/glimmer/dsl/web/component_expression.rb
|
265
267
|
- lib/glimmer/dsl/web/content_data_binding_expression.rb
|
266
268
|
- lib/glimmer/dsl/web/data_binding_expression.rb
|
267
269
|
- lib/glimmer/dsl/web/dsl.rb
|
@@ -274,6 +276,7 @@ files:
|
|
274
276
|
- lib/glimmer/dsl/web/shine_data_binding_expression.rb
|
275
277
|
- lib/glimmer/util/proc_tracker.rb
|
276
278
|
- lib/glimmer/web.rb
|
279
|
+
- lib/glimmer/web/component.rb
|
277
280
|
- lib/glimmer/web/element_proxy.rb
|
278
281
|
- lib/glimmer/web/event_proxy.rb
|
279
282
|
- lib/glimmer/web/listener_proxy.rb
|