stimulus_reflex 3.4.0 → 3.4.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +34 -3
- data/CODE_OF_CONDUCT.md +6 -0
- data/Gemfile.lock +172 -120
- data/README.md +3 -2
- data/app/channels/stimulus_reflex/channel.rb +5 -10
- data/lib/stimulus_reflex/cable_ready_channels.rb +9 -2
- data/lib/stimulus_reflex/callbacks.rb +48 -0
- data/lib/stimulus_reflex/logger.rb +6 -6
- data/lib/stimulus_reflex/reflex.rb +18 -42
- data/lib/stimulus_reflex/reflex_factory.rb +62 -0
- data/lib/stimulus_reflex/version.rb +1 -1
- data/lib/stimulus_reflex.rb +2 -0
- data/package.json +2 -2
- data/stimulus_reflex.gemspec +1 -1
- data/test/reflex_factory_test.rb +79 -0
- data/test/reflex_test.rb +1 -1
- data/test/test_helper.rb +34 -0
- data/yarn.lock +134 -131
- metadata +16 -17
- data/tags +0 -156
- data/test/tmp/app/reflexes/application_reflex.rb +0 -12
- data/test/tmp/app/reflexes/demo_reflex.rb +0 -34
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2c20bc83a1fd5adac26fb305aa6cee7e90f81082519428bc5b2d2907f300f121
|
4
|
+
data.tar.gz: f4f21bf47ebab3dcca9aea10ffe1211ba24d862fcd46c877745c0bbb7cb98e80
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 920a38e28bdff1331fc3a3ada0b68f361aab2fef1cd9d680dedf8f17748809853b5f61e1c10f70427135545daa4c581e0e8dcfe014c43b85cc52d14fa314de27
|
7
|
+
data.tar.gz: 230110002f7f182bbaddc3037fc042853f0189a2b6573882f9668eba3db2223084820462e7bd800b27384c7ebe9267119884c317b5c7ae6588923142e8ec5371
|
data/CHANGELOG.md
CHANGED
@@ -2,7 +2,38 @@
|
|
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...HEAD)
|
6
|
+
|
7
|
+
**Implemented enhancements:**
|
8
|
+
|
9
|
+
- controller element holds Reflex metadata [\#417](https://github.com/hopsoft/stimulus_reflex/pull/417) ([leastbad](https://github.com/leastbad))
|
10
|
+
|
11
|
+
**Fixed bugs:**
|
12
|
+
|
13
|
+
- life-cycle callbacks return correct element reference [\#431](https://github.com/hopsoft/stimulus_reflex/pull/431) ([leastbad](https://github.com/leastbad))
|
14
|
+
- encode form data for chars like '&' and '=' [\#418](https://github.com/hopsoft/stimulus_reflex/pull/418) ([RolandStuder](https://github.com/RolandStuder))
|
15
|
+
- Bug fix: Updating changelog generator to push to master, not main [\#416](https://github.com/hopsoft/stimulus_reflex/pull/416) ([MikeRogers0](https://github.com/MikeRogers0))
|
16
|
+
- Prefix dom\_id with hash/pound [\#410](https://github.com/hopsoft/stimulus_reflex/pull/410) ([hopsoft](https://github.com/hopsoft))
|
17
|
+
|
18
|
+
**Closed issues:**
|
19
|
+
|
20
|
+
- Form serialisation does not escape input values [\#430](https://github.com/hopsoft/stimulus_reflex/issues/430)
|
21
|
+
- dispatchEvent before morph in reflex actions [\#428](https://github.com/hopsoft/stimulus_reflex/issues/428)
|
22
|
+
- Multiple text inputs with the same name lose value in Reflex [\#425](https://github.com/hopsoft/stimulus_reflex/issues/425)
|
23
|
+
- Lifecycle events not being issued correctly [\#413](https://github.com/hopsoft/stimulus_reflex/issues/413)
|
24
|
+
- If the element no longer exists, try to find it. [\#412](https://github.com/hopsoft/stimulus_reflex/issues/412)
|
25
|
+
|
26
|
+
**Merged pull requests:**
|
27
|
+
|
28
|
+
- Fixes bug where multiple inputs with the same name lost element value [\#426](https://github.com/hopsoft/stimulus_reflex/pull/426) ([jonsgreen](https://github.com/jonsgreen))
|
29
|
+
- Update to work with mutatable CR config [\#421](https://github.com/hopsoft/stimulus_reflex/pull/421) ([hopsoft](https://github.com/hopsoft))
|
30
|
+
- Bump nokogiri from 1.10.10 to 1.11.1 [\#420](https://github.com/hopsoft/stimulus_reflex/pull/420) ([dependabot[bot]](https://github.com/apps/dependabot))
|
31
|
+
- Add matrix strategy to ruby tests [\#415](https://github.com/hopsoft/stimulus_reflex/pull/415) ([julianrubisch](https://github.com/julianrubisch))
|
32
|
+
- fix 'operartion' typo [\#411](https://github.com/hopsoft/stimulus_reflex/pull/411) ([marcoroth](https://github.com/marcoroth))
|
33
|
+
|
34
|
+
## [v3.4.0](https://github.com/hopsoft/stimulus_reflex/tree/v3.4.0) (2020-12-18)
|
35
|
+
|
36
|
+
[Full Changelog](https://github.com/hopsoft/stimulus_reflex/compare/v3.4.0.pre9...v3.4.0)
|
6
37
|
|
7
38
|
**Closed issues:**
|
8
39
|
|
@@ -70,7 +101,6 @@
|
|
70
101
|
- Update templates for new stage etc [\#390](https://github.com/hopsoft/stimulus_reflex/pull/390) ([leastbad](https://github.com/leastbad))
|
71
102
|
- reflexError and received refactor [\#389](https://github.com/hopsoft/stimulus_reflex/pull/389) ([leastbad](https://github.com/leastbad))
|
72
103
|
- add jQuery support to SR library events [\#388](https://github.com/hopsoft/stimulus_reflex/pull/388) ([leastbad](https://github.com/leastbad))
|
73
|
-
- dont exit in sanity checker on `stimulus\_reflex:install` [\#387](https://github.com/hopsoft/stimulus_reflex/pull/387) ([marcoroth](https://github.com/marcoroth))
|
74
104
|
- Allow `success` and `after` lifecycle methods on replaced elements [\#386](https://github.com/hopsoft/stimulus_reflex/pull/386) ([marcoroth](https://github.com/marcoroth))
|
75
105
|
- split SR operations from data.operations [\#385](https://github.com/hopsoft/stimulus_reflex/pull/385) ([leastbad](https://github.com/leastbad))
|
76
106
|
- don't show findElement warnings unless debugging [\#384](https://github.com/hopsoft/stimulus_reflex/pull/384) ([leastbad](https://github.com/leastbad))
|
@@ -87,6 +117,7 @@
|
|
87
117
|
|
88
118
|
**Merged pull requests:**
|
89
119
|
|
120
|
+
- dont exit in sanity checker on `stimulus\_reflex:install` [\#387](https://github.com/hopsoft/stimulus_reflex/pull/387) ([marcoroth](https://github.com/marcoroth))
|
90
121
|
- Move package.json to root of project [\#380](https://github.com/hopsoft/stimulus_reflex/pull/380) ([hopsoft](https://github.com/hopsoft))
|
91
122
|
- make element.reflexController a dictionary [\#379](https://github.com/hopsoft/stimulus_reflex/pull/379) ([existentialmutt](https://github.com/existentialmutt))
|
92
123
|
- fixed bug preventing callbacks for multiple morphs [\#378](https://github.com/hopsoft/stimulus_reflex/pull/378) ([leastbad](https://github.com/leastbad))
|
@@ -441,7 +472,6 @@
|
|
441
472
|
- Loosen Rails requirement to 5.2 with instructions [\#205](https://github.com/hopsoft/stimulus_reflex/pull/205) ([jasoncharnes](https://github.com/jasoncharnes))
|
442
473
|
- 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))
|
443
474
|
- Small typo/grammar fix in quickstart doc. [\#198](https://github.com/hopsoft/stimulus_reflex/pull/198) ([acoffman](https://github.com/acoffman))
|
444
|
-
- Add halted lifecycle event [\#193](https://github.com/hopsoft/stimulus_reflex/pull/193) ([websebdev](https://github.com/websebdev))
|
445
475
|
- 147 extract multiple checkbox values [\#175](https://github.com/hopsoft/stimulus_reflex/pull/175) ([julianrubisch](https://github.com/julianrubisch))
|
446
476
|
|
447
477
|
## [v3.2.1](https://github.com/hopsoft/stimulus_reflex/tree/v3.2.1) (2020-05-09)
|
@@ -493,6 +523,7 @@
|
|
493
523
|
|
494
524
|
**Merged pull requests:**
|
495
525
|
|
526
|
+
- Add halted lifecycle event [\#193](https://github.com/hopsoft/stimulus_reflex/pull/193) ([websebdev](https://github.com/websebdev))
|
496
527
|
- Some housekeeping [\#189](https://github.com/hopsoft/stimulus_reflex/pull/189) ([hopsoft](https://github.com/hopsoft))
|
497
528
|
- Allow to call stimulate without a reflex target [\#188](https://github.com/hopsoft/stimulus_reflex/pull/188) ([marcoroth](https://github.com/marcoroth))
|
498
529
|
- Fix bug in super documentation [\#174](https://github.com/hopsoft/stimulus_reflex/pull/174) ([silva96](https://github.com/silva96))
|
data/CODE_OF_CONDUCT.md
CHANGED
@@ -61,6 +61,12 @@ is deemed necessary and appropriate to the circumstances. The project team is
|
|
61
61
|
obligated to maintain confidentiality with regard to the reporter of an incident.
|
62
62
|
Further details of specific enforcement policies may be posted separately.
|
63
63
|
|
64
|
+
### General Policy
|
65
|
+
|
66
|
+
- 1st offense - user will be warned that they violated the CoC
|
67
|
+
- 2nd offense - user will be publicly flagged as a CoC violator
|
68
|
+
- 3rd offense - user will be banned from the community
|
69
|
+
|
64
70
|
Project maintainers who do not follow or enforce the Code of Conduct in good
|
65
71
|
faith may face temporary or permanent repercussions as determined by other
|
66
72
|
members of the project's leadership.
|
data/Gemfile.lock
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
stimulus_reflex (3.4.
|
5
|
-
cable_ready (
|
4
|
+
stimulus_reflex (3.4.2)
|
5
|
+
cable_ready (~> 4.5)
|
6
6
|
nokogiri
|
7
7
|
rack
|
8
8
|
rails (>= 5.2)
|
@@ -11,169 +11,221 @@ PATH
|
|
11
11
|
GEM
|
12
12
|
remote: https://rubygems.org/
|
13
13
|
specs:
|
14
|
-
actioncable (
|
15
|
-
actionpack (=
|
16
|
-
activesupport (=
|
14
|
+
actioncable (7.1.3.2)
|
15
|
+
actionpack (= 7.1.3.2)
|
16
|
+
activesupport (= 7.1.3.2)
|
17
17
|
nio4r (~> 2.0)
|
18
18
|
websocket-driver (>= 0.6.1)
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
19
|
+
zeitwerk (~> 2.6)
|
20
|
+
actionmailbox (7.1.3.2)
|
21
|
+
actionpack (= 7.1.3.2)
|
22
|
+
activejob (= 7.1.3.2)
|
23
|
+
activerecord (= 7.1.3.2)
|
24
|
+
activestorage (= 7.1.3.2)
|
25
|
+
activesupport (= 7.1.3.2)
|
25
26
|
mail (>= 2.7.1)
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
27
|
+
net-imap
|
28
|
+
net-pop
|
29
|
+
net-smtp
|
30
|
+
actionmailer (7.1.3.2)
|
31
|
+
actionpack (= 7.1.3.2)
|
32
|
+
actionview (= 7.1.3.2)
|
33
|
+
activejob (= 7.1.3.2)
|
34
|
+
activesupport (= 7.1.3.2)
|
31
35
|
mail (~> 2.5, >= 2.5.4)
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
36
|
+
net-imap
|
37
|
+
net-pop
|
38
|
+
net-smtp
|
39
|
+
rails-dom-testing (~> 2.2)
|
40
|
+
actionpack (7.1.3.2)
|
41
|
+
actionview (= 7.1.3.2)
|
42
|
+
activesupport (= 7.1.3.2)
|
43
|
+
nokogiri (>= 1.8.5)
|
44
|
+
racc
|
45
|
+
rack (>= 2.2.4)
|
46
|
+
rack-session (>= 1.0.1)
|
37
47
|
rack-test (>= 0.6.3)
|
38
|
-
rails-dom-testing (~> 2.
|
39
|
-
rails-html-sanitizer (~> 1.
|
40
|
-
actiontext (
|
41
|
-
actionpack (=
|
42
|
-
activerecord (=
|
43
|
-
activestorage (=
|
44
|
-
activesupport (=
|
48
|
+
rails-dom-testing (~> 2.2)
|
49
|
+
rails-html-sanitizer (~> 1.6)
|
50
|
+
actiontext (7.1.3.2)
|
51
|
+
actionpack (= 7.1.3.2)
|
52
|
+
activerecord (= 7.1.3.2)
|
53
|
+
activestorage (= 7.1.3.2)
|
54
|
+
activesupport (= 7.1.3.2)
|
55
|
+
globalid (>= 0.6.0)
|
45
56
|
nokogiri (>= 1.8.5)
|
46
|
-
actionview (
|
47
|
-
activesupport (=
|
57
|
+
actionview (7.1.3.2)
|
58
|
+
activesupport (= 7.1.3.2)
|
48
59
|
builder (~> 3.1)
|
49
|
-
erubi (~> 1.
|
50
|
-
rails-dom-testing (~> 2.
|
51
|
-
rails-html-sanitizer (~> 1.
|
52
|
-
activejob (
|
53
|
-
activesupport (=
|
60
|
+
erubi (~> 1.11)
|
61
|
+
rails-dom-testing (~> 2.2)
|
62
|
+
rails-html-sanitizer (~> 1.6)
|
63
|
+
activejob (7.1.3.2)
|
64
|
+
activesupport (= 7.1.3.2)
|
54
65
|
globalid (>= 0.3.6)
|
55
|
-
activemodel (
|
56
|
-
activesupport (=
|
57
|
-
activerecord (
|
58
|
-
activemodel (=
|
59
|
-
activesupport (=
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
activesupport (
|
66
|
+
activemodel (7.1.3.2)
|
67
|
+
activesupport (= 7.1.3.2)
|
68
|
+
activerecord (7.1.3.2)
|
69
|
+
activemodel (= 7.1.3.2)
|
70
|
+
activesupport (= 7.1.3.2)
|
71
|
+
timeout (>= 0.4.0)
|
72
|
+
activestorage (7.1.3.2)
|
73
|
+
actionpack (= 7.1.3.2)
|
74
|
+
activejob (= 7.1.3.2)
|
75
|
+
activerecord (= 7.1.3.2)
|
76
|
+
activesupport (= 7.1.3.2)
|
77
|
+
marcel (~> 1.0)
|
78
|
+
activesupport (7.1.3.2)
|
79
|
+
base64
|
80
|
+
bigdecimal
|
68
81
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
82
|
+
connection_pool (>= 2.2.5)
|
83
|
+
drb
|
69
84
|
i18n (>= 1.6, < 2)
|
70
85
|
minitest (>= 5.1)
|
86
|
+
mutex_m
|
71
87
|
tzinfo (~> 2.0)
|
72
|
-
|
73
|
-
|
88
|
+
ast (2.4.2)
|
89
|
+
base64 (0.2.0)
|
90
|
+
bigdecimal (3.1.6)
|
74
91
|
builder (3.2.4)
|
75
|
-
cable_ready (4.
|
92
|
+
cable_ready (4.5.0)
|
76
93
|
rails (>= 5.2)
|
94
|
+
thread-local (>= 1.1.0)
|
77
95
|
coderay (1.1.3)
|
78
|
-
concurrent-ruby (1.
|
96
|
+
concurrent-ruby (1.2.3)
|
97
|
+
connection_pool (2.4.1)
|
79
98
|
crass (1.0.6)
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
99
|
+
date (3.3.4)
|
100
|
+
drb (2.2.1)
|
101
|
+
erubi (1.12.0)
|
102
|
+
globalid (1.2.1)
|
103
|
+
activesupport (>= 6.1)
|
104
|
+
i18n (1.14.4)
|
84
105
|
concurrent-ruby (~> 1.0)
|
85
|
-
|
106
|
+
io-console (0.7.2)
|
107
|
+
irb (1.12.0)
|
108
|
+
rdoc
|
109
|
+
reline (>= 0.4.2)
|
110
|
+
loofah (2.22.0)
|
86
111
|
crass (~> 1.0.2)
|
87
|
-
nokogiri (>= 1.
|
88
|
-
mail (2.
|
112
|
+
nokogiri (>= 1.12.0)
|
113
|
+
mail (2.8.1)
|
89
114
|
mini_mime (>= 0.1.1)
|
90
|
-
|
91
|
-
|
115
|
+
net-imap
|
116
|
+
net-pop
|
117
|
+
net-smtp
|
118
|
+
marcel (1.0.4)
|
92
119
|
method_source (0.9.2)
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
120
|
+
mini_mime (1.1.5)
|
121
|
+
mini_portile2 (2.8.5)
|
122
|
+
minitest (5.22.2)
|
123
|
+
mutex_m (0.2.0)
|
124
|
+
net-imap (0.4.10)
|
125
|
+
date
|
126
|
+
net-protocol
|
127
|
+
net-pop (0.1.2)
|
128
|
+
net-protocol
|
129
|
+
net-protocol (0.2.2)
|
130
|
+
timeout
|
131
|
+
net-smtp (0.4.0.1)
|
132
|
+
net-protocol
|
133
|
+
nio4r (2.7.0)
|
134
|
+
nokogiri (1.16.2)
|
135
|
+
mini_portile2 (~> 2.8.2)
|
136
|
+
racc (~> 1.4)
|
100
137
|
parallel (1.20.1)
|
101
|
-
parser (
|
138
|
+
parser (3.0.0.0)
|
102
139
|
ast (~> 2.4.1)
|
103
140
|
pry (0.12.2)
|
104
141
|
coderay (~> 1.1.0)
|
105
142
|
method_source (~> 0.9.0)
|
106
143
|
pry-nav (0.3.0)
|
107
144
|
pry (>= 0.9.10, < 0.13.0)
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
145
|
+
psych (5.1.2)
|
146
|
+
stringio
|
147
|
+
racc (1.7.3)
|
148
|
+
rack (3.0.9.1)
|
149
|
+
rack-session (2.0.0)
|
150
|
+
rack (>= 3.0.0)
|
151
|
+
rack-test (2.1.0)
|
152
|
+
rack (>= 1.3)
|
153
|
+
rackup (2.1.0)
|
154
|
+
rack (>= 3)
|
155
|
+
webrick (~> 1.8)
|
156
|
+
rails (7.1.3.2)
|
157
|
+
actioncable (= 7.1.3.2)
|
158
|
+
actionmailbox (= 7.1.3.2)
|
159
|
+
actionmailer (= 7.1.3.2)
|
160
|
+
actionpack (= 7.1.3.2)
|
161
|
+
actiontext (= 7.1.3.2)
|
162
|
+
actionview (= 7.1.3.2)
|
163
|
+
activejob (= 7.1.3.2)
|
164
|
+
activemodel (= 7.1.3.2)
|
165
|
+
activerecord (= 7.1.3.2)
|
166
|
+
activestorage (= 7.1.3.2)
|
167
|
+
activesupport (= 7.1.3.2)
|
123
168
|
bundler (>= 1.15.0)
|
124
|
-
railties (=
|
125
|
-
|
126
|
-
|
127
|
-
|
169
|
+
railties (= 7.1.3.2)
|
170
|
+
rails-dom-testing (2.2.0)
|
171
|
+
activesupport (>= 5.0.0)
|
172
|
+
minitest
|
128
173
|
nokogiri (>= 1.6)
|
129
|
-
rails-html-sanitizer (1.
|
130
|
-
loofah (~> 2.
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
174
|
+
rails-html-sanitizer (1.6.0)
|
175
|
+
loofah (~> 2.21)
|
176
|
+
nokogiri (~> 1.14)
|
177
|
+
railties (7.1.3.2)
|
178
|
+
actionpack (= 7.1.3.2)
|
179
|
+
activesupport (= 7.1.3.2)
|
180
|
+
irb
|
181
|
+
rackup (>= 1.0.0)
|
182
|
+
rake (>= 12.2)
|
183
|
+
thor (~> 1.0, >= 1.2.2)
|
184
|
+
zeitwerk (~> 2.6)
|
137
185
|
rainbow (3.0.0)
|
138
|
-
rake (13.0.
|
139
|
-
|
140
|
-
|
186
|
+
rake (13.0.3)
|
187
|
+
rdoc (6.6.2)
|
188
|
+
psych (>= 4.0.0)
|
189
|
+
redis (5.1.0)
|
190
|
+
redis-client (>= 0.17.0)
|
191
|
+
redis-client (0.21.0)
|
192
|
+
connection_pool
|
193
|
+
regexp_parser (2.0.3)
|
194
|
+
reline (0.4.3)
|
195
|
+
io-console (~> 0.5)
|
141
196
|
rexml (3.2.4)
|
142
|
-
rubocop (1.
|
197
|
+
rubocop (1.7.0)
|
143
198
|
parallel (~> 1.10)
|
144
199
|
parser (>= 2.7.1.5)
|
145
200
|
rainbow (>= 2.2.2, < 4.0)
|
146
|
-
regexp_parser (>= 1.8)
|
201
|
+
regexp_parser (>= 1.8, < 3.0)
|
147
202
|
rexml
|
148
|
-
rubocop-ast (>= 1.
|
203
|
+
rubocop-ast (>= 1.2.0, < 2.0)
|
149
204
|
ruby-progressbar (~> 1.7)
|
150
205
|
unicode-display_width (>= 1.4.0, < 2.0)
|
151
|
-
rubocop-ast (1.
|
206
|
+
rubocop-ast (1.4.1)
|
152
207
|
parser (>= 2.7.1.5)
|
153
|
-
rubocop-performance (1.9.
|
208
|
+
rubocop-performance (1.9.2)
|
154
209
|
rubocop (>= 0.90.0, < 2.0)
|
155
210
|
rubocop-ast (>= 0.4.0)
|
156
|
-
ruby-progressbar (1.
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
sprockets-rails (3.2.2)
|
161
|
-
actionpack (>= 4.0)
|
162
|
-
activesupport (>= 4.0)
|
163
|
-
sprockets (>= 3.0.0)
|
164
|
-
standard (0.10.2)
|
165
|
-
rubocop (= 1.4.2)
|
166
|
-
rubocop-performance (= 1.9.1)
|
211
|
+
ruby-progressbar (1.11.0)
|
212
|
+
standard (0.11.0)
|
213
|
+
rubocop (= 1.7.0)
|
214
|
+
rubocop-performance (= 1.9.2)
|
167
215
|
standardrb (1.0.0)
|
168
216
|
standard
|
169
|
-
|
170
|
-
|
217
|
+
stringio (3.1.0)
|
218
|
+
thor (1.3.1)
|
219
|
+
thread-local (1.1.0)
|
220
|
+
timeout (0.4.1)
|
221
|
+
tzinfo (2.0.6)
|
171
222
|
concurrent-ruby (~> 1.0)
|
172
223
|
unicode-display_width (1.7.0)
|
173
|
-
|
224
|
+
webrick (1.8.1)
|
225
|
+
websocket-driver (0.7.6)
|
174
226
|
websocket-extensions (>= 0.1.0)
|
175
227
|
websocket-extensions (0.1.5)
|
176
|
-
zeitwerk (2.
|
228
|
+
zeitwerk (2.6.13)
|
177
229
|
|
178
230
|
PLATFORMS
|
179
231
|
ruby
|
@@ -187,4 +239,4 @@ DEPENDENCIES
|
|
187
239
|
stimulus_reflex!
|
188
240
|
|
189
241
|
BUNDLED WITH
|
190
|
-
2.
|
242
|
+
2.2.33
|
data/README.md
CHANGED
@@ -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-1726-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" />
|
@@ -65,6 +65,7 @@ This project strives to live up to the vision outlined in [The Rails Doctrine](h
|
|
65
65
|
|
66
66
|
- [StimulusReflex Documentation](https://docs.stimulusreflex.com)
|
67
67
|
- [CableReady Documentation](https://cableready.stimulusreflex.com)
|
68
|
+
- [StimulusReflex Cheatsheet](https://devhints.io/stimulus-reflex)
|
68
69
|
|
69
70
|
## ✨ Demos
|
70
71
|
|
@@ -74,7 +75,7 @@ This project strives to live up to the vision outlined in [The Rails Doctrine](h
|
|
74
75
|
|
75
76
|
## 👩👩👧 Discord Community
|
76
77
|
|
77
|
-
Please join over
|
78
|
+
Please join over 1000 of us on [Discord](https://discord.gg/XveN625) for support getting started, as well as active discussions around Rails, StimulusJS and CableReady.
|
78
79
|
|
79
80
|
![](https://img.shields.io/discord/629472241427415060)
|
80
81
|
|
@@ -20,9 +20,9 @@ class StimulusReflex::Channel < StimulusReflex.configuration.parent_channel.cons
|
|
20
20
|
selectors = (data["selectors"] || []).select(&:present?)
|
21
21
|
selectors = data["selectors"] = ["body"] if selectors.blank?
|
22
22
|
target = data["target"].to_s
|
23
|
-
|
24
|
-
|
25
|
-
|
23
|
+
factory = StimulusReflex::ReflexFactory.new(target)
|
24
|
+
reflex_class = factory.call
|
25
|
+
method_name = factory.method_name
|
26
26
|
arguments = (data["args"] || []).map { |arg| object_with_indifferent_access arg }
|
27
27
|
element = StimulusReflex::Element.new(data)
|
28
28
|
permanent_attribute_name = data["permanentAttributeName"]
|
@@ -31,7 +31,6 @@ class StimulusReflex::Channel < StimulusReflex.configuration.parent_channel.cons
|
|
31
31
|
|
32
32
|
begin
|
33
33
|
begin
|
34
|
-
reflex_class = reflex_name.constantize.tap { |klass| raise ArgumentError.new("#{reflex_name} is not a StimulusReflex::Reflex") unless is_reflex?(klass) }
|
35
34
|
reflex = reflex_class.new(self,
|
36
35
|
url: url,
|
37
36
|
element: element,
|
@@ -40,8 +39,8 @@ class StimulusReflex::Channel < StimulusReflex.configuration.parent_channel.cons
|
|
40
39
|
params: params,
|
41
40
|
client_attributes: {
|
42
41
|
reflex_id: data["reflexId"],
|
43
|
-
|
44
|
-
|
42
|
+
xpath_controller: data["xpathController"],
|
43
|
+
xpath_element: data["xpathElement"],
|
45
44
|
reflex_controller: data["reflexController"],
|
46
45
|
permanent_attribute_name: permanent_attribute_name
|
47
46
|
})
|
@@ -109,10 +108,6 @@ class StimulusReflex::Channel < StimulusReflex.configuration.parent_channel.cons
|
|
109
108
|
object
|
110
109
|
end
|
111
110
|
|
112
|
-
def is_reflex?(reflex_class)
|
113
|
-
reflex_class.ancestors.include? StimulusReflex::Reflex
|
114
|
-
end
|
115
|
-
|
116
111
|
def delegate_call_to_reflex(reflex, method_name, arguments = [])
|
117
112
|
method = reflex.method(method_name)
|
118
113
|
required_params = method.parameters.select { |(kind, _)| kind == :req }
|
@@ -2,8 +2,6 @@
|
|
2
2
|
|
3
3
|
module StimulusReflex
|
4
4
|
class CableReadyChannels
|
5
|
-
stimulus_reflex_channel_methods = CableReady::Channels.instance.operations.keys + [:broadcast, :broadcast_to]
|
6
|
-
delegate(*stimulus_reflex_channel_methods, to: "stimulus_reflex_channel")
|
7
5
|
delegate :[], to: "cable_ready_channels"
|
8
6
|
|
9
7
|
def initialize(stream_name)
|
@@ -17,5 +15,14 @@ module StimulusReflex
|
|
17
15
|
def stimulus_reflex_channel
|
18
16
|
CableReady::Channels.instance[@stream_name]
|
19
17
|
end
|
18
|
+
|
19
|
+
def method_missing(name, *args)
|
20
|
+
return stimulus_reflex_channel.public_send(name, *args) if stimulus_reflex_channel.respond_to?(name)
|
21
|
+
super
|
22
|
+
end
|
23
|
+
|
24
|
+
def respond_to_missing?(name, include_all)
|
25
|
+
stimulus_reflex_channel.respond_to?(name) || super
|
26
|
+
end
|
20
27
|
end
|
21
28
|
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
require "active_support/concern"
|
2
|
+
|
3
|
+
module StimulusReflex
|
4
|
+
module Callbacks
|
5
|
+
extend ActiveSupport::Concern
|
6
|
+
|
7
|
+
included do
|
8
|
+
include ActiveSupport::Callbacks
|
9
|
+
define_callbacks :process, skip_after_callbacks_if_terminated: true
|
10
|
+
end
|
11
|
+
|
12
|
+
class_methods do
|
13
|
+
def before_reflex(*args, &block)
|
14
|
+
add_callback(:before, *args, &block)
|
15
|
+
end
|
16
|
+
|
17
|
+
def after_reflex(*args, &block)
|
18
|
+
add_callback(:after, *args, &block)
|
19
|
+
end
|
20
|
+
|
21
|
+
def around_reflex(*args, &block)
|
22
|
+
add_callback(:around, *args, &block)
|
23
|
+
end
|
24
|
+
|
25
|
+
private
|
26
|
+
|
27
|
+
def add_callback(kind, *args, &block)
|
28
|
+
options = args.extract_options!
|
29
|
+
options.assert_valid_keys :if, :unless, :only, :except
|
30
|
+
set_callback(*[:process, kind, args, normalize_callback_options!(options)].flatten, &block)
|
31
|
+
end
|
32
|
+
|
33
|
+
def normalize_callback_options!(options)
|
34
|
+
normalize_callback_option! options, :only, :if
|
35
|
+
normalize_callback_option! options, :except, :unless
|
36
|
+
options
|
37
|
+
end
|
38
|
+
|
39
|
+
def normalize_callback_option!(options, from, to)
|
40
|
+
if (from = options.delete(from))
|
41
|
+
from_set = Array(from).map(&:to_s).to_set
|
42
|
+
from = proc { |reflex| from_set.include? reflex.method_name }
|
43
|
+
options[to] = Array(options[to]).unshift(from)
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
@@ -79,22 +79,22 @@ module StimulusReflex
|
|
79
79
|
Time.now.strftime("%Y-%m-%d %H:%M:%S")
|
80
80
|
end
|
81
81
|
|
82
|
-
def method_missing
|
83
|
-
return send(
|
82
|
+
def method_missing(name, *args)
|
83
|
+
return send(name) if private_instance_methods.include?(name.to_sym)
|
84
84
|
|
85
85
|
reflex.connection.identifiers.each do |identifier|
|
86
86
|
ident = reflex.connection.send(identifier)
|
87
|
-
return ident.send(
|
87
|
+
return ident.send(name) if ident.respond_to?(:attributes) && ident.attributes.key?(name.to_s)
|
88
88
|
end
|
89
89
|
"-"
|
90
90
|
end
|
91
91
|
|
92
|
-
def respond_to_missing?
|
93
|
-
return true if private_instance_methods.include?(
|
92
|
+
def respond_to_missing?(name, include_all)
|
93
|
+
return true if private_instance_methods.include?(name.to_sym)
|
94
94
|
|
95
95
|
reflex.connection.identifiers.each do |identifier|
|
96
96
|
ident = reflex.connection.send(identifier)
|
97
|
-
return true if ident.respond_to?(:attributes) && ident.attributes.key?(
|
97
|
+
return true if ident.respond_to?(:attributes) && ident.attributes.key?(name.to_s)
|
98
98
|
end
|
99
99
|
false
|
100
100
|
end
|