stimulus_reflex 3.5.0.pre2 → 3.5.0.pre3
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 +56 -11
- data/Gemfile.lock +71 -66
- data/README.md +4 -3
- data/app/channels/stimulus_reflex/channel.rb +11 -11
- data/lib/generators/stimulus_reflex/stimulus_reflex_generator.rb +5 -4
- data/lib/generators/stimulus_reflex/templates/config/initializers/stimulus_reflex.rb +5 -0
- data/lib/stimulus_reflex/broadcasters/broadcaster.rb +18 -17
- data/lib/stimulus_reflex/broadcasters/nothing_broadcaster.rb +6 -1
- data/lib/stimulus_reflex/broadcasters/page_broadcaster.rb +1 -3
- data/lib/stimulus_reflex/broadcasters/selector_broadcaster.rb +2 -6
- data/lib/stimulus_reflex/configuration.rb +2 -1
- data/lib/stimulus_reflex/dataset.rb +34 -0
- data/lib/stimulus_reflex/element.rb +12 -46
- data/lib/stimulus_reflex/reflex.rb +7 -2
- data/lib/stimulus_reflex/utils/attribute_builder.rb +17 -0
- data/lib/stimulus_reflex/utils/logger.rb +6 -2
- data/lib/stimulus_reflex/version.rb +1 -1
- data/lib/tasks/stimulus_reflex/install.rake +1 -1
- data/test/broadcasters/broadcaster_test.rb +0 -1
- data/test/broadcasters/broadcaster_test_case.rb +24 -0
- data/test/broadcasters/nothing_broadcaster_test.rb +14 -22
- data/test/broadcasters/page_broadcaster_test.rb +30 -32
- data/test/broadcasters/selector_broadcaster_test.rb +82 -88
- data/test/element_test.rb +73 -0
- data/test/generators/stimulus_reflex_generator_test.rb +8 -0
- data/test/reflex_test.rb +11 -0
- data/test/test_helper.rb +3 -1
- data/test/tmp/app/reflexes/demo_reflex.rb +0 -1
- metadata +36 -20
- data/package.json +0 -58
- data/stimulus_reflex.gemspec +0 -42
- data/yarn.lock +0 -4680
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: de74a55565a28991a825bcc37db07d7e2fc9335bf68c29fec27610f311060ee4
|
4
|
+
data.tar.gz: d178376b89fa7a061c71d6346189094831bb53c143c5e99c62ab3128fb70138a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e90fdee9c58d66893eb1af762848b0c8f81972de1198f947ca10e0224092c674b5008289cade3639568df44ab735ac1c6b95547c932d66a8ce707c6fb0a5f428
|
7
|
+
data.tar.gz: 5956987432927c7af475e524886354eda2439c8dd3793d135e8c63d1aab4a46d21edfab80a66c6315081daba07efa4f52bce33f3a5fdca8195a38c76df2e522d
|
data/CHANGELOG.md
CHANGED
@@ -2,7 +2,44 @@
|
|
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.
|
5
|
+
[Full Changelog](https://github.com/stimulusreflex/stimulus_reflex/compare/v3.5.0.pre2...HEAD)
|
6
|
+
|
7
|
+
**Implemented enhancements:**
|
8
|
+
|
9
|
+
- Allow to skip stages in the generator [\#541](https://github.com/stimulusreflex/stimulus_reflex/issues/541)
|
10
|
+
- reverse merge params into locals [\#542](https://github.com/stimulusreflex/stimulus_reflex/pull/542) ([leastbad](https://github.com/leastbad))
|
11
|
+
- specify env headers for page morph controller [\#538](https://github.com/stimulusreflex/stimulus_reflex/pull/538) ([leastbad](https://github.com/leastbad))
|
12
|
+
- New CR wire format + reworked server message events [\#536](https://github.com/stimulusreflex/stimulus_reflex/pull/536) ([leastbad](https://github.com/leastbad))
|
13
|
+
- reflex render layout defaults to false [\#534](https://github.com/stimulusreflex/stimulus_reflex/pull/534) ([leastbad](https://github.com/leastbad))
|
14
|
+
|
15
|
+
**Closed issues:**
|
16
|
+
|
17
|
+
- Controller action being re-run is different from expected. [\#540](https://github.com/stimulusreflex/stimulus_reflex/issues/540)
|
18
|
+
- The ActionCable channel subscription for StimulusReflex gets rejected when interacting too fast [\#539](https://github.com/stimulusreflex/stimulus_reflex/issues/539)
|
19
|
+
- Stimulus reflex not working making server to stop on ruby on rails [\#533](https://github.com/stimulusreflex/stimulus_reflex/issues/533)
|
20
|
+
|
21
|
+
**Merged pull requests:**
|
22
|
+
|
23
|
+
- 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))
|
24
|
+
- Add test for param behavior [\#545](https://github.com/stimulusreflex/stimulus_reflex/pull/545) ([julianrubisch](https://github.com/julianrubisch))
|
25
|
+
- Add generator options to skip reflex and stimulus [\#543](https://github.com/stimulusreflex/stimulus_reflex/pull/543) ([nachiket87](https://github.com/nachiket87))
|
26
|
+
- Fix comment [\#537](https://github.com/stimulusreflex/stimulus_reflex/pull/537) ([julianrubisch](https://github.com/julianrubisch))
|
27
|
+
- 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))
|
28
|
+
- Add test for `data-reflex-dataset="descendants"` [\#531](https://github.com/stimulusreflex/stimulus_reflex/pull/531) ([assuntaw](https://github.com/assuntaw))
|
29
|
+
- Provide proxy methods boolean and numeric on Element [\#528](https://github.com/stimulusreflex/stimulus_reflex/pull/528) ([julianrubisch](https://github.com/julianrubisch))
|
30
|
+
|
31
|
+
## [v3.5.0.pre2](https://github.com/stimulusreflex/stimulus_reflex/tree/v3.5.0.pre2) (2021-07-21)
|
32
|
+
|
33
|
+
[Full Changelog](https://github.com/stimulusreflex/stimulus_reflex/compare/v3.5.0.pre1...v3.5.0.pre2)
|
34
|
+
|
35
|
+
**Implemented enhancements:**
|
36
|
+
|
37
|
+
- Optionally provide innerHtml and textContent on StimulusReflex::Element [\#517](https://github.com/stimulusreflex/stimulus_reflex/pull/517) ([julianrubisch](https://github.com/julianrubisch))
|
38
|
+
|
39
|
+
**Fixed bugs:**
|
40
|
+
|
41
|
+
- Sanity checker should not abort stimulus\_reflex install task [\#508](https://github.com/stimulusreflex/stimulus_reflex/issues/508)
|
42
|
+
- Improve install experience [\#510](https://github.com/stimulusreflex/stimulus_reflex/pull/510) ([leastbad](https://github.com/leastbad))
|
6
43
|
|
7
44
|
**Closed issues:**
|
8
45
|
|
@@ -12,10 +49,13 @@
|
|
12
49
|
|
13
50
|
**Merged pull requests:**
|
14
51
|
|
52
|
+
- Specify form selector [\#527](https://github.com/stimulusreflex/stimulus_reflex/pull/527) ([julianrubisch](https://github.com/julianrubisch))
|
15
53
|
- Fix two minor typos [\#526](https://github.com/stimulusreflex/stimulus_reflex/pull/526) ([julianrubisch](https://github.com/julianrubisch))
|
16
54
|
- chore: add sideEffects false to make Webpack happy [\#523](https://github.com/stimulusreflex/stimulus_reflex/pull/523) ([ParamagicDev](https://github.com/ParamagicDev))
|
55
|
+
- Morph stimulus reflex element AKA "single element page morph" [\#522](https://github.com/stimulusreflex/stimulus_reflex/pull/522) ([julianrubisch](https://github.com/julianrubisch))
|
17
56
|
- Add localization example to ApplicationReflex template [\#521](https://github.com/stimulusreflex/stimulus_reflex/pull/521) ([erlingur](https://github.com/erlingur))
|
18
57
|
- refactor stream\_name [\#519](https://github.com/stimulusreflex/stimulus_reflex/pull/519) ([leastbad](https://github.com/leastbad))
|
58
|
+
- Schema object with getters [\#505](https://github.com/stimulusreflex/stimulus_reflex/pull/505) ([leastbad](https://github.com/leastbad))
|
19
59
|
|
20
60
|
## [v3.5.0.pre1](https://github.com/stimulusreflex/stimulus_reflex/tree/v3.5.0.pre1) (2021-06-02)
|
21
61
|
|
@@ -125,6 +165,7 @@
|
|
125
165
|
- Extract RequestParameters class [\#451](https://github.com/stimulusreflex/stimulus_reflex/pull/451) ([julianrubisch](https://github.com/julianrubisch))
|
126
166
|
- run changelog action not on every single push to master [\#450](https://github.com/stimulusreflex/stimulus_reflex/pull/450) ([marcoroth](https://github.com/marcoroth))
|
127
167
|
- Extract method invocation policy [\#448](https://github.com/stimulusreflex/stimulus_reflex/pull/448) ([julianrubisch](https://github.com/julianrubisch))
|
168
|
+
- remove unnecessary gate [\#439](https://github.com/stimulusreflex/stimulus_reflex/pull/439) ([leastbad](https://github.com/leastbad))
|
128
169
|
|
129
170
|
## [v3.4.1](https://github.com/stimulusreflex/stimulus_reflex/tree/v3.4.1) (2021-01-26)
|
130
171
|
|
@@ -137,7 +178,7 @@
|
|
137
178
|
**Fixed bugs:**
|
138
179
|
|
139
180
|
- life-cycle callbacks return correct element reference [\#431](https://github.com/stimulusreflex/stimulus_reflex/pull/431) ([leastbad](https://github.com/leastbad))
|
140
|
-
-
|
181
|
+
- encode form data for chars like '&' and '=' [\#418](https://github.com/stimulusreflex/stimulus_reflex/pull/418) ([RolandStuder](https://github.com/RolandStuder))
|
141
182
|
- Prefix dom\_id with hash/pound [\#410](https://github.com/stimulusreflex/stimulus_reflex/pull/410) ([hopsoft](https://github.com/hopsoft))
|
142
183
|
|
143
184
|
**Closed issues:**
|
@@ -150,7 +191,6 @@
|
|
150
191
|
|
151
192
|
**Merged pull requests:**
|
152
193
|
|
153
|
-
- remove unnecessary gate [\#439](https://github.com/stimulusreflex/stimulus_reflex/pull/439) ([leastbad](https://github.com/leastbad))
|
154
194
|
- Extract callbacks to module [\#427](https://github.com/stimulusreflex/stimulus_reflex/pull/427) ([julianrubisch](https://github.com/julianrubisch))
|
155
195
|
- Fixes bug where multiple inputs with the same name lost element value [\#426](https://github.com/stimulusreflex/stimulus_reflex/pull/426) ([jonsgreen](https://github.com/jonsgreen))
|
156
196
|
- Add general policy for CoC enforcement [\#424](https://github.com/stimulusreflex/stimulus_reflex/pull/424) ([hopsoft](https://github.com/hopsoft))
|
@@ -179,7 +219,7 @@
|
|
179
219
|
|
180
220
|
**Fixed bugs:**
|
181
221
|
|
182
|
-
-
|
222
|
+
- Bug fix: Updating changelog generator to push to master, not main [\#416](https://github.com/stimulusreflex/stimulus_reflex/pull/416) ([MikeRogers0](https://github.com/MikeRogers0))
|
183
223
|
- fix up install task [\#401](https://github.com/stimulusreflex/stimulus_reflex/pull/401) ([leastbad](https://github.com/leastbad))
|
184
224
|
- Fix multiple broadcasts from within the same reflex [\#400](https://github.com/stimulusreflex/stimulus_reflex/pull/400) ([hopsoft](https://github.com/hopsoft))
|
185
225
|
|
@@ -376,6 +416,7 @@
|
|
376
416
|
|
377
417
|
**Merged pull requests:**
|
378
418
|
|
419
|
+
- fixes and tweaks to client logging subsystem [\#313](https://github.com/stimulusreflex/stimulus_reflex/pull/313) ([leastbad](https://github.com/leastbad))
|
379
420
|
- add ready event after setupDeclarativeReflexes [\#312](https://github.com/stimulusreflex/stimulus_reflex/pull/312) ([leastbad](https://github.com/leastbad))
|
380
421
|
- Refactor sanity checks on boot [\#311](https://github.com/stimulusreflex/stimulus_reflex/pull/311) ([excid3](https://github.com/excid3))
|
381
422
|
|
@@ -395,7 +436,6 @@
|
|
395
436
|
|
396
437
|
**Merged pull requests:**
|
397
438
|
|
398
|
-
- fixes and tweaks to client logging subsystem [\#313](https://github.com/stimulusreflex/stimulus_reflex/pull/313) ([leastbad](https://github.com/leastbad))
|
399
439
|
- Support IE11 msCrypto \(\#308\) [\#310](https://github.com/stimulusreflex/stimulus_reflex/pull/310) ([chooselife22](https://github.com/chooselife22))
|
400
440
|
- Print warning and exit if caching is disabled or npm/gem versions are mismatched [\#309](https://github.com/stimulusreflex/stimulus_reflex/pull/309) ([excid3](https://github.com/excid3))
|
401
441
|
- ActionCable connectivity events [\#307](https://github.com/stimulusreflex/stimulus_reflex/pull/307) ([leastbad](https://github.com/leastbad))
|
@@ -496,7 +536,6 @@
|
|
496
536
|
**Fixed bugs:**
|
497
537
|
|
498
538
|
- Limit MutationObserver mutations [\#256](https://github.com/stimulusreflex/stimulus_reflex/pull/256) ([jasoncharnes](https://github.com/jasoncharnes))
|
499
|
-
- Add more smarts to \_\_perform [\#235](https://github.com/stimulusreflex/stimulus_reflex/pull/235) ([hopsoft](https://github.com/hopsoft))
|
500
539
|
|
501
540
|
**Closed issues:**
|
502
541
|
|
@@ -525,6 +564,7 @@
|
|
525
564
|
- Revert "Add instructions for pulling the user id out of session storage" [\#239](https://github.com/stimulusreflex/stimulus_reflex/pull/239) ([leastbad](https://github.com/leastbad))
|
526
565
|
- Add instructions for pulling the user id out of session storage [\#238](https://github.com/stimulusreflex/stimulus_reflex/pull/238) ([mtomov](https://github.com/mtomov))
|
527
566
|
- adds params documentation [\#230](https://github.com/stimulusreflex/stimulus_reflex/pull/230) ([RolandStuder](https://github.com/RolandStuder))
|
567
|
+
- Fix calling wrong controller lifecycle methods [\#226](https://github.com/stimulusreflex/stimulus_reflex/pull/226) ([davidalejandroaguilar](https://github.com/davidalejandroaguilar))
|
528
568
|
- Allow to pass reflex action names to reflex generator [\#224](https://github.com/stimulusreflex/stimulus_reflex/pull/224) ([marcoroth](https://github.com/marcoroth))
|
529
569
|
|
530
570
|
## [v3.2.3](https://github.com/stimulusreflex/stimulus_reflex/tree/v3.2.3) (2020-06-15)
|
@@ -533,6 +573,7 @@
|
|
533
573
|
|
534
574
|
**Fixed bugs:**
|
535
575
|
|
576
|
+
- Add more smarts to \_\_perform [\#235](https://github.com/stimulusreflex/stimulus_reflex/pull/235) ([hopsoft](https://github.com/hopsoft))
|
536
577
|
- \_\_perform had a bug where it was only ever calling the first event [\#234](https://github.com/stimulusreflex/stimulus_reflex/pull/234) ([leastbad](https://github.com/leastbad))
|
537
578
|
- merges insteads of overwrites params for reflex actions with form data [\#231](https://github.com/stimulusreflex/stimulus_reflex/pull/231) ([RolandStuder](https://github.com/RolandStuder))
|
538
579
|
|
@@ -543,7 +584,6 @@
|
|
543
584
|
**Merged pull requests:**
|
544
585
|
|
545
586
|
- Fix typos in the documentation [\#228](https://github.com/stimulusreflex/stimulus_reflex/pull/228) ([dlt](https://github.com/dlt))
|
546
|
-
- Always commit session [\#222](https://github.com/stimulusreflex/stimulus_reflex/pull/222) ([hopsoft](https://github.com/hopsoft))
|
547
587
|
|
548
588
|
## [v3.2.2](https://github.com/stimulusreflex/stimulus_reflex/tree/v3.2.2) (2020-06-06)
|
549
589
|
|
@@ -564,7 +604,6 @@
|
|
564
604
|
|
565
605
|
**Merged pull requests:**
|
566
606
|
|
567
|
-
- Fix calling wrong controller lifecycle methods [\#226](https://github.com/stimulusreflex/stimulus_reflex/pull/226) ([davidalejandroaguilar](https://github.com/davidalejandroaguilar))
|
568
607
|
- Always commit session [\#222](https://github.com/stimulusreflex/stimulus_reflex/pull/222) ([hopsoft](https://github.com/hopsoft))
|
569
608
|
|
570
609
|
## [v3.2.2.pre0](https://github.com/stimulusreflex/stimulus_reflex/tree/v3.2.2.pre0) (2020-05-27)
|
@@ -671,7 +710,6 @@
|
|
671
710
|
- Possible bug when about to perform cableready operations [\#166](https://github.com/stimulusreflex/stimulus_reflex/issues/166)
|
672
711
|
- Reflex not binding to ajax loaded content [\#161](https://github.com/stimulusreflex/stimulus_reflex/issues/161)
|
673
712
|
- Input field values sometimes remain [\#159](https://github.com/stimulusreflex/stimulus_reflex/issues/159)
|
674
|
-
- remove changelog rake task [\#150](https://github.com/stimulusreflex/stimulus_reflex/pull/150) ([andrewmcodes](https://github.com/andrewmcodes))
|
675
713
|
|
676
714
|
**Closed issues:**
|
677
715
|
|
@@ -721,6 +759,7 @@
|
|
721
759
|
**Fixed bugs:**
|
722
760
|
|
723
761
|
- Cannot read property 'removeEventListener' of undefined after updating to 3.1.0 [\#151](https://github.com/stimulusreflex/stimulus_reflex/issues/151)
|
762
|
+
- remove changelog rake task [\#150](https://github.com/stimulusreflex/stimulus_reflex/pull/150) ([andrewmcodes](https://github.com/andrewmcodes))
|
724
763
|
|
725
764
|
**Closed issues:**
|
726
765
|
|
@@ -802,6 +841,10 @@
|
|
802
841
|
|
803
842
|
[Full Changelog](https://github.com/stimulusreflex/stimulus_reflex/compare/v2.2.0...v2.2.1)
|
804
843
|
|
844
|
+
**Fixed bugs:**
|
845
|
+
|
846
|
+
- Cleanup and fixes around lifecycle dispatch [\#121](https://github.com/stimulusreflex/stimulus_reflex/pull/121) ([hopsoft](https://github.com/hopsoft))
|
847
|
+
|
805
848
|
## [v2.2.0](https://github.com/stimulusreflex/stimulus_reflex/tree/v2.2.0) (2020-02-28)
|
806
849
|
|
807
850
|
[Full Changelog](https://github.com/stimulusreflex/stimulus_reflex/compare/v2.1.9...v2.2.0)
|
@@ -823,6 +866,10 @@
|
|
823
866
|
|
824
867
|
[Full Changelog](https://github.com/stimulusreflex/stimulus_reflex/compare/v2.1.7...v2.1.8)
|
825
868
|
|
869
|
+
**Implemented enhancements:**
|
870
|
+
|
871
|
+
- More defense in the received handler [\#107](https://github.com/stimulusreflex/stimulus_reflex/pull/107) ([hopsoft](https://github.com/hopsoft))
|
872
|
+
|
826
873
|
**Fixed bugs:**
|
827
874
|
|
828
875
|
- Fix bug related to trailing slash in URL path [\#111](https://github.com/stimulusreflex/stimulus_reflex/pull/111) ([hopsoft](https://github.com/hopsoft))
|
@@ -865,7 +912,6 @@
|
|
865
912
|
|
866
913
|
**Fixed bugs:**
|
867
914
|
|
868
|
-
- Cleanup and fixes around lifecycle dispatch [\#121](https://github.com/stimulusreflex/stimulus_reflex/pull/121) ([hopsoft](https://github.com/hopsoft))
|
869
915
|
- Use application.js as fallback file path [\#82](https://github.com/stimulusreflex/stimulus_reflex/pull/82) ([julianrubisch](https://github.com/julianrubisch))
|
870
916
|
|
871
917
|
**Closed issues:**
|
@@ -881,7 +927,6 @@
|
|
881
927
|
|
882
928
|
**Implemented enhancements:**
|
883
929
|
|
884
|
-
- More defense in the received handler [\#107](https://github.com/stimulusreflex/stimulus_reflex/pull/107) ([hopsoft](https://github.com/hopsoft))
|
885
930
|
- Add CodeFund sponsorship [\#75](https://github.com/stimulusreflex/stimulus_reflex/pull/75) ([coderberry](https://github.com/coderberry))
|
886
931
|
|
887
932
|
**Fixed bugs:**
|
data/Gemfile.lock
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
stimulus_reflex (3.5.0.
|
5
|
-
cable_ready (= 5.0.0.
|
4
|
+
stimulus_reflex (3.5.0.pre3)
|
5
|
+
cable_ready (= 5.0.0.pre4)
|
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.4)
|
15
|
-
actionpack (= 6.1.4)
|
16
|
-
activesupport (= 6.1.4)
|
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.4)
|
20
|
-
actionpack (= 6.1.4)
|
21
|
-
activejob (= 6.1.4)
|
22
|
-
activerecord (= 6.1.4)
|
23
|
-
activestorage (= 6.1.4)
|
24
|
-
activesupport (= 6.1.4)
|
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.4)
|
27
|
-
actionpack (= 6.1.4)
|
28
|
-
actionview (= 6.1.4)
|
29
|
-
activejob (= 6.1.4)
|
30
|
-
activesupport (= 6.1.4)
|
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.4)
|
34
|
-
actionview (= 6.1.4)
|
35
|
-
activesupport (= 6.1.4)
|
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.4)
|
41
|
-
actionpack (= 6.1.4)
|
42
|
-
activerecord (= 6.1.4)
|
43
|
-
activestorage (= 6.1.4)
|
44
|
-
activesupport (= 6.1.4)
|
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.4)
|
47
|
-
activesupport (= 6.1.4)
|
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.4)
|
53
|
-
activesupport (= 6.1.4)
|
52
|
+
activejob (6.1.4.1)
|
53
|
+
activesupport (= 6.1.4.1)
|
54
54
|
globalid (>= 0.3.6)
|
55
|
-
activemodel (6.1.4)
|
56
|
-
activesupport (= 6.1.4)
|
57
|
-
activerecord (6.1.4)
|
58
|
-
activemodel (= 6.1.4)
|
59
|
-
activesupport (= 6.1.4)
|
60
|
-
activestorage (6.1.4)
|
61
|
-
actionpack (= 6.1.4)
|
62
|
-
activejob (= 6.1.4)
|
63
|
-
activerecord (= 6.1.4)
|
64
|
-
activesupport (= 6.1.4)
|
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
66
|
mini_mime (>= 1.1.0)
|
67
|
-
activesupport (6.1.4)
|
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,30 +72,33 @@ GEM
|
|
72
72
|
zeitwerk (~> 2.3)
|
73
73
|
ast (2.4.2)
|
74
74
|
builder (3.2.4)
|
75
|
-
cable_ready (5.0.0.
|
75
|
+
cable_ready (5.0.0.pre4)
|
76
76
|
rails (>= 5.2)
|
77
77
|
thread-local (>= 1.1.0)
|
78
78
|
coderay (1.1.3)
|
79
79
|
concurrent-ruby (1.1.9)
|
80
80
|
crass (1.0.6)
|
81
81
|
erubi (1.10.0)
|
82
|
-
globalid (0.
|
83
|
-
activesupport (>=
|
82
|
+
globalid (0.5.2)
|
83
|
+
activesupport (>= 5.0)
|
84
84
|
i18n (1.8.10)
|
85
85
|
concurrent-ruby (~> 1.0)
|
86
|
-
loofah (2.
|
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.
|
91
|
+
marcel (1.0.2)
|
92
92
|
method_source (0.9.2)
|
93
|
-
mini_mime (1.1.
|
93
|
+
mini_mime (1.1.1)
|
94
94
|
minitest (5.14.4)
|
95
|
-
|
96
|
-
|
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)
|
97
100
|
racc (~> 1.4)
|
98
|
-
nokogiri (1.
|
101
|
+
nokogiri (1.12.5-x86_64-linux)
|
99
102
|
racc (~> 1.4)
|
100
103
|
parallel (1.20.1)
|
101
104
|
parser (3.0.2.0)
|
@@ -109,35 +112,35 @@ GEM
|
|
109
112
|
rack (2.2.3)
|
110
113
|
rack-test (1.1.0)
|
111
114
|
rack (>= 1.0, < 3)
|
112
|
-
rails (6.1.4)
|
113
|
-
actioncable (= 6.1.4)
|
114
|
-
actionmailbox (= 6.1.4)
|
115
|
-
actionmailer (= 6.1.4)
|
116
|
-
actionpack (= 6.1.4)
|
117
|
-
actiontext (= 6.1.4)
|
118
|
-
actionview (= 6.1.4)
|
119
|
-
activejob (= 6.1.4)
|
120
|
-
activemodel (= 6.1.4)
|
121
|
-
activerecord (= 6.1.4)
|
122
|
-
activestorage (= 6.1.4)
|
123
|
-
activesupport (= 6.1.4)
|
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)
|
124
127
|
bundler (>= 1.15.0)
|
125
|
-
railties (= 6.1.4)
|
128
|
+
railties (= 6.1.4.1)
|
126
129
|
sprockets-rails (>= 2.0.0)
|
127
130
|
rails-dom-testing (2.0.3)
|
128
131
|
activesupport (>= 4.2.0)
|
129
132
|
nokogiri (>= 1.6)
|
130
|
-
rails-html-sanitizer (1.
|
133
|
+
rails-html-sanitizer (1.4.2)
|
131
134
|
loofah (~> 2.3)
|
132
|
-
railties (6.1.4)
|
133
|
-
actionpack (= 6.1.4)
|
134
|
-
activesupport (= 6.1.4)
|
135
|
+
railties (6.1.4.1)
|
136
|
+
actionpack (= 6.1.4.1)
|
137
|
+
activesupport (= 6.1.4.1)
|
135
138
|
method_source
|
136
139
|
rake (>= 0.13)
|
137
140
|
thor (~> 1.0)
|
138
141
|
rainbow (3.0.0)
|
139
142
|
rake (13.0.6)
|
140
|
-
redis (4.
|
143
|
+
redis (4.4.0)
|
141
144
|
regexp_parser (2.1.1)
|
142
145
|
rexml (3.2.5)
|
143
146
|
rubocop (1.18.3)
|
@@ -179,10 +182,12 @@ GEM
|
|
179
182
|
|
180
183
|
PLATFORMS
|
181
184
|
arm64-darwin-20
|
185
|
+
x86_64-darwin-19
|
182
186
|
x86_64-linux
|
183
187
|
|
184
188
|
DEPENDENCIES
|
185
189
|
bundler (~> 2.0)
|
190
|
+
mocha
|
186
191
|
pry
|
187
192
|
pry-nav
|
188
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
|
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
|

|
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
|
|
@@ -24,15 +24,15 @@ class StimulusReflex::Channel < StimulusReflex.configuration.parent_channel.cons
|
|
24
24
|
|
25
25
|
if reflex
|
26
26
|
reflex.rescue_with_handler(exception)
|
27
|
-
|
28
|
-
reflex.
|
27
|
+
reflex.logger&.error error_message
|
28
|
+
reflex.error data: data, body: "#{exception} #{exception.backtrace.first.split(":in ")[0] if Rails.env.development?}"
|
29
29
|
else
|
30
|
-
|
30
|
+
reflex.logger&.error error_message
|
31
31
|
|
32
32
|
if body.to_s.include? "No route matches"
|
33
33
|
initializer_path = Rails.root.join("config", "initializers", "stimulus_reflex.rb")
|
34
34
|
|
35
|
-
|
35
|
+
reflex.logger&.warn <<~NOTE
|
36
36
|
\e[33mNOTE: StimulusReflex failed to locate a matching route and could not re-render the page.
|
37
37
|
|
38
38
|
If your app uses Rack middleware to rewrite part of the request path, you must enable those middleware modules in StimulusReflex.
|
@@ -54,22 +54,22 @@ class StimulusReflex::Channel < StimulusReflex.configuration.parent_channel.cons
|
|
54
54
|
end
|
55
55
|
|
56
56
|
if reflex.halted?
|
57
|
-
reflex.
|
57
|
+
reflex.halted data: data
|
58
58
|
else
|
59
59
|
begin
|
60
60
|
reflex.broadcast(reflex_data.selectors, data)
|
61
61
|
rescue => exception
|
62
62
|
reflex.rescue_with_handler(exception)
|
63
63
|
error = exception_with_backtrace(exception)
|
64
|
-
reflex.
|
65
|
-
|
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]}"
|
66
66
|
end
|
67
67
|
end
|
68
68
|
ensure
|
69
69
|
if reflex
|
70
70
|
commit_session(reflex)
|
71
71
|
report_failed_basic_auth(reflex) if reflex.controller?
|
72
|
-
reflex.logger&.
|
72
|
+
reflex.logger&.log_all_operations
|
73
73
|
end
|
74
74
|
end
|
75
75
|
end
|
@@ -97,19 +97,19 @@ class StimulusReflex::Channel < StimulusReflex.configuration.parent_channel.cons
|
|
97
97
|
store.commit_session reflex.request, reflex.controller.response
|
98
98
|
rescue => exception
|
99
99
|
error = exception_with_backtrace(exception)
|
100
|
-
|
100
|
+
reflex.logger&.error "\e[31mFailed to commit session! #{error[:message]}\e[0m\n#{error[:backtrace]}"
|
101
101
|
end
|
102
102
|
|
103
103
|
def report_failed_basic_auth(reflex)
|
104
104
|
if reflex.controller.response.status == 401
|
105
|
-
|
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"
|
106
106
|
end
|
107
107
|
end
|
108
108
|
|
109
109
|
def exception_with_backtrace(exception)
|
110
110
|
{
|
111
111
|
message: exception.to_s,
|
112
|
-
backtrace: exception.backtrace.first,
|
112
|
+
backtrace: exception.backtrace.first.split(":in ")[0],
|
113
113
|
stack: exception.backtrace.join("\n")
|
114
114
|
}
|
115
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
|
@@ -25,6 +25,11 @@ StimulusReflex.configure do |config|
|
|
25
25
|
|
26
26
|
# config.parent_channel = "ApplicationCable::Channel"
|
27
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
|
+
|
28
33
|
# Customize server-side Reflex logging format, with optional colorization:
|
29
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
|
30
35
|
# Available colors: red, green, yellow, blue, magenta, cyan, white
|
@@ -26,33 +26,34 @@ module StimulusReflex
|
|
26
26
|
false
|
27
27
|
end
|
28
28
|
|
29
|
-
def
|
29
|
+
def halted(data: {})
|
30
30
|
operations << ["document", :dispatch_event]
|
31
31
|
cable_ready.dispatch_event(
|
32
|
-
name: "stimulus-reflex:
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
32
|
+
name: "stimulus-reflex:morph-halted",
|
33
|
+
payload: payload,
|
34
|
+
stimulus_reflex: data.merge(morph: to_sym)
|
35
|
+
).broadcast
|
36
|
+
end
|
37
|
+
|
38
|
+
def error(data: {}, body: nil)
|
39
|
+
operations << ["document", :dispatch_event]
|
40
|
+
cable_ready.dispatch_event(
|
41
|
+
name: "stimulus-reflex:morph-error",
|
42
|
+
payload: payload,
|
43
|
+
stimulus_reflex: data.merge(morph: to_sym),
|
44
|
+
body: body&.to_s
|
45
|
+
).broadcast
|
46
|
+
end
|
47
|
+
|
48
|
+
# abstract methods to be implemented by subclasses
|
46
49
|
def broadcast(*args)
|
47
50
|
raise NotImplementedError
|
48
51
|
end
|
49
52
|
|
50
|
-
# abstract method to be implemented by subclasses
|
51
53
|
def to_sym
|
52
54
|
raise NotImplementedError
|
53
55
|
end
|
54
56
|
|
55
|
-
# abstract method to be implemented by subclasses
|
56
57
|
def to_s
|
57
58
|
raise NotImplementedError
|
58
59
|
end
|
@@ -3,7 +3,12 @@
|
|
3
3
|
module StimulusReflex
|
4
4
|
class NothingBroadcaster < Broadcaster
|
5
5
|
def broadcast(_, data)
|
6
|
-
|
6
|
+
operations << ["document", :dispatch_event]
|
7
|
+
cable_ready.dispatch_event(
|
8
|
+
name: "stimulus-reflex:morph-nothing",
|
9
|
+
payload: payload,
|
10
|
+
stimulus_reflex: data.merge(morph: to_sym)
|
11
|
+
).broadcast
|
7
12
|
end
|
8
13
|
|
9
14
|
def nothing?
|
@@ -19,9 +19,7 @@ module StimulusReflex
|
|
19
19
|
payload: payload,
|
20
20
|
children_only: true,
|
21
21
|
permanent_attribute_name: permanent_attribute_name,
|
22
|
-
stimulus_reflex: data.merge(
|
23
|
-
morph: to_sym
|
24
|
-
})
|
22
|
+
stimulus_reflex: data.merge(morph: to_sym)
|
25
23
|
)
|
26
24
|
end
|
27
25
|
cable_ready.broadcast
|