glimmer-dsl-web 0.4.2 → 0.4.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -14,20 +14,33 @@ class TodoListItem
14
14
  end
15
15
 
16
16
  markup {
17
+
18
+
17
19
  li {
18
- class_name <= [ todo, :completed,
19
- on_read: -> { li_class_name(todo) }
20
- ]
21
- class_name <= [ todo, :editing,
22
- on_read: -> { li_class_name(todo) }
23
- ]
20
+ # Data-bind inclusion of `completed` in `li` `class` attribute unidirectionally to `todo` `completed` attribute,
21
+ # meaning inclusion/exclusion of `completed` class happens automatically when `todo.completed` boolean value changes.
22
+ class_name(:completed) <= [todo, :completed]
23
+
24
+ # Data-bind inclusion of `active` in `li` `class` attribute unidirectionally to `todo` `completed` attribute, negated,
25
+ # meaning inclusion/exclusion of `active` class happens automatically when `todo.completed` negated boolean value changes.
26
+ class_name(:active) <= [todo, :completed, on_read: :!]
27
+
28
+ # Data-bind inclusion of `editing` in `li` `class` attribute unidirectionally to `todo` `editing` attribute,
29
+ # meaning inclusion/exclusion of `editing` class happens automatically when `todo.editing` boolean value changes.
30
+ class_name(:editing) <= [todo, :editing]
24
31
 
25
32
  div(class: 'view') {
26
33
  input(class: 'toggle', type: 'checkbox') {
34
+ # Data-bind `input` `checked` property bidirectionally to `todo` `completed` attribute
35
+ # meaning make any changes to the `todo` `completed` attribute value automatically update the `input` `checked` property
36
+ # and any changes to the `input` `checked` property by the user automatically update the `todo` `completed` attribute value.
37
+ # `after_write` hook is invoked after writing a new value to the model attribute (`todo` `completed` attribute)
27
38
  checked <=> [todo, :completed]
28
39
  }
29
40
 
30
41
  label {
42
+ # Data-bind `label` inner HTML unidirectionally to `todo.task` (`String` value),
43
+ # meaning make changes to `todo` `task` attribute automatically update `label` inner HTML.
31
44
  inner_html <= [todo, :task]
32
45
 
33
46
  ondblclick do |event|
@@ -50,111 +63,103 @@ class TodoListItem
50
63
  }
51
64
  }
52
65
 
53
- def li_class_name(todo)
54
- classes = []
55
- classes << 'completed' if todo.completed?
56
- classes << 'active' if !todo.completed?
57
- classes << 'editing' if todo.editing?
58
- classes.join(' ')
59
- end
60
-
61
66
  style {
62
- rule('.todo-list li.completed label') {
67
+ r('.todo-list li.completed label') {
63
68
  color '#949494'
64
69
  text_decoration 'line-through'
65
70
  }
66
71
 
67
- rule('.todo-list li') {
72
+ r('.todo-list li') {
68
73
  border_bottom '1px solid #ededed'
69
- font_size '24px'
70
- position 'relative'
74
+ font_size 24
75
+ position :relative
71
76
  }
72
77
 
73
- rule('.todo-list li .toggle') {
74
- _webkit_appearance 'none'
75
- appearance 'none'
76
- border 'none'
77
- bottom '0'
78
- height 'auto'
78
+ r('.todo-list li .toggle') {
79
+ _webkit_appearance :none
80
+ appearance :none
81
+ border :none
82
+ bottom 0
83
+ height :auto
79
84
  margin 'auto 0'
80
- opacity '0'
81
- position 'absolute'
82
- text_align 'center'
83
- top '0'
84
- width '40px'
85
+ opacity 0
86
+ position :absolute
87
+ text_align :center
88
+ top 0
89
+ width 40
85
90
  }
86
91
 
87
- rule('.todo-list li label') {
92
+ r('.todo-list li label') {
88
93
  color '#484848'
89
- display 'block'
94
+ display :block
90
95
  font_weight '400'
91
96
  line_height '1.2'
92
- min_height '40px'
97
+ min_height 40
93
98
  padding '15px 15px 15px 60px'
94
99
  transition 'color .4s'
95
100
  word_break 'break-all'
96
101
  }
97
102
 
98
- rule('.todo-list li .toggle+label') {
103
+ r('.todo-list li .toggle+label') {
99
104
  background_image 'url(data:image/svg+xml;utf8,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2240%22%20height%3D%2240%22%20viewBox%3D%22-10%20-18%20100%20135%22%3E%3Ccircle%20cx%3D%2250%22%20cy%3D%2250%22%20r%3D%2250%22%20fill%3D%22none%22%20stroke%3D%22%23949494%22%20stroke-width%3D%223%22/%3E%3C/svg%3E)'
100
- background_position '0'
105
+ background_position 0
101
106
  background_repeat 'no-repeat'
102
107
  }
103
108
 
104
- rule('.todo-list li.completed label') {
109
+ r('.todo-list li.completed label') {
105
110
  color '#949494'
106
111
  text_decoration 'line-through'
107
112
  }
108
113
 
109
- rule('.todo-list li .toggle:checked+label') {
114
+ r('.todo-list li .toggle:checked+label') {
110
115
  background_image 'url(data:image/svg+xml;utf8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2240%22%20height%3D%2240%22%20viewBox%3D%22-10%20-18%20100%20135%22%3E%3Ccircle%20cx%3D%2250%22%20cy%3D%2250%22%20r%3D%2250%22%20fill%3D%22none%22%20stroke%3D%22%2359A193%22%20stroke-width%3D%223%22%2F%3E%3Cpath%20fill%3D%22%233EA390%22%20d%3D%22M72%2025L42%2071%2027%2056l-4%204%2020%2020%2034-52z%22%2F%3E%3C%2Fsvg%3E)'
111
116
  }
112
117
 
113
- rule('.todo-list li.editing') {
114
- border_bottom 'none'
115
- padding '0'
118
+ r('.todo-list li.editing') {
119
+ border_bottom :none
120
+ padding 0
116
121
  }
117
122
 
118
- rule('.todo-list li.editing input[type=checkbox], .todo-list li.editing label') {
119
- opacity '0'
123
+ r('.todo-list li.editing input[type=checkbox], .todo-list li.editing label') {
124
+ opacity 0
120
125
  }
121
126
 
122
- rule('.todo-list li .destroy') {
123
- bottom '0'
127
+ r('.todo-list li .destroy') {
128
+ bottom 0
124
129
  color '#949494'
125
- display 'none'
126
- font_size '30px'
127
- height '40px'
130
+ display :none
131
+ font_size 30
132
+ height 40
128
133
  margin 'auto 0'
129
- position 'absolute'
130
- right '10px'
131
- top '0'
134
+ position :absolute
135
+ right 10
136
+ top 0
132
137
  transition 'color .2s ease-out'
133
- width '40px'
138
+ width 40
134
139
  }
135
140
 
136
- rule('.todo-list li:focus .destroy, .todo-list li:hover .destroy') {
137
- display 'block'
141
+ r('.todo-list li:focus .destroy, .todo-list li:hover .destroy') {
142
+ display :block
138
143
  }
139
144
 
140
- rule('.todo-list li .destroy:focus, .todo-list li .destroy:hover') {
145
+ r('.todo-list li .destroy:focus, .todo-list li .destroy:hover') {
141
146
  color '#c18585'
142
147
  }
143
148
 
144
- rule('.todo-list li .destroy:after') {
149
+ r('.todo-list li .destroy:after') {
145
150
  content '"×"'
146
- display 'block'
151
+ display :block
147
152
  height '100%'
148
153
  line_height '1.1'
149
154
  }
150
155
 
151
156
  media ('screen and (-webkit-min-device-pixel-ratio: 0)') {
152
- rule('.todo-list li .toggle, .toggle-all') {
153
- background 'none'
157
+ r('.todo-list li .toggle, .toggle-all') {
158
+ background :none
154
159
  }
155
160
 
156
- rule('.todo-list li .toggle') {
157
- height '40px'
161
+ r('.todo-list li .toggle') {
162
+ height 40
158
163
  }
159
164
  }
160
165
  }
@@ -16,26 +16,26 @@ class TodoMvcFooter
16
16
  }
17
17
 
18
18
  style {
19
- rule('footer.info') {
19
+ r('footer.info') {
20
20
  margin '65px auto 0'
21
21
  color '#4d4d4d'
22
- font_size '11px'
22
+ font_size 11
23
23
  text_shadow '0 1px 0 rgba(255, 255, 255, 0.5)'
24
- text_align 'center'
24
+ text_align :center
25
25
  }
26
26
 
27
- rule('footer.info p') {
27
+ r('footer.info p') {
28
28
  line_height '1'
29
29
  }
30
30
 
31
- rule('footer.info a') {
32
- color 'inherit'
33
- text_decoration 'none'
31
+ r('footer.info a') {
32
+ color :inherit
33
+ text_decoration :none
34
34
  font_weight '400'
35
35
  }
36
36
 
37
- rule('footer.info a:hover') {
38
- text_decoration 'underline'
37
+ r('footer.info a:hover') {
38
+ text_decoration :underline
39
39
  }
40
40
  }
41
41
  end
@@ -37,41 +37,41 @@ class TodoMvc
37
37
  }
38
38
 
39
39
  style {
40
- rule('body, button, html') {
41
- margin '0'
42
- padding '0'
40
+ r('body, button, html') {
41
+ margin 0
42
+ padding 0
43
43
  }
44
44
 
45
- rule('button') {
46
- _webkit_font_smoothing 'antialiased'
47
- _webkit_appearance 'none'
48
- appearance 'none'
49
- background 'none'
50
- border '0'
51
- color 'inherit'
52
- font_family 'inherit'
45
+ r('button') {
46
+ _webkit_font_smoothing :antialiased
47
+ _webkit_appearance :none
48
+ appearance :none
49
+ background :none
50
+ border 0
51
+ color :inherit
52
+ font_family :inherit
53
53
  font_size '100%'
54
- font_weight 'inherit'
55
- vertical_align 'baseline'
54
+ font_weight :inherit
55
+ vertical_align :baseline
56
56
  }
57
57
 
58
- rule('.todoapp') {
58
+ r('.todoapp') {
59
59
  background '#fff'
60
60
  margin '130px 0 40px 0'
61
- position 'relative'
61
+ position :relative
62
62
  box_shadow '0 2px 4px 0 rgba(0, 0, 0, 0.2), 0 25px 50px 0 rgba(0, 0, 0, 0.1)'
63
63
  }
64
64
 
65
65
  media('screen and (-webkit-min-device-pixel-ratio:0)') {
66
- rule('body') {
66
+ r('body') {
67
67
  font "14px 'Helvetica Neue', Helvetica, Arial, sans-serif"
68
- line_height '1.4em'
68
+ line_height 1.4.em
69
69
  background '#f5f5f5'
70
70
  color '#111111'
71
- min_width '230px'
72
- max_width '550px'
71
+ min_width 230
72
+ max_width 550
73
73
  margin '0 auto'
74
- _webkit_font_smoothing 'antialiased'
74
+ _webkit_font_smoothing :antialiased
75
75
  font_weight '300'
76
76
  }
77
77
  }
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.4.2
4
+ version: 0.4.4
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-07-28 00:00:00.000000000 Z
11
+ date: 2024-08-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: glimmer
@@ -100,14 +100,14 @@ dependencies:
100
100
  requirements:
101
101
  - - "~>"
102
102
  - !ruby/object:Gem::Version
103
- version: 0.5.1
103
+ version: 0.5.2
104
104
  type: :runtime
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
108
  - - "~>"
109
109
  - !ruby/object:Gem::Version
110
- version: 0.5.1
110
+ version: 0.5.2
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: to_collection
113
113
  requirement: !ruby/object:Gem::Requirement
@@ -299,6 +299,7 @@ files:
299
299
  - lib/glimmer/data_binding/element_binding.rb
300
300
  - lib/glimmer/dsl/web/a_expression.rb
301
301
  - lib/glimmer/dsl/web/bind_expression.rb
302
+ - lib/glimmer/dsl/web/class_name_inclusion_data_binding.rb
302
303
  - lib/glimmer/dsl/web/component_expression.rb
303
304
  - lib/glimmer/dsl/web/content_data_binding_expression.rb
304
305
  - lib/glimmer/dsl/web/data_binding_expression.rb