cable_ready 4.2.0 → 4.4.0.pre0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +294 -0
- data/Gemfile.lock +104 -72
- data/README.md +1 -1
- data/Rakefile +6 -0
- data/cable_ready.gemspec +4 -2
- data/lib/cable_ready/broadcaster.rb +5 -1
- data/lib/cable_ready/channel.rb +18 -213
- data/lib/cable_ready/channels.rb +64 -7
- data/lib/cable_ready/version.rb +1 -1
- metadata +39 -11
- data/yarn.lock +0 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f9e80c88ee4b5f489f4dae10d4fa4928ec1f2fe122045e079edfb60b67671c17
|
4
|
+
data.tar.gz: 1785e8a0e3e44eb48c07c8dd5d78de0e7ccce0de26578d8e1aec0a3145f32376
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 99a851b96f1ec3165e690b3c8aba93a1ffb39776092bce8972164912ea65de51e8a0ce91043507ca1750259000afac3f1f099e190537362f5bcd8a859134d9a3
|
7
|
+
data.tar.gz: 4cd74f4379d0e71ab516269df9cbd7804d673b77a5229f401c50cde36e2a4bed603db02e15b6487156f8e187510d8ed6dec76ee34691bd7bdb1c9b2b9f8eb595
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,294 @@
|
|
1
|
+
# Changelog
|
2
|
+
|
3
|
+
## [Unreleased](https://github.com/hopsoft/cable_ready/tree/HEAD)
|
4
|
+
|
5
|
+
[Full Changelog](https://github.com/hopsoft/cable_ready/compare/v4.3.0...HEAD)
|
6
|
+
|
7
|
+
**Implemented enhancements:**
|
8
|
+
|
9
|
+
- Add a shared mutex to avoid concurrency issues in Channels [\#65](https://github.com/hopsoft/cable_ready/pull/65) ([barrywoolgar](https://github.com/barrywoolgar))
|
10
|
+
|
11
|
+
**Closed issues:**
|
12
|
+
|
13
|
+
- Using morph with a document fragment appears to do a full replace instead of a morph [\#67](https://github.com/hopsoft/cable_ready/issues/67)
|
14
|
+
- documentation: Mention cable.yml adapter configuration [\#66](https://github.com/hopsoft/cable_ready/issues/66)
|
15
|
+
|
16
|
+
**Merged pull requests:**
|
17
|
+
|
18
|
+
- Provide an async perform method [\#63](https://github.com/hopsoft/cable_ready/pull/63) ([julianrubisch](https://github.com/julianrubisch))
|
19
|
+
- Add braces to hash parameter to remove warning [\#61](https://github.com/hopsoft/cable_ready/pull/61) ([dabit](https://github.com/dabit))
|
20
|
+
- only pass inner html if childrenOnly is false [\#58](https://github.com/hopsoft/cable_ready/pull/58) ([joshleblanc](https://github.com/joshleblanc))
|
21
|
+
|
22
|
+
## [v4.3.0](https://github.com/hopsoft/cable_ready/tree/v4.3.0) (2020-07-02)
|
23
|
+
|
24
|
+
[Full Changelog](https://github.com/hopsoft/cable_ready/compare/v4.3.0.pre2...v4.3.0)
|
25
|
+
|
26
|
+
## [v4.3.0.pre2](https://github.com/hopsoft/cable_ready/tree/v4.3.0.pre2) (2020-06-27)
|
27
|
+
|
28
|
+
[Full Changelog](https://github.com/hopsoft/cable_ready/compare/v4.3.0-pre1...v4.3.0.pre2)
|
29
|
+
|
30
|
+
**Implemented enhancements:**
|
31
|
+
|
32
|
+
- Notifications [\#55](https://github.com/hopsoft/cable_ready/pull/55) ([leastbad](https://github.com/leastbad))
|
33
|
+
|
34
|
+
**Closed issues:**
|
35
|
+
|
36
|
+
- current\_user concerns? [\#54](https://github.com/hopsoft/cable_ready/issues/54)
|
37
|
+
- Update documentation [\#52](https://github.com/hopsoft/cable_ready/issues/52)
|
38
|
+
|
39
|
+
**Merged pull requests:**
|
40
|
+
|
41
|
+
- Bump rack from 2.2.2 to 2.2.3 [\#57](https://github.com/hopsoft/cable_ready/pull/57) ([dependabot[bot]](https://github.com/apps/dependabot))
|
42
|
+
- Bump actionpack from 6.0.3.1 to 6.0.3.2 [\#56](https://github.com/hopsoft/cable_ready/pull/56) ([dependabot[bot]](https://github.com/apps/dependabot))
|
43
|
+
|
44
|
+
## [v4.3.0-pre1](https://github.com/hopsoft/cable_ready/tree/v4.3.0-pre1) (2020-06-15)
|
45
|
+
|
46
|
+
[Full Changelog](https://github.com/hopsoft/cable_ready/compare/v4.3.0.pre1...v4.3.0-pre1)
|
47
|
+
|
48
|
+
## [v4.3.0.pre1](https://github.com/hopsoft/cable_ready/tree/v4.3.0.pre1) (2020-06-15)
|
49
|
+
|
50
|
+
[Full Changelog](https://github.com/hopsoft/cable_ready/compare/v4.3.0.pre0...v4.3.0.pre1)
|
51
|
+
|
52
|
+
**Merged pull requests:**
|
53
|
+
|
54
|
+
- text\_content is missing from 4.3.0.pre0 [\#53](https://github.com/hopsoft/cable_ready/pull/53) ([leastbad](https://github.com/leastbad))
|
55
|
+
|
56
|
+
## [v4.3.0.pre0](https://github.com/hopsoft/cable_ready/tree/v4.3.0.pre0) (2020-06-13)
|
57
|
+
|
58
|
+
[Full Changelog](https://github.com/hopsoft/cable_ready/compare/v4.2.0...v4.3.0.pre0)
|
59
|
+
|
60
|
+
**Implemented enhancements:**
|
61
|
+
|
62
|
+
- Make DOMOperations extendable [\#44](https://github.com/hopsoft/cable_ready/pull/44) ([n-rodriguez](https://github.com/n-rodriguez))
|
63
|
+
- broadcast\_to method [\#38](https://github.com/hopsoft/cable_ready/pull/38) ([leastbad](https://github.com/leastbad))
|
64
|
+
|
65
|
+
**Closed issues:**
|
66
|
+
|
67
|
+
- Make JS DOMOperations extendable [\#43](https://github.com/hopsoft/cable_ready/issues/43)
|
68
|
+
|
69
|
+
**Merged pull requests:**
|
70
|
+
|
71
|
+
- Dom id signature fix [\#51](https://github.com/hopsoft/cable_ready/pull/51) ([leastbad](https://github.com/leastbad))
|
72
|
+
- add dom\_id helper [\#50](https://github.com/hopsoft/cable_ready/pull/50) ([leastbad](https://github.com/leastbad))
|
73
|
+
- Support for multiple CSS classes. [\#49](https://github.com/hopsoft/cable_ready/pull/49) ([sarriagada](https://github.com/sarriagada))
|
74
|
+
- Make morph emit after event [\#48](https://github.com/hopsoft/cable_ready/pull/48) ([julianrubisch](https://github.com/julianrubisch))
|
75
|
+
- Customize operations via initializer [\#47](https://github.com/hopsoft/cable_ready/pull/47) ([leastbad](https://github.com/leastbad))
|
76
|
+
- Correct method 'outerHtml' to 'outer\_html' in documentation [\#39](https://github.com/hopsoft/cable_ready/pull/39) ([pskarlas](https://github.com/pskarlas))
|
77
|
+
- Add setStyles [\#37](https://github.com/hopsoft/cable_ready/pull/37) ([excid3](https://github.com/excid3))
|
78
|
+
- Fix typo in method name outerHTML -\> outer\_html [\#35](https://github.com/hopsoft/cable_ready/pull/35) ([back2war](https://github.com/back2war))
|
79
|
+
|
80
|
+
## [v4.2.0](https://github.com/hopsoft/cable_ready/tree/v4.2.0) (2020-06-02)
|
81
|
+
|
82
|
+
[Full Changelog](https://github.com/hopsoft/cable_ready/compare/v4.1.2...v4.2.0)
|
83
|
+
|
84
|
+
**Closed issues:**
|
85
|
+
|
86
|
+
- Question: Would you consider this intended behaviour? [\#41](https://github.com/hopsoft/cable_ready/issues/41)
|
87
|
+
|
88
|
+
**Merged pull requests:**
|
89
|
+
|
90
|
+
- after-outer-html emitted from new element [\#46](https://github.com/hopsoft/cable_ready/pull/46) ([leastbad](https://github.com/leastbad))
|
91
|
+
- Fix `outer\_html` notation [\#45](https://github.com/hopsoft/cable_ready/pull/45) ([julianrubisch](https://github.com/julianrubisch))
|
92
|
+
- Print out the selector for easier debugging perform errors [\#36](https://github.com/hopsoft/cable_ready/pull/36) ([excid3](https://github.com/excid3))
|
93
|
+
- add set\_property method to library [\#34](https://github.com/hopsoft/cable_ready/pull/34) ([leastbad](https://github.com/leastbad))
|
94
|
+
|
95
|
+
## [v4.1.2](https://github.com/hopsoft/cable_ready/tree/v4.1.2) (2020-04-27)
|
96
|
+
|
97
|
+
[Full Changelog](https://github.com/hopsoft/cable_ready/compare/v4.1.1...v4.1.2)
|
98
|
+
|
99
|
+
**Fixed bugs:**
|
100
|
+
|
101
|
+
- Ensure the active text input retains its value and focus after DOM mutations [\#33](https://github.com/hopsoft/cable_ready/pull/33) ([hopsoft](https://github.com/hopsoft))
|
102
|
+
|
103
|
+
## [v4.1.1](https://github.com/hopsoft/cable_ready/tree/v4.1.1) (2020-04-20)
|
104
|
+
|
105
|
+
[Full Changelog](https://github.com/hopsoft/cable_ready/compare/v4.1.0...v4.1.1)
|
106
|
+
|
107
|
+
**Implemented enhancements:**
|
108
|
+
|
109
|
+
- add set\_style method to library [\#32](https://github.com/hopsoft/cable_ready/pull/32) ([leastbad](https://github.com/leastbad))
|
110
|
+
|
111
|
+
**Merged pull requests:**
|
112
|
+
|
113
|
+
- Add funding file [\#31](https://github.com/hopsoft/cable_ready/pull/31) ([andrewmcodes](https://github.com/andrewmcodes))
|
114
|
+
- update README and package.json [\#30](https://github.com/hopsoft/cable_ready/pull/30) ([andrewmcodes](https://github.com/andrewmcodes))
|
115
|
+
|
116
|
+
## [v4.1.0](https://github.com/hopsoft/cable_ready/tree/v4.1.0) (2020-04-05)
|
117
|
+
|
118
|
+
[Full Changelog](https://github.com/hopsoft/cable_ready/compare/v4.0.9...v4.1.0)
|
119
|
+
|
120
|
+
**Merged pull requests:**
|
121
|
+
|
122
|
+
- Bump acorn from 7.1.0 to 7.1.1 in /javascript [\#29](https://github.com/hopsoft/cable_ready/pull/29) ([dependabot[bot]](https://github.com/apps/dependabot))
|
123
|
+
- Set cookie support [\#28](https://github.com/hopsoft/cable_ready/pull/28) ([hopsoft](https://github.com/hopsoft))
|
124
|
+
- README.md: Fix typo [\#27](https://github.com/hopsoft/cable_ready/pull/27) ([henrik](https://github.com/henrik))
|
125
|
+
- Update event-dispatch.md [\#25](https://github.com/hopsoft/cable_ready/pull/25) ([leastbad](https://github.com/leastbad))
|
126
|
+
- Fix typo on Remove Css Class methods [\#24](https://github.com/hopsoft/cable_ready/pull/24) ([darkrubyist](https://github.com/darkrubyist))
|
127
|
+
|
128
|
+
## [v4.0.9](https://github.com/hopsoft/cable_ready/tree/v4.0.9) (2020-01-27)
|
129
|
+
|
130
|
+
[Full Changelog](https://github.com/hopsoft/cable_ready/compare/v4.0.8...v4.0.9)
|
131
|
+
|
132
|
+
**Merged pull requests:**
|
133
|
+
|
134
|
+
- Add support to ignore missing DOM elements via options parameter [\#23](https://github.com/hopsoft/cable_ready/pull/23) ([leastbad](https://github.com/leastbad))
|
135
|
+
- fix sporadic error - undefined method \<\< for nil, when adding operation [\#21](https://github.com/hopsoft/cable_ready/pull/21) ([szTheory](https://github.com/szTheory))
|
136
|
+
|
137
|
+
## [v4.0.8](https://github.com/hopsoft/cable_ready/tree/v4.0.8) (2019-11-04)
|
138
|
+
|
139
|
+
[Full Changelog](https://github.com/hopsoft/cable_ready/compare/v4.0.7...v4.0.8)
|
140
|
+
|
141
|
+
**Merged pull requests:**
|
142
|
+
|
143
|
+
- Simplify logic to make it more understandable [\#20](https://github.com/hopsoft/cable_ready/pull/20) ([hopsoft](https://github.com/hopsoft))
|
144
|
+
|
145
|
+
## [v4.0.7](https://github.com/hopsoft/cable_ready/tree/v4.0.7) (2019-10-05)
|
146
|
+
|
147
|
+
[Full Changelog](https://github.com/hopsoft/cable_ready/compare/v4.0.6...v4.0.7)
|
148
|
+
|
149
|
+
**Merged pull requests:**
|
150
|
+
|
151
|
+
- Add gh actions [\#17](https://github.com/hopsoft/cable_ready/pull/17) ([andrewmcodes](https://github.com/andrewmcodes))
|
152
|
+
- Add Gitbook integration [\#16](https://github.com/hopsoft/cable_ready/pull/16) ([andrewmcodes](https://github.com/andrewmcodes))
|
153
|
+
|
154
|
+
## [v4.0.6](https://github.com/hopsoft/cable_ready/tree/v4.0.6) (2019-10-03)
|
155
|
+
|
156
|
+
[Full Changelog](https://github.com/hopsoft/cable_ready/compare/v4.0.5...v4.0.6)
|
157
|
+
|
158
|
+
**Implemented enhancements:**
|
159
|
+
|
160
|
+
- Add support for redirect/visit [\#10](https://github.com/hopsoft/cable_ready/issues/10)
|
161
|
+
|
162
|
+
**Merged pull requests:**
|
163
|
+
|
164
|
+
- Update to format with prettier-standard [\#15](https://github.com/hopsoft/cable_ready/pull/15) ([hopsoft](https://github.com/hopsoft))
|
165
|
+
- Add support for permanent nodes [\#14](https://github.com/hopsoft/cable_ready/pull/14) ([andreaslillebo](https://github.com/andreaslillebo))
|
166
|
+
|
167
|
+
## [v4.0.5](https://github.com/hopsoft/cable_ready/tree/v4.0.5) (2019-09-20)
|
168
|
+
|
169
|
+
[Full Changelog](https://github.com/hopsoft/cable_ready/compare/v4.0.4...v4.0.5)
|
170
|
+
|
171
|
+
**Merged pull requests:**
|
172
|
+
|
173
|
+
- Hopsoft/bubble [\#13](https://github.com/hopsoft/cable_ready/pull/13) ([hopsoft](https://github.com/hopsoft))
|
174
|
+
|
175
|
+
## [v4.0.4](https://github.com/hopsoft/cable_ready/tree/v4.0.4) (2019-09-19)
|
176
|
+
|
177
|
+
[Full Changelog](https://github.com/hopsoft/cable_ready/compare/v4.0.3...v4.0.4)
|
178
|
+
|
179
|
+
**Merged pull requests:**
|
180
|
+
|
181
|
+
- Refactor how events are managed [\#12](https://github.com/hopsoft/cable_ready/pull/12) ([hopsoft](https://github.com/hopsoft))
|
182
|
+
- Added support for XPath selectors [\#11](https://github.com/hopsoft/cable_ready/pull/11) ([leastbad](https://github.com/leastbad))
|
183
|
+
|
184
|
+
## [v4.0.3](https://github.com/hopsoft/cable_ready/tree/v4.0.3) (2019-08-17)
|
185
|
+
|
186
|
+
[Full Changelog](https://github.com/hopsoft/cable_ready/compare/v4.0.2...v4.0.3)
|
187
|
+
|
188
|
+
## [v4.0.2](https://github.com/hopsoft/cable_ready/tree/v4.0.2) (2019-08-10)
|
189
|
+
|
190
|
+
[Full Changelog](https://github.com/hopsoft/cable_ready/compare/v4.0.1...v4.0.2)
|
191
|
+
|
192
|
+
## [v4.0.1](https://github.com/hopsoft/cable_ready/tree/v4.0.1) (2019-08-10)
|
193
|
+
|
194
|
+
[Full Changelog](https://github.com/hopsoft/cable_ready/compare/v4.0.0...v4.0.1)
|
195
|
+
|
196
|
+
**Merged pull requests:**
|
197
|
+
|
198
|
+
- Merge JavaScript NPM package into this repo [\#9](https://github.com/hopsoft/cable_ready/pull/9) ([hopsoft](https://github.com/hopsoft))
|
199
|
+
|
200
|
+
## [v4.0.0](https://github.com/hopsoft/cable_ready/tree/v4.0.0) (2019-08-09)
|
201
|
+
|
202
|
+
[Full Changelog](https://github.com/hopsoft/cable_ready/compare/v3.0.1...v4.0.0)
|
203
|
+
|
204
|
+
## [v3.0.1](https://github.com/hopsoft/cable_ready/tree/v3.0.1) (2019-05-13)
|
205
|
+
|
206
|
+
[Full Changelog](https://github.com/hopsoft/cable_ready/compare/v3.0.0...v3.0.1)
|
207
|
+
|
208
|
+
## [v3.0.0](https://github.com/hopsoft/cable_ready/tree/v3.0.0) (2019-03-25)
|
209
|
+
|
210
|
+
[Full Changelog](https://github.com/hopsoft/cable_ready/compare/v2.0.8...v3.0.0)
|
211
|
+
|
212
|
+
**Merged pull requests:**
|
213
|
+
|
214
|
+
- Use outerHTML instead of replace [\#8](https://github.com/hopsoft/cable_ready/pull/8) ([hopsoft](https://github.com/hopsoft))
|
215
|
+
|
216
|
+
## [v2.0.8](https://github.com/hopsoft/cable_ready/tree/v2.0.8) (2018-11-25)
|
217
|
+
|
218
|
+
[Full Changelog](https://github.com/hopsoft/cable_ready/compare/v2.0.7...v2.0.8)
|
219
|
+
|
220
|
+
**Merged pull requests:**
|
221
|
+
|
222
|
+
- Dispatch before/after events for DOM activity [\#7](https://github.com/hopsoft/cable_ready/pull/7) ([hopsoft](https://github.com/hopsoft))
|
223
|
+
|
224
|
+
## [v2.0.7](https://github.com/hopsoft/cable_ready/tree/v2.0.7) (2018-10-26)
|
225
|
+
|
226
|
+
[Full Changelog](https://github.com/hopsoft/cable_ready/compare/v2.0.6...v2.0.7)
|
227
|
+
|
228
|
+
## [v2.0.6](https://github.com/hopsoft/cable_ready/tree/v2.0.6) (2018-10-20)
|
229
|
+
|
230
|
+
[Full Changelog](https://github.com/hopsoft/cable_ready/compare/v2.0.5...v2.0.6)
|
231
|
+
|
232
|
+
## [v2.0.5](https://github.com/hopsoft/cable_ready/tree/v2.0.5) (2018-10-08)
|
233
|
+
|
234
|
+
[Full Changelog](https://github.com/hopsoft/cable_ready/compare/v2.0.4...v2.0.5)
|
235
|
+
|
236
|
+
**Merged pull requests:**
|
237
|
+
|
238
|
+
- Support morph option for childrenOnly [\#6](https://github.com/hopsoft/cable_ready/pull/6) ([hopsoft](https://github.com/hopsoft))
|
239
|
+
|
240
|
+
## [v2.0.4](https://github.com/hopsoft/cable_ready/tree/v2.0.4) (2017-11-09)
|
241
|
+
|
242
|
+
[Full Changelog](https://github.com/hopsoft/cable_ready/compare/v2.0.3...v2.0.4)
|
243
|
+
|
244
|
+
## [v2.0.3](https://github.com/hopsoft/cable_ready/tree/v2.0.3) (2017-11-06)
|
245
|
+
|
246
|
+
[Full Changelog](https://github.com/hopsoft/cable_ready/compare/v2.0.2...v2.0.3)
|
247
|
+
|
248
|
+
**Merged pull requests:**
|
249
|
+
|
250
|
+
- Compress HTML [\#5](https://github.com/hopsoft/cable_ready/pull/5) ([hopsoft](https://github.com/hopsoft))
|
251
|
+
|
252
|
+
## [v2.0.2](https://github.com/hopsoft/cable_ready/tree/v2.0.2) (2017-11-03)
|
253
|
+
|
254
|
+
[Full Changelog](https://github.com/hopsoft/cable_ready/compare/v2.0.1...v2.0.2)
|
255
|
+
|
256
|
+
**Merged pull requests:**
|
257
|
+
|
258
|
+
- Make morph a first class operation [\#4](https://github.com/hopsoft/cable_ready/pull/4) ([hopsoft](https://github.com/hopsoft))
|
259
|
+
|
260
|
+
## [v2.0.1](https://github.com/hopsoft/cable_ready/tree/v2.0.1) (2017-10-15)
|
261
|
+
|
262
|
+
[Full Changelog](https://github.com/hopsoft/cable_ready/compare/v2.0.0...v2.0.1)
|
263
|
+
|
264
|
+
## [v2.0.0](https://github.com/hopsoft/cable_ready/tree/v2.0.0) (2017-10-14)
|
265
|
+
|
266
|
+
[Full Changelog](https://github.com/hopsoft/cable_ready/compare/v1.1.0...v2.0.0)
|
267
|
+
|
268
|
+
**Merged pull requests:**
|
269
|
+
|
270
|
+
- Improved programmatic interface [\#3](https://github.com/hopsoft/cable_ready/pull/3) ([hopsoft](https://github.com/hopsoft))
|
271
|
+
|
272
|
+
## [v1.1.0](https://github.com/hopsoft/cable_ready/tree/v1.1.0) (2017-09-24)
|
273
|
+
|
274
|
+
[Full Changelog](https://github.com/hopsoft/cable_ready/compare/v1.0.0...v1.1.0)
|
275
|
+
|
276
|
+
**Closed issues:**
|
277
|
+
|
278
|
+
- FINISH IT!!! [\#1](https://github.com/hopsoft/cable_ready/issues/1)
|
279
|
+
|
280
|
+
**Merged pull requests:**
|
281
|
+
|
282
|
+
- Support more DOM operations/mutations [\#2](https://github.com/hopsoft/cable_ready/pull/2) ([hopsoft](https://github.com/hopsoft))
|
283
|
+
|
284
|
+
## [v1.0.0](https://github.com/hopsoft/cable_ready/tree/v1.0.0) (2017-09-20)
|
285
|
+
|
286
|
+
[Full Changelog](https://github.com/hopsoft/cable_ready/compare/v0.1.0...v1.0.0)
|
287
|
+
|
288
|
+
## [v0.1.0](https://github.com/hopsoft/cable_ready/tree/v0.1.0) (2017-05-19)
|
289
|
+
|
290
|
+
[Full Changelog](https://github.com/hopsoft/cable_ready/compare/e62800f06e2f436fc66de2b9840313ba1de349bc...v0.1.0)
|
291
|
+
|
292
|
+
|
293
|
+
|
294
|
+
\* *This Changelog was automatically generated by [github_changelog_generator](https://github.com/github-changelog-generator/github-changelog-generator)*
|
data/Gemfile.lock
CHANGED
@@ -1,80 +1,95 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
cable_ready (4.
|
4
|
+
cable_ready (4.4.0.pre0)
|
5
5
|
rails (>= 5.2)
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: https://rubygems.org/
|
9
9
|
specs:
|
10
|
-
actioncable (6.0.3.
|
11
|
-
actionpack (= 6.0.3.
|
10
|
+
actioncable (6.0.3.2)
|
11
|
+
actionpack (= 6.0.3.2)
|
12
12
|
nio4r (~> 2.0)
|
13
13
|
websocket-driver (>= 0.6.1)
|
14
|
-
actionmailbox (6.0.3.
|
15
|
-
actionpack (= 6.0.3.
|
16
|
-
activejob (= 6.0.3.
|
17
|
-
activerecord (= 6.0.3.
|
18
|
-
activestorage (= 6.0.3.
|
19
|
-
activesupport (= 6.0.3.
|
14
|
+
actionmailbox (6.0.3.2)
|
15
|
+
actionpack (= 6.0.3.2)
|
16
|
+
activejob (= 6.0.3.2)
|
17
|
+
activerecord (= 6.0.3.2)
|
18
|
+
activestorage (= 6.0.3.2)
|
19
|
+
activesupport (= 6.0.3.2)
|
20
20
|
mail (>= 2.7.1)
|
21
|
-
actionmailer (6.0.3.
|
22
|
-
actionpack (= 6.0.3.
|
23
|
-
actionview (= 6.0.3.
|
24
|
-
activejob (= 6.0.3.
|
21
|
+
actionmailer (6.0.3.2)
|
22
|
+
actionpack (= 6.0.3.2)
|
23
|
+
actionview (= 6.0.3.2)
|
24
|
+
activejob (= 6.0.3.2)
|
25
25
|
mail (~> 2.5, >= 2.5.4)
|
26
26
|
rails-dom-testing (~> 2.0)
|
27
|
-
actionpack (6.0.3.
|
28
|
-
actionview (= 6.0.3.
|
29
|
-
activesupport (= 6.0.3.
|
27
|
+
actionpack (6.0.3.2)
|
28
|
+
actionview (= 6.0.3.2)
|
29
|
+
activesupport (= 6.0.3.2)
|
30
30
|
rack (~> 2.0, >= 2.0.8)
|
31
31
|
rack-test (>= 0.6.3)
|
32
32
|
rails-dom-testing (~> 2.0)
|
33
33
|
rails-html-sanitizer (~> 1.0, >= 1.2.0)
|
34
|
-
actiontext (6.0.3.
|
35
|
-
actionpack (= 6.0.3.
|
36
|
-
activerecord (= 6.0.3.
|
37
|
-
activestorage (= 6.0.3.
|
38
|
-
activesupport (= 6.0.3.
|
34
|
+
actiontext (6.0.3.2)
|
35
|
+
actionpack (= 6.0.3.2)
|
36
|
+
activerecord (= 6.0.3.2)
|
37
|
+
activestorage (= 6.0.3.2)
|
38
|
+
activesupport (= 6.0.3.2)
|
39
39
|
nokogiri (>= 1.8.5)
|
40
|
-
actionview (6.0.3.
|
41
|
-
activesupport (= 6.0.3.
|
40
|
+
actionview (6.0.3.2)
|
41
|
+
activesupport (= 6.0.3.2)
|
42
42
|
builder (~> 3.1)
|
43
43
|
erubi (~> 1.4)
|
44
44
|
rails-dom-testing (~> 2.0)
|
45
45
|
rails-html-sanitizer (~> 1.1, >= 1.2.0)
|
46
|
-
activejob (6.0.3.
|
47
|
-
activesupport (= 6.0.3.
|
46
|
+
activejob (6.0.3.2)
|
47
|
+
activesupport (= 6.0.3.2)
|
48
48
|
globalid (>= 0.3.6)
|
49
|
-
activemodel (6.0.3.
|
50
|
-
activesupport (= 6.0.3.
|
51
|
-
activerecord (6.0.3.
|
52
|
-
activemodel (= 6.0.3.
|
53
|
-
activesupport (= 6.0.3.
|
54
|
-
activestorage (6.0.3.
|
55
|
-
actionpack (= 6.0.3.
|
56
|
-
activejob (= 6.0.3.
|
57
|
-
activerecord (= 6.0.3.
|
49
|
+
activemodel (6.0.3.2)
|
50
|
+
activesupport (= 6.0.3.2)
|
51
|
+
activerecord (6.0.3.2)
|
52
|
+
activemodel (= 6.0.3.2)
|
53
|
+
activesupport (= 6.0.3.2)
|
54
|
+
activestorage (6.0.3.2)
|
55
|
+
actionpack (= 6.0.3.2)
|
56
|
+
activejob (= 6.0.3.2)
|
57
|
+
activerecord (= 6.0.3.2)
|
58
58
|
marcel (~> 0.3.1)
|
59
|
-
activesupport (6.0.3.
|
59
|
+
activesupport (6.0.3.2)
|
60
60
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
61
61
|
i18n (>= 0.7, < 2)
|
62
62
|
minitest (~> 5.1)
|
63
63
|
tzinfo (~> 1.1)
|
64
64
|
zeitwerk (~> 2.2, >= 2.2.2)
|
65
|
-
|
65
|
+
addressable (2.7.0)
|
66
|
+
public_suffix (>= 2.0.2, < 5.0)
|
67
|
+
ast (2.4.1)
|
66
68
|
builder (3.2.4)
|
67
69
|
coderay (1.1.3)
|
68
|
-
concurrent-ruby (1.1.
|
70
|
+
concurrent-ruby (1.1.7)
|
69
71
|
crass (1.0.6)
|
70
72
|
erubi (1.9.0)
|
73
|
+
faraday (1.0.1)
|
74
|
+
multipart-post (>= 1.2, < 3)
|
75
|
+
faraday-http-cache (2.2.0)
|
76
|
+
faraday (>= 0.8)
|
77
|
+
github_changelog_generator (1.15.2)
|
78
|
+
activesupport
|
79
|
+
faraday-http-cache
|
80
|
+
multi_json
|
81
|
+
octokit (~> 4.6)
|
82
|
+
rainbow (>= 2.2.1)
|
83
|
+
rake (>= 10.0)
|
84
|
+
retriable (~> 3.0)
|
71
85
|
globalid (0.4.2)
|
72
86
|
activesupport (>= 4.2.0)
|
73
|
-
i18n (1.8.
|
87
|
+
i18n (1.8.5)
|
74
88
|
concurrent-ruby (~> 1.0)
|
75
|
-
loofah (2.
|
89
|
+
loofah (2.7.0)
|
76
90
|
crass (~> 1.0.2)
|
77
91
|
nokogiri (>= 1.5.9)
|
92
|
+
magic_frozen_string_literal (1.1.0)
|
78
93
|
mail (2.7.1)
|
79
94
|
mini_mime (>= 0.1.1)
|
80
95
|
marcel (0.3.3)
|
@@ -83,70 +98,85 @@ GEM
|
|
83
98
|
mimemagic (0.3.5)
|
84
99
|
mini_mime (1.0.2)
|
85
100
|
mini_portile2 (2.4.0)
|
86
|
-
minitest (5.14.
|
101
|
+
minitest (5.14.2)
|
102
|
+
multi_json (1.15.0)
|
103
|
+
multipart-post (2.1.1)
|
87
104
|
nio4r (2.5.2)
|
88
|
-
nokogiri (1.10.
|
105
|
+
nokogiri (1.10.10)
|
89
106
|
mini_portile2 (~> 2.4.0)
|
90
|
-
|
91
|
-
|
92
|
-
|
107
|
+
octokit (4.18.0)
|
108
|
+
faraday (>= 0.9)
|
109
|
+
sawyer (~> 0.8.0, >= 0.5.3)
|
110
|
+
parallel (1.19.2)
|
111
|
+
parser (2.7.1.4)
|
112
|
+
ast (~> 2.4.1)
|
93
113
|
pry (0.12.2)
|
94
114
|
coderay (~> 1.1.0)
|
95
115
|
method_source (~> 0.9.0)
|
96
116
|
pry-nav (0.3.0)
|
97
117
|
pry (>= 0.9.10, < 0.13.0)
|
98
|
-
|
118
|
+
public_suffix (4.0.5)
|
119
|
+
rack (2.2.3)
|
99
120
|
rack-test (1.1.0)
|
100
121
|
rack (>= 1.0, < 3)
|
101
|
-
rails (6.0.3.
|
102
|
-
actioncable (= 6.0.3.
|
103
|
-
actionmailbox (= 6.0.3.
|
104
|
-
actionmailer (= 6.0.3.
|
105
|
-
actionpack (= 6.0.3.
|
106
|
-
actiontext (= 6.0.3.
|
107
|
-
actionview (= 6.0.3.
|
108
|
-
activejob (= 6.0.3.
|
109
|
-
activemodel (= 6.0.3.
|
110
|
-
activerecord (= 6.0.3.
|
111
|
-
activestorage (= 6.0.3.
|
112
|
-
activesupport (= 6.0.3.
|
122
|
+
rails (6.0.3.2)
|
123
|
+
actioncable (= 6.0.3.2)
|
124
|
+
actionmailbox (= 6.0.3.2)
|
125
|
+
actionmailer (= 6.0.3.2)
|
126
|
+
actionpack (= 6.0.3.2)
|
127
|
+
actiontext (= 6.0.3.2)
|
128
|
+
actionview (= 6.0.3.2)
|
129
|
+
activejob (= 6.0.3.2)
|
130
|
+
activemodel (= 6.0.3.2)
|
131
|
+
activerecord (= 6.0.3.2)
|
132
|
+
activestorage (= 6.0.3.2)
|
133
|
+
activesupport (= 6.0.3.2)
|
113
134
|
bundler (>= 1.3.0)
|
114
|
-
railties (= 6.0.3.
|
135
|
+
railties (= 6.0.3.2)
|
115
136
|
sprockets-rails (>= 2.0.0)
|
116
137
|
rails-dom-testing (2.0.3)
|
117
138
|
activesupport (>= 4.2.0)
|
118
139
|
nokogiri (>= 1.6)
|
119
140
|
rails-html-sanitizer (1.3.0)
|
120
141
|
loofah (~> 2.3)
|
121
|
-
railties (6.0.3.
|
122
|
-
actionpack (= 6.0.3.
|
123
|
-
activesupport (= 6.0.3.
|
142
|
+
railties (6.0.3.2)
|
143
|
+
actionpack (= 6.0.3.2)
|
144
|
+
activesupport (= 6.0.3.2)
|
124
145
|
method_source
|
125
146
|
rake (>= 0.8.7)
|
126
147
|
thor (>= 0.20.3, < 2.0)
|
127
148
|
rainbow (3.0.0)
|
128
149
|
rake (13.0.1)
|
150
|
+
regexp_parser (1.7.1)
|
151
|
+
retriable (3.1.2)
|
129
152
|
rexml (3.2.4)
|
130
|
-
rubocop (0.
|
153
|
+
rubocop (0.89.1)
|
131
154
|
parallel (~> 1.10)
|
132
|
-
parser (>= 2.7.
|
155
|
+
parser (>= 2.7.1.1)
|
133
156
|
rainbow (>= 2.2.2, < 4.0)
|
157
|
+
regexp_parser (>= 1.7)
|
134
158
|
rexml
|
159
|
+
rubocop-ast (>= 0.3.0, < 1.0)
|
135
160
|
ruby-progressbar (~> 1.7)
|
136
161
|
unicode-display_width (>= 1.4.0, < 2.0)
|
137
|
-
rubocop-
|
138
|
-
|
162
|
+
rubocop-ast (0.3.0)
|
163
|
+
parser (>= 2.7.1.4)
|
164
|
+
rubocop-performance (1.7.1)
|
165
|
+
rubocop (>= 0.82.0)
|
139
166
|
ruby-progressbar (1.10.1)
|
140
|
-
|
167
|
+
sawyer (0.8.2)
|
168
|
+
addressable (>= 2.3.5)
|
169
|
+
faraday (> 0.8, < 2.0)
|
170
|
+
sprockets (4.0.2)
|
141
171
|
concurrent-ruby (~> 1.0)
|
142
172
|
rack (> 1, < 3)
|
143
173
|
sprockets-rails (3.2.1)
|
144
174
|
actionpack (>= 4.0)
|
145
175
|
activesupport (>= 4.0)
|
146
176
|
sprockets (>= 3.0.0)
|
147
|
-
standard (0.
|
148
|
-
rubocop (~> 0.
|
149
|
-
rubocop-performance (~> 1.
|
177
|
+
standard (0.5.2)
|
178
|
+
rubocop (~> 0.89.1)
|
179
|
+
rubocop-performance (~> 1.7.1)
|
150
180
|
standardrb (1.0.0)
|
151
181
|
standard
|
152
182
|
thor (1.0.1)
|
@@ -154,16 +184,18 @@ GEM
|
|
154
184
|
tzinfo (1.2.7)
|
155
185
|
thread_safe (~> 0.1)
|
156
186
|
unicode-display_width (1.7.0)
|
157
|
-
websocket-driver (0.7.
|
187
|
+
websocket-driver (0.7.3)
|
158
188
|
websocket-extensions (>= 0.1.0)
|
159
|
-
websocket-extensions (0.1.
|
160
|
-
zeitwerk (2.
|
189
|
+
websocket-extensions (0.1.5)
|
190
|
+
zeitwerk (2.4.0)
|
161
191
|
|
162
192
|
PLATFORMS
|
163
193
|
ruby
|
164
194
|
|
165
195
|
DEPENDENCIES
|
166
196
|
cable_ready!
|
197
|
+
github_changelog_generator
|
198
|
+
magic_frozen_string_literal
|
167
199
|
pry
|
168
200
|
pry-nav
|
169
201
|
rake
|
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-375-brightgreen.svg?style=flat" />
|
15
15
|
</a>
|
16
16
|
<a href="https://cableready.stimulusreflex.com" target="_blank">
|
17
17
|
<img alt="Documentation" src="https://img.shields.io/badge/documentation-yes-brightgreen.svg" />
|
data/Rakefile
CHANGED
@@ -1,9 +1,15 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require "bundler/gem_tasks"
|
4
|
+
require "github_changelog_generator/task"
|
4
5
|
|
5
6
|
task default: [:test]
|
6
7
|
|
7
8
|
task :test do
|
8
9
|
puts "Please write some tests..."
|
9
10
|
end
|
11
|
+
|
12
|
+
GitHubChangelogGenerator::RakeTask.new :changelog do |config|
|
13
|
+
config.user = "hopsoft"
|
14
|
+
config.project = "cable_ready"
|
15
|
+
end
|
data/cable_ready.gemspec
CHANGED
@@ -14,8 +14,10 @@ Gem::Specification.new do |gem|
|
|
14
14
|
|
15
15
|
gem.add_dependency "rails", ">= 5.2"
|
16
16
|
|
17
|
-
gem.add_development_dependency "
|
18
|
-
gem.add_development_dependency "
|
17
|
+
gem.add_development_dependency "github_changelog_generator"
|
18
|
+
gem.add_development_dependency "magic_frozen_string_literal"
|
19
19
|
gem.add_development_dependency "pry"
|
20
20
|
gem.add_development_dependency "pry-nav"
|
21
|
+
gem.add_development_dependency "rake"
|
22
|
+
gem.add_development_dependency "standardrb"
|
21
23
|
end
|
@@ -7,7 +7,11 @@ module CableReady
|
|
7
7
|
extend ::ActiveSupport::Concern
|
8
8
|
|
9
9
|
def cable_ready
|
10
|
-
|
10
|
+
CableReady::Channels.instance
|
11
|
+
end
|
12
|
+
|
13
|
+
def dom_id(record, prefix = nil)
|
14
|
+
"##{ActionView::RecordIdentifier.dom_id(record, prefix)}"
|
11
15
|
end
|
12
16
|
end
|
13
17
|
end
|
data/lib/cable_ready/channel.rb
CHANGED
@@ -2,234 +2,39 @@
|
|
2
2
|
|
3
3
|
module CableReady
|
4
4
|
class Channel
|
5
|
-
attr_reader :
|
5
|
+
attr_reader :identifier, :operations, :available_operations
|
6
6
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
# ...
|
15
|
-
# ]
|
16
|
-
#
|
17
|
-
# # DOM Events ..................................................................................................
|
18
|
-
#
|
19
|
-
# dispatch_event: [{
|
20
|
-
# name: "string",
|
21
|
-
# detail: "object",
|
22
|
-
# selector: "string",
|
23
|
-
# }, ...],
|
24
|
-
#
|
25
|
-
# # Element Mutations ...........................................................................................
|
26
|
-
#
|
27
|
-
# morph: [{
|
28
|
-
# selector: "string",
|
29
|
-
# html: "string"
|
30
|
-
# children_only: true|false,
|
31
|
-
# permanent_attribute_name: "string",
|
32
|
-
# focus_selector: "string",
|
33
|
-
# }, ...],
|
34
|
-
#
|
35
|
-
# inner_html: [{
|
36
|
-
# selector: "string",
|
37
|
-
# focus_selector: "string",
|
38
|
-
# html: "string"
|
39
|
-
# }, ...],
|
40
|
-
#
|
41
|
-
# outer_html: [{
|
42
|
-
# selector: "string",
|
43
|
-
# focus_selector: "string",
|
44
|
-
# html: "string"
|
45
|
-
# }, ...],
|
46
|
-
#
|
47
|
-
# text_content: [{
|
48
|
-
# selector: "string",
|
49
|
-
# text: "string"
|
50
|
-
# }, ...]
|
51
|
-
#
|
52
|
-
# insert_adjacent_html: [{
|
53
|
-
# selector: "string",
|
54
|
-
# focus_selector: "string",
|
55
|
-
# position: "string",
|
56
|
-
# html: "string"
|
57
|
-
# }, ...],
|
58
|
-
#
|
59
|
-
# insert_adjacent_text: [{
|
60
|
-
# selector: "string",
|
61
|
-
# position: "string",
|
62
|
-
# text: "string"
|
63
|
-
# }, ...],
|
64
|
-
#
|
65
|
-
# remove: [{
|
66
|
-
# selector: "string",
|
67
|
-
# focus_selector: "string,
|
68
|
-
# }, ...],
|
69
|
-
#
|
70
|
-
# set_property: [{
|
71
|
-
# name: "string",
|
72
|
-
# selector: "string",
|
73
|
-
# value: "string"
|
74
|
-
# }, ...],
|
75
|
-
#
|
76
|
-
# set_value: [{
|
77
|
-
# selector: "string",
|
78
|
-
# value: "string"
|
79
|
-
# }, ...],
|
80
|
-
#
|
81
|
-
# # Attribute Mutations .........................................................................................
|
82
|
-
#
|
83
|
-
# set_attribute: [{
|
84
|
-
# selector: "string",
|
85
|
-
# name: "string",
|
86
|
-
# value: "string"
|
87
|
-
# }, ...],
|
88
|
-
#
|
89
|
-
# remove_attribute: [{
|
90
|
-
# selector: "string",
|
91
|
-
# name: "string"
|
92
|
-
# }, ...],
|
93
|
-
#
|
94
|
-
# # CSS Class Mutations .........................................................................................
|
95
|
-
#
|
96
|
-
# add_css_class: [{
|
97
|
-
# selector: "string",
|
98
|
-
# name: "string"
|
99
|
-
# }, ...],
|
100
|
-
#
|
101
|
-
# remove_css_class: [{
|
102
|
-
# selector: "string",
|
103
|
-
# name: "string"
|
104
|
-
# }, ...],
|
105
|
-
#
|
106
|
-
# # Style Mutations ...........................................................................................
|
107
|
-
#
|
108
|
-
# set_style: [{
|
109
|
-
# selector: "string",
|
110
|
-
# name: "string",
|
111
|
-
# value: "string"
|
112
|
-
# }, ...],
|
113
|
-
#
|
114
|
-
# # Dataset Mutations ...........................................................................................
|
115
|
-
#
|
116
|
-
# set_dataset_property: [{
|
117
|
-
# selector: "string",
|
118
|
-
# name: "string",
|
119
|
-
# value: "string"
|
120
|
-
# }, ...],
|
121
|
-
# }
|
122
|
-
def initialize(name)
|
123
|
-
@name = name
|
124
|
-
@operations = stub
|
7
|
+
def initialize(identifier, available_operations)
|
8
|
+
@identifier = identifier
|
9
|
+
@available_operations = available_operations
|
10
|
+
reset
|
11
|
+
available_operations.each do |available_operation, implementation|
|
12
|
+
define_singleton_method available_operation, &implementation
|
13
|
+
end
|
125
14
|
end
|
126
15
|
|
127
|
-
def clear
|
128
|
-
@operations = stub
|
129
|
-
end
|
130
|
-
|
131
|
-
def broadcast
|
16
|
+
def broadcast(clear)
|
132
17
|
operations.select! { |_, list| list.present? }
|
133
18
|
operations.deep_transform_keys! { |key| key.to_s.camelize(:lower) }
|
134
|
-
ActionCable.server.broadcast
|
135
|
-
clear
|
136
|
-
end
|
137
|
-
|
138
|
-
def set_cookie(value)
|
139
|
-
add_operation(:set_cookie, {cookie: value})
|
140
|
-
end
|
141
|
-
|
142
|
-
def dispatch_event(options = {})
|
143
|
-
add_operation(:dispatch_event, options)
|
144
|
-
end
|
145
|
-
|
146
|
-
def morph(options = {})
|
147
|
-
add_operation(:morph, options)
|
148
|
-
end
|
149
|
-
|
150
|
-
def inner_html(options = {})
|
151
|
-
add_operation(:inner_html, options)
|
152
|
-
end
|
153
|
-
|
154
|
-
def outer_html(options = {})
|
155
|
-
add_operation(:outer_html, options)
|
156
|
-
end
|
157
|
-
|
158
|
-
def text_content(options = {})
|
159
|
-
add_operation(:text_content, options)
|
160
|
-
end
|
161
|
-
|
162
|
-
def insert_adjacent_html(options = {})
|
163
|
-
add_operation(:insert_adjacent_html, options)
|
164
|
-
end
|
165
|
-
|
166
|
-
def insert_adjacent_text(options = {})
|
167
|
-
add_operation(:insert_adjacent_text, options)
|
19
|
+
ActionCable.server.broadcast identifier, {"cableReady" => true, "operations" => operations}
|
20
|
+
reset if clear
|
168
21
|
end
|
169
22
|
|
170
|
-
def
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
add_operation(:set_property, options)
|
176
|
-
end
|
177
|
-
|
178
|
-
def set_value(options = {})
|
179
|
-
add_operation(:set_value, options)
|
180
|
-
end
|
181
|
-
|
182
|
-
def set_attribute(options = {})
|
183
|
-
add_operation(:set_attribute, options)
|
184
|
-
end
|
185
|
-
|
186
|
-
def remove_attribute(options = {})
|
187
|
-
add_operation(:remove_attribute, options)
|
188
|
-
end
|
189
|
-
|
190
|
-
def add_css_class(options = {})
|
191
|
-
add_operation(:add_css_class, options)
|
192
|
-
end
|
193
|
-
|
194
|
-
def remove_css_class(options = {})
|
195
|
-
add_operation(:remove_css_class, options)
|
196
|
-
end
|
197
|
-
|
198
|
-
def set_style(options = {})
|
199
|
-
add_operation(:set_style, options)
|
200
|
-
end
|
201
|
-
|
202
|
-
def set_dataset_property(options = {})
|
203
|
-
add_operation(:set_dataset_property, options)
|
23
|
+
def broadcast_to(model, clear)
|
24
|
+
operations.select! { |_, list| list.present? }
|
25
|
+
operations.deep_transform_keys! { |key| key.to_s.camelize(:lower) }
|
26
|
+
identifier.broadcast_to model, {"cableReady" => true, "operations" => operations}
|
27
|
+
reset if clear
|
204
28
|
end
|
205
29
|
|
206
30
|
private
|
207
31
|
|
208
32
|
def add_operation(key, options)
|
209
|
-
operations[key] ||= []
|
210
33
|
operations[key] << options
|
211
34
|
end
|
212
35
|
|
213
|
-
def
|
214
|
-
{
|
215
|
-
add_css_class: [],
|
216
|
-
dispatch_event: [],
|
217
|
-
inner_html: [],
|
218
|
-
insert_adjacent_html: [],
|
219
|
-
insert_adjacent_text: [],
|
220
|
-
morph: [],
|
221
|
-
outer_html: [],
|
222
|
-
remove: [],
|
223
|
-
remove_attribute: [],
|
224
|
-
remove_css_class: [],
|
225
|
-
set_attribute: [],
|
226
|
-
set_cookie: [],
|
227
|
-
set_dataset_property: [],
|
228
|
-
set_style: [],
|
229
|
-
set_property: [],
|
230
|
-
set_value: [],
|
231
|
-
text_content: []
|
232
|
-
}
|
36
|
+
def reset
|
37
|
+
@operations = Hash.new { |hash, operation| hash[operation] = [] }
|
233
38
|
end
|
234
39
|
end
|
235
40
|
end
|
data/lib/cable_ready/channels.rb
CHANGED
@@ -4,21 +4,78 @@ require_relative "channel"
|
|
4
4
|
|
5
5
|
module CableReady
|
6
6
|
class Channels
|
7
|
+
include Singleton
|
8
|
+
attr_accessor :operations
|
9
|
+
|
10
|
+
def self.configure
|
11
|
+
yield CableReady::Channels.instance if block_given?
|
12
|
+
end
|
13
|
+
|
7
14
|
def initialize
|
8
15
|
@channels = {}
|
16
|
+
@operations = {}
|
17
|
+
%i[
|
18
|
+
add_css_class
|
19
|
+
console_log
|
20
|
+
dispatch_event
|
21
|
+
inner_html
|
22
|
+
insert_adjacent_html
|
23
|
+
insert_adjacent_text
|
24
|
+
morph
|
25
|
+
notification
|
26
|
+
outer_html
|
27
|
+
remove
|
28
|
+
remove_attribute
|
29
|
+
remove_css_class
|
30
|
+
set_attribute
|
31
|
+
set_cookie
|
32
|
+
set_dataset_property
|
33
|
+
set_property
|
34
|
+
set_style
|
35
|
+
set_styles
|
36
|
+
set_value
|
37
|
+
text_content
|
38
|
+
].each do |operation|
|
39
|
+
add_operation operation
|
40
|
+
end
|
9
41
|
end
|
10
42
|
|
11
|
-
def
|
12
|
-
@
|
43
|
+
def add_operation(operation, &implementation)
|
44
|
+
@operations[operation] = implementation || ->(options = {}) { add_operation(operation, options) }
|
13
45
|
end
|
14
46
|
|
15
|
-
def
|
16
|
-
@channels
|
47
|
+
def [](identifier)
|
48
|
+
@channels[identifier] ||= CableReady::Channel.new(identifier, operations)
|
17
49
|
end
|
18
50
|
|
19
|
-
def broadcast
|
20
|
-
|
21
|
-
|
51
|
+
def broadcast(*identifiers, clear: true)
|
52
|
+
mutex.synchronize do
|
53
|
+
@channels.values
|
54
|
+
.reject { |channel| identifiers.any? && identifiers.exclude?(channel.identifier) }
|
55
|
+
.select { |channel| channel.identifier.is_a?(String) }
|
56
|
+
.tap do |channels|
|
57
|
+
channels.each { |channel| @channels[channel.identifier].broadcast(clear) }
|
58
|
+
channels.each { |channel| @channels.except!(channel.identifier) if clear }
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
def broadcast_to(model, *identifiers, clear: true)
|
64
|
+
mutex.synchronize do
|
65
|
+
@channels.values
|
66
|
+
.reject { |channel| identifiers.any? && identifiers.exclude?(channel.identifier) }
|
67
|
+
.reject { |channel| channel.identifier.is_a?(String) }
|
68
|
+
.tap do |channels|
|
69
|
+
channels.each { |channel| @channels[channel.identifier].broadcast_to(model, clear) }
|
70
|
+
channels.each { |channel| @channels.except!(channel.identifier) if clear }
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
private
|
76
|
+
|
77
|
+
def mutex
|
78
|
+
@mutex ||= Mutex.new
|
22
79
|
end
|
23
80
|
end
|
24
81
|
end
|
data/lib/cable_ready/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cable_ready
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.
|
4
|
+
version: 4.4.0.pre0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nathan Hopkins
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-09-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -25,7 +25,7 @@ dependencies:
|
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '5.2'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: github_changelog_generator
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - ">="
|
@@ -39,7 +39,7 @@ dependencies:
|
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
42
|
+
name: magic_frozen_string_literal
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - ">="
|
@@ -80,13 +80,42 @@ dependencies:
|
|
80
80
|
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
|
-
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rake
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: standardrb
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
description:
|
84
112
|
email:
|
85
113
|
- natehop@gmail.com
|
86
114
|
executables: []
|
87
115
|
extensions: []
|
88
116
|
extra_rdoc_files: []
|
89
117
|
files:
|
118
|
+
- CHANGELOG.md
|
90
119
|
- CODE_OF_CONDUCT.md
|
91
120
|
- Gemfile
|
92
121
|
- Gemfile.lock
|
@@ -104,12 +133,11 @@ files:
|
|
104
133
|
- lib/cable_ready/channels.rb
|
105
134
|
- lib/cable_ready/version.rb
|
106
135
|
- tags
|
107
|
-
- yarn.lock
|
108
136
|
homepage: https://github.com/hopsoft/cable_ready
|
109
137
|
licenses:
|
110
138
|
- MIT
|
111
139
|
metadata: {}
|
112
|
-
post_install_message:
|
140
|
+
post_install_message:
|
113
141
|
rdoc_options: []
|
114
142
|
require_paths:
|
115
143
|
- lib
|
@@ -120,12 +148,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
120
148
|
version: '0'
|
121
149
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
122
150
|
requirements:
|
123
|
-
- - "
|
151
|
+
- - ">"
|
124
152
|
- !ruby/object:Gem::Version
|
125
|
-
version:
|
153
|
+
version: 1.3.1
|
126
154
|
requirements: []
|
127
155
|
rubygems_version: 3.0.3
|
128
|
-
signing_key:
|
156
|
+
signing_key:
|
129
157
|
specification_version: 4
|
130
158
|
summary: Out-of-Band Server Triggered DOM Operations
|
131
159
|
test_files: []
|
data/yarn.lock
DELETED