stimulus_reflex 3.5.0.pre1 → 3.5.0.pre5

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of stimulus_reflex might be problematic. Click here for more details.

Files changed (34) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +75 -8
  3. data/Gemfile.lock +86 -78
  4. data/README.md +8 -7
  5. data/app/channels/stimulus_reflex/channel.rb +13 -17
  6. data/lib/generators/stimulus_reflex/stimulus_reflex_generator.rb +5 -4
  7. data/lib/generators/stimulus_reflex/templates/app/reflexes/application_reflex.rb.tt +11 -4
  8. data/lib/generators/stimulus_reflex/templates/config/initializers/stimulus_reflex.rb +15 -0
  9. data/lib/stimulus_reflex/broadcasters/broadcaster.rb +18 -17
  10. data/lib/stimulus_reflex/broadcasters/nothing_broadcaster.rb +6 -1
  11. data/lib/stimulus_reflex/broadcasters/page_broadcaster.rb +1 -3
  12. data/lib/stimulus_reflex/broadcasters/selector_broadcaster.rb +19 -20
  13. data/lib/stimulus_reflex/broadcasters/update.rb +23 -0
  14. data/lib/stimulus_reflex/configuration.rb +3 -1
  15. data/lib/stimulus_reflex/dataset.rb +34 -0
  16. data/lib/stimulus_reflex/element.rb +16 -33
  17. data/lib/stimulus_reflex/reflex.rb +7 -2
  18. data/lib/stimulus_reflex/utils/attribute_builder.rb +17 -0
  19. data/lib/stimulus_reflex/utils/logger.rb +6 -2
  20. data/lib/stimulus_reflex/utils/sanity_checker.rb +75 -67
  21. data/lib/stimulus_reflex/version.rb +1 -1
  22. data/lib/stimulus_reflex.rb +1 -0
  23. data/lib/tasks/stimulus_reflex/install.rake +49 -12
  24. data/test/broadcasters/broadcaster_test.rb +0 -1
  25. data/test/broadcasters/broadcaster_test_case.rb +24 -0
  26. data/test/broadcasters/nothing_broadcaster_test.rb +14 -22
  27. data/test/broadcasters/page_broadcaster_test.rb +30 -32
  28. data/test/broadcasters/selector_broadcaster_test.rb +82 -88
  29. data/test/element_test.rb +73 -0
  30. data/test/generators/stimulus_reflex_generator_test.rb +8 -0
  31. data/test/reflex_test.rb +11 -0
  32. data/test/test_helper.rb +21 -1
  33. data/test/tmp/app/reflexes/application_reflex.rb +10 -3
  34. metadata +25 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9d5edbaac849737adbe09ac8d932b54784d4abe66ca110e4b67de41ac5efc384
4
- data.tar.gz: 99fc0159e13f73880033e68fb4dbeef8395d0824fe578cc98c1134287b4d874f
3
+ metadata.gz: cb8aa9fc0714abf533a20a6466d58136a98c3fdef0b6f2b766638cd3862db674
4
+ data.tar.gz: 0b48e7457a4d5d7d126cd7231b2c7d0c678dcf81ab20e4b1ece5c9a680226aa6
5
5
  SHA512:
6
- metadata.gz: 60e68a4a4080da634e101fcd659bbe5c3e9268ba6c481718deaea5ecffafa09d81550ac6463fad4bd19b97c1ca6ebe53f640d854df42f1532d623c844edee371
7
- data.tar.gz: ba09f73f57e4af83a751caab5d1f14eaab7662e298153e4371b15a6b13cde577321dd5b32548d644ff0726c1fb98d995b23e4c7372b19e0cff9e6877a32d244a
6
+ metadata.gz: 8a654745f258679272c6231df67912a33721a81f0b87116f3badca7c1fef06165de2cde8cc8b5737e2248644bd3efc9e70f5f700a729efaef2600f5a3c4635d0
7
+ data.tar.gz: 9ca032691ae924c8157d7b9dee76f216f30d9d54673b005c47f7cb01fd647d00728c29f4ee008d5a4d817e729a7156a9f3525e2444fed903da46ff4796d1472d
data/CHANGELOG.md CHANGED
@@ -2,12 +2,83 @@
2
2
 
3
3
  ## [Unreleased](https://github.com/stimulusreflex/stimulus_reflex/tree/HEAD)
4
4
 
5
- [Full Changelog](https://github.com/stimulusreflex/stimulus_reflex/compare/v3.5.0.pre0...HEAD)
5
+ [Full Changelog](https://github.com/stimulusreflex/stimulus_reflex/compare/v3.5.0.pre3...HEAD)
6
+
7
+ **Closed issues:**
8
+
9
+ - Rails 7 Alpha Incompatibility [\#552](https://github.com/stimulusreflex/stimulus_reflex/issues/552)
10
+
11
+ ## [v3.5.0.pre3](https://github.com/stimulusreflex/stimulus_reflex/tree/v3.5.0.pre3) (2021-10-01)
12
+
13
+ [Full Changelog](https://github.com/stimulusreflex/stimulus_reflex/compare/v3.5.0.pre2...v3.5.0.pre3)
14
+
15
+ **Implemented enhancements:**
16
+
17
+ - Allow to skip stages in the generator [\#541](https://github.com/stimulusreflex/stimulus_reflex/issues/541)
18
+ - document body connection status classes [\#547](https://github.com/stimulusreflex/stimulus_reflex/pull/547) ([leastbad](https://github.com/leastbad))
19
+ - overhaul Reflex logging [\#546](https://github.com/stimulusreflex/stimulus_reflex/pull/546) ([leastbad](https://github.com/leastbad))
20
+ - reverse merge params into locals [\#542](https://github.com/stimulusreflex/stimulus_reflex/pull/542) ([leastbad](https://github.com/leastbad))
21
+ - specify env headers for page morph controller [\#538](https://github.com/stimulusreflex/stimulus_reflex/pull/538) ([leastbad](https://github.com/leastbad))
22
+ - New CR wire format + reworked server message events [\#536](https://github.com/stimulusreflex/stimulus_reflex/pull/536) ([leastbad](https://github.com/leastbad))
23
+ - reflex render layout defaults to false [\#534](https://github.com/stimulusreflex/stimulus_reflex/pull/534) ([leastbad](https://github.com/leastbad))
24
+
25
+ **Closed issues:**
26
+
27
+ - Controller action being re-run is different from expected. [\#540](https://github.com/stimulusreflex/stimulus_reflex/issues/540)
28
+ - The ActionCable channel subscription for StimulusReflex gets rejected when interacting too fast [\#539](https://github.com/stimulusreflex/stimulus_reflex/issues/539)
29
+ - Stimulus reflex not working making server to stop on ruby on rails [\#533](https://github.com/stimulusreflex/stimulus_reflex/issues/533)
30
+
31
+ **Merged pull requests:**
32
+
33
+ - Bump nokogiri from 1.12.3 to 1.12.5 [\#548](https://github.com/stimulusreflex/stimulus_reflex/pull/548) ([dependabot[bot]](https://github.com/apps/dependabot))
34
+ - Add test for param behavior [\#545](https://github.com/stimulusreflex/stimulus_reflex/pull/545) ([julianrubisch](https://github.com/julianrubisch))
35
+ - Add generator options to skip reflex and stimulus [\#543](https://github.com/stimulusreflex/stimulus_reflex/pull/543) ([nachiket87](https://github.com/nachiket87))
36
+ - Fix comment [\#537](https://github.com/stimulusreflex/stimulus_reflex/pull/537) ([julianrubisch](https://github.com/julianrubisch))
37
+ - add first line of stacktrace to console.log error in dev environment [\#532](https://github.com/stimulusreflex/stimulus_reflex/pull/532) ([RolandStuder](https://github.com/RolandStuder))
38
+ - Add test for `data-reflex-dataset="descendants"` [\#531](https://github.com/stimulusreflex/stimulus_reflex/pull/531) ([assuntaw](https://github.com/assuntaw))
39
+ - Provide proxy methods boolean and numeric on Element [\#528](https://github.com/stimulusreflex/stimulus_reflex/pull/528) ([julianrubisch](https://github.com/julianrubisch))
40
+
41
+ ## [v3.5.0.pre2](https://github.com/stimulusreflex/stimulus_reflex/tree/v3.5.0.pre2) (2021-07-21)
42
+
43
+ [Full Changelog](https://github.com/stimulusreflex/stimulus_reflex/compare/v3.5.0.pre1...v3.5.0.pre2)
44
+
45
+ **Implemented enhancements:**
46
+
47
+ - Optionally provide innerHtml and textContent on StimulusReflex::Element [\#517](https://github.com/stimulusreflex/stimulus_reflex/pull/517) ([julianrubisch](https://github.com/julianrubisch))
48
+
49
+ **Fixed bugs:**
50
+
51
+ - Sanity checker should not abort stimulus\_reflex install task [\#508](https://github.com/stimulusreflex/stimulus_reflex/issues/508)
52
+ - Improve install experience [\#510](https://github.com/stimulusreflex/stimulus_reflex/pull/510) ([leastbad](https://github.com/leastbad))
53
+
54
+ **Closed issues:**
55
+
56
+ - Calling Reflex with data-action and data-reflex-dataset='combined' send combined dataset with event.currentTarget only [\#525](https://github.com/stimulusreflex/stimulus_reflex/issues/525)
57
+ - HAML code with form tag connect controller twice [\#520](https://github.com/stimulusreflex/stimulus_reflex/issues/520)
58
+ - Web Components Breaking In Stimulus Reflex Morph [\#511](https://github.com/stimulusreflex/stimulus_reflex/issues/511)
59
+
60
+ **Merged pull requests:**
61
+
62
+ - Specify form selector [\#527](https://github.com/stimulusreflex/stimulus_reflex/pull/527) ([julianrubisch](https://github.com/julianrubisch))
63
+ - Fix two minor typos [\#526](https://github.com/stimulusreflex/stimulus_reflex/pull/526) ([julianrubisch](https://github.com/julianrubisch))
64
+ - chore: add sideEffects false to make Webpack happy [\#523](https://github.com/stimulusreflex/stimulus_reflex/pull/523) ([ParamagicDev](https://github.com/ParamagicDev))
65
+ - Morph stimulus reflex element AKA "single element page morph" [\#522](https://github.com/stimulusreflex/stimulus_reflex/pull/522) ([julianrubisch](https://github.com/julianrubisch))
66
+ - Add localization example to ApplicationReflex template [\#521](https://github.com/stimulusreflex/stimulus_reflex/pull/521) ([erlingur](https://github.com/erlingur))
67
+ - refactor stream\_name [\#519](https://github.com/stimulusreflex/stimulus_reflex/pull/519) ([leastbad](https://github.com/leastbad))
68
+ - Schema object with getters [\#505](https://github.com/stimulusreflex/stimulus_reflex/pull/505) ([leastbad](https://github.com/leastbad))
69
+
70
+ ## [v3.5.0.pre1](https://github.com/stimulusreflex/stimulus_reflex/tree/v3.5.0.pre1) (2021-06-02)
71
+
72
+ [Full Changelog](https://github.com/stimulusreflex/stimulus_reflex/compare/v3.5.0.pre0...v3.5.0.pre1)
6
73
 
7
74
  **Fixed bugs:**
8
75
 
9
76
  - handle operations that have string-defined selector argument [\#509](https://github.com/stimulusreflex/stimulus_reflex/pull/509) ([leastbad](https://github.com/leastbad))
10
77
 
78
+ **Closed issues:**
79
+
80
+ - How to \(better\) use Stimulus Reflex with Cypress? [\#512](https://github.com/stimulusreflex/stimulus_reflex/issues/512)
81
+
11
82
  **Merged pull requests:**
12
83
 
13
84
  - Update reflexes.js [\#515](https://github.com/stimulusreflex/stimulus_reflex/pull/515) ([julianrubisch](https://github.com/julianrubisch))
@@ -155,6 +226,7 @@
155
226
  **Implemented enhancements:**
156
227
 
157
228
  - Allow StimulusReflex to process Rack middlewares [\#399](https://github.com/stimulusreflex/stimulus_reflex/pull/399) ([marcoroth](https://github.com/marcoroth))
229
+ - Support for Stimulus 2 [\#398](https://github.com/stimulusreflex/stimulus_reflex/pull/398) ([marcoroth](https://github.com/marcoroth))
158
230
 
159
231
  **Fixed bugs:**
160
232
 
@@ -189,10 +261,6 @@
189
261
 
190
262
  [Full Changelog](https://github.com/stimulusreflex/stimulus_reflex/compare/v3.4.0.pre6...v3.4.0.pre7)
191
263
 
192
- **Implemented enhancements:**
193
-
194
- - Support for Stimulus 2 [\#398](https://github.com/stimulusreflex/stimulus_reflex/pull/398) ([marcoroth](https://github.com/marcoroth))
195
-
196
264
  **Closed issues:**
197
265
 
198
266
  - Multiple reflex submissions can lead to unexpected behaviour. [\#391](https://github.com/stimulusreflex/stimulus_reflex/issues/391)
@@ -484,7 +552,6 @@
484
552
  - beforeUpdate/updateSuccess/updateError functions deprecated? [\#255](https://github.com/stimulusreflex/stimulus_reflex/issues/255)
485
553
  - Error handling will fail if reflex is not defined [\#253](https://github.com/stimulusreflex/stimulus_reflex/issues/253)
486
554
  - Select with data-reflex in Firefox flickers [\#251](https://github.com/stimulusreflex/stimulus_reflex/issues/251)
487
- - data-reflex-attributes vs data-reflex-dataset [\#237](https://github.com/stimulusreflex/stimulus_reflex/issues/237)
488
555
  - Shorthand action notations corresponding to stimulus [\#233](https://github.com/stimulusreflex/stimulus_reflex/issues/233)
489
556
  - Lifecycle methods only called for one reflex [\#225](https://github.com/stimulusreflex/stimulus_reflex/issues/225)
490
557
  - Tweak the generator so we can specify reflex actions [\#219](https://github.com/stimulusreflex/stimulus_reflex/issues/219)
@@ -637,7 +704,6 @@
637
704
 
638
705
  - Some housekeeping [\#189](https://github.com/stimulusreflex/stimulus_reflex/pull/189) ([hopsoft](https://github.com/hopsoft))
639
706
  - Allow to call stimulate without a reflex target [\#188](https://github.com/stimulusreflex/stimulus_reflex/pull/188) ([marcoroth](https://github.com/marcoroth))
640
- - prettier-standard: include all js files in the project [\#177](https://github.com/stimulusreflex/stimulus_reflex/pull/177) ([marcoroth](https://github.com/marcoroth))
641
707
  - Fix bug in super documentation [\#174](https://github.com/stimulusreflex/stimulus_reflex/pull/174) ([silva96](https://github.com/silva96))
642
708
 
643
709
  ## [v3.1.4](https://github.com/stimulusreflex/stimulus_reflex/tree/v3.1.4) (2020-04-27)
@@ -664,6 +730,7 @@
664
730
 
665
731
  **Merged pull requests:**
666
732
 
733
+ - prettier-standard: include all js files in the project [\#177](https://github.com/stimulusreflex/stimulus_reflex/pull/177) ([marcoroth](https://github.com/marcoroth))
667
734
  - Remove implicit permanent for text inputs [\#176](https://github.com/stimulusreflex/stimulus_reflex/pull/176) ([hopsoft](https://github.com/hopsoft))
668
735
  - Support devise authenticated routes [\#172](https://github.com/stimulusreflex/stimulus_reflex/pull/172) ([db0sch](https://github.com/db0sch))
669
736
  - setupDeclarativeReflexes export with UJS support [\#169](https://github.com/stimulusreflex/stimulus_reflex/pull/169) ([leastbad](https://github.com/leastbad))
@@ -986,6 +1053,7 @@
986
1053
 
987
1054
  **Implemented enhancements:**
988
1055
 
1056
+ - Implicitly send DOM attributes to reflex methods [\#21](https://github.com/stimulusreflex/stimulus_reflex/pull/21) ([hopsoft](https://github.com/hopsoft))
989
1057
  - Add Ruby magic comment [\#18](https://github.com/stimulusreflex/stimulus_reflex/pull/18) ([dixpac](https://github.com/dixpac))
990
1058
  - Add GitHub Actions for Linters [\#17](https://github.com/stimulusreflex/stimulus_reflex/pull/17) ([andrewmcodes](https://github.com/andrewmcodes))
991
1059
 
@@ -1047,7 +1115,6 @@
1047
1115
 
1048
1116
  **Implemented enhancements:**
1049
1117
 
1050
- - Implicitly send DOM attributes to reflex methods [\#21](https://github.com/stimulusreflex/stimulus_reflex/pull/21) ([hopsoft](https://github.com/hopsoft))
1051
1118
  - Explicit opt-in for ActionCable connection [\#6](https://github.com/stimulusreflex/stimulus_reflex/pull/6) ([hopsoft](https://github.com/hopsoft))
1052
1119
 
1053
1120
  ## [v0.1.12](https://github.com/stimulusreflex/stimulus_reflex/tree/v0.1.12) (2018-11-03)
data/Gemfile.lock CHANGED
@@ -1,8 +1,8 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- stimulus_reflex (3.5.0.pre1)
5
- cable_ready (= 5.0.0.pre1)
4
+ stimulus_reflex (3.5.0.pre5)
5
+ cable_ready (= 5.0.0.pre5)
6
6
  nokogiri
7
7
  rack
8
8
  rails (>= 5.2)
@@ -11,60 +11,60 @@ PATH
11
11
  GEM
12
12
  remote: https://rubygems.org/
13
13
  specs:
14
- actioncable (6.1.3.2)
15
- actionpack (= 6.1.3.2)
16
- activesupport (= 6.1.3.2)
14
+ actioncable (6.1.4.1)
15
+ actionpack (= 6.1.4.1)
16
+ activesupport (= 6.1.4.1)
17
17
  nio4r (~> 2.0)
18
18
  websocket-driver (>= 0.6.1)
19
- actionmailbox (6.1.3.2)
20
- actionpack (= 6.1.3.2)
21
- activejob (= 6.1.3.2)
22
- activerecord (= 6.1.3.2)
23
- activestorage (= 6.1.3.2)
24
- activesupport (= 6.1.3.2)
19
+ actionmailbox (6.1.4.1)
20
+ actionpack (= 6.1.4.1)
21
+ activejob (= 6.1.4.1)
22
+ activerecord (= 6.1.4.1)
23
+ activestorage (= 6.1.4.1)
24
+ activesupport (= 6.1.4.1)
25
25
  mail (>= 2.7.1)
26
- actionmailer (6.1.3.2)
27
- actionpack (= 6.1.3.2)
28
- actionview (= 6.1.3.2)
29
- activejob (= 6.1.3.2)
30
- activesupport (= 6.1.3.2)
26
+ actionmailer (6.1.4.1)
27
+ actionpack (= 6.1.4.1)
28
+ actionview (= 6.1.4.1)
29
+ activejob (= 6.1.4.1)
30
+ activesupport (= 6.1.4.1)
31
31
  mail (~> 2.5, >= 2.5.4)
32
32
  rails-dom-testing (~> 2.0)
33
- actionpack (6.1.3.2)
34
- actionview (= 6.1.3.2)
35
- activesupport (= 6.1.3.2)
33
+ actionpack (6.1.4.1)
34
+ actionview (= 6.1.4.1)
35
+ activesupport (= 6.1.4.1)
36
36
  rack (~> 2.0, >= 2.0.9)
37
37
  rack-test (>= 0.6.3)
38
38
  rails-dom-testing (~> 2.0)
39
39
  rails-html-sanitizer (~> 1.0, >= 1.2.0)
40
- actiontext (6.1.3.2)
41
- actionpack (= 6.1.3.2)
42
- activerecord (= 6.1.3.2)
43
- activestorage (= 6.1.3.2)
44
- activesupport (= 6.1.3.2)
40
+ actiontext (6.1.4.1)
41
+ actionpack (= 6.1.4.1)
42
+ activerecord (= 6.1.4.1)
43
+ activestorage (= 6.1.4.1)
44
+ activesupport (= 6.1.4.1)
45
45
  nokogiri (>= 1.8.5)
46
- actionview (6.1.3.2)
47
- activesupport (= 6.1.3.2)
46
+ actionview (6.1.4.1)
47
+ activesupport (= 6.1.4.1)
48
48
  builder (~> 3.1)
49
49
  erubi (~> 1.4)
50
50
  rails-dom-testing (~> 2.0)
51
51
  rails-html-sanitizer (~> 1.1, >= 1.2.0)
52
- activejob (6.1.3.2)
53
- activesupport (= 6.1.3.2)
52
+ activejob (6.1.4.1)
53
+ activesupport (= 6.1.4.1)
54
54
  globalid (>= 0.3.6)
55
- activemodel (6.1.3.2)
56
- activesupport (= 6.1.3.2)
57
- activerecord (6.1.3.2)
58
- activemodel (= 6.1.3.2)
59
- activesupport (= 6.1.3.2)
60
- activestorage (6.1.3.2)
61
- actionpack (= 6.1.3.2)
62
- activejob (= 6.1.3.2)
63
- activerecord (= 6.1.3.2)
64
- activesupport (= 6.1.3.2)
55
+ activemodel (6.1.4.1)
56
+ activesupport (= 6.1.4.1)
57
+ activerecord (6.1.4.1)
58
+ activemodel (= 6.1.4.1)
59
+ activesupport (= 6.1.4.1)
60
+ activestorage (6.1.4.1)
61
+ actionpack (= 6.1.4.1)
62
+ activejob (= 6.1.4.1)
63
+ activerecord (= 6.1.4.1)
64
+ activesupport (= 6.1.4.1)
65
65
  marcel (~> 1.0.0)
66
- mini_mime (~> 1.0.2)
67
- activesupport (6.1.3.2)
66
+ mini_mime (>= 1.1.0)
67
+ activesupport (6.1.4.1)
68
68
  concurrent-ruby (~> 1.0, >= 1.0.2)
69
69
  i18n (>= 1.6, < 2)
70
70
  minitest (>= 5.1)
@@ -72,31 +72,36 @@ GEM
72
72
  zeitwerk (~> 2.3)
73
73
  ast (2.4.2)
74
74
  builder (3.2.4)
75
- cable_ready (5.0.0.pre1)
75
+ cable_ready (5.0.0.pre5)
76
76
  rails (>= 5.2)
77
77
  thread-local (>= 1.1.0)
78
78
  coderay (1.1.3)
79
- concurrent-ruby (1.1.8)
79
+ concurrent-ruby (1.1.9)
80
80
  crass (1.0.6)
81
81
  erubi (1.10.0)
82
- globalid (0.4.2)
83
- activesupport (>= 4.2.0)
82
+ globalid (0.5.2)
83
+ activesupport (>= 5.0)
84
84
  i18n (1.8.10)
85
85
  concurrent-ruby (~> 1.0)
86
- loofah (2.9.1)
86
+ loofah (2.12.0)
87
87
  crass (~> 1.0.2)
88
88
  nokogiri (>= 1.5.9)
89
89
  mail (2.7.1)
90
90
  mini_mime (>= 0.1.1)
91
- marcel (1.0.1)
91
+ marcel (1.0.2)
92
92
  method_source (0.9.2)
93
- mini_mime (1.0.3)
93
+ mini_mime (1.1.1)
94
94
  minitest (5.14.4)
95
- nio4r (2.5.7)
96
- nokogiri (1.11.6-x86_64-linux)
95
+ mocha (1.13.0)
96
+ nio4r (2.5.8)
97
+ nokogiri (1.12.5-arm64-darwin)
98
+ racc (~> 1.4)
99
+ nokogiri (1.12.5-x86_64-darwin)
100
+ racc (~> 1.4)
101
+ nokogiri (1.12.5-x86_64-linux)
97
102
  racc (~> 1.4)
98
103
  parallel (1.20.1)
99
- parser (3.0.1.1)
104
+ parser (3.0.2.0)
100
105
  ast (~> 2.4.1)
101
106
  pry (0.12.2)
102
107
  coderay (~> 1.1.0)
@@ -107,49 +112,49 @@ GEM
107
112
  rack (2.2.3)
108
113
  rack-test (1.1.0)
109
114
  rack (>= 1.0, < 3)
110
- rails (6.1.3.2)
111
- actioncable (= 6.1.3.2)
112
- actionmailbox (= 6.1.3.2)
113
- actionmailer (= 6.1.3.2)
114
- actionpack (= 6.1.3.2)
115
- actiontext (= 6.1.3.2)
116
- actionview (= 6.1.3.2)
117
- activejob (= 6.1.3.2)
118
- activemodel (= 6.1.3.2)
119
- activerecord (= 6.1.3.2)
120
- activestorage (= 6.1.3.2)
121
- activesupport (= 6.1.3.2)
115
+ rails (6.1.4.1)
116
+ actioncable (= 6.1.4.1)
117
+ actionmailbox (= 6.1.4.1)
118
+ actionmailer (= 6.1.4.1)
119
+ actionpack (= 6.1.4.1)
120
+ actiontext (= 6.1.4.1)
121
+ actionview (= 6.1.4.1)
122
+ activejob (= 6.1.4.1)
123
+ activemodel (= 6.1.4.1)
124
+ activerecord (= 6.1.4.1)
125
+ activestorage (= 6.1.4.1)
126
+ activesupport (= 6.1.4.1)
122
127
  bundler (>= 1.15.0)
123
- railties (= 6.1.3.2)
128
+ railties (= 6.1.4.1)
124
129
  sprockets-rails (>= 2.0.0)
125
130
  rails-dom-testing (2.0.3)
126
131
  activesupport (>= 4.2.0)
127
132
  nokogiri (>= 1.6)
128
- rails-html-sanitizer (1.3.0)
133
+ rails-html-sanitizer (1.4.2)
129
134
  loofah (~> 2.3)
130
- railties (6.1.3.2)
131
- actionpack (= 6.1.3.2)
132
- activesupport (= 6.1.3.2)
135
+ railties (6.1.4.1)
136
+ actionpack (= 6.1.4.1)
137
+ activesupport (= 6.1.4.1)
133
138
  method_source
134
- rake (>= 0.8.7)
139
+ rake (>= 0.13)
135
140
  thor (~> 1.0)
136
141
  rainbow (3.0.0)
137
- rake (13.0.3)
138
- redis (4.2.5)
142
+ rake (13.0.6)
143
+ redis (4.4.0)
139
144
  regexp_parser (2.1.1)
140
145
  rexml (3.2.5)
141
- rubocop (1.14.0)
146
+ rubocop (1.18.3)
142
147
  parallel (~> 1.10)
143
148
  parser (>= 3.0.0.0)
144
149
  rainbow (>= 2.2.2, < 4.0)
145
150
  regexp_parser (>= 1.8, < 3.0)
146
151
  rexml
147
- rubocop-ast (>= 1.5.0, < 2.0)
152
+ rubocop-ast (>= 1.7.0, < 2.0)
148
153
  ruby-progressbar (~> 1.7)
149
154
  unicode-display_width (>= 1.4.0, < 3.0)
150
- rubocop-ast (1.5.0)
155
+ rubocop-ast (1.8.0)
151
156
  parser (>= 3.0.1.1)
152
- rubocop-performance (1.11.2)
157
+ rubocop-performance (1.11.4)
153
158
  rubocop (>= 1.7.0, < 2.0)
154
159
  rubocop-ast (>= 0.4.0)
155
160
  ruby-progressbar (1.11.0)
@@ -160,9 +165,9 @@ GEM
160
165
  actionpack (>= 4.0)
161
166
  activesupport (>= 4.0)
162
167
  sprockets (>= 3.0.0)
163
- standard (1.1.1)
164
- rubocop (= 1.14.0)
165
- rubocop-performance (= 1.11.2)
168
+ standard (1.1.5)
169
+ rubocop (= 1.18.3)
170
+ rubocop-performance (= 1.11.4)
166
171
  standardrb (1.0.0)
167
172
  standard
168
173
  thor (1.1.0)
@@ -170,16 +175,19 @@ GEM
170
175
  tzinfo (2.0.4)
171
176
  concurrent-ruby (~> 1.0)
172
177
  unicode-display_width (2.0.0)
173
- websocket-driver (0.7.4)
178
+ websocket-driver (0.7.5)
174
179
  websocket-extensions (>= 0.1.0)
175
180
  websocket-extensions (0.1.5)
176
181
  zeitwerk (2.4.2)
177
182
 
178
183
  PLATFORMS
184
+ arm64-darwin-20
185
+ x86_64-darwin-19
179
186
  x86_64-linux
180
187
 
181
188
  DEPENDENCIES
182
189
  bundler (~> 2.0)
190
+ mocha
183
191
  pry
184
192
  pry-nav
185
193
  rake
data/README.md CHANGED
@@ -69,13 +69,14 @@ This project strives to live up to the vision outlined in [The Rails Doctrine](h
69
69
 
70
70
  ## ✨ Demos
71
71
 
72
- - [StimulusReflex Expo](http://expo.stimulusreflex.com) - part showcase, part learning tool
73
72
  - [Build a Twitter Clone in 10 Minutes](https://youtu.be/F5hA79vKE_E) (video)
73
+ - [BeastMode](https://beastmode.leastbad.com/) - faceted search, with filtering, sorting and pagination
74
+ - [StimulusReflex Patterns](https://www.stimulusreflexpatterns.com/patterns/) - single-file SR apps hosted on Glitch
74
75
  - [BoxDrop](https://dropbox-clone-rails.herokuapp.com/) - a Dropbox-inspired [concept demo](https://github.com/marcoroth/boxdrop/)
75
76
 
76
77
  ## 👩‍👩‍👧 Discord Community
77
78
 
78
- Please join over 1300 of us on [Discord](https://discord.gg/stimulus-reflex) for support getting started, as well as active discussions around Rails, StimulusJS and CableReady.
79
+ Please join over 1500 of us on [Discord](https://discord.gg/stimulus-reflex) for support getting started, as well as active discussions around Rails, StimulusJS and CableReady.
79
80
 
80
81
  ![](https://img.shields.io/discord/629472241427415060)
81
82
 
@@ -89,7 +90,7 @@ Please note that we are not actively providing support on Stack Overflow. If you
89
90
 
90
91
  ## 🚀 Installation and upgrading
91
92
 
92
- CLI and manual setup procedures are fully detailed in the [official docs](https://docs.stimulusreflex.com/setup). For information on upgrading existing projects to v3.4, read [this](https://docs.stimulusreflex.com/setup#upgrading-to-v-3-4-0).
93
+ CLI and manual setup procedures are fully detailed in the [official docs](https://docs.stimulusreflex.com/setup). For information on upgrading existing projects to v3.4, read [this](https://docs.stimulusreflex.com/hello-world/setup#upgrading-to-v-3-4-0).
93
94
 
94
95
  ## 🙏 Contributing
95
96
 
@@ -109,10 +110,10 @@ View the [wiki](https://github.com/stimulusreflex/stimulus_reflex/wiki/Editor-Co
109
110
  ## 📦 Releasing
110
111
 
111
112
  1. Bump version number at `lib/stimulus_reflex/version.rb`
112
- 1. Run `rake build`
113
- 1. Run `rake release`
114
- 1. Run `yarn publish --no-git-tag-version`
115
- 1. Commit and push changes to the `package.json` file
113
+ 2. Run `rake build`
114
+ 3. Run `rake release`
115
+ 4. Run `yarn publish --no-git-tag-version`
116
+ 5. Commit and push changes to the `package.json` file
116
117
 
117
118
  ## 📝 License
118
119
 
@@ -4,11 +4,7 @@ class StimulusReflex::Channel < StimulusReflex.configuration.parent_channel.cons
4
4
  attr_reader :reflex_data
5
5
 
6
6
  def stream_name
7
- ids = connection.identifiers.map { |identifier| send(identifier).try(:id) || send(identifier) }
8
- [
9
- params[:channel],
10
- ids.select(&:present?).join(";")
11
- ].select(&:present?).join(":")
7
+ [params[:channel], connection.connection_identifier].join(":")
12
8
  end
13
9
 
14
10
  def subscribed
@@ -28,15 +24,15 @@ class StimulusReflex::Channel < StimulusReflex.configuration.parent_channel.cons
28
24
 
29
25
  if reflex
30
26
  reflex.rescue_with_handler(exception)
31
- puts error_message
32
- reflex.broadcast_message subject: "error", data: data, error: exception
27
+ reflex.logger&.error error_message
28
+ reflex.error data: data, body: "#{exception} #{exception.backtrace.first.split(":in ")[0] if Rails.env.development?}"
33
29
  else
34
- puts error_message
30
+ reflex.logger&.error error_message
35
31
 
36
32
  if body.to_s.include? "No route matches"
37
33
  initializer_path = Rails.root.join("config", "initializers", "stimulus_reflex.rb")
38
34
 
39
- puts <<~NOTE
35
+ reflex.logger&.warn <<~NOTE
40
36
  \e[33mNOTE: StimulusReflex failed to locate a matching route and could not re-render the page.
41
37
 
42
38
  If your app uses Rack middleware to rewrite part of the request path, you must enable those middleware modules in StimulusReflex.
@@ -58,22 +54,22 @@ class StimulusReflex::Channel < StimulusReflex.configuration.parent_channel.cons
58
54
  end
59
55
 
60
56
  if reflex.halted?
61
- reflex.broadcast_message subject: "halted", data: data
57
+ reflex.halted data: data
62
58
  else
63
59
  begin
64
60
  reflex.broadcast(reflex_data.selectors, data)
65
61
  rescue => exception
66
62
  reflex.rescue_with_handler(exception)
67
63
  error = exception_with_backtrace(exception)
68
- reflex.broadcast_message subject: "error", data: data, error: exception
69
- puts "\e[31mReflex failed to re-render: #{error[:message]} [#{reflex_data.url}]\e[0m\n#{error[:stack]}"
64
+ reflex.error data: data, body: "#{exception} #{exception.backtrace.first.split(":in ")[0] if Rails.env.development?}"
65
+ reflex.logger&.error "\e[31mReflex failed to re-render: #{error[:message]} [#{reflex_data.url}]\e[0m\n#{error[:stack]}"
70
66
  end
71
67
  end
72
68
  ensure
73
69
  if reflex
74
70
  commit_session(reflex)
75
71
  report_failed_basic_auth(reflex) if reflex.controller?
76
- reflex.logger&.print
72
+ reflex.logger&.log_all_operations
77
73
  end
78
74
  end
79
75
  end
@@ -92,7 +88,7 @@ class StimulusReflex::Channel < StimulusReflex.configuration.parent_channel.cons
92
88
  elsif policy.arguments?
93
89
  reflex.process(method_name, *arguments)
94
90
  else
95
- raise ArgumentError.new("wrong number of arguments (given #{arguments.inspect}, expected #{required_params.inspect}, optional #{optional_params.inspect})")
91
+ raise ArgumentError.new("wrong number of arguments (given #{arguments.inspect}, expected #{policy.required_params.inspect}, optional #{policy.optional_params.inspect})")
96
92
  end
97
93
  end
98
94
 
@@ -101,19 +97,19 @@ class StimulusReflex::Channel < StimulusReflex.configuration.parent_channel.cons
101
97
  store.commit_session reflex.request, reflex.controller.response
102
98
  rescue => exception
103
99
  error = exception_with_backtrace(exception)
104
- puts "\e[31mFailed to commit session! #{error[:message]}\e[0m\n#{error[:backtrace]}"
100
+ reflex.logger&.error "\e[31mFailed to commit session! #{error[:message]}\e[0m\n#{error[:backtrace]}"
105
101
  end
106
102
 
107
103
  def report_failed_basic_auth(reflex)
108
104
  if reflex.controller.response.status == 401
109
- puts "\e[31mReflex failed to process controller action \"#{reflex.controller.class}##{reflex.controller.action_name}\" due to HTTP basic auth. Consider adding \"unless: -> { @stimulus_reflex }\" to the before_action or method responible for authentication.\e[0m"
105
+ reflex.logger&.error "\e[31mReflex failed to process controller action \"#{reflex.controller.class}##{reflex.controller.action_name}\" due to HTTP basic auth. Consider adding \"unless: -> { @stimulus_reflex }\" to the before_action or method responible for authentication.\e[0m"
110
106
  end
111
107
  end
112
108
 
113
109
  def exception_with_backtrace(exception)
114
110
  {
115
111
  message: exception.to_s,
116
- backtrace: exception.backtrace.first,
112
+ backtrace: exception.backtrace.first.split(":in ")[0],
117
113
  stack: exception.backtrace.join("\n")
118
114
  }
119
115
  end
@@ -7,20 +7,21 @@ class StimulusReflexGenerator < Rails::Generators::NamedBase
7
7
 
8
8
  argument :name, type: :string, required: true, banner: "NAME"
9
9
  argument :actions, type: :array, default: [], banner: "action action"
10
+ class_options skip_stimulus: false, skip_app_reflex: false, skip_reflex: false, skip_app_controller: false
10
11
 
11
12
  def execute
12
13
  actions.map!(&:underscore)
13
14
 
14
15
  copy_application_files if behavior == :invoke
15
16
 
16
- template "app/reflexes/%file_name%_reflex.rb"
17
- template "app/javascript/controllers/%file_name%_controller.js"
17
+ template "app/reflexes/%file_name%_reflex.rb" unless options[:skip_reflex]
18
+ template "app/javascript/controllers/%file_name%_controller.js" unless options[:skip_stimulus]
18
19
  end
19
20
 
20
21
  private
21
22
 
22
23
  def copy_application_files
23
- template "app/reflexes/application_reflex.rb"
24
- template "app/javascript/controllers/application_controller.js"
24
+ template "app/reflexes/application_reflex.rb" unless options[:skip_app_reflex]
25
+ template "app/javascript/controllers/application_controller.js" unless options[:skip_app_controller]
25
26
  end
26
27
  end
@@ -1,12 +1,19 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class ApplicationReflex < StimulusReflex::Reflex
4
- # Put application-wide Reflex behavior and callbacks in this file.
4
+ # Put application-wide Reflex behavior and callbacks in this file.
5
5
  #
6
- # Example:
6
+ # Learn more at: https://docs.stimulusreflex.com/rtfm/reflex-classes
7
7
  #
8
- # # If your ActionCable connection is: `identified_by :current_user`
8
+ # If your ActionCable connection is: `identified_by :current_user`
9
9
  # delegate :current_user, to: :connection
10
10
  #
11
- # Learn more at: https://docs.stimulusreflex.com/rtfm/reflex-classes
11
+ # If you need to localize your Reflexes, you can set the I18n locale here:
12
+ #
13
+ # before_reflex do
14
+ # I18n.locale = :fr
15
+ # end
16
+ #
17
+ # For code examples, considerations and caveats, see:
18
+ # https://docs.stimulusreflex.com/rtfm/patterns#internationalization
12
19
  end
@@ -1,5 +1,10 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ # The ActionCable logger is REALLY noisy, and might even impact performance.
4
+ # Uncomment the line below to silence the ActionCable logger.
5
+
6
+ # ActionCable.server.config.logger = Logger.new(nil)
7
+
3
8
  StimulusReflex.configure do |config|
4
9
  # Enable/disable exiting / warning when the sanity checks fail options:
5
10
  # `:exit` or `:warn` or `:ignore`
@@ -11,10 +16,20 @@ StimulusReflex.configure do |config|
11
16
 
12
17
  # config.on_new_version_available = :ignore
13
18
 
19
+ # Enable/disable exiting / warning when there is no default URLs specified in environment config
20
+ # `:warn` or `:ignore`
21
+
22
+ # config.on_missing_default_urls = :warn
23
+
14
24
  # Override the parent class that the StimulusReflex ActionCable channel inherits from
15
25
 
16
26
  # config.parent_channel = "ApplicationCable::Channel"
17
27
 
28
+ # Override the logger that the StimulusReflex uses; default is Rails' logger
29
+ # eg. Logger.new(RAILS_ROOT + "/log/reflex.log")
30
+
31
+ # config.logger = Rails.logger
32
+
18
33
  # Customize server-side Reflex logging format, with optional colorization:
19
34
  # Available tokens: session_id, session_id_full, reflex_info, operation, reflex_id, reflex_id_full, mode, selector, operation_counter, connection_id, connection_id_full, timestamp
20
35
  # Available colors: red, green, yellow, blue, magenta, cyan, white