turbo_power 0.1.6 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c074d5a9c8049bd4719c301ded00f447224c02de8028daafe7757173770bd2e2
4
- data.tar.gz: bd29bd5a9409224d63c575a569f4b83663b5c5ee65860d33224d9e9a0367902e
3
+ metadata.gz: 9fe460f5963de71ca3deae0ec792bda57273a54a0e938d13c0da62887c76a014
4
+ data.tar.gz: 934234dfb39b37bc81b62388f332a1782d18e18b383ad53dabfe22f41cc29e4d
5
5
  SHA512:
6
- metadata.gz: 7217becd3cdb0ba5b5bd0d9c39cad1dc6061e98d98115f137ad7cc9d3b9d2570fa88bcf2f5df4c074087a117dcca3bb38506d0b5dd46c0f1838cc6f5c777502f
7
- data.tar.gz: 480e6be4cee77da365f368ee85e663deeaa990b473ec3d17dc004a8b9601614a5b16824be84e34540ed315124bd128c3ecbc1baae957c98648fe30d5df9ac26a
6
+ metadata.gz: b1d2a5b0554a5e85cb1b9de0f9102733b6b07d37a0f3d16055b3d89637bd31ec07f21eeb3b178e737934f0fb6cbdd7ab022b78fb61976deb23c950db1b55f0a0
7
+ data.tar.gz: 2c1b293a1aabd7bd591201b357302192352bccc8a75bab05a626beb9556beaecb45a93096d6dcfb5746235b279e2b91643dd64d68dd2009b7121a883d3c34253
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- turbo_power (0.1.6)
4
+ turbo_power (0.2.0)
5
5
  turbo-rails (~> 1.3.0)
6
6
  turbo_ready
7
7
 
@@ -77,37 +77,42 @@ GEM
77
77
  builder (3.2.4)
78
78
  concurrent-ruby (1.1.10)
79
79
  crass (1.0.6)
80
- erubi (1.11.0)
80
+ date (3.3.3)
81
+ erubi (1.12.0)
81
82
  globalid (1.0.0)
82
83
  activesupport (>= 5.0)
83
84
  i18n (1.12.0)
84
85
  concurrent-ruby (~> 1.0)
85
- json (2.6.2)
86
- loofah (2.19.0)
86
+ json (2.6.3)
87
+ loofah (2.19.1)
87
88
  crass (~> 1.0.2)
88
89
  nokogiri (>= 1.5.9)
89
- mail (2.7.1)
90
+ mail (2.8.0)
90
91
  mini_mime (>= 0.1.1)
92
+ net-imap
93
+ net-pop
94
+ net-smtp
91
95
  marcel (1.0.2)
92
96
  method_source (1.0.0)
93
97
  mini_mime (1.1.2)
94
98
  minitest (5.16.3)
95
- net-imap (0.3.1)
99
+ net-imap (0.3.4)
100
+ date
96
101
  net-protocol
97
102
  net-pop (0.1.2)
98
103
  net-protocol
99
- net-protocol (0.1.3)
104
+ net-protocol (0.2.1)
100
105
  timeout
101
106
  net-smtp (0.3.3)
102
107
  net-protocol
103
108
  nio4r (2.5.8)
104
- nokogiri (1.13.9-x86_64-darwin)
109
+ nokogiri (1.13.10-x86_64-darwin)
105
110
  racc (~> 1.4)
106
111
  parallel (1.22.1)
107
- parser (3.1.2.1)
112
+ parser (3.1.3.0)
108
113
  ast (~> 2.4.1)
109
- racc (1.6.0)
110
- rack (2.2.4)
114
+ racc (1.6.2)
115
+ rack (2.2.5)
111
116
  rack-test (2.0.2)
112
117
  rack (>= 1.3)
113
118
  rails (7.0.4)
@@ -127,8 +132,8 @@ GEM
127
132
  rails-dom-testing (2.0.3)
128
133
  activesupport (>= 4.2.0)
129
134
  nokogiri (>= 1.6)
130
- rails-html-sanitizer (1.4.3)
131
- loofah (~> 2.3)
135
+ rails-html-sanitizer (1.4.4)
136
+ loofah (~> 2.19, >= 2.19.1)
132
137
  railties (7.0.4)
133
138
  actionpack (= 7.0.4)
134
139
  activesupport (= 7.0.4)
@@ -138,9 +143,9 @@ GEM
138
143
  zeitwerk (~> 2.5)
139
144
  rainbow (3.1.1)
140
145
  rake (13.0.6)
141
- regexp_parser (2.6.0)
146
+ regexp_parser (2.6.1)
142
147
  rexml (3.2.5)
143
- rubocop (1.38.0)
148
+ rubocop (1.41.1)
144
149
  json (~> 2.3)
145
150
  parallel (~> 1.10)
146
151
  parser (>= 3.1.2.1)
@@ -150,24 +155,24 @@ GEM
150
155
  rubocop-ast (>= 1.23.0, < 2.0)
151
156
  ruby-progressbar (~> 1.7)
152
157
  unicode-display_width (>= 1.4.0, < 3.0)
153
- rubocop-ast (1.23.0)
158
+ rubocop-ast (1.24.0)
154
159
  parser (>= 3.1.1.0)
155
160
  ruby-progressbar (1.11.0)
156
- sprockets (4.1.1)
161
+ sprockets (4.2.0)
157
162
  concurrent-ruby (~> 1.0)
158
- rack (> 1, < 3)
163
+ rack (>= 2.2.4, < 4)
159
164
  sprockets-rails (3.4.2)
160
165
  actionpack (>= 5.2)
161
166
  activesupport (>= 5.2)
162
167
  sprockets (>= 3.0.0)
163
- sqlite3 (1.5.3-x86_64-darwin)
168
+ sqlite3 (1.5.4-x86_64-darwin)
164
169
  thor (1.2.1)
165
- timeout (0.3.0)
170
+ timeout (0.3.1)
166
171
  turbo-rails (1.3.2)
167
172
  actionpack (>= 6.0.0)
168
173
  activejob (>= 6.0.0)
169
174
  railties (>= 6.0.0)
170
- turbo_ready (0.1.2)
175
+ turbo_ready (0.1.4)
171
176
  rails (>= 6.1)
172
177
  turbo-rails (>= 1.1)
173
178
  tzinfo (2.0.5)
@@ -189,4 +194,4 @@ DEPENDENCIES
189
194
  turbo_power!
190
195
 
191
196
  BUNDLED WITH
192
- 2.3.22
197
+ 2.4.1
data/README.md CHANGED
@@ -68,9 +68,7 @@ pin "application", preload: true
68
68
  pin "@hotwired/stimulus", to: "stimulus.min.js", preload: true
69
69
  pin "@hotwired/stimulus-loading", to: "stimulus-loading.js", preload: true
70
70
  - pin "@hotwired/turbo", to: "https://ga.jspm.io/npm:@hotwired/turbo@7.2.0/dist/turbo.es2017-esm.js"
71
- pin "turbo_power", to: "https://ga.jspm.io/npm:turbo_power@0.1.4/dist/index.js"
72
- + // or use the bundled script shipped with the `turbo_power` gem
73
- + pin "turbo_power", to: "turbo_power.js"
71
+ pin "turbo_power", to: "https://ga.jspm.io/npm:turbo_power@0.1.6/dist/index.js"
74
72
  ```
75
73
 
76
74
  **app/javascript/application.js**
@@ -114,7 +112,7 @@ import 'controllers'
114
112
  * `turbo_stream.remove_css_class(target, classes, **attributes)`
115
113
  * `turbo_stream.set_attribute(target, attribute, value, **attributes)`
116
114
  * `turbo_stream.set_dataset_attribute(target, attribute, value, **attributes)`
117
- * `turbo_stream.set_property(target, property, value, **attributes)`
115
+ * `turbo_stream.set_property(target, name, value, **attributes)`
118
116
  * `turbo_stream.set_style(target, name, value, **attributes)`
119
117
  * `turbo_stream.set_styles(target, styles, **attributes)`
120
118
  * `turbo_stream.set_value(target, value, **attributes)`
@@ -125,6 +123,11 @@ import 'controllers'
125
123
  * `turbo_stream.dispatch_event(target, name, detail: {}, **attributes)`
126
124
 
127
125
 
126
+ ### Form Actions
127
+
128
+ * `turbo_stream.reset_form(target, **attributes)`
129
+
130
+
128
131
  ### Storage Actions
129
132
 
130
133
  * `turbo_stream.clear_storage(type, **attributes)`
@@ -140,14 +143,12 @@ import 'controllers'
140
143
 
141
144
  ### Browser Actions
142
145
 
143
- * `turbo_stream.redirect_to(url, action_name = nil, **attributes)`
144
146
  * `turbo_stream.reload(**attributes)`
145
147
  * `turbo_stream.scroll_into_view(target, inline = "nearest", **attributes)`
146
148
  * `turbo_stream.set_cookie(cookie, **attributes)`
147
149
  * `turbo_stream.set_cookie_item(key, value, **attributes)`
148
150
  * `turbo_stream.set_focus(target, **attributes)`
149
151
  * `turbo_stream.set_title(title, **attributes)`
150
- * `turbo_stream.turbo_clear_cache()`
151
152
 
152
153
 
153
154
  ### Browser History Actions
@@ -162,15 +163,24 @@ import 'controllers'
162
163
  * `turbo_stream.console_log(message, level = 'log', **attributes)`
163
164
  * `turbo_stream.console_table(data, columns, **attributes)`
164
165
 
166
+
165
167
  ### Notification Actions
166
168
 
167
169
  * `turbo_stream.notification(title, options, **attributes)`
168
170
 
171
+
169
172
  ### Turbo Frame Actions
170
173
 
171
174
  * `turbo_stream.turbo_frame_reload(frame_id, **attributes)`
172
175
  * `turbo_stream.turbo_frame_set_src(frame_id, src, **attributes)`
173
176
 
177
+
178
+ ### Turbo Actions
179
+
180
+ * `turbo_stream.redirect_to(url, turbo_action = "advance", **attributes)`
181
+ * `turbo_stream.turbo_clear_cache()`
182
+
183
+
174
184
  ## Development
175
185
 
176
186
  After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Patch for Turbo::Broadcastable which is mixed into ActiveRecord
4
+ # SEE: https://github.com/hotwired/turbo-rails/blob/main/app/models/concerns/turbo/broadcastable.rb
5
+ module TurboBoost::Streams::Patches::Broadcastable
6
+ def broadcast_invoke_to(*streamables, method, **kwargs)
7
+ Turbo::StreamsChannel.broadcast_invoke_to(*streamables, method, **kwargs)
8
+ end
9
+
10
+ def broadcast_invoke_later_to(*streamables, method, **kwargs)
11
+ Turbo::StreamsChannel.broadcast_invoke_later_to(*streamables, method, **kwargs)
12
+ end
13
+
14
+ def broadcast_set_title(method, **kwargs)
15
+ broadcast_invoke_to(self, method, **kwargs)
16
+ end
17
+
18
+ def broadcast_invoke_later(method, **kwargs)
19
+ broadcast_invoke_later_to(self, method, **kwargs)
20
+ end
21
+ end
@@ -7,16 +7,12 @@ module TurboPower
7
7
  ## Also see:
8
8
  ## => https://github.com/hotwired/turbo-rails/pull/374
9
9
 
10
- def custom_action(name, target: nil, content: nil, allow_inferred_rendering: true, attributes: {}, **rendering, &block)
11
- template = render_template(target, content, allow_inferred_rendering: allow_inferred_rendering, **rendering, &block)
12
-
13
- turbo_stream_action_tag name, target: target, template: template, **attributes
10
+ def custom_action(name, target: nil, content: nil, attributes: {})
11
+ turbo_stream_action_tag name, target: target, template: content, **attributes
14
12
  end
15
13
 
16
- def custom_action_all(name, targets: nil, content: nil, allow_inferred_rendering: true, attributes: {}, **rendering, &block)
17
- template = render_template(targets, content, allow_inferred_rendering: allow_inferred_rendering, **rendering, &block)
18
-
19
- turbo_stream_action_tag name, targets: targets, template: template, **attributes
14
+ def custom_action_all(name, targets: nil, content: nil, attributes: {})
15
+ turbo_stream_action_tag name, targets: targets, template: content, **attributes
20
16
  end
21
17
 
22
18
  # DOM Actions
@@ -75,8 +71,8 @@ module TurboPower
75
71
  custom_action_all :set_dataset_attribute, targets: target, attributes: attributes.merge(attribute: attribute, value: value)
76
72
  end
77
73
 
78
- def set_property(target, property, value, **attributes)
79
- custom_action_all :set_property, targets: target, attributes: attributes.merge(property: property, value: value)
74
+ def set_property(target, name, value, **attributes)
75
+ custom_action_all :set_property, targets: target, attributes: attributes.merge(name: name, value: value)
80
76
  end
81
77
 
82
78
  def set_style(target, name, value, **attributes)
@@ -88,7 +84,7 @@ module TurboPower
88
84
  end
89
85
 
90
86
  def set_value(target, value, **attributes)
91
- custom_action_all :set_value, targets: target, attribtues: attributes.merge(value: value)
87
+ custom_action_all :set_value, targets: target, attributes: attributes.merge(value: value)
92
88
  end
93
89
 
94
90
  # Event Actions
@@ -97,6 +93,12 @@ module TurboPower
97
93
  custom_action_all :dispatch_event, targets: target, attributes: attributes.merge(name: name), content: detail.to_json
98
94
  end
99
95
 
96
+ # Form Actions
97
+
98
+ def reset_form(target, **attributes)
99
+ custom_action_all :reset_form, targets: target, attributes: attributes
100
+ end
101
+
100
102
  # Storage Actions
101
103
 
102
104
  def clear_storage(type, **attributes)
@@ -137,8 +139,8 @@ module TurboPower
137
139
 
138
140
  # Browser Actions
139
141
 
140
- def redirect_to(url, action_name = nil, **attributes)
141
- custom_action :redirect_to, attributes: attributes.merge(url: url, action: action_name)
142
+ def redirect_to(url, turbo_action = "advance", **attributes)
143
+ custom_action :redirect_to, attributes: attributes.merge(url: url, turbo_action: turbo_action)
142
144
  end
143
145
 
144
146
  def reload(**attributes)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module TurboPower
4
- VERSION = "0.1.6"
4
+ VERSION = "0.2.0"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: turbo_power
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marco Roth
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-11-19 00:00:00.000000000 Z
11
+ date: 2023-01-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: turbo-rails
@@ -56,9 +56,9 @@ files:
56
56
  - bin/setup
57
57
  - lib/turbo_power.rb
58
58
  - lib/turbo_power/engine.rb
59
+ - lib/turbo_power/patches/broadcastable.rb
59
60
  - lib/turbo_power/stream_helper.rb
60
61
  - lib/turbo_power/version.rb
61
- - turbo_power-0.1.5.gem
62
62
  - turbo_power.gemspec
63
63
  homepage: https://github.com/marcoroth/turbo_power-rails
64
64
  licenses:
Binary file