turbo_power 0.6.1 → 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4e8ff8643127634682d934640147295a85a4c5d865299031b79eaca8d9e07a2a
4
- data.tar.gz: ce24c63c1e2bb9bdeca2bdbb30cb3515aed4b320f01659f65c089a3d1ae63e7c
3
+ metadata.gz: ef9c05689874bd714de2a00b908a1fffeda8964a34b6f491a0e0f0b02efbd511
4
+ data.tar.gz: 5a5f03e89bc90ba272a7f16a1a7695106bf786c387cb41e687cc3278bfd89c76
5
5
  SHA512:
6
- metadata.gz: d69f06b40f30aa9848182d26c59f5b46af9b9783d9bd21a194ea523266530f3dda316da634bf9a4b4096457f4746044a20e0e4b2defc64b2a79e2a4a7d5f75a2
7
- data.tar.gz: 260f22024b9ddeb9201434d366d463258c293d4b85fd981ad02c2d3f14b91e85fa35e7881f22cae53d412bb66f0d5a7bc70a912a00e2943bd80571fe15dd285b
6
+ metadata.gz: 59d199b2ba89ee134ecd4b18b4c6e3b26929733d8c3f1fbe093af5544c096476e27e473351ff7a637d912c5fd49e809ebb0ec6a08e8474eb96663b4440fffda1
7
+ data.tar.gz: 4aced757dab415c650cb9324f37ec1c4a18d94d3b53bf1ec5736d712a2b8ceac80d23bd5fdf9e70844ed908cb860afa24a6d868bd9c8a1a9d32be37f82deccdc
data/Gemfile CHANGED
@@ -8,7 +8,8 @@ gem "rake", "~> 13.0"
8
8
  gem "rubocop", "~> 1.21"
9
9
 
10
10
  group :test do
11
- gem "sprockets-rails"
12
- gem "sqlite3"
11
+ gem "rails"
13
12
  gem "simplecov"
13
+ gem "sprockets-rails"
14
+ gem "sqlite3", "~> 1.3"
14
15
  end
data/Gemfile.lock CHANGED
@@ -1,75 +1,191 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- turbo_power (0.6.1)
4
+ turbo_power (0.6.2)
5
5
  turbo-rails (>= 1.3.0)
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
9
9
  specs:
10
- actionpack (7.0.4.2)
11
- actionview (= 7.0.4.2)
12
- activesupport (= 7.0.4.2)
13
- rack (~> 2.0, >= 2.2.0)
10
+ actioncable (7.1.3.4)
11
+ actionpack (= 7.1.3.4)
12
+ activesupport (= 7.1.3.4)
13
+ nio4r (~> 2.0)
14
+ websocket-driver (>= 0.6.1)
15
+ zeitwerk (~> 2.6)
16
+ actionmailbox (7.1.3.4)
17
+ actionpack (= 7.1.3.4)
18
+ activejob (= 7.1.3.4)
19
+ activerecord (= 7.1.3.4)
20
+ activestorage (= 7.1.3.4)
21
+ activesupport (= 7.1.3.4)
22
+ mail (>= 2.7.1)
23
+ net-imap
24
+ net-pop
25
+ net-smtp
26
+ actionmailer (7.1.3.4)
27
+ actionpack (= 7.1.3.4)
28
+ actionview (= 7.1.3.4)
29
+ activejob (= 7.1.3.4)
30
+ activesupport (= 7.1.3.4)
31
+ mail (~> 2.5, >= 2.5.4)
32
+ net-imap
33
+ net-pop
34
+ net-smtp
35
+ rails-dom-testing (~> 2.2)
36
+ actionpack (7.1.3.4)
37
+ actionview (= 7.1.3.4)
38
+ activesupport (= 7.1.3.4)
39
+ nokogiri (>= 1.8.5)
40
+ racc
41
+ rack (>= 2.2.4)
42
+ rack-session (>= 1.0.1)
14
43
  rack-test (>= 0.6.3)
15
- rails-dom-testing (~> 2.0)
16
- rails-html-sanitizer (~> 1.0, >= 1.2.0)
17
- actionview (7.0.4.2)
18
- activesupport (= 7.0.4.2)
44
+ rails-dom-testing (~> 2.2)
45
+ rails-html-sanitizer (~> 1.6)
46
+ actiontext (7.1.3.4)
47
+ actionpack (= 7.1.3.4)
48
+ activerecord (= 7.1.3.4)
49
+ activestorage (= 7.1.3.4)
50
+ activesupport (= 7.1.3.4)
51
+ globalid (>= 0.6.0)
52
+ nokogiri (>= 1.8.5)
53
+ actionview (7.1.3.4)
54
+ activesupport (= 7.1.3.4)
19
55
  builder (~> 3.1)
20
- erubi (~> 1.4)
21
- rails-dom-testing (~> 2.0)
22
- rails-html-sanitizer (~> 1.1, >= 1.2.0)
23
- activejob (7.0.4.2)
24
- activesupport (= 7.0.4.2)
56
+ erubi (~> 1.11)
57
+ rails-dom-testing (~> 2.2)
58
+ rails-html-sanitizer (~> 1.6)
59
+ activejob (7.1.3.4)
60
+ activesupport (= 7.1.3.4)
25
61
  globalid (>= 0.3.6)
26
- activesupport (7.0.4.2)
62
+ activemodel (7.1.3.4)
63
+ activesupport (= 7.1.3.4)
64
+ activerecord (7.1.3.4)
65
+ activemodel (= 7.1.3.4)
66
+ activesupport (= 7.1.3.4)
67
+ timeout (>= 0.4.0)
68
+ activestorage (7.1.3.4)
69
+ actionpack (= 7.1.3.4)
70
+ activejob (= 7.1.3.4)
71
+ activerecord (= 7.1.3.4)
72
+ activesupport (= 7.1.3.4)
73
+ marcel (~> 1.0)
74
+ activesupport (7.1.3.4)
75
+ base64
76
+ bigdecimal
27
77
  concurrent-ruby (~> 1.0, >= 1.0.2)
78
+ connection_pool (>= 2.2.5)
79
+ drb
28
80
  i18n (>= 1.6, < 2)
29
81
  minitest (>= 5.1)
82
+ mutex_m
30
83
  tzinfo (~> 2.0)
31
84
  ast (2.4.2)
32
- builder (3.2.4)
33
- concurrent-ruby (1.2.2)
85
+ base64 (0.2.0)
86
+ bigdecimal (3.1.8)
87
+ bigdecimal (3.1.8-java)
88
+ builder (3.3.0)
89
+ concurrent-ruby (1.3.1)
90
+ connection_pool (2.4.1)
34
91
  crass (1.0.6)
92
+ date (3.3.4)
93
+ date (3.3.4-java)
35
94
  docile (1.4.0)
95
+ drb (2.2.1)
36
96
  erubi (1.12.0)
37
- globalid (1.1.0)
38
- activesupport (>= 5.0)
39
- i18n (1.12.0)
97
+ globalid (1.2.1)
98
+ activesupport (>= 6.1)
99
+ i18n (1.14.5)
40
100
  concurrent-ruby (~> 1.0)
101
+ io-console (0.7.2)
102
+ io-console (0.7.2-java)
103
+ irb (1.13.1)
104
+ rdoc (>= 4.0.0)
105
+ reline (>= 0.4.2)
106
+ jar-dependencies (0.4.1)
41
107
  json (2.6.3)
42
- loofah (2.19.1)
108
+ json (2.6.3-java)
109
+ loofah (2.22.0)
43
110
  crass (~> 1.0.2)
44
- nokogiri (>= 1.5.9)
45
- method_source (1.0.0)
46
- mini_portile2 (2.8.5)
47
- minitest (5.17.0)
48
- nokogiri (1.14.2)
49
- mini_portile2 (~> 2.8.0)
111
+ nokogiri (>= 1.12.0)
112
+ mail (2.8.1)
113
+ mini_mime (>= 0.1.1)
114
+ net-imap
115
+ net-pop
116
+ net-smtp
117
+ marcel (1.0.4)
118
+ mini_mime (1.1.5)
119
+ mini_portile2 (2.8.7)
120
+ minitest (5.23.1)
121
+ mutex_m (0.2.0)
122
+ net-imap (0.4.12)
123
+ date
124
+ net-protocol
125
+ net-pop (0.1.2)
126
+ net-protocol
127
+ net-protocol (0.2.2)
128
+ timeout
129
+ net-smtp (0.5.0)
130
+ net-protocol
131
+ nio4r (2.7.3)
132
+ nio4r (2.7.3-java)
133
+ nokogiri (1.16.5)
134
+ mini_portile2 (~> 2.8.2)
50
135
  racc (~> 1.4)
51
136
  parallel (1.22.1)
52
137
  parser (3.1.3.0)
53
138
  ast (~> 2.4.1)
54
- racc (1.6.2)
55
- rack (2.2.6.2)
56
- rack-test (2.0.2)
139
+ psych (5.1.2)
140
+ stringio
141
+ psych (5.1.2-java)
142
+ jar-dependencies (>= 0.1.7)
143
+ racc (1.8.0)
144
+ racc (1.8.0-java)
145
+ rack (3.0.11)
146
+ rack-session (2.0.0)
147
+ rack (>= 3.0.0)
148
+ rack-test (2.1.0)
57
149
  rack (>= 1.3)
58
- rails-dom-testing (2.0.3)
59
- activesupport (>= 4.2.0)
150
+ rackup (2.1.0)
151
+ rack (>= 3)
152
+ webrick (~> 1.8)
153
+ rails (7.1.3.4)
154
+ actioncable (= 7.1.3.4)
155
+ actionmailbox (= 7.1.3.4)
156
+ actionmailer (= 7.1.3.4)
157
+ actionpack (= 7.1.3.4)
158
+ actiontext (= 7.1.3.4)
159
+ actionview (= 7.1.3.4)
160
+ activejob (= 7.1.3.4)
161
+ activemodel (= 7.1.3.4)
162
+ activerecord (= 7.1.3.4)
163
+ activestorage (= 7.1.3.4)
164
+ activesupport (= 7.1.3.4)
165
+ bundler (>= 1.15.0)
166
+ railties (= 7.1.3.4)
167
+ rails-dom-testing (2.2.0)
168
+ activesupport (>= 5.0.0)
169
+ minitest
60
170
  nokogiri (>= 1.6)
61
- rails-html-sanitizer (1.5.0)
62
- loofah (~> 2.19, >= 2.19.1)
63
- railties (7.0.4.2)
64
- actionpack (= 7.0.4.2)
65
- activesupport (= 7.0.4.2)
66
- method_source
171
+ rails-html-sanitizer (1.6.0)
172
+ loofah (~> 2.21)
173
+ nokogiri (~> 1.14)
174
+ railties (7.1.3.4)
175
+ actionpack (= 7.1.3.4)
176
+ activesupport (= 7.1.3.4)
177
+ irb
178
+ rackup (>= 1.0.0)
67
179
  rake (>= 12.2)
68
- thor (~> 1.0)
69
- zeitwerk (~> 2.5)
180
+ thor (~> 1.0, >= 1.2.2)
181
+ zeitwerk (~> 2.6)
70
182
  rainbow (3.1.1)
71
- rake (13.0.6)
183
+ rake (13.2.1)
184
+ rdoc (6.7.0)
185
+ psych (>= 4.0.0)
72
186
  regexp_parser (2.6.1)
187
+ reline (0.5.8)
188
+ io-console (~> 0.5)
73
189
  rexml (3.2.5)
74
190
  rubocop (1.41.1)
75
191
  json (~> 2.3)
@@ -97,29 +213,42 @@ GEM
97
213
  actionpack (>= 5.2)
98
214
  activesupport (>= 5.2)
99
215
  sprockets (>= 3.0.0)
100
- sqlite3 (1.5.4)
216
+ sqlite3 (1.7.3)
101
217
  mini_portile2 (~> 2.8.0)
102
- thor (1.2.1)
103
- turbo-rails (1.3.3)
218
+ stringio (3.1.0)
219
+ thor (1.3.1)
220
+ timeout (0.4.1)
221
+ turbo-rails (2.0.5)
104
222
  actionpack (>= 6.0.0)
105
223
  activejob (>= 6.0.0)
106
224
  railties (>= 6.0.0)
107
225
  tzinfo (2.0.6)
108
226
  concurrent-ruby (~> 1.0)
109
227
  unicode-display_width (2.3.0)
110
- zeitwerk (2.6.7)
228
+ webrick (1.8.1)
229
+ websocket-driver (0.7.6)
230
+ websocket-extensions (>= 0.1.0)
231
+ websocket-driver (0.7.6-java)
232
+ websocket-extensions (>= 0.1.0)
233
+ websocket-extensions (0.1.5)
234
+ zeitwerk (2.6.15)
111
235
 
112
236
  PLATFORMS
237
+ java
238
+ x64-mingw32
239
+ x86-mingw32
240
+ x86-mswin32
113
241
  x86_64-darwin-19
114
242
  x86_64-darwin-22
115
243
  x86_64-darwin-23
116
244
 
117
245
  DEPENDENCIES
246
+ rails
118
247
  rake (~> 13.0)
119
248
  rubocop (~> 1.21)
120
249
  simplecov
121
250
  sprockets-rails
122
- sqlite3
251
+ sqlite3 (~> 1.3)
123
252
  turbo_power!
124
253
 
125
254
  BUNDLED WITH
@@ -17,7 +17,7 @@ module TurboPower
17
17
  def custom_broadcast_action_to(*streamables, action:, **attributes)
18
18
  broadcast_stream_to(
19
19
  *streamables,
20
- content: turbo_stream_action_tag(action, **attributes)
20
+ content: RenderHelper.public_send(action, **attributes)
21
21
  )
22
22
  end
23
23
 
@@ -0,0 +1,28 @@
1
+ module TurboPower
2
+ class RenderHelper
3
+ extend ActionView::Helpers::TagHelper
4
+ extend TurboPower::StreamHelper
5
+
6
+ def self.turbo_stream_action_tag(action, target: nil, targets: nil, template: nil, **attributes)
7
+ template = action.to_sym.in?(%i[ remove refresh ]) ? "" : tag.template(template.to_s.html_safe)
8
+
9
+ if target = convert_to_turbo_stream_dom_id(target)
10
+ tag.turbo_stream(template, **attributes, action: action, target: target)
11
+ elsif targets = convert_to_turbo_stream_dom_id(targets, include_selector: true)
12
+ tag.turbo_stream(template, **attributes, action: action, targets: targets)
13
+ else
14
+ tag.turbo_stream(template, **attributes, action: action)
15
+ end
16
+ end
17
+
18
+ private
19
+
20
+ def self.convert_to_turbo_stream_dom_id(target, include_selector: false)
21
+ if Array(target).any? { |value| value.respond_to?(:to_key) }
22
+ "#{"#" if include_selector}#{ActionView::RecordIdentifier.dom_id(*target)}"
23
+ else
24
+ target
25
+ end
26
+ end
27
+ end
28
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module TurboPower
4
- VERSION = "0.6.1"
4
+ VERSION = "0.6.2"
5
5
  end
data/lib/turbo_power.rb CHANGED
@@ -6,6 +6,7 @@ require_relative "turbo_power/version"
6
6
  require_relative "turbo_power/engine"
7
7
  require_relative "turbo_power/attribute_transformations"
8
8
  require_relative "turbo_power/stream_helper"
9
+ require_relative "turbo_power/render_helper"
9
10
  require_relative "turbo_power/broadcasts"
10
11
  require_relative "turbo_power/broadcastable"
11
12
 
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.6.1
4
+ version: 0.6.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marco Roth
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-01-07 00:00:00.000000000 Z
11
+ date: 2024-06-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: turbo-rails
@@ -45,6 +45,7 @@ files:
45
45
  - lib/turbo_power/broadcastable.rb
46
46
  - lib/turbo_power/broadcasts.rb
47
47
  - lib/turbo_power/engine.rb
48
+ - lib/turbo_power/render_helper.rb
48
49
  - lib/turbo_power/stream_helper.rb
49
50
  - lib/turbo_power/version.rb
50
51
  - turbo_power.gemspec
@@ -71,7 +72,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
71
72
  - !ruby/object:Gem::Version
72
73
  version: '0'
73
74
  requirements: []
74
- rubygems_version: 3.5.3
75
+ rubygems_version: 3.5.9
75
76
  signing_key:
76
77
  specification_version: 4
77
78
  summary: Power-pack for Turbo Streams