turbo_power 0.1.2 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +5 -2
- data/Gemfile.lock +24 -23
- data/README.md +53 -1
- data/Rakefile +2 -0
- data/lib/turbo_power/stream_helper.rb +4 -4
- data/lib/turbo_power/version.rb +1 -1
- data/turbo_power.gemspec +1 -2
- metadata +5 -10
- data/test/test_helper.rb +0 -6
- data/test/turbo_power/stream_helper_test.rb +0 -11
- data/test/turbo_power_test.rb +0 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 379fda8d863682b5df68a6327c7938bd613c432dd1e5c97306e7d9e8ad28463b
|
4
|
+
data.tar.gz: 678bdcad96b093b5684a04a07bff8394941adb079bff5210774cb436fb87d6f4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1aed7e3e61ce36fd5b973fe5bd1f61bfadf0be2e736f8409a970a46364fffcbbfcb43ff3819538fe996ce8293399f986d21b1c3a790423032b5f77a3012e3ed1
|
7
|
+
data.tar.gz: 49da0daa9678e58cbdcd76184bda70a8bdc7d7a086bba04de6e3dd1c258410b486f69d5d389333c5889c41bce2c1b807ddd3b1723a9b6a41701906208dace606
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
turbo_power (0.1.
|
4
|
+
turbo_power (0.1.5)
|
5
5
|
turbo-rails (~> 1.3.0)
|
6
6
|
turbo_ready
|
7
7
|
|
@@ -77,7 +77,6 @@ GEM
|
|
77
77
|
builder (3.2.4)
|
78
78
|
concurrent-ruby (1.1.10)
|
79
79
|
crass (1.0.6)
|
80
|
-
digest (3.1.0)
|
81
80
|
erubi (1.11.0)
|
82
81
|
globalid (1.0.0)
|
83
82
|
activesupport (>= 5.0)
|
@@ -93,22 +92,16 @@ GEM
|
|
93
92
|
method_source (1.0.0)
|
94
93
|
mini_mime (1.1.2)
|
95
94
|
minitest (5.16.3)
|
96
|
-
net-imap (0.
|
97
|
-
digest
|
95
|
+
net-imap (0.3.1)
|
98
96
|
net-protocol
|
99
|
-
|
100
|
-
net-pop (0.1.1)
|
101
|
-
digest
|
97
|
+
net-pop (0.1.2)
|
102
98
|
net-protocol
|
103
|
-
timeout
|
104
99
|
net-protocol (0.1.3)
|
105
100
|
timeout
|
106
|
-
net-smtp (0.3.
|
107
|
-
digest
|
101
|
+
net-smtp (0.3.3)
|
108
102
|
net-protocol
|
109
|
-
timeout
|
110
103
|
nio4r (2.5.8)
|
111
|
-
nokogiri (1.13.
|
104
|
+
nokogiri (1.13.9-x86_64-darwin)
|
112
105
|
racc (~> 1.4)
|
113
106
|
parallel (1.22.1)
|
114
107
|
parser (3.1.2.1)
|
@@ -145,47 +138,55 @@ GEM
|
|
145
138
|
zeitwerk (~> 2.5)
|
146
139
|
rainbow (3.1.1)
|
147
140
|
rake (13.0.6)
|
148
|
-
regexp_parser (2.
|
141
|
+
regexp_parser (2.6.0)
|
149
142
|
rexml (3.2.5)
|
150
|
-
rubocop (1.
|
143
|
+
rubocop (1.38.0)
|
151
144
|
json (~> 2.3)
|
152
145
|
parallel (~> 1.10)
|
153
146
|
parser (>= 3.1.2.1)
|
154
147
|
rainbow (>= 2.2.2, < 4.0)
|
155
148
|
regexp_parser (>= 1.8, < 3.0)
|
156
149
|
rexml (>= 3.2.5, < 4.0)
|
157
|
-
rubocop-ast (>= 1.
|
150
|
+
rubocop-ast (>= 1.23.0, < 2.0)
|
158
151
|
ruby-progressbar (~> 1.7)
|
159
152
|
unicode-display_width (>= 1.4.0, < 3.0)
|
160
|
-
rubocop-ast (1.
|
153
|
+
rubocop-ast (1.23.0)
|
161
154
|
parser (>= 3.1.1.0)
|
162
155
|
ruby-progressbar (1.11.0)
|
163
|
-
|
156
|
+
sprockets (4.1.1)
|
157
|
+
concurrent-ruby (~> 1.0)
|
158
|
+
rack (> 1, < 3)
|
159
|
+
sprockets-rails (3.4.2)
|
160
|
+
actionpack (>= 5.2)
|
161
|
+
activesupport (>= 5.2)
|
162
|
+
sprockets (>= 3.0.0)
|
163
|
+
sqlite3 (1.5.3-x86_64-darwin)
|
164
164
|
thor (1.2.1)
|
165
165
|
timeout (0.3.0)
|
166
|
-
turbo-rails (1.3.
|
166
|
+
turbo-rails (1.3.2)
|
167
167
|
actionpack (>= 6.0.0)
|
168
168
|
activejob (>= 6.0.0)
|
169
169
|
railties (>= 6.0.0)
|
170
|
-
turbo_ready (0.1.
|
170
|
+
turbo_ready (0.1.2)
|
171
171
|
rails (>= 6.1)
|
172
172
|
turbo-rails (>= 1.1)
|
173
173
|
tzinfo (2.0.5)
|
174
174
|
concurrent-ruby (~> 1.0)
|
175
|
-
unicode-display_width (2.
|
175
|
+
unicode-display_width (2.3.0)
|
176
176
|
websocket-driver (0.7.5)
|
177
177
|
websocket-extensions (>= 0.1.0)
|
178
178
|
websocket-extensions (0.1.5)
|
179
|
-
zeitwerk (2.6.
|
179
|
+
zeitwerk (2.6.4)
|
180
180
|
|
181
181
|
PLATFORMS
|
182
182
|
x86_64-darwin-19
|
183
183
|
|
184
184
|
DEPENDENCIES
|
185
|
-
minitest (~> 5.0)
|
186
185
|
rake (~> 13.0)
|
187
186
|
rubocop (~> 1.21)
|
187
|
+
sprockets-rails
|
188
|
+
sqlite3
|
188
189
|
turbo_power!
|
189
190
|
|
190
191
|
BUNDLED WITH
|
191
|
-
2.3.
|
192
|
+
2.3.22
|
data/README.md
CHANGED
@@ -1,4 +1,25 @@
|
|
1
|
-
|
1
|
+
<p align="center">
|
2
|
+
<picture>
|
3
|
+
<source media="(prefers-color-scheme: dark)" srcset="assets/hero-dark.png">
|
4
|
+
<img src="assets/hero.png" height="340px">
|
5
|
+
</picture>
|
6
|
+
</p>
|
7
|
+
|
8
|
+
<h1 align="center">TurboPower for Rails</h1>
|
9
|
+
|
10
|
+
<p align="center">
|
11
|
+
<a href="https://github.com/marcoroth/turbo_power">
|
12
|
+
<img src="https://github.com/marcoroth/turbo_power-rails/actions/workflows/tests.yml/badge.svg">
|
13
|
+
</a>
|
14
|
+
<a href="https://rubygems.org/gems/turbo_power">
|
15
|
+
<img alt="GEM Version" src="https://img.shields.io/gem/v/turbo_power?color=38C160&logo=ruby&logoColor=FE1616">
|
16
|
+
</a>
|
17
|
+
<a href="https://rubygems.org/gems/turbo_power">
|
18
|
+
<img alt="Gem Downloads" src="https://img.shields.io/gem/dt/turbo_power?color=38C160&logo=ruby&logoColor=FE1616">
|
19
|
+
</a>
|
20
|
+
</p>
|
21
|
+
|
22
|
+
## Getting Started
|
2
23
|
|
3
24
|
TurboPower Rails is a power-pack for Turbo Streams. This gem provides server-side Ruby helpers for the NPM package [`turbo_power`](https://github.com/marcoroth/turbo_power).
|
4
25
|
|
@@ -33,6 +54,37 @@ import * as Turbo from '@hotwired/turbo'
|
|
33
54
|
+TurboPower.initialize(Turbo.StreamActions)
|
34
55
|
```
|
35
56
|
|
57
|
+
### Installation on a stock Rails 7 install with importmaps
|
58
|
+
|
59
|
+
1. `./bin/importmap pin turbo_power`
|
60
|
+
|
61
|
+
2. You'll then have to make sure the following files are modified as such:
|
62
|
+
|
63
|
+
**config/importmaps.rb**
|
64
|
+
```diff
|
65
|
+
pin "application", preload: true
|
66
|
+
- pin "@hotwired/turbo-rails", to: "turbo.min.js", preload: true
|
67
|
+
+ pin "@hotwired/turbo", to: "turbo.min.js", preload: true
|
68
|
+
pin "@hotwired/stimulus", to: "stimulus.min.js", preload: true
|
69
|
+
pin "@hotwired/stimulus-loading", to: "stimulus-loading.js", preload: true
|
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"
|
74
|
+
```
|
75
|
+
|
76
|
+
**app/javascript/application.js**
|
77
|
+
```diff
|
78
|
+
- import '@hotwired/turbo-rails'
|
79
|
+
+ import { Turbo } from '@hotwired/turbo'
|
80
|
+
import 'controllers'
|
81
|
+
+ import TurboPower from 'turbo_power'
|
82
|
+
+ TurboPower.initialize(Turbo.StreamActions)
|
83
|
+
```
|
84
|
+
|
85
|
+
**Note:** These modifications will continue to work when upgrading Turbo via the [turbo-rails](https://github.com/hotwired/turbo-rails) gem. You can [read more](https://github.com/marcoroth/turbo_power-rails/issues/2) for the reasoning behind these adjustments.
|
86
|
+
|
87
|
+
|
36
88
|
## Usage
|
37
89
|
|
38
90
|
### Actions from `turbo_ready`
|
data/Rakefile
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require "bundler/setup"
|
3
4
|
require "bundler/gem_tasks"
|
4
5
|
require "rake/testtask"
|
5
6
|
|
@@ -7,6 +8,7 @@ Rake::TestTask.new(:test) do |t|
|
|
7
8
|
t.libs << "test"
|
8
9
|
t.libs << "lib"
|
9
10
|
t.test_files = FileList["test/**/*_test.rb"]
|
11
|
+
t.warning = false
|
10
12
|
end
|
11
13
|
|
12
14
|
require "rubocop/rake_task"
|
@@ -29,11 +29,11 @@ module TurboPower
|
|
29
29
|
custom_action_all :inner_html, targets: target, content: html, attributes: attributes, &block
|
30
30
|
end
|
31
31
|
|
32
|
-
def insert_adjacent_html(target, html = nil, position:
|
32
|
+
def insert_adjacent_html(target, html = nil, position: "beforeend", **attributes, &block)
|
33
33
|
custom_action_all :insert_adjacent_html, targets: target, content: html, attributes: attributes.merge(position: position), &block
|
34
34
|
end
|
35
35
|
|
36
|
-
def insert_adjacent_text(target, text, position:
|
36
|
+
def insert_adjacent_text(target, text, position: "beforebegin", **attributes)
|
37
37
|
custom_action_all :insert_adjacent_text, targets: target, content: "", attributes: attributes.merge(text: text, position: position)
|
38
38
|
end
|
39
39
|
|
@@ -94,7 +94,7 @@ module TurboPower
|
|
94
94
|
# Event Actions
|
95
95
|
|
96
96
|
def dispatch_event(target, name, detail: {}, **attributes)
|
97
|
-
custom_action_all :dispatch_event, targets: target, attributes: attributes.merge(name: name,
|
97
|
+
custom_action_all :dispatch_event, targets: target, attributes: attributes.merge(name: name), content: detail.to_json
|
98
98
|
end
|
99
99
|
|
100
100
|
# Storage Actions
|
@@ -202,7 +202,7 @@ module TurboPower
|
|
202
202
|
end
|
203
203
|
|
204
204
|
def set_turbo_frame_src(frame_id, src, **attributes)
|
205
|
-
custom_action :
|
205
|
+
custom_action :set_turbo_frame_src, target: frame_id, attributes: attributes.merge(src: src)
|
206
206
|
end
|
207
207
|
end
|
208
208
|
end
|
data/lib/turbo_power/version.rb
CHANGED
data/turbo_power.gemspec
CHANGED
@@ -17,6 +17,7 @@ Gem::Specification.new do |spec|
|
|
17
17
|
spec.metadata["homepage_uri"] = spec.homepage
|
18
18
|
spec.metadata["source_code_uri"] = "https://github.com/marcoroth/turbo_power-rails"
|
19
19
|
spec.metadata["changelog_uri"] = "https://github.com/marcoroth/turbo_power-rails/blob/main/CHANGELOG.md"
|
20
|
+
spec.metadata["rubygems_mfa_required"] = "true"
|
20
21
|
|
21
22
|
spec.files = Dir[
|
22
23
|
"lib/**/*.{rb,rake}",
|
@@ -26,8 +27,6 @@ Gem::Specification.new do |spec|
|
|
26
27
|
"[A-Z]*"
|
27
28
|
]
|
28
29
|
|
29
|
-
spec.test_files = Dir["test/**/*.rb"]
|
30
|
-
|
31
30
|
spec.add_dependency "turbo-rails", "~> 1.3.0"
|
32
31
|
spec.add_dependency "turbo_ready"
|
33
32
|
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.
|
4
|
+
version: 0.1.5
|
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
|
+
date: 2022-11-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: turbo-rails
|
@@ -58,9 +58,6 @@ files:
|
|
58
58
|
- lib/turbo_power/engine.rb
|
59
59
|
- lib/turbo_power/stream_helper.rb
|
60
60
|
- lib/turbo_power/version.rb
|
61
|
-
- test/test_helper.rb
|
62
|
-
- test/turbo_power/stream_helper_test.rb
|
63
|
-
- test/turbo_power_test.rb
|
64
61
|
- turbo_power.gemspec
|
65
62
|
homepage: https://github.com/marcoroth/turbo_power-rails
|
66
63
|
licenses:
|
@@ -69,6 +66,7 @@ metadata:
|
|
69
66
|
homepage_uri: https://github.com/marcoroth/turbo_power-rails
|
70
67
|
source_code_uri: https://github.com/marcoroth/turbo_power-rails
|
71
68
|
changelog_uri: https://github.com/marcoroth/turbo_power-rails/blob/main/CHANGELOG.md
|
69
|
+
rubygems_mfa_required: 'true'
|
72
70
|
post_install_message:
|
73
71
|
rdoc_options: []
|
74
72
|
require_paths:
|
@@ -84,11 +82,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
84
82
|
- !ruby/object:Gem::Version
|
85
83
|
version: '0'
|
86
84
|
requirements: []
|
87
|
-
rubygems_version: 3.3.
|
85
|
+
rubygems_version: 3.3.7
|
88
86
|
signing_key:
|
89
87
|
specification_version: 4
|
90
88
|
summary: Power-pack for Turbo Streams
|
91
|
-
test_files:
|
92
|
-
- test/test_helper.rb
|
93
|
-
- test/turbo_power/stream_helper_test.rb
|
94
|
-
- test/turbo_power_test.rb
|
89
|
+
test_files: []
|
data/test/test_helper.rb
DELETED