stimulus_reflex 3.5.0.pre9 → 3.5.0.pre10

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

Potentially problematic release.


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

Files changed (103) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +0 -1
  3. data/Gemfile.lock +122 -127
  4. data/README.md +10 -16
  5. data/app/assets/javascripts/stimulus_reflex.js +710 -505
  6. data/app/assets/javascripts/stimulus_reflex.min.js +1 -1
  7. data/app/assets/javascripts/stimulus_reflex.min.js.map +1 -1
  8. data/app/assets/javascripts/stimulus_reflex.umd.js +660 -500
  9. data/app/assets/javascripts/stimulus_reflex.umd.min.js +660 -500
  10. data/app/assets/javascripts/stimulus_reflex.umd.min.js.map +1 -1
  11. data/app/channels/stimulus_reflex/channel.rb +9 -7
  12. data/bin/console +0 -2
  13. data/bin/standardize +2 -1
  14. data/lib/generators/stimulus_reflex/stimulus_reflex_generator.rb +72 -7
  15. data/lib/generators/stimulus_reflex/templates/app/controllers/examples_controller.rb.tt +9 -0
  16. data/lib/generators/stimulus_reflex/templates/app/javascript/channels/consumer.js.tt +6 -0
  17. data/lib/generators/stimulus_reflex/templates/app/javascript/channels/index.js.esbuild.tt +4 -0
  18. data/lib/generators/stimulus_reflex/templates/app/javascript/channels/index.js.importmap.tt +2 -0
  19. data/lib/generators/stimulus_reflex/templates/app/javascript/channels/index.js.shakapacker.tt +5 -0
  20. data/lib/generators/stimulus_reflex/templates/app/javascript/channels/index.js.vite.tt +1 -0
  21. data/lib/generators/stimulus_reflex/templates/app/javascript/channels/index.js.webpacker.tt +5 -0
  22. data/lib/generators/stimulus_reflex/templates/app/javascript/config/cable_ready.js.tt +4 -0
  23. data/lib/generators/stimulus_reflex/templates/app/javascript/config/index.js.tt +2 -0
  24. data/lib/generators/stimulus_reflex/templates/app/javascript/config/mrujs.js.tt +9 -0
  25. data/lib/generators/stimulus_reflex/templates/app/javascript/config/stimulus_reflex.js.tt +5 -0
  26. data/lib/generators/stimulus_reflex/templates/app/javascript/controllers/%file_name%_controller.js.tt +141 -0
  27. data/lib/generators/stimulus_reflex/templates/app/javascript/controllers/application.js.tt +11 -0
  28. data/lib/generators/stimulus_reflex/templates/app/javascript/controllers/application_controller.js.tt +74 -0
  29. data/lib/generators/stimulus_reflex/templates/app/javascript/controllers/index.js.esbuild.tt +7 -0
  30. data/lib/generators/stimulus_reflex/templates/app/javascript/controllers/index.js.importmap.tt +5 -0
  31. data/lib/generators/stimulus_reflex/templates/app/javascript/controllers/index.js.shakapacker.tt +5 -0
  32. data/lib/generators/stimulus_reflex/templates/app/javascript/controllers/index.js.vite.tt +5 -0
  33. data/lib/generators/stimulus_reflex/templates/app/javascript/controllers/index.js.webpacker.tt +5 -0
  34. data/{test/tmp/app/reflexes/user_reflex.rb → lib/generators/stimulus_reflex/templates/app/reflexes/%file_name%_reflex.rb.tt} +38 -9
  35. data/lib/generators/stimulus_reflex/templates/app/reflexes/application_reflex.rb.tt +27 -0
  36. data/lib/generators/stimulus_reflex/templates/app/views/examples/show.html.erb.tt +207 -0
  37. data/lib/generators/stimulus_reflex/templates/config/initializers/cable_ready.rb +22 -0
  38. data/lib/generators/stimulus_reflex/templates/config/initializers/stimulus_reflex.rb +18 -13
  39. data/lib/generators/stimulus_reflex/templates/esbuild.config.mjs.tt +94 -0
  40. data/lib/install/action_cable.rb +155 -0
  41. data/lib/install/broadcaster.rb +90 -0
  42. data/lib/install/bundle.rb +56 -0
  43. data/lib/install/compression.rb +41 -0
  44. data/lib/install/config.rb +87 -0
  45. data/lib/install/development.rb +110 -0
  46. data/lib/install/esbuild.rb +114 -0
  47. data/lib/install/example.rb +22 -0
  48. data/lib/install/importmap.rb +133 -0
  49. data/lib/install/initializers.rb +25 -0
  50. data/lib/install/mrujs.rb +133 -0
  51. data/lib/install/npm_packages.rb +25 -0
  52. data/lib/install/reflexes.rb +25 -0
  53. data/lib/install/shakapacker.rb +64 -0
  54. data/lib/install/spring.rb +54 -0
  55. data/lib/install/updatable.rb +34 -0
  56. data/lib/install/vite.rb +64 -0
  57. data/lib/install/webpacker.rb +90 -0
  58. data/lib/install/yarn.rb +55 -0
  59. data/lib/stimulus_reflex/broadcasters/broadcaster.rb +15 -8
  60. data/lib/stimulus_reflex/broadcasters/page_broadcaster.rb +7 -8
  61. data/lib/stimulus_reflex/broadcasters/selector_broadcaster.rb +10 -10
  62. data/lib/stimulus_reflex/broadcasters/update.rb +3 -0
  63. data/lib/stimulus_reflex/cable_readiness.rb +29 -0
  64. data/lib/stimulus_reflex/cable_ready_channels.rb +5 -5
  65. data/lib/stimulus_reflex/callbacks.rb +17 -1
  66. data/lib/stimulus_reflex/concern_enhancer.rb +6 -4
  67. data/lib/stimulus_reflex/configuration.rb +12 -2
  68. data/lib/stimulus_reflex/dataset.rb +11 -1
  69. data/lib/stimulus_reflex/engine.rb +20 -9
  70. data/lib/stimulus_reflex/html/document.rb +59 -0
  71. data/lib/stimulus_reflex/html/document_fragment.rb +13 -0
  72. data/lib/stimulus_reflex/importmap.rb +3 -0
  73. data/lib/stimulus_reflex/installer.rb +274 -0
  74. data/lib/stimulus_reflex/open_struct_fix.rb +2 -0
  75. data/lib/stimulus_reflex/reflex.rb +25 -25
  76. data/lib/stimulus_reflex/reflex_data.rb +15 -3
  77. data/lib/stimulus_reflex/reflex_factory.rb +4 -2
  78. data/lib/stimulus_reflex/request_parameters.rb +2 -0
  79. data/lib/stimulus_reflex/utils/logger.rb +10 -0
  80. data/lib/stimulus_reflex/utils/sanity_checker.rb +8 -48
  81. data/lib/stimulus_reflex/version.rb +1 -1
  82. data/lib/stimulus_reflex.rb +2 -0
  83. data/lib/tasks/stimulus_reflex/stimulus_reflex.rake +252 -0
  84. data/package.json +34 -28
  85. data/{rollup.config.js → rollup.config.mjs} +8 -7
  86. data/stimulus_reflex.gemspec +16 -19
  87. data/yarn.lock +1320 -742
  88. metadata +124 -77
  89. data/LATEST +0 -1
  90. data/lib/generators/stimulus_reflex/initializer_generator.rb +0 -14
  91. data/test/broadcasters/broadcaster_test.rb +0 -11
  92. data/test/broadcasters/broadcaster_test_case.rb +0 -39
  93. data/test/broadcasters/nothing_broadcaster_test.rb +0 -31
  94. data/test/broadcasters/page_broadcaster_test.rb +0 -79
  95. data/test/broadcasters/selector_broadcaster_test.rb +0 -173
  96. data/test/callbacks_test.rb +0 -652
  97. data/test/concern_enhancer_test.rb +0 -54
  98. data/test/element_test.rb +0 -254
  99. data/test/generators/stimulus_reflex_generator_test.rb +0 -58
  100. data/test/reflex_test.rb +0 -43
  101. data/test/test_helper.rb +0 -71
  102. data/test/tmp/app/reflexes/application_reflex.rb +0 -12
  103. data/yarn-error.log +0 -4964
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stimulus_reflex
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.5.0.pre9
4
+ version: 3.5.0.pre10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nathan Hopkins
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-04-01 00:00:00.000000000 Z
11
+ date: 2023-02-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: actioncable
@@ -17,6 +17,9 @@ dependencies:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '5.2'
20
+ - - "<"
21
+ - !ruby/object:Gem::Version
22
+ version: '8'
20
23
  type: :runtime
21
24
  prerelease: false
22
25
  version_requirements: !ruby/object:Gem::Requirement
@@ -24,6 +27,9 @@ dependencies:
24
27
  - - ">="
25
28
  - !ruby/object:Gem::Version
26
29
  version: '5.2'
30
+ - - "<"
31
+ - !ruby/object:Gem::Version
32
+ version: '8'
27
33
  - !ruby/object:Gem::Dependency
28
34
  name: actionpack
29
35
  requirement: !ruby/object:Gem::Requirement
@@ -31,6 +37,9 @@ dependencies:
31
37
  - - ">="
32
38
  - !ruby/object:Gem::Version
33
39
  version: '5.2'
40
+ - - "<"
41
+ - !ruby/object:Gem::Version
42
+ version: '8'
34
43
  type: :runtime
35
44
  prerelease: false
36
45
  version_requirements: !ruby/object:Gem::Requirement
@@ -38,6 +47,9 @@ dependencies:
38
47
  - - ">="
39
48
  - !ruby/object:Gem::Version
40
49
  version: '5.2'
50
+ - - "<"
51
+ - !ruby/object:Gem::Version
52
+ version: '8'
41
53
  - !ruby/object:Gem::Dependency
42
54
  name: actionview
43
55
  requirement: !ruby/object:Gem::Requirement
@@ -45,6 +57,9 @@ dependencies:
45
57
  - - ">="
46
58
  - !ruby/object:Gem::Version
47
59
  version: '5.2'
60
+ - - "<"
61
+ - !ruby/object:Gem::Version
62
+ version: '8'
48
63
  type: :runtime
49
64
  prerelease: false
50
65
  version_requirements: !ruby/object:Gem::Requirement
@@ -52,6 +67,9 @@ dependencies:
52
67
  - - ">="
53
68
  - !ruby/object:Gem::Version
54
69
  version: '5.2'
70
+ - - "<"
71
+ - !ruby/object:Gem::Version
72
+ version: '8'
55
73
  - !ruby/object:Gem::Dependency
56
74
  name: activesupport
57
75
  requirement: !ruby/object:Gem::Requirement
@@ -59,6 +77,9 @@ dependencies:
59
77
  - - ">="
60
78
  - !ruby/object:Gem::Version
61
79
  version: '5.2'
80
+ - - "<"
81
+ - !ruby/object:Gem::Version
82
+ version: '8'
62
83
  type: :runtime
63
84
  prerelease: false
64
85
  version_requirements: !ruby/object:Gem::Requirement
@@ -66,6 +87,9 @@ dependencies:
66
87
  - - ">="
67
88
  - !ruby/object:Gem::Version
68
89
  version: '5.2'
90
+ - - "<"
91
+ - !ruby/object:Gem::Version
92
+ version: '8'
69
93
  - !ruby/object:Gem::Dependency
70
94
  name: railties
71
95
  requirement: !ruby/object:Gem::Requirement
@@ -73,6 +97,9 @@ dependencies:
73
97
  - - ">="
74
98
  - !ruby/object:Gem::Version
75
99
  version: '5.2'
100
+ - - "<"
101
+ - !ruby/object:Gem::Version
102
+ version: '8'
76
103
  type: :runtime
77
104
  prerelease: false
78
105
  version_requirements: !ruby/object:Gem::Requirement
@@ -80,62 +107,71 @@ dependencies:
80
107
  - - ">="
81
108
  - !ruby/object:Gem::Version
82
109
  version: '5.2'
110
+ - - "<"
111
+ - !ruby/object:Gem::Version
112
+ version: '8'
83
113
  - !ruby/object:Gem::Dependency
84
114
  name: cable_ready
85
115
  requirement: !ruby/object:Gem::Requirement
86
116
  requirements:
87
117
  - - ">="
88
118
  - !ruby/object:Gem::Version
89
- version: 5.0.0.pre9
119
+ version: 5.0.0.pre10
90
120
  type: :runtime
91
121
  prerelease: false
92
122
  version_requirements: !ruby/object:Gem::Requirement
93
123
  requirements:
94
124
  - - ">="
95
125
  - !ruby/object:Gem::Version
96
- version: 5.0.0.pre9
126
+ version: 5.0.0.pre10
97
127
  - !ruby/object:Gem::Dependency
98
128
  name: nokogiri
99
129
  requirement: !ruby/object:Gem::Requirement
100
130
  requirements:
101
- - - ">="
131
+ - - "~>"
102
132
  - !ruby/object:Gem::Version
103
- version: '0'
133
+ version: '1.0'
104
134
  type: :runtime
105
135
  prerelease: false
106
136
  version_requirements: !ruby/object:Gem::Requirement
107
137
  requirements:
108
- - - ">="
138
+ - - "~>"
109
139
  - !ruby/object:Gem::Version
110
- version: '0'
140
+ version: '1.0'
111
141
  - !ruby/object:Gem::Dependency
112
142
  name: rack
113
143
  requirement: !ruby/object:Gem::Requirement
114
144
  requirements:
115
- - - ">="
145
+ - - "~>"
116
146
  - !ruby/object:Gem::Version
117
- version: '0'
147
+ version: '2.0'
118
148
  type: :runtime
119
149
  prerelease: false
120
150
  version_requirements: !ruby/object:Gem::Requirement
121
151
  requirements:
122
- - - ">="
152
+ - - "~>"
123
153
  - !ruby/object:Gem::Version
124
- version: '0'
154
+ version: '2.0'
125
155
  - !ruby/object:Gem::Dependency
126
156
  name: redis
127
157
  requirement: !ruby/object:Gem::Requirement
128
158
  requirements:
129
159
  - - ">="
130
160
  - !ruby/object:Gem::Version
131
- version: '0'
161
+ version: '4.0'
162
+ - - "<"
163
+ - !ruby/object:Gem::Version
164
+ version: '6.0'
132
165
  type: :runtime
133
166
  prerelease: false
134
167
  version_requirements: !ruby/object:Gem::Requirement
135
168
  requirements:
136
169
  - - ">="
137
170
  - !ruby/object:Gem::Version
138
- version: '0'
171
+ version: '4.0'
172
+ - - "<"
173
+ - !ruby/object:Gem::Version
174
+ version: '6.0'
139
175
  - !ruby/object:Gem::Dependency
140
176
  name: bundler
141
177
  requirement: !ruby/object:Gem::Requirement
@@ -151,47 +187,33 @@ dependencies:
151
187
  - !ruby/object:Gem::Version
152
188
  version: '2.0'
153
189
  - !ruby/object:Gem::Dependency
154
- name: mocha
190
+ name: magic_frozen_string_literal
155
191
  requirement: !ruby/object:Gem::Requirement
156
192
  requirements:
157
- - - ">="
158
- - !ruby/object:Gem::Version
159
- version: '0'
160
- type: :development
161
- prerelease: false
162
- version_requirements: !ruby/object:Gem::Requirement
163
- requirements:
164
- - - ">="
165
- - !ruby/object:Gem::Version
166
- version: '0'
167
- - !ruby/object:Gem::Dependency
168
- name: pry
169
- requirement: !ruby/object:Gem::Requirement
170
- requirements:
171
- - - ">="
193
+ - - "~>"
172
194
  - !ruby/object:Gem::Version
173
- version: '0'
195
+ version: '1.2'
174
196
  type: :development
175
197
  prerelease: false
176
198
  version_requirements: !ruby/object:Gem::Requirement
177
199
  requirements:
178
- - - ">="
200
+ - - "~>"
179
201
  - !ruby/object:Gem::Version
180
- version: '0'
202
+ version: '1.2'
181
203
  - !ruby/object:Gem::Dependency
182
- name: pry-nav
204
+ name: mocha
183
205
  requirement: !ruby/object:Gem::Requirement
184
206
  requirements:
185
- - - ">="
207
+ - - "~>"
186
208
  - !ruby/object:Gem::Version
187
- version: '0'
209
+ version: '1.13'
188
210
  type: :development
189
211
  prerelease: false
190
212
  version_requirements: !ruby/object:Gem::Requirement
191
213
  requirements:
192
- - - ">="
214
+ - - "~>"
193
215
  - !ruby/object:Gem::Version
194
- version: '0'
216
+ version: '1.13'
195
217
  - !ruby/object:Gem::Dependency
196
218
  name: rails
197
219
  requirement: !ruby/object:Gem::Requirement
@@ -199,6 +221,9 @@ dependencies:
199
221
  - - ">="
200
222
  - !ruby/object:Gem::Version
201
223
  version: '5.2'
224
+ - - "<"
225
+ - !ruby/object:Gem::Version
226
+ version: '8'
202
227
  type: :development
203
228
  prerelease: false
204
229
  version_requirements: !ruby/object:Gem::Requirement
@@ -206,34 +231,37 @@ dependencies:
206
231
  - - ">="
207
232
  - !ruby/object:Gem::Version
208
233
  version: '5.2'
234
+ - - "<"
235
+ - !ruby/object:Gem::Version
236
+ version: '8'
209
237
  - !ruby/object:Gem::Dependency
210
238
  name: rake
211
239
  requirement: !ruby/object:Gem::Requirement
212
240
  requirements:
213
- - - ">="
241
+ - - "~>"
214
242
  - !ruby/object:Gem::Version
215
- version: '0'
243
+ version: '13.0'
216
244
  type: :development
217
245
  prerelease: false
218
246
  version_requirements: !ruby/object:Gem::Requirement
219
247
  requirements:
220
- - - ">="
248
+ - - "~>"
221
249
  - !ruby/object:Gem::Version
222
- version: '0'
250
+ version: '13.0'
223
251
  - !ruby/object:Gem::Dependency
224
- name: standardrb
252
+ name: standard
225
253
  requirement: !ruby/object:Gem::Requirement
226
254
  requirements:
227
255
  - - "~>"
228
256
  - !ruby/object:Gem::Version
229
- version: '1.0'
257
+ version: '1.24'
230
258
  type: :development
231
259
  prerelease: false
232
260
  version_requirements: !ruby/object:Gem::Requirement
233
261
  requirements:
234
262
  - - "~>"
235
263
  - !ruby/object:Gem::Version
236
- version: '1.0'
264
+ version: '1.24'
237
265
  description:
238
266
  email:
239
267
  - natehop@gmail.com
@@ -245,7 +273,6 @@ files:
245
273
  - CODE_OF_CONDUCT.md
246
274
  - Gemfile
247
275
  - Gemfile.lock
248
- - LATEST
249
276
  - LICENSE.txt
250
277
  - README.md
251
278
  - Rakefile
@@ -261,15 +288,58 @@ files:
261
288
  - bin/rake
262
289
  - bin/setup
263
290
  - bin/standardize
264
- - lib/generators/stimulus_reflex/initializer_generator.rb
265
291
  - lib/generators/stimulus_reflex/stimulus_reflex_generator.rb
292
+ - lib/generators/stimulus_reflex/templates/app/controllers/examples_controller.rb.tt
293
+ - lib/generators/stimulus_reflex/templates/app/javascript/channels/consumer.js.tt
294
+ - lib/generators/stimulus_reflex/templates/app/javascript/channels/index.js.esbuild.tt
295
+ - lib/generators/stimulus_reflex/templates/app/javascript/channels/index.js.importmap.tt
296
+ - lib/generators/stimulus_reflex/templates/app/javascript/channels/index.js.shakapacker.tt
297
+ - lib/generators/stimulus_reflex/templates/app/javascript/channels/index.js.vite.tt
298
+ - lib/generators/stimulus_reflex/templates/app/javascript/channels/index.js.webpacker.tt
299
+ - lib/generators/stimulus_reflex/templates/app/javascript/config/cable_ready.js.tt
300
+ - lib/generators/stimulus_reflex/templates/app/javascript/config/index.js.tt
301
+ - lib/generators/stimulus_reflex/templates/app/javascript/config/mrujs.js.tt
302
+ - lib/generators/stimulus_reflex/templates/app/javascript/config/stimulus_reflex.js.tt
303
+ - lib/generators/stimulus_reflex/templates/app/javascript/controllers/%file_name%_controller.js.tt
304
+ - lib/generators/stimulus_reflex/templates/app/javascript/controllers/application.js.tt
305
+ - lib/generators/stimulus_reflex/templates/app/javascript/controllers/application_controller.js.tt
306
+ - lib/generators/stimulus_reflex/templates/app/javascript/controllers/index.js.esbuild.tt
307
+ - lib/generators/stimulus_reflex/templates/app/javascript/controllers/index.js.importmap.tt
308
+ - lib/generators/stimulus_reflex/templates/app/javascript/controllers/index.js.shakapacker.tt
309
+ - lib/generators/stimulus_reflex/templates/app/javascript/controllers/index.js.vite.tt
310
+ - lib/generators/stimulus_reflex/templates/app/javascript/controllers/index.js.webpacker.tt
311
+ - lib/generators/stimulus_reflex/templates/app/reflexes/%file_name%_reflex.rb.tt
312
+ - lib/generators/stimulus_reflex/templates/app/reflexes/application_reflex.rb.tt
313
+ - lib/generators/stimulus_reflex/templates/app/views/examples/show.html.erb.tt
314
+ - lib/generators/stimulus_reflex/templates/config/initializers/cable_ready.rb
266
315
  - lib/generators/stimulus_reflex/templates/config/initializers/stimulus_reflex.rb
316
+ - lib/generators/stimulus_reflex/templates/esbuild.config.mjs.tt
317
+ - lib/install/action_cable.rb
318
+ - lib/install/broadcaster.rb
319
+ - lib/install/bundle.rb
320
+ - lib/install/compression.rb
321
+ - lib/install/config.rb
322
+ - lib/install/development.rb
323
+ - lib/install/esbuild.rb
324
+ - lib/install/example.rb
325
+ - lib/install/importmap.rb
326
+ - lib/install/initializers.rb
327
+ - lib/install/mrujs.rb
328
+ - lib/install/npm_packages.rb
329
+ - lib/install/reflexes.rb
330
+ - lib/install/shakapacker.rb
331
+ - lib/install/spring.rb
332
+ - lib/install/updatable.rb
333
+ - lib/install/vite.rb
334
+ - lib/install/webpacker.rb
335
+ - lib/install/yarn.rb
267
336
  - lib/stimulus_reflex.rb
268
337
  - lib/stimulus_reflex/broadcasters/broadcaster.rb
269
338
  - lib/stimulus_reflex/broadcasters/nothing_broadcaster.rb
270
339
  - lib/stimulus_reflex/broadcasters/page_broadcaster.rb
271
340
  - lib/stimulus_reflex/broadcasters/selector_broadcaster.rb
272
341
  - lib/stimulus_reflex/broadcasters/update.rb
342
+ - lib/stimulus_reflex/cable_readiness.rb
273
343
  - lib/stimulus_reflex/cable_ready_channels.rb
274
344
  - lib/stimulus_reflex/callbacks.rb
275
345
  - lib/stimulus_reflex/concern_enhancer.rb
@@ -277,7 +347,10 @@ files:
277
347
  - lib/stimulus_reflex/dataset.rb
278
348
  - lib/stimulus_reflex/element.rb
279
349
  - lib/stimulus_reflex/engine.rb
350
+ - lib/stimulus_reflex/html/document.rb
351
+ - lib/stimulus_reflex/html/document_fragment.rb
280
352
  - lib/stimulus_reflex/importmap.rb
353
+ - lib/stimulus_reflex/installer.rb
281
354
  - lib/stimulus_reflex/open_struct_fix.rb
282
355
  - lib/stimulus_reflex/policies/reflex_invocation_policy.rb
283
356
  - lib/stimulus_reflex/reflex.rb
@@ -289,24 +362,11 @@ files:
289
362
  - lib/stimulus_reflex/utils/logger.rb
290
363
  - lib/stimulus_reflex/utils/sanity_checker.rb
291
364
  - lib/stimulus_reflex/version.rb
365
+ - lib/tasks/stimulus_reflex/stimulus_reflex.rake
292
366
  - package.json
293
- - rollup.config.js
367
+ - rollup.config.mjs
294
368
  - stimulus_reflex.gemspec
295
- - test/broadcasters/broadcaster_test.rb
296
- - test/broadcasters/broadcaster_test_case.rb
297
- - test/broadcasters/nothing_broadcaster_test.rb
298
- - test/broadcasters/page_broadcaster_test.rb
299
- - test/broadcasters/selector_broadcaster_test.rb
300
- - test/callbacks_test.rb
301
- - test/concern_enhancer_test.rb
302
- - test/element_test.rb
303
- - test/generators/stimulus_reflex_generator_test.rb
304
- - test/reflex_test.rb
305
- - test/test_helper.rb
306
- - test/tmp/app/reflexes/application_reflex.rb
307
- - test/tmp/app/reflexes/user_reflex.rb
308
369
  - web-test-runner.config.mjs
309
- - yarn-error.log
310
370
  - yarn.lock
311
371
  homepage: https://github.com/stimulusreflex/stimulus_reflex
312
372
  licenses:
@@ -340,22 +400,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
340
400
  - !ruby/object:Gem::Version
341
401
  version: 1.3.1
342
402
  requirements: []
343
- rubygems_version: 3.3.3
403
+ rubygems_version: 3.4.1
344
404
  signing_key:
345
405
  specification_version: 4
346
406
  summary: Build reactive applications with the Rails tooling you already know and love.
347
- test_files:
348
- - test/broadcasters/broadcaster_test.rb
349
- - test/broadcasters/broadcaster_test_case.rb
350
- - test/broadcasters/nothing_broadcaster_test.rb
351
- - test/broadcasters/page_broadcaster_test.rb
352
- - test/broadcasters/selector_broadcaster_test.rb
353
- - test/callbacks_test.rb
354
- - test/concern_enhancer_test.rb
355
- - test/element_test.rb
356
- - test/generators/stimulus_reflex_generator_test.rb
357
- - test/reflex_test.rb
358
- - test/test_helper.rb
359
- - test/tmp/app/reflexes/application_reflex.rb
360
- - test/tmp/app/reflexes/user_reflex.rb
407
+ test_files: []
361
408
  ...
data/LATEST DELETED
@@ -1 +0,0 @@
1
- 3.4.1
@@ -1,14 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "rails/generators"
4
-
5
- module StimulusReflex
6
- class InitializerGenerator < Rails::Generators::Base
7
- desc "Creates a StimulusReflex initializer in config/initializers"
8
- source_root File.expand_path("templates", __dir__)
9
-
10
- def copy_initializer_file
11
- copy_file "config/initializers/stimulus_reflex.rb"
12
- end
13
- end
14
- end
@@ -1,11 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative "broadcaster_test_case"
4
-
5
- class StimulusReflex::BroadcasterTest < StimulusReflex::BroadcasterTestCase
6
- test "raises a NotImplementedError if called directly" do
7
- broadcaster = StimulusReflex::Broadcaster.new(@reflex)
8
-
9
- assert_raises(NotImplementedError) { broadcaster.broadcast }
10
- end
11
- end
@@ -1,39 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative "../test_helper"
4
-
5
- class StimulusReflex::BroadcasterTestCase < ActionCable::Channel::TestCase
6
- tests StimulusReflex::Channel
7
-
8
- def assert_broadcast_on(stream, data, &block)
9
- serialized_msg = ActiveSupport::JSON.decode(ActiveSupport::JSON.encode(data))
10
-
11
- new_messages = broadcasts(stream)
12
- if block
13
- old_messages = new_messages
14
- clear_messages(stream)
15
-
16
- yield
17
- new_messages = broadcasts(stream)
18
- clear_messages(stream)
19
-
20
- (old_messages + new_messages).each { |m| pubsub_adapter.broadcast(stream, m) }
21
- end
22
-
23
- message = new_messages.find { |msg| ActiveSupport::JSON.decode(msg) == serialized_msg }
24
-
25
- unless message
26
- puts "\n\n#{ActiveSupport::JSON.decode(new_messages.first)}\n#{data}\n\n"
27
- end
28
-
29
- assert message, "No messages sent with #{data} to #{stream}"
30
- end
31
-
32
- setup do
33
- stub_connection(session_id: SecureRandom.uuid)
34
- def connection.env
35
- @env ||= {}
36
- end
37
- @reflex = StimulusReflex::Reflex.new(subscribe, url: "https://test.stimulusreflex.com", client_attributes: {reflex_id: "666", version: StimulusReflex::VERSION})
38
- end
39
- end
@@ -1,31 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative "broadcaster_test_case"
4
-
5
- class StimulusReflex::NothingBroadcasterTest < StimulusReflex::BroadcasterTestCase
6
- test "broadcasts a nothing morph when called" do
7
- broadcaster = StimulusReflex::NothingBroadcaster.new(@reflex)
8
-
9
- expected = {
10
- "cableReady" => true,
11
- "operations" => [
12
- {
13
- "name" => "stimulus-reflex:morph-nothing",
14
- "selector" => nil,
15
- "payload" => {},
16
- "stimulusReflex" => {
17
- "some" => "data",
18
- "morph" => "nothing"
19
- },
20
- "reflexId" => "666",
21
- "operation" => "dispatchEvent"
22
- }
23
- ],
24
- "version" => CableReady::VERSION
25
- }
26
-
27
- assert_broadcast_on @reflex.stream_name, expected do
28
- broadcaster.broadcast nil, {some: :data}
29
- end
30
- end
31
- end
@@ -1,79 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative "broadcaster_test_case"
4
-
5
- class StimulusReflex::PageBroadcasterTest < StimulusReflex::BroadcasterTestCase
6
- test "returns if the response html is empty" do
7
- broadcaster = StimulusReflex::PageBroadcaster.new(@reflex)
8
- broadcaster.broadcast(["#foo"], {some: :data})
9
- # TODO: figure out how to refute_broadcast_on
10
- end
11
-
12
- test "performs a page morph on body" do
13
- class << @reflex.controller.response
14
- def body
15
- "<html><head></head><body><div>New Content</div><div>Another Content</div></body></html>"
16
- end
17
- end
18
-
19
- broadcaster = StimulusReflex::PageBroadcaster.new(@reflex)
20
-
21
- expected = {
22
- "cableReady" => true,
23
- "operations" => [
24
- {
25
- "selector" => "body",
26
- "html" => "<div>New Content</div><div>Another Content</div>",
27
- "payload" => {},
28
- "childrenOnly" => true,
29
- "permanentAttributeName" => nil,
30
- "stimulusReflex" => {
31
- "some" => :data,
32
- "morph" => :page
33
- },
34
- "reflexId" => "666",
35
- "operation" => "morph"
36
- }
37
- ],
38
- "version" => CableReady::VERSION
39
- }
40
-
41
- assert_broadcast_on @reflex.stream_name, expected do
42
- broadcaster.broadcast(["body"], {some: :data})
43
- end
44
- end
45
-
46
- test "performs a page morph given an array of reflex root selectors" do
47
- class << @reflex.controller.response
48
- def body
49
- "<html><head></head><body><div id=\"foo\">New Content</div></body></html>"
50
- end
51
- end
52
-
53
- broadcaster = StimulusReflex::PageBroadcaster.new(@reflex)
54
-
55
- expected = {
56
- "cableReady" => true,
57
- "operations" => [
58
- {
59
- "selector" => "#foo",
60
- "html" => "New Content",
61
- "payload" => {},
62
- "childrenOnly" => true,
63
- "permanentAttributeName" => nil,
64
- "stimulusReflex" => {
65
- "some" => :data,
66
- "morph" => :page
67
- },
68
- "reflexId" => "666",
69
- "operation" => "morph"
70
- }
71
- ],
72
- "version" => CableReady::VERSION
73
- }
74
-
75
- assert_broadcast_on @reflex.stream_name, expected do
76
- broadcaster.broadcast(["#foo"], {some: :data})
77
- end
78
- end
79
- end