turbo_power 0.1.3 → 0.1.6
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 +4 -4
- data/Gemfile.lock +15 -27
- data/README.md +34 -2
- data/lib/turbo_power/stream_helper.rb +8 -4
- data/lib/turbo_power/version.rb +1 -1
- data/turbo_power-0.1.5.gem +0 -0
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c074d5a9c8049bd4719c301ded00f447224c02de8028daafe7757173770bd2e2
|
4
|
+
data.tar.gz: bd29bd5a9409224d63c575a569f4b83663b5c5ee65860d33224d9e9a0367902e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7217becd3cdb0ba5b5bd0d9c39cad1dc6061e98d98115f137ad7cc9d3b9d2570fa88bcf2f5df4c074087a117dcca3bb38506d0b5dd46c0f1838cc6f5c777502f
|
7
|
+
data.tar.gz: 480e6be4cee77da365f368ee85e663deeaa990b473ec3d17dc004a8b9601614a5b16824be84e34540ed315124bd128c3ecbc1baae957c98648fe30d5df9ac26a
|
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.6)
|
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,24 +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.
|
112
|
-
racc (~> 1.4)
|
113
|
-
nokogiri (1.13.8-x86_64-linux)
|
104
|
+
nokogiri (1.13.9-x86_64-darwin)
|
114
105
|
racc (~> 1.4)
|
115
106
|
parallel (1.22.1)
|
116
107
|
parser (3.1.2.1)
|
@@ -147,19 +138,19 @@ GEM
|
|
147
138
|
zeitwerk (~> 2.5)
|
148
139
|
rainbow (3.1.1)
|
149
140
|
rake (13.0.6)
|
150
|
-
regexp_parser (2.
|
141
|
+
regexp_parser (2.6.0)
|
151
142
|
rexml (3.2.5)
|
152
|
-
rubocop (1.
|
143
|
+
rubocop (1.38.0)
|
153
144
|
json (~> 2.3)
|
154
145
|
parallel (~> 1.10)
|
155
146
|
parser (>= 3.1.2.1)
|
156
147
|
rainbow (>= 2.2.2, < 4.0)
|
157
148
|
regexp_parser (>= 1.8, < 3.0)
|
158
149
|
rexml (>= 3.2.5, < 4.0)
|
159
|
-
rubocop-ast (>= 1.
|
150
|
+
rubocop-ast (>= 1.23.0, < 2.0)
|
160
151
|
ruby-progressbar (~> 1.7)
|
161
152
|
unicode-display_width (>= 1.4.0, < 3.0)
|
162
|
-
rubocop-ast (1.
|
153
|
+
rubocop-ast (1.23.0)
|
163
154
|
parser (>= 3.1.1.0)
|
164
155
|
ruby-progressbar (1.11.0)
|
165
156
|
sprockets (4.1.1)
|
@@ -169,29 +160,26 @@ GEM
|
|
169
160
|
actionpack (>= 5.2)
|
170
161
|
activesupport (>= 5.2)
|
171
162
|
sprockets (>= 3.0.0)
|
172
|
-
sqlite3 (1.5.
|
173
|
-
sqlite3 (1.5.0-x86_64-linux)
|
174
|
-
strscan (3.0.4)
|
163
|
+
sqlite3 (1.5.3-x86_64-darwin)
|
175
164
|
thor (1.2.1)
|
176
165
|
timeout (0.3.0)
|
177
|
-
turbo-rails (1.3.
|
166
|
+
turbo-rails (1.3.2)
|
178
167
|
actionpack (>= 6.0.0)
|
179
168
|
activejob (>= 6.0.0)
|
180
169
|
railties (>= 6.0.0)
|
181
|
-
turbo_ready (0.1.
|
170
|
+
turbo_ready (0.1.2)
|
182
171
|
rails (>= 6.1)
|
183
172
|
turbo-rails (>= 1.1)
|
184
173
|
tzinfo (2.0.5)
|
185
174
|
concurrent-ruby (~> 1.0)
|
186
|
-
unicode-display_width (2.
|
175
|
+
unicode-display_width (2.3.0)
|
187
176
|
websocket-driver (0.7.5)
|
188
177
|
websocket-extensions (>= 0.1.0)
|
189
178
|
websocket-extensions (0.1.5)
|
190
|
-
zeitwerk (2.6.
|
179
|
+
zeitwerk (2.6.6)
|
191
180
|
|
192
181
|
PLATFORMS
|
193
182
|
x86_64-darwin-19
|
194
|
-
x86_64-linux
|
195
183
|
|
196
184
|
DEPENDENCIES
|
197
185
|
rake (~> 13.0)
|
@@ -201,4 +189,4 @@ DEPENDENCIES
|
|
201
189
|
turbo_power!
|
202
190
|
|
203
191
|
BUNDLED WITH
|
204
|
-
2.3.
|
192
|
+
2.3.22
|
data/README.md
CHANGED
@@ -54,6 +54,37 @@ import * as Turbo from '@hotwired/turbo'
|
|
54
54
|
+TurboPower.initialize(Turbo.StreamActions)
|
55
55
|
```
|
56
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
|
+
|
57
88
|
## Usage
|
58
89
|
|
59
90
|
### Actions from `turbo_ready`
|
@@ -116,6 +147,7 @@ import * as Turbo from '@hotwired/turbo'
|
|
116
147
|
* `turbo_stream.set_cookie_item(key, value, **attributes)`
|
117
148
|
* `turbo_stream.set_focus(target, **attributes)`
|
118
149
|
* `turbo_stream.set_title(title, **attributes)`
|
150
|
+
* `turbo_stream.turbo_clear_cache()`
|
119
151
|
|
120
152
|
|
121
153
|
### Browser History Actions
|
@@ -136,8 +168,8 @@ import * as Turbo from '@hotwired/turbo'
|
|
136
168
|
|
137
169
|
### Turbo Frame Actions
|
138
170
|
|
139
|
-
* `turbo_stream.
|
140
|
-
* `turbo_stream.
|
171
|
+
* `turbo_stream.turbo_frame_reload(frame_id, **attributes)`
|
172
|
+
* `turbo_stream.turbo_frame_set_src(frame_id, src, **attributes)`
|
141
173
|
|
142
174
|
## Development
|
143
175
|
|
@@ -165,6 +165,10 @@ module TurboPower
|
|
165
165
|
custom_action :set_title, attributes: attributes.merge(title: title)
|
166
166
|
end
|
167
167
|
|
168
|
+
def turbo_clear_cache(**attributes)
|
169
|
+
custom_action :turbo_clear_cache, attributes: attributes
|
170
|
+
end
|
171
|
+
|
168
172
|
# Browser History Actions
|
169
173
|
|
170
174
|
def history_go(delta, **attributes)
|
@@ -197,12 +201,12 @@ module TurboPower
|
|
197
201
|
|
198
202
|
# Turbo Frame Actions
|
199
203
|
|
200
|
-
def
|
201
|
-
custom_action :
|
204
|
+
def turbo_frame_reload(frame_id, **attributes)
|
205
|
+
custom_action :turbo_frame_reload, target: frame_id, attributes: attributes
|
202
206
|
end
|
203
207
|
|
204
|
-
def
|
205
|
-
custom_action :
|
208
|
+
def turbo_frame_set_src(frame_id, src, **attributes)
|
209
|
+
custom_action :turbo_frame_set_src, target: frame_id, attributes: attributes.merge(src: src)
|
206
210
|
end
|
207
211
|
end
|
208
212
|
end
|
data/lib/turbo_power/version.rb
CHANGED
Binary file
|
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.6
|
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-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: turbo-rails
|
@@ -58,6 +58,7 @@ files:
|
|
58
58
|
- lib/turbo_power/engine.rb
|
59
59
|
- lib/turbo_power/stream_helper.rb
|
60
60
|
- lib/turbo_power/version.rb
|
61
|
+
- turbo_power-0.1.5.gem
|
61
62
|
- turbo_power.gemspec
|
62
63
|
homepage: https://github.com/marcoroth/turbo_power-rails
|
63
64
|
licenses:
|
@@ -82,7 +83,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
82
83
|
- !ruby/object:Gem::Version
|
83
84
|
version: '0'
|
84
85
|
requirements: []
|
85
|
-
rubygems_version: 3.3.
|
86
|
+
rubygems_version: 3.3.7
|
86
87
|
signing_key:
|
87
88
|
specification_version: 4
|
88
89
|
summary: Power-pack for Turbo Streams
|