stimulus_reflex 3.4.0.pre2 → 3.4.0.pre7
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.
Potentially problematic release.
This version of stimulus_reflex might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/CHANGELOG.md +90 -3
- data/Gemfile.lock +18 -18
- data/README.md +6 -10
- data/Rakefile +5 -5
- data/app/channels/stimulus_reflex/channel.rb +20 -4
- data/bin/console +1 -0
- data/bin/standardize +1 -1
- data/lib/generators/stimulus_reflex/templates/app/javascript/controllers/%file_name%_controller.js.tt +14 -2
- data/lib/generators/stimulus_reflex/templates/app/javascript/controllers/application_controller.js.tt +10 -2
- data/lib/generators/stimulus_reflex/templates/app/reflexes/%file_name%_reflex.rb.tt +19 -9
- data/lib/generators/stimulus_reflex/templates/app/reflexes/application_reflex.rb.tt +2 -2
- data/lib/generators/stimulus_reflex/templates/config/initializers/stimulus_reflex.rb +13 -2
- data/lib/stimulus_reflex.rb +3 -0
- data/lib/stimulus_reflex/broadcasters/broadcaster.rb +11 -6
- data/lib/stimulus_reflex/broadcasters/nothing_broadcaster.rb +4 -0
- data/lib/stimulus_reflex/broadcasters/page_broadcaster.rb +8 -2
- data/lib/stimulus_reflex/broadcasters/selector_broadcaster.rb +12 -2
- data/lib/stimulus_reflex/cable_ready_channels.rb +12 -0
- data/lib/stimulus_reflex/configuration.rb +5 -2
- data/lib/stimulus_reflex/logger.rb +106 -0
- data/lib/stimulus_reflex/reflex.rb +9 -5
- data/lib/stimulus_reflex/sanity_checker.rb +60 -11
- data/lib/stimulus_reflex/utils/colorize.rb +23 -0
- data/lib/stimulus_reflex/version.rb +1 -1
- data/lib/tasks/stimulus_reflex/install.rake +3 -3
- data/package.json +11 -17
- data/stimulus_reflex.gemspec +1 -1
- data/tags +82 -41
- data/test/broadcasters/broadcaster_test.rb +10 -0
- data/test/broadcasters/broadcaster_test_case.rb +13 -0
- data/test/broadcasters/nothing_broadcaster_test.rb +33 -0
- data/test/broadcasters/page_broadcaster_test.rb +73 -0
- data/test/broadcasters/selector_broadcaster_test.rb +55 -0
- data/test/test_helper.rb +37 -0
- data/test/tmp/app/reflexes/application_reflex.rb +2 -2
- data/test/tmp/app/reflexes/demo_reflex.rb +33 -0
- data/yarn.lock +248 -1798
- metadata +28 -15
- data/test/tmp/app/reflexes/user_reflex.rb +0 -33
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d53413cf3a4976f46192ac4158076417c4413ab02ca172b14d39e6e58ce9e441
|
4
|
+
data.tar.gz: cf98a2ae76724127124d5ad3d033d1d3433ab7c6efbbefc2430cb7b3fd10be30
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4f6ac946ad23e7ad2e8bcb4788790dd7f2ea551db4433b4e2cb8f26eeed1c54d1aee7a2a809a18258a3ccefbd63b683db08ccc40900bc2ef996ddd4538e9ae87
|
7
|
+
data.tar.gz: 24df503ca6fbfe22e4080b8b81caa737a11d53b9139c238bb472ab6ec06c51e632e2e680222c70b6fec95c74b7c5ba696f82a1dcfb5ec519552885580c8c52f8
|
data/CHANGELOG.md
CHANGED
@@ -2,7 +2,94 @@
|
|
2
2
|
|
3
3
|
## [Unreleased](https://github.com/hopsoft/stimulus_reflex/tree/HEAD)
|
4
4
|
|
5
|
-
[Full Changelog](https://github.com/hopsoft/stimulus_reflex/compare/v3.4.0.
|
5
|
+
[Full Changelog](https://github.com/hopsoft/stimulus_reflex/compare/v3.4.0.pre6...HEAD)
|
6
|
+
|
7
|
+
**Closed issues:**
|
8
|
+
|
9
|
+
- Multiple reflex submissions can lead to unexpected behaviour. [\#391](https://github.com/hopsoft/stimulus_reflex/issues/391)
|
10
|
+
|
11
|
+
**Merged pull requests:**
|
12
|
+
|
13
|
+
- Trigger piggy back operations after SR operations [\#395](https://github.com/hopsoft/stimulus_reflex/pull/395) ([hopsoft](https://github.com/hopsoft))
|
14
|
+
- `invokeLifecycleMethod\(\)`: handle undefined `element` parameter [\#393](https://github.com/hopsoft/stimulus_reflex/pull/393) ([marcoroth](https://github.com/marcoroth))
|
15
|
+
- don't warn folks twice [\#392](https://github.com/hopsoft/stimulus_reflex/pull/392) ([leastbad](https://github.com/leastbad))
|
16
|
+
|
17
|
+
## [v3.4.0.pre6](https://github.com/hopsoft/stimulus_reflex/tree/v3.4.0.pre6) (2020-11-29)
|
18
|
+
|
19
|
+
[Full Changelog](https://github.com/hopsoft/stimulus_reflex/compare/v3.4.0.pre5...v3.4.0.pre6)
|
20
|
+
|
21
|
+
**Merged pull requests:**
|
22
|
+
|
23
|
+
- Update templates for new stage etc [\#390](https://github.com/hopsoft/stimulus_reflex/pull/390) ([leastbad](https://github.com/leastbad))
|
24
|
+
- reflexError and received refactor [\#389](https://github.com/hopsoft/stimulus_reflex/pull/389) ([leastbad](https://github.com/leastbad))
|
25
|
+
- add jQuery support to SR library events [\#388](https://github.com/hopsoft/stimulus_reflex/pull/388) ([leastbad](https://github.com/leastbad))
|
26
|
+
- dont exit in sanity checker on `stimulus\_reflex:install` [\#387](https://github.com/hopsoft/stimulus_reflex/pull/387) ([marcoroth](https://github.com/marcoroth))
|
27
|
+
- Allow `success` and `after` lifecycle methods on replaced elements [\#386](https://github.com/hopsoft/stimulus_reflex/pull/386) ([marcoroth](https://github.com/marcoroth))
|
28
|
+
- split SR operations from data.operations [\#385](https://github.com/hopsoft/stimulus_reflex/pull/385) ([leastbad](https://github.com/leastbad))
|
29
|
+
- don't show findElement warnings unless debugging [\#384](https://github.com/hopsoft/stimulus_reflex/pull/384) ([leastbad](https://github.com/leastbad))
|
30
|
+
- Setup a proxy object that wraps CableReady::Channels [\#382](https://github.com/hopsoft/stimulus_reflex/pull/382) ([hopsoft](https://github.com/hopsoft))
|
31
|
+
- non-SR cable\_ready operation pass-through [\#381](https://github.com/hopsoft/stimulus_reflex/pull/381) ([leastbad](https://github.com/leastbad))
|
32
|
+
|
33
|
+
## [v3.4.0.pre5](https://github.com/hopsoft/stimulus_reflex/tree/v3.4.0.pre5) (2020-11-25)
|
34
|
+
|
35
|
+
[Full Changelog](https://github.com/hopsoft/stimulus_reflex/compare/v3.4.0.pre4...v3.4.0.pre5)
|
36
|
+
|
37
|
+
**Closed issues:**
|
38
|
+
|
39
|
+
- SR doesn't seem to handle redirects / 302s [\#376](https://github.com/hopsoft/stimulus_reflex/issues/376)
|
40
|
+
|
41
|
+
**Merged pull requests:**
|
42
|
+
|
43
|
+
- Move package.json to root of project [\#380](https://github.com/hopsoft/stimulus_reflex/pull/380) ([hopsoft](https://github.com/hopsoft))
|
44
|
+
- make element.reflexController a dictionary [\#379](https://github.com/hopsoft/stimulus_reflex/pull/379) ([existentialmutt](https://github.com/existentialmutt))
|
45
|
+
- fixed bug preventing callbacks for multiple morphs [\#378](https://github.com/hopsoft/stimulus_reflex/pull/378) ([leastbad](https://github.com/leastbad))
|
46
|
+
- Handles to mitigate race conditions when running reflexes in quick succession on the same element [\#377](https://github.com/hopsoft/stimulus_reflex/pull/377) ([existentialmutt](https://github.com/existentialmutt))
|
47
|
+
- Exit with nonzero status code [\#375](https://github.com/hopsoft/stimulus_reflex/pull/375) ([julianrubisch](https://github.com/julianrubisch))
|
48
|
+
|
49
|
+
## [v3.4.0.pre4](https://github.com/hopsoft/stimulus_reflex/tree/v3.4.0.pre4) (2020-11-19)
|
50
|
+
|
51
|
+
[Full Changelog](https://github.com/hopsoft/stimulus_reflex/compare/v3.4.0.pre3...v3.4.0.pre4)
|
52
|
+
|
53
|
+
**Fixed bugs:**
|
54
|
+
|
55
|
+
- Fix fatal error in `stimulus\_reflex:install` task with Rails 5.2 [\#371](https://github.com/hopsoft/stimulus_reflex/pull/371) ([Matt-Yorkley](https://github.com/Matt-Yorkley))
|
56
|
+
- fix nothing morphs and error messages [\#368](https://github.com/hopsoft/stimulus_reflex/pull/368) ([leastbad](https://github.com/leastbad))
|
57
|
+
|
58
|
+
**Closed issues:**
|
59
|
+
|
60
|
+
- `stimulus\_reflex:install` fails to complete in Rails 5.2 [\#367](https://github.com/hopsoft/stimulus_reflex/issues/367)
|
61
|
+
- Form data still not captured [\#366](https://github.com/hopsoft/stimulus_reflex/issues/366)
|
62
|
+
- Console exception when reflex does not update a page that didn't trigger the reflex [\#363](https://github.com/hopsoft/stimulus_reflex/issues/363)
|
63
|
+
- Improve server-side logging options [\#264](https://github.com/hopsoft/stimulus_reflex/issues/264)
|
64
|
+
|
65
|
+
**Merged pull requests:**
|
66
|
+
|
67
|
+
- use puts instead of ActionCable.logger to sidestep silenced AC logs [\#373](https://github.com/hopsoft/stimulus_reflex/pull/373) ([leastbad](https://github.com/leastbad))
|
68
|
+
- Improve logged post\_install.js message [\#372](https://github.com/hopsoft/stimulus_reflex/pull/372) ([forsbergplustwo](https://github.com/forsbergplustwo))
|
69
|
+
- Pass additional reflex-related data to reflex from data [\#370](https://github.com/hopsoft/stimulus_reflex/pull/370) ([joshleblanc](https://github.com/joshleblanc))
|
70
|
+
- fix: rip out microbundle [\#369](https://github.com/hopsoft/stimulus_reflex/pull/369) ([ParamagicDev](https://github.com/ParamagicDev))
|
71
|
+
- Add tests for broadcasters [\#364](https://github.com/hopsoft/stimulus_reflex/pull/364) ([julianrubisch](https://github.com/julianrubisch))
|
72
|
+
- Do not run sanity check on `rails generate stimulus\_reflex:config` [\#362](https://github.com/hopsoft/stimulus_reflex/pull/362) ([RolandStuder](https://github.com/RolandStuder))
|
73
|
+
- fix: revert CR and @rails/actioncable to dependencies [\#361](https://github.com/hopsoft/stimulus_reflex/pull/361) ([ParamagicDev](https://github.com/ParamagicDev))
|
74
|
+
- xpath fix [\#360](https://github.com/hopsoft/stimulus_reflex/pull/360) ([leastbad](https://github.com/leastbad))
|
75
|
+
|
76
|
+
## [v3.4.0.pre3](https://github.com/hopsoft/stimulus_reflex/tree/v3.4.0.pre3) (2020-11-11)
|
77
|
+
|
78
|
+
[Full Changelog](https://github.com/hopsoft/stimulus_reflex/compare/v3.4.0.pre2...v3.4.0.pre3)
|
79
|
+
|
80
|
+
**Merged pull requests:**
|
81
|
+
|
82
|
+
- Allow to supress warnings for sanity checks [\#359](https://github.com/hopsoft/stimulus_reflex/pull/359) ([RolandStuder](https://github.com/RolandStuder))
|
83
|
+
- serializeForm: only append given input if element is submit button [\#357](https://github.com/hopsoft/stimulus_reflex/pull/357) ([marcoroth](https://github.com/marcoroth))
|
84
|
+
- Update package.json to 3.4.0-pre2 [\#356](https://github.com/hopsoft/stimulus_reflex/pull/356) ([marcoroth](https://github.com/marcoroth))
|
85
|
+
- Fix elementToXPath import [\#355](https://github.com/hopsoft/stimulus_reflex/pull/355) ([julianrubisch](https://github.com/julianrubisch))
|
86
|
+
- Add guard clause to return valid empty form data [\#354](https://github.com/hopsoft/stimulus_reflex/pull/354) ([julianrubisch](https://github.com/julianrubisch))
|
87
|
+
- simplify xpath functions [\#353](https://github.com/hopsoft/stimulus_reflex/pull/353) ([leastbad](https://github.com/leastbad))
|
88
|
+
- pass reflex id to reflex [\#352](https://github.com/hopsoft/stimulus_reflex/pull/352) ([joshleblanc](https://github.com/joshleblanc))
|
89
|
+
|
90
|
+
## [v3.4.0.pre2](https://github.com/hopsoft/stimulus_reflex/tree/v3.4.0.pre2) (2020-11-06)
|
91
|
+
|
92
|
+
[Full Changelog](https://github.com/hopsoft/stimulus_reflex/compare/v3.4.0.pre1...v3.4.0.pre2)
|
6
93
|
|
7
94
|
**Closed issues:**
|
8
95
|
|
@@ -308,7 +395,6 @@
|
|
308
395
|
- Loosen Rails requirement to 5.2 with instructions [\#205](https://github.com/hopsoft/stimulus_reflex/pull/205) ([jasoncharnes](https://github.com/jasoncharnes))
|
309
396
|
- Fix undefined is not an object for Object.keys in log.js [\#201](https://github.com/hopsoft/stimulus_reflex/pull/201) ([marcoroth](https://github.com/marcoroth))
|
310
397
|
- Small typo/grammar fix in quickstart doc. [\#198](https://github.com/hopsoft/stimulus_reflex/pull/198) ([acoffman](https://github.com/acoffman))
|
311
|
-
- Add halted lifecycle event [\#193](https://github.com/hopsoft/stimulus_reflex/pull/193) ([websebdev](https://github.com/websebdev))
|
312
398
|
- 147 extract multiple checkbox values [\#175](https://github.com/hopsoft/stimulus_reflex/pull/175) ([julianrubisch](https://github.com/julianrubisch))
|
313
399
|
|
314
400
|
## [v3.2.1](https://github.com/hopsoft/stimulus_reflex/tree/v3.2.1) (2020-05-09)
|
@@ -351,7 +437,7 @@
|
|
351
437
|
|
352
438
|
**Fixed bugs:**
|
353
439
|
|
354
|
-
- Pluralize the generated class name, so that will match with the file name [\#178](https://github.com/hopsoft/stimulus_reflex/pull/178) ([
|
440
|
+
- Pluralize the generated class name, so that will match with the file name [\#178](https://github.com/hopsoft/stimulus_reflex/pull/178) ([dark88888](https://github.com/dark88888))
|
355
441
|
|
356
442
|
**Closed issues:**
|
357
443
|
|
@@ -360,6 +446,7 @@
|
|
360
446
|
|
361
447
|
**Merged pull requests:**
|
362
448
|
|
449
|
+
- Add halted lifecycle event [\#193](https://github.com/hopsoft/stimulus_reflex/pull/193) ([websebdev](https://github.com/websebdev))
|
363
450
|
- Some housekeeping [\#189](https://github.com/hopsoft/stimulus_reflex/pull/189) ([hopsoft](https://github.com/hopsoft))
|
364
451
|
- Allow to call stimulate without a reflex target [\#188](https://github.com/hopsoft/stimulus_reflex/pull/188) ([marcoroth](https://github.com/marcoroth))
|
365
452
|
- Fix bug in super documentation [\#174](https://github.com/hopsoft/stimulus_reflex/pull/174) ([silva96](https://github.com/silva96))
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
stimulus_reflex (3.4.0.
|
4
|
+
stimulus_reflex (3.4.0.pre7)
|
5
|
+
cable_ready (>= 4.4)
|
5
6
|
nokogiri
|
6
7
|
rack
|
7
8
|
rails (>= 5.2)
|
@@ -67,17 +68,17 @@ GEM
|
|
67
68
|
zeitwerk (~> 2.2, >= 2.2.2)
|
68
69
|
ast (2.4.1)
|
69
70
|
builder (3.2.4)
|
70
|
-
cable_ready (4.3
|
71
|
+
cable_ready (4.4.3)
|
71
72
|
rails (>= 5.2)
|
72
73
|
coderay (1.1.3)
|
73
74
|
concurrent-ruby (1.1.7)
|
74
75
|
crass (1.0.6)
|
75
|
-
erubi (1.
|
76
|
+
erubi (1.10.0)
|
76
77
|
globalid (0.4.2)
|
77
78
|
activesupport (>= 4.2.0)
|
78
79
|
i18n (1.8.5)
|
79
80
|
concurrent-ruby (~> 1.0)
|
80
|
-
loofah (2.
|
81
|
+
loofah (2.8.0)
|
81
82
|
crass (~> 1.0.2)
|
82
83
|
nokogiri (>= 1.5.9)
|
83
84
|
mail (2.7.1)
|
@@ -92,7 +93,7 @@ GEM
|
|
92
93
|
nio4r (2.5.4)
|
93
94
|
nokogiri (1.10.10)
|
94
95
|
mini_portile2 (~> 2.4.0)
|
95
|
-
parallel (1.
|
96
|
+
parallel (1.20.1)
|
96
97
|
parser (2.7.2.0)
|
97
98
|
ast (~> 2.4.1)
|
98
99
|
pry (0.12.2)
|
@@ -131,22 +132,22 @@ GEM
|
|
131
132
|
thor (>= 0.20.3, < 2.0)
|
132
133
|
rainbow (3.0.0)
|
133
134
|
rake (13.0.1)
|
134
|
-
redis (4.2.
|
135
|
-
regexp_parser (
|
135
|
+
redis (4.2.5)
|
136
|
+
regexp_parser (2.0.0)
|
136
137
|
rexml (3.2.4)
|
137
|
-
rubocop (1.
|
138
|
+
rubocop (1.4.2)
|
138
139
|
parallel (~> 1.10)
|
139
140
|
parser (>= 2.7.1.5)
|
140
141
|
rainbow (>= 2.2.2, < 4.0)
|
141
142
|
regexp_parser (>= 1.8)
|
142
143
|
rexml
|
143
|
-
rubocop-ast (>=
|
144
|
+
rubocop-ast (>= 1.1.1)
|
144
145
|
ruby-progressbar (~> 1.7)
|
145
146
|
unicode-display_width (>= 1.4.0, < 2.0)
|
146
|
-
rubocop-ast (1.
|
147
|
+
rubocop-ast (1.3.0)
|
147
148
|
parser (>= 2.7.1.5)
|
148
|
-
rubocop-performance (1.
|
149
|
-
rubocop (>= 0.
|
149
|
+
rubocop-performance (1.9.1)
|
150
|
+
rubocop (>= 0.90.0, < 2.0)
|
150
151
|
rubocop-ast (>= 0.4.0)
|
151
152
|
ruby-progressbar (1.10.1)
|
152
153
|
sprockets (4.0.2)
|
@@ -156,27 +157,26 @@ GEM
|
|
156
157
|
actionpack (>= 4.0)
|
157
158
|
activesupport (>= 4.0)
|
158
159
|
sprockets (>= 3.0.0)
|
159
|
-
standard (0.
|
160
|
-
rubocop (= 1.
|
161
|
-
rubocop-performance (= 1.
|
160
|
+
standard (0.10.1)
|
161
|
+
rubocop (= 1.4.2)
|
162
|
+
rubocop-performance (= 1.9.1)
|
162
163
|
standardrb (1.0.0)
|
163
164
|
standard
|
164
165
|
thor (1.0.1)
|
165
166
|
thread_safe (0.3.6)
|
166
|
-
tzinfo (1.2.
|
167
|
+
tzinfo (1.2.8)
|
167
168
|
thread_safe (~> 0.1)
|
168
169
|
unicode-display_width (1.7.0)
|
169
170
|
websocket-driver (0.7.3)
|
170
171
|
websocket-extensions (>= 0.1.0)
|
171
172
|
websocket-extensions (0.1.5)
|
172
|
-
zeitwerk (2.4.
|
173
|
+
zeitwerk (2.4.2)
|
173
174
|
|
174
175
|
PLATFORMS
|
175
176
|
ruby
|
176
177
|
|
177
178
|
DEPENDENCIES
|
178
179
|
bundler (~> 2.0)
|
179
|
-
cable_ready (>= 4.3.0)
|
180
180
|
pry
|
181
181
|
pry-nav
|
182
182
|
rake
|
data/README.md
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
<p align="center">
|
2
|
-
<img src="assets/stimulus-reflex-logo-with-copy.svg" width="360" />
|
2
|
+
<img src="https://gitcdn.link/repo/hopsoft/stimulus_reflex/master/assets/stimulus-reflex-logo-with-copy.svg" width="360" />
|
3
3
|
<h1 align="center">Welcome to StimulusReflex 👋</h1>
|
4
4
|
<p align="center">
|
5
5
|
<img src="https://img.shields.io/gem/v/stimulus_reflex.svg?color=red" />
|
@@ -11,7 +11,7 @@
|
|
11
11
|
<img alt="License: MIT" src="https://img.shields.io/badge/license-MIT-brightgreen.svg" target="_blank" />
|
12
12
|
</a>
|
13
13
|
<a href="http://blog.codinghorror.com/the-best-code-is-no-code-at-all/" target="_blank">
|
14
|
-
<img alt="Lines of Code" src="https://img.shields.io/badge/lines_of_code-
|
14
|
+
<img alt="Lines of Code" src="https://img.shields.io/badge/lines_of_code-1599-brightgreen.svg?style=flat" />
|
15
15
|
</a>
|
16
16
|
<a href="https://docs.stimulusreflex.com/" target="_blank">
|
17
17
|
<img alt="Documentation" src="https://img.shields.io/badge/documentation-yes-brightgreen.svg" />
|
@@ -30,9 +30,6 @@
|
|
30
30
|
<a href="https://www.codacy.com/manual/hopsoft/stimulus_reflex/dashboard?utm_source=github.com&utm_medium=referral&utm_content=hopsoft/stimulus_reflex&utm_campaign=Badge_Grade" target="_blank">
|
31
31
|
<img alt="Code Quality" src="https://app.codacy.com/project/badge/Grade/d1d72a7060f5467b8696884351cf477f"/>
|
32
32
|
</a>
|
33
|
-
<a href="https://codeclimate.com/github/hopsoft/stimulus_reflex/maintainability" target="_blank">
|
34
|
-
<img alt="Maintainability" src="https://api.codeclimate.com/v1/badges/2b24fdbd1ae37a24bedb/maintainability" />
|
35
|
-
</a>
|
36
33
|
<a target="_blank" rel="noopener noreferrer" href="https://github.com/hopsoft/stimulus_reflex/workflows/Prettier-Standard/badge.svg">
|
37
34
|
<img src="https://github.com/hopsoft/stimulus_reflex/workflows/Prettier-Standard/badge.svg" alt="Prettier-Standard" style="max-width:100%;">
|
38
35
|
</a>
|
@@ -54,7 +51,7 @@ And, it's fast.
|
|
54
51
|
|
55
52
|
It works seamlessly with the Rails tooling you already know and love.
|
56
53
|
|
57
|
-
- Server-rendered HTML, delivered in
|
54
|
+
- Server-rendered HTML, delivered in milliseconds over the wire via Websockets
|
58
55
|
- ERB templates and partials, with first-class [ViewComponent](https://github.com/github/view_component) support
|
59
56
|
- [Russian doll caching](https://edgeguides.rubyonrails.org/caching_with_rails.html#russian-doll-caching) and [ActiveJob](https://guides.rubyonrails.org/active_job_basics.html)
|
60
57
|
- [StimulusJS](https://stimulusjs.org/) and [Turbolinks](https://www.youtube.com/watch?v=SWEts0rlezA)
|
@@ -77,7 +74,7 @@ This project strives to live up to the vision outlined in [The Rails Doctrine](h
|
|
77
74
|
|
78
75
|
## 👩👩👧 Discord Community
|
79
76
|
|
80
|
-
Please join over
|
77
|
+
Please join over 800 of us on [Discord](https://discord.gg/XveN625) for support getting started, as well as active discussions around Rails, StimulusJS and CableReady.
|
81
78
|
|
82
79
|

|
83
80
|
|
@@ -113,9 +110,8 @@ View the [wiki](https://github.com/hopsoft/stimulus_reflex/wiki/Editor-Configura
|
|
113
110
|
1. Bump version number at `lib/stimulus_reflex/version.rb`
|
114
111
|
1. Run `rake build`
|
115
112
|
1. Run `rake release`
|
116
|
-
1.
|
117
|
-
1.
|
118
|
-
|
113
|
+
1. Run `yarn publish --no-git-tag-version`
|
114
|
+
1. Commit and push changes to the `package.json` file
|
119
115
|
|
120
116
|
## 📝 License
|
121
117
|
|
data/Rakefile
CHANGED
@@ -3,13 +3,13 @@
|
|
3
3
|
require "bundler/gem_tasks"
|
4
4
|
require "rails/test_unit/runner"
|
5
5
|
|
6
|
-
task
|
7
|
-
|
8
|
-
task :test do |task|
|
9
|
-
return 1 unless system("cd javascript && yarn run test")
|
10
|
-
Rails::TestUnit::Runner.run
|
6
|
+
task :test_javascript do |task|
|
7
|
+
system "yarn run test"
|
11
8
|
end
|
12
9
|
|
13
10
|
task :test_ruby do |task|
|
14
11
|
Rails::TestUnit::Runner.run
|
15
12
|
end
|
13
|
+
|
14
|
+
task test: [:test_javascript, :test_ruby]
|
15
|
+
task default: [:test]
|
@@ -32,7 +32,19 @@ class StimulusReflex::Channel < StimulusReflex.configuration.parent_channel.cons
|
|
32
32
|
begin
|
33
33
|
begin
|
34
34
|
reflex_class = reflex_name.constantize.tap { |klass| raise ArgumentError.new("#{reflex_name} is not a StimulusReflex::Reflex") unless is_reflex?(klass) }
|
35
|
-
reflex = reflex_class.new(self,
|
35
|
+
reflex = reflex_class.new(self,
|
36
|
+
url: url,
|
37
|
+
element: element,
|
38
|
+
selectors: selectors,
|
39
|
+
method_name: method_name,
|
40
|
+
params: params,
|
41
|
+
client_attributes: {
|
42
|
+
reflex_id: data["reflexId"],
|
43
|
+
xpath: data["xpath"],
|
44
|
+
c_xpath: data["cXpath"],
|
45
|
+
reflex_controller: data["reflexController"],
|
46
|
+
permanent_attribute_name: permanent_attribute_name
|
47
|
+
})
|
36
48
|
delegate_call_to_reflex reflex, method_name, arguments
|
37
49
|
rescue => invoke_error
|
38
50
|
message = exception_message_with_backtrace(invoke_error)
|
@@ -41,7 +53,7 @@ class StimulusReflex::Channel < StimulusReflex.configuration.parent_channel.cons
|
|
41
53
|
reflex.rescue_with_handler(invoke_error)
|
42
54
|
reflex.broadcast_message subject: "error", body: body, data: data, error: invoke_error
|
43
55
|
else
|
44
|
-
|
56
|
+
puts "\e[31m#{body}\e[0m"
|
45
57
|
end
|
46
58
|
return
|
47
59
|
end
|
@@ -56,10 +68,14 @@ class StimulusReflex::Channel < StimulusReflex.configuration.parent_channel.cons
|
|
56
68
|
message = exception_message_with_backtrace(render_error)
|
57
69
|
body = "Reflex failed to re-render: #{message} [#{url}]"
|
58
70
|
reflex.broadcast_message subject: "error", body: body, data: data, error: render_error
|
71
|
+
puts "\e[31m#{body}\e[0m"
|
59
72
|
end
|
60
73
|
end
|
61
74
|
ensure
|
62
|
-
|
75
|
+
if reflex
|
76
|
+
commit_session(reflex)
|
77
|
+
reflex.logger.print
|
78
|
+
end
|
63
79
|
end
|
64
80
|
end
|
65
81
|
|
@@ -94,7 +110,7 @@ class StimulusReflex::Channel < StimulusReflex.configuration.parent_channel.cons
|
|
94
110
|
store.commit_session reflex.request, reflex.controller.response
|
95
111
|
rescue => e
|
96
112
|
message = "Failed to commit session! #{exception_message_with_backtrace(e)}"
|
97
|
-
|
113
|
+
puts "\e[31m#{message}\e[0m"
|
98
114
|
end
|
99
115
|
|
100
116
|
def exception_message_with_backtrace(exception)
|
data/bin/console
CHANGED
data/bin/standardize
CHANGED
@@ -56,12 +56,20 @@ export default class extends ApplicationController {
|
|
56
56
|
// }
|
57
57
|
|
58
58
|
// danceSuccess(element, reflex, noop, reflexId) {
|
59
|
-
// element.innerText = '
|
59
|
+
// element.innerText = '\nDanced like no one was watching! Was someone watching?'
|
60
60
|
// }
|
61
61
|
|
62
62
|
// danceError(element, reflex, error, reflexId) {
|
63
63
|
// console.error('danceError', error);
|
64
|
-
// element.innerText = "
|
64
|
+
// element.innerText = "\nCouldn\'t dance!"
|
65
|
+
// }
|
66
|
+
|
67
|
+
// afterDance(element, reflex, noop, reflexId) {
|
68
|
+
// element.innerText = '\nWhatever that was, it\'s over now.'
|
69
|
+
// }
|
70
|
+
|
71
|
+
// finalizeDance(element, reflex, noop, reflexId) {
|
72
|
+
// element.innerText = '\nNow, the cleanup can begin!'
|
65
73
|
// }
|
66
74
|
<% end -%>
|
67
75
|
<% actions.each do |action| -%>
|
@@ -84,6 +92,10 @@ export default class extends ApplicationController {
|
|
84
92
|
// <%= "after_#{action}".camelize(:lower) %>(element, reflex, noop, reflexId) {
|
85
93
|
// console.log("after <%= action %>", element, reflex, reflexId)
|
86
94
|
// }
|
95
|
+
|
96
|
+
// <%= "finalize_#{action}".camelize(:lower) %>(element, reflex, noop, reflexId) {
|
97
|
+
// console.log("finalize <%= action %>", element, reflex, reflexId)
|
98
|
+
// }
|
87
99
|
<%= "\n" unless action == actions.last -%>
|
88
100
|
<% end -%>
|
89
101
|
}
|
@@ -39,14 +39,22 @@ export default class extends Controller {
|
|
39
39
|
}
|
40
40
|
|
41
41
|
reflexSuccess (element, reflex, noop, reflexId) {
|
42
|
-
// show success message
|
42
|
+
// show success message
|
43
43
|
}
|
44
44
|
|
45
45
|
reflexError (element, reflex, error, reflexId) {
|
46
|
-
// show error message
|
46
|
+
// show error message
|
47
|
+
}
|
48
|
+
|
49
|
+
reflexHalted (element, reflex, error, reflexId) {
|
50
|
+
// handle aborted Reflex action
|
47
51
|
}
|
48
52
|
|
49
53
|
afterReflex (element, reflex, noop, reflexId) {
|
50
54
|
// document.body.classList.remove('wait')
|
51
55
|
}
|
56
|
+
|
57
|
+
finalizeReflex (element, reflex, noop, reflexId) {
|
58
|
+
// all operations have completed, animation etc is now safe
|
59
|
+
}
|
52
60
|
}
|
@@ -3,24 +3,34 @@
|
|
3
3
|
class <%= class_name %>Reflex < ApplicationReflex
|
4
4
|
# Add Reflex methods in this file.
|
5
5
|
#
|
6
|
-
# All Reflex instances expose the following properties:
|
6
|
+
# All Reflex instances include CableReady::Broadcaster and expose the following properties:
|
7
7
|
#
|
8
|
-
# - connection
|
9
|
-
# - channel
|
10
|
-
# - request
|
11
|
-
# - session
|
12
|
-
# -
|
13
|
-
# -
|
14
|
-
# - params
|
8
|
+
# - connection - the ActionCable connection
|
9
|
+
# - channel - the ActionCable channel
|
10
|
+
# - request - an ActionDispatch::Request proxy for the socket connection
|
11
|
+
# - session - the ActionDispatch::Session store for the current visitor
|
12
|
+
# - flash - the ActionDispatch::Flash::FlashHash for the current request
|
13
|
+
# - url - the URL of the page that triggered the reflex
|
14
|
+
# - params - parameters from the element's closest form (if any)
|
15
|
+
# - element - a Hash like object that represents the HTML element that triggered the reflex
|
16
|
+
# - signed - use a signed Global ID to map dataset attribute to a model eg. element.signed[:foo]
|
17
|
+
# - unsigned - use an unsigned Global ID to map dataset attribute to a model eg. element.unsigned[:foo]
|
18
|
+
# - cable_ready - a special cable_ready that can broadcast to the current visitor (no brackets needed)
|
19
|
+
# - reflex_id - a UUIDv4 that uniquely identies each Reflex
|
15
20
|
#
|
16
21
|
# Example:
|
17
22
|
#
|
23
|
+
# before_reflex do
|
24
|
+
# # throw :abort # this will prevent the Reflex from continuing
|
25
|
+
# # learn more about callbacks at https://docs.stimulusreflex.com/lifecycle
|
26
|
+
# end
|
27
|
+
#
|
18
28
|
# def example(argument=true)
|
19
29
|
# # Your logic here...
|
20
30
|
# # Any declared instance variables will be made available to the Rails controller and view.
|
21
31
|
# end
|
22
32
|
#
|
23
|
-
# Learn more at: https://docs.stimulusreflex.com
|
33
|
+
# Learn more at: https://docs.stimulusreflex.com/reflexes#reflex-classes
|
24
34
|
|
25
35
|
<% actions.each do |action| -%>
|
26
36
|
def <%= action %>
|