view_component 2.62.0 → 2.82.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of view_component might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/LICENSE.txt +1 -1
- data/app/assets/vendor/prism.css +3 -195
- data/app/assets/vendor/prism.min.js +11 -11
- data/app/controllers/concerns/view_component/preview_actions.rb +6 -10
- data/app/controllers/view_components_system_test_controller.rb +7 -0
- data/app/helpers/preview_helper.rb +2 -2
- data/app/views/view_components/preview.html.erb +2 -2
- data/docs/CHANGELOG.md +383 -21
- data/lib/rails/generators/abstract_generator.rb +3 -5
- data/lib/rails/generators/component/component_generator.rb +5 -4
- data/lib/rails/generators/locale/component_generator.rb +1 -1
- data/lib/rails/generators/preview/component_generator.rb +10 -3
- data/lib/view_component/base.rb +41 -47
- data/lib/view_component/compiler.rb +57 -68
- data/lib/view_component/config.rb +176 -0
- data/lib/view_component/content_areas.rb +2 -3
- data/lib/view_component/deprecation.rb +2 -2
- data/lib/view_component/docs_builder_component.html.erb +1 -1
- data/lib/view_component/docs_builder_component.rb +1 -1
- data/lib/view_component/engine.rb +23 -29
- data/lib/view_component/polymorphic_slots.rb +11 -5
- data/lib/view_component/render_component_helper.rb +1 -0
- data/lib/view_component/slotable.rb +2 -3
- data/lib/view_component/slotable_v2.rb +48 -8
- data/lib/view_component/system_test_case.rb +13 -0
- data/lib/view_component/system_test_helpers.rb +27 -0
- data/lib/view_component/test_helpers.rb +65 -15
- data/lib/view_component/translatable.rb +1 -1
- data/lib/view_component/version.rb +1 -1
- data/lib/view_component.rb +6 -3
- metadata +50 -18
- data/lib/view_component/previewable.rb +0 -62
- data/lib/view_component/render_preview_helper.rb +0 -50
data/docs/CHANGELOG.md
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
---
|
2
2
|
layout: default
|
3
3
|
title: Changelog
|
4
|
+
nav_order: 5
|
4
5
|
---
|
5
6
|
|
6
7
|
<!-- Add unreleased changes under the "main" heading. -->
|
@@ -9,6 +10,363 @@ title: Changelog
|
|
9
10
|
|
10
11
|
## main
|
11
12
|
|
13
|
+
## 2.82.0
|
14
|
+
|
15
|
+
* Revert "Avoid loading ActionView::Base during initialization (#1528)"
|
16
|
+
|
17
|
+
*Jon Rohan*
|
18
|
+
|
19
|
+
* Fix tests using `with_rendered_component_path` with custom layouts.
|
20
|
+
|
21
|
+
*Ian Hollander*
|
22
|
+
|
23
|
+
## 2.81.0
|
24
|
+
|
25
|
+
* Adjust the way response objects are set on the preview controller to work around a recent change in Rails main.
|
26
|
+
|
27
|
+
*Cameron Dutro*
|
28
|
+
|
29
|
+
* Fix typo in "Generate a Stimulus controller" documentation.
|
30
|
+
|
31
|
+
*Ben Trewern*
|
32
|
+
|
33
|
+
* Modify the `render_in_view_context` test helper to forward its args to the block.
|
34
|
+
|
35
|
+
*Cameron Dutro*
|
36
|
+
|
37
|
+
## 2.80.0
|
38
|
+
|
39
|
+
* Move system test endpoint out of the unrelated previews controller.
|
40
|
+
|
41
|
+
*Edwin Mak*
|
42
|
+
|
43
|
+
* Display Ruby 2.7 deprecation notice only once, when starting the application.
|
44
|
+
|
45
|
+
*Henrik Hauge Bjørnskov*
|
46
|
+
|
47
|
+
* Require Rails 5.2+ in gemspec and update documentation.
|
48
|
+
|
49
|
+
*Drew Bragg*
|
50
|
+
|
51
|
+
* Add documentation for using `with_rendered_component_path` with RSpec.
|
52
|
+
|
53
|
+
*Edwin Mak*
|
54
|
+
|
55
|
+
## 2.79.0
|
56
|
+
|
57
|
+
* Add ability to pass explicit `preview_path` to preview generator.
|
58
|
+
|
59
|
+
*Erinna Chen*
|
60
|
+
|
61
|
+
* Add `with_rendered_component_path` helper for writing component system tests.
|
62
|
+
|
63
|
+
*Edwin Mak*
|
64
|
+
|
65
|
+
* Include gem name and deprecation horizon in every deprecation message.
|
66
|
+
|
67
|
+
*Jan Klimo*
|
68
|
+
|
69
|
+
## 2.78.0
|
70
|
+
|
71
|
+
* Support variants with dots in their names.
|
72
|
+
|
73
|
+
*Javi Martín*
|
74
|
+
|
75
|
+
## 2.77.0
|
76
|
+
|
77
|
+
* Support variants with dashes in their names.
|
78
|
+
|
79
|
+
*Javi Martín*
|
80
|
+
|
81
|
+
## 2.76.0
|
82
|
+
|
83
|
+
* `Component.with_collection` supports components that accept splatted keyword arguments.
|
84
|
+
|
85
|
+
*Zee Spencer*
|
86
|
+
|
87
|
+
* Remove `config.view_component.use_consistent_rendering_lifecycle` since it is no longer planned for 3.0.
|
88
|
+
|
89
|
+
*Blake Williams*
|
90
|
+
|
91
|
+
* Prevent polymorphic slots from calculating `content` when setting a slot.
|
92
|
+
|
93
|
+
*Blake Williams*
|
94
|
+
|
95
|
+
* Add ability to pass in the preview class to `render_preview`.
|
96
|
+
|
97
|
+
*Jon Rohan*
|
98
|
+
|
99
|
+
* Fix issue causing PVC tests to fail in CI.
|
100
|
+
|
101
|
+
*Cameron Dutro*
|
102
|
+
|
103
|
+
* Fix YARD docs build task.
|
104
|
+
|
105
|
+
*Hans Lemuet*
|
106
|
+
|
107
|
+
* Add Startup Jobs to list of companies using ViewComponent.
|
108
|
+
|
109
|
+
*Marc Köhlbrugge*
|
110
|
+
|
111
|
+
* Run PVC's accessibility tests in a single process to avoid resource contention in CI.
|
112
|
+
|
113
|
+
*Cameron Dutro*
|
114
|
+
|
115
|
+
## 2.75.0
|
116
|
+
|
117
|
+
* Avoid loading ActionView::Base during Rails initialization.
|
118
|
+
|
119
|
+
*Jonathan del Strother*
|
120
|
+
|
121
|
+
<!-- vale off -->
|
122
|
+
* Mention lambda slots rendering returned values lazily in the guide.
|
123
|
+
|
124
|
+
*Graham Rogers*
|
125
|
+
<!-- vale on -->
|
126
|
+
|
127
|
+
* Add "ViewComponent In The Wild" articles to resources.
|
128
|
+
|
129
|
+
*Alexander Baygeldin*
|
130
|
+
|
131
|
+
## 2.74.1
|
132
|
+
|
133
|
+
* Add more users of ViewComponent to docs.
|
134
|
+
|
135
|
+
*Joel Hawksley*
|
136
|
+
|
137
|
+
* Add a known issue for usage with `turbo_frame_tag` to the documentation.
|
138
|
+
|
139
|
+
*Vlad Radulescu*
|
140
|
+
|
141
|
+
* Add note about system testing components with previews.
|
142
|
+
|
143
|
+
*Joel Hawksley*
|
144
|
+
|
145
|
+
* Remove locking mechanisms from the compiler.
|
146
|
+
|
147
|
+
*Cameron Dutro*
|
148
|
+
|
149
|
+
## 2.74.0
|
150
|
+
|
151
|
+
* Add Avo to list of companies using ViewComponent.
|
152
|
+
|
153
|
+
*Adrian Marin*
|
154
|
+
|
155
|
+
* Promote experimental `_output_postamble` method to public API as `output_postamble`.
|
156
|
+
|
157
|
+
*Joel Hawksley*
|
158
|
+
|
159
|
+
* Promote experimental `_sidecar_files` method to public API as `sidecar_files`.
|
160
|
+
|
161
|
+
*Joel Hawksley*
|
162
|
+
|
163
|
+
* Fix `show_previews` regression introduced in 2.73.0.
|
164
|
+
|
165
|
+
*Andy Baranov*
|
166
|
+
|
167
|
+
* `with_request_url` test helper supports router constraints (such as Devise).
|
168
|
+
|
169
|
+
*Aotokitsuruya*
|
170
|
+
|
171
|
+
## 2.73.0
|
172
|
+
|
173
|
+
* Remove experimental `_after_compile` lifecycle method.
|
174
|
+
|
175
|
+
*Joel Hawksley*
|
176
|
+
|
177
|
+
* Fix capitalization of JavaScript in docs.
|
178
|
+
|
179
|
+
*Erinna Chen*
|
180
|
+
|
181
|
+
* Add PrintReleaf to list of companies using ViewComponent.
|
182
|
+
|
183
|
+
*Ry Kulp*
|
184
|
+
|
185
|
+
* Simplify CI configuration to a single build per Ruby/Rails version.
|
186
|
+
|
187
|
+
*Joel Hawksley*
|
188
|
+
|
189
|
+
* Correctly document `generate.sidecar` config option.
|
190
|
+
|
191
|
+
*Ruben Smit*
|
192
|
+
|
193
|
+
* Add Yobbers to list of companies using ViewComponent.
|
194
|
+
|
195
|
+
*Anton Prins*
|
196
|
+
|
197
|
+
## 2.72.0
|
198
|
+
|
199
|
+
* Deprecate support for Ruby < 2.7 for removal in v3.0.0.
|
200
|
+
|
201
|
+
*Joel Hawksley*
|
202
|
+
|
203
|
+
* Add `changelog_uri` to gemspec.
|
204
|
+
|
205
|
+
*Joel Hawksley*
|
206
|
+
|
207
|
+
* Link to `CHANGELOG.md` instead of symlink.
|
208
|
+
|
209
|
+
*Joel Hawksley.
|
210
|
+
|
211
|
+
* Add Aluuno to list of companies using ViewComponent.
|
212
|
+
|
213
|
+
*Daniel Naves de Carvalho*
|
214
|
+
|
215
|
+
* Add `source_code_uri` to gemspec.
|
216
|
+
|
217
|
+
*Yoshiyuki Hirano*
|
218
|
+
|
219
|
+
* Update link to benchmark script in docs.
|
220
|
+
|
221
|
+
*Daniel Diekmeier*
|
222
|
+
|
223
|
+
* Add special exception message for `renders_one :content` explaining that content passed as a block will be assigned to the `content` accessor without having to create an explicit slot.
|
224
|
+
|
225
|
+
*Daniel Diekmeier*
|
226
|
+
|
227
|
+
## 2.71.0
|
228
|
+
|
229
|
+
**ViewComponent has moved to a new organization: [https://github.com/viewcomponent/view_component](https://github.com/viewcomponent/view_component). See [https://github.com/viewcomponent/view_component/issues/1424](https://github.com/viewcomponent/view_component/issues/1424) for more details.**
|
230
|
+
|
231
|
+
## 2.70.0
|
232
|
+
|
233
|
+
* `render_preview` can pass parameters to preview.
|
234
|
+
|
235
|
+
*Joel Hawksley*
|
236
|
+
|
237
|
+
* Fix docs typos.
|
238
|
+
|
239
|
+
*Joel Hawksley*
|
240
|
+
|
241
|
+
* Add architectural decisions to documentation and rename sidebar sections.
|
242
|
+
|
243
|
+
*Joel Hawksley*
|
244
|
+
|
245
|
+
* Clarify documentation on testability of Rails views.
|
246
|
+
|
247
|
+
*Joel Hawksley*
|
248
|
+
|
249
|
+
* Add Arrows to list of companies using ViewComponent.
|
250
|
+
|
251
|
+
*Matt Swanson*
|
252
|
+
|
253
|
+
* Add WIP to list of companies using ViewComponent.
|
254
|
+
|
255
|
+
*Marc Köhlbrugge*
|
256
|
+
|
257
|
+
* Update slots documentation to include how to reference slots.
|
258
|
+
|
259
|
+
*Brittany Ellich*
|
260
|
+
|
261
|
+
* Add Clio to list of companies using ViewComponent.
|
262
|
+
|
263
|
+
*Mike Buckley*
|
264
|
+
|
265
|
+
## 2.69.0
|
266
|
+
|
267
|
+
* Add missing `require` to fix `pvc` build.
|
268
|
+
|
269
|
+
*Joel Hawksley*
|
270
|
+
|
271
|
+
* Add `config.view_component.use_consistent_rendering_lifecycle` to ensure side-effects in `content` are consistently evaluated before components are rendered. This change effectively means that `content` is evaluated for every component render where `render?` returns true. As a result, code that's passed to a component via a block/content will now always be evaluated, before `#call`, which can reveal bugs in existing components. This configuration option defaults to `false` but will be enabled in 3.0 and the old behavior will be removed.
|
272
|
+
|
273
|
+
*Blake Williams*
|
274
|
+
|
275
|
+
* Update Prism to version 1.28.0.
|
276
|
+
|
277
|
+
*Thomas Hutterer*
|
278
|
+
|
279
|
+
* Corrects the deprecation warning for named slots to show the file and line where the slot is called.
|
280
|
+
|
281
|
+
*River Bailey*
|
282
|
+
|
283
|
+
## 2.68.0
|
284
|
+
|
285
|
+
* Update `gemspec` author to be ViewComponent team.
|
286
|
+
|
287
|
+
*Joel Hawksley*
|
288
|
+
|
289
|
+
* Fix bug where `ViewComponent::Compiler` wasn't required.
|
290
|
+
|
291
|
+
*Joel Hawksley*
|
292
|
+
|
293
|
+
## 2.67.0
|
294
|
+
|
295
|
+
* Use ViewComponent::Base.config as the internal endpoint for config.
|
296
|
+
|
297
|
+
*Simon Fish*
|
298
|
+
|
299
|
+
* Fix bug where `#with_request_url`, when used with query string, set the incorrect `request.path` and `request.fullpath`.
|
300
|
+
|
301
|
+
*Franz Liedke*
|
302
|
+
|
303
|
+
* Add link to [ViewComponentAttributes](https://github.com/amba-Health/view_component_attributes) in Resources section of docs.
|
304
|
+
|
305
|
+
*Romaric Pascal*
|
306
|
+
|
307
|
+
* `render_preview` test helper is available by default. It is no longer necessary to include `ViewComponent::RenderPreviewHelper`.
|
308
|
+
|
309
|
+
*Joel Hawksley*
|
310
|
+
|
311
|
+
## 2.66.0
|
312
|
+
|
313
|
+
* Add missing `generate.sidecar`, `generate.stimulus_controller`, `generate.locale`, `generate.distinct_locale_files`, `generate.preview` config options to `config.view_component`.
|
314
|
+
|
315
|
+
*Simon Fish*
|
316
|
+
|
317
|
+
## 2.65.0
|
318
|
+
|
319
|
+
* Raise `ArgumentError` when conflicting Slots are defined.
|
320
|
+
|
321
|
+
Before this change it was possible to define Slots with conflicting names, for example:
|
322
|
+
|
323
|
+
```ruby
|
324
|
+
class MyComponent < ViewComponent::Base
|
325
|
+
renders_one :item
|
326
|
+
renders_many :items
|
327
|
+
end
|
328
|
+
```
|
329
|
+
|
330
|
+
*Joel Hawksley*
|
331
|
+
|
332
|
+
## 2.64.0
|
333
|
+
|
334
|
+
* Add `warn_on_deprecated_slot_setter` flag to opt-in to deprecation warning.
|
335
|
+
|
336
|
+
In [v2.54.0](https://viewcomponent.org/CHANGELOG.html#2540), the Slots API was updated to require the `with_*` prefix for setting Slots. The non-`with_*` setters will be deprecated in a coming version and removed in `v3.0`.
|
337
|
+
|
338
|
+
To enable the coming deprecation warning, add `warn_on_deprecated_slot_setter`:
|
339
|
+
|
340
|
+
```ruby
|
341
|
+
class DeprecatedSlotsSetterComponent < ViewComponent::Base
|
342
|
+
warn_on_deprecated_slot_setter
|
343
|
+
end
|
344
|
+
```
|
345
|
+
|
346
|
+
*Joel Hawksley*
|
347
|
+
|
348
|
+
* Add [`m`](https://rubygems.org/gems/m) to development environment.
|
349
|
+
|
350
|
+
*Joel Hawksley*
|
351
|
+
|
352
|
+
* Fix potential deadlock scenario in the compiler's development mode.
|
353
|
+
|
354
|
+
*Blake Williams*
|
355
|
+
|
356
|
+
## 2.63.0
|
357
|
+
|
358
|
+
* Fixed typo in `renders_many` documentation.
|
359
|
+
|
360
|
+
*Graham Rogers*
|
361
|
+
|
362
|
+
* Add documentation about working with `turbo-rails`.
|
363
|
+
|
364
|
+
*Matheus Poli Camilo*
|
365
|
+
|
366
|
+
* Fix issue causing helper methods to not be available in nested components when the render monkey patch is disabled and `render_component` is used.
|
367
|
+
|
368
|
+
*Daniel Scheffknecht*
|
369
|
+
|
12
370
|
## 2.62.0
|
13
371
|
|
14
372
|
* Remove the experimental global output buffer feature.
|
@@ -25,11 +383,15 @@ title: Changelog
|
|
25
383
|
|
26
384
|
*Josh Clayton*
|
27
385
|
|
386
|
+
* Add predicate method support to polymorphic slots.
|
387
|
+
|
388
|
+
*Graham Rogers*
|
389
|
+
|
28
390
|
## 2.61.1
|
29
391
|
|
30
392
|
* Revert `Expose Capybara DSL methods directly inside tests.` This change unintentionally broke other Capybara methods and thus introduced a regression. We aren't confident that we can fail forward so we have decided to revert this change.
|
31
393
|
|
32
|
-
*Joel Hawksley
|
394
|
+
*Joel Hawksley, Blake Williams*
|
33
395
|
|
34
396
|
* Revert change making content evaluation consistent.
|
35
397
|
|
@@ -112,7 +474,7 @@ title: Changelog
|
|
112
474
|
|
113
475
|
* Add @boardfish and @spone as maintainers.
|
114
476
|
|
115
|
-
*Joel Hawksley
|
477
|
+
*Joel Hawksley, Cameron Dutro, Blake Williams*
|
116
478
|
|
117
479
|
* Re-compile updated, inherited templates when class caching is disabled.
|
118
480
|
|
@@ -172,13 +534,13 @@ title: Changelog
|
|
172
534
|
|
173
535
|
* Restore removed `rendered_component`, marking it for deprecation in v3.0.0.
|
174
536
|
|
175
|
-
*Tyson Gach
|
537
|
+
*Tyson Gach, Richard Macklin, Joel Hawksley*
|
176
538
|
|
177
539
|
## 2.56.1
|
178
540
|
|
179
541
|
* Rename private accessor `rendered_component` to `rendered_content`.
|
180
542
|
|
181
|
-
*Yoshiyuki Hirano
|
543
|
+
*Yoshiyuki Hirano, Simon Dawson*
|
182
544
|
|
183
545
|
## 2.56.0
|
184
546
|
|
@@ -269,7 +631,7 @@ title: Changelog
|
|
269
631
|
|
270
632
|
* Skip Rails 5.2 in local test environment if using incompatible Ruby version.
|
271
633
|
|
272
|
-
*Cameron Dutro
|
634
|
+
*Cameron Dutro, Blake Williams, Joel Hawksley*
|
273
635
|
|
274
636
|
* Improve landing page documentation.
|
275
637
|
|
@@ -295,7 +657,7 @@ title: Changelog
|
|
295
657
|
|
296
658
|
* Add the option to use a "global" output buffer so `form_for` and friends can be used with view components.
|
297
659
|
|
298
|
-
*Cameron Dutro
|
660
|
+
*Cameron Dutro, Blake Williams*
|
299
661
|
|
300
662
|
* Fix fragment caching in partials when global output buffer is enabled.
|
301
663
|
* Fix template inheritance when eager loading is disabled.
|
@@ -432,7 +794,7 @@ title: Changelog
|
|
432
794
|
|
433
795
|
* Add generators to support `tailwindcss-rails`.
|
434
796
|
|
435
|
-
*Dino Maric
|
797
|
+
*Dino Maric, Hans Lemuet*
|
436
798
|
|
437
799
|
* Add a namespaced component example to docs.
|
438
800
|
|
@@ -613,7 +975,7 @@ title: Changelog
|
|
613
975
|
|
614
976
|
* Rename internal accessor to use private naming.
|
615
977
|
|
616
|
-
*Joel Hawksley
|
978
|
+
*Joel Hawksley, Blake Williams, Cameron Dutro*
|
617
979
|
|
618
980
|
* Add Github repo link to docs website header.
|
619
981
|
|
@@ -681,7 +1043,7 @@ title: Changelog
|
|
681
1043
|
|
682
1044
|
* Add support for `image_path` helper in previews.
|
683
1045
|
|
684
|
-
*Tobias Ahlin
|
1046
|
+
*Tobias Ahlin, Joel Hawksley*
|
685
1047
|
|
686
1048
|
* Add section to docs listing users of ViewComponent. Please submit a PR to add your team to the list!
|
687
1049
|
|
@@ -719,7 +1081,7 @@ title: Changelog
|
|
719
1081
|
|
720
1082
|
* Fix bug where `helpers` would instantiate and use a new `view_context` in each component.
|
721
1083
|
|
722
|
-
*Blake Williams
|
1084
|
+
*Blake Williams, Ian C. Anderson*
|
723
1085
|
|
724
1086
|
* Implement polymorphic slots as experimental feature. See the Slots documentation to learn more.
|
725
1087
|
|
@@ -746,7 +1108,7 @@ title: Changelog
|
|
746
1108
|
|
747
1109
|
* Fix bug where `with_collection_parameter` didn't inherit from parent component.
|
748
1110
|
|
749
|
-
*Will Drexler
|
1111
|
+
*Will Drexler, Christian Campoli*
|
750
1112
|
|
751
1113
|
* Allow query parameters in `with_request_url` test helper.
|
752
1114
|
|
@@ -786,7 +1148,7 @@ title: Changelog
|
|
786
1148
|
|
787
1149
|
* Clarify documentation of `with_variant` as an override of Action Pack.
|
788
1150
|
|
789
|
-
*Blake Williams
|
1151
|
+
*Blake Williams, Cameron Dutro, Joel Hawksley*
|
790
1152
|
|
791
1153
|
* Update docs page to be called Javascript and CSS, rename Building ViewComponents to Guide.
|
792
1154
|
|
@@ -811,7 +1173,7 @@ title: Changelog
|
|
811
1173
|
|
812
1174
|
* Clarify slots example in docs to reduce naming confusion.
|
813
1175
|
|
814
|
-
*Joel Hawksley
|
1176
|
+
*Joel Hawksley, Blake Williams*
|
815
1177
|
|
816
1178
|
* Fix error in documentation for `render_many` passthrough slots.
|
817
1179
|
|
@@ -1273,7 +1635,7 @@ _Note: This release includes an underlying change to Slots that may affect incor
|
|
1273
1635
|
|
1274
1636
|
* Add support for templates as ViewComponent::Preview examples.
|
1275
1637
|
|
1276
|
-
*Juan Manuel Ramallo
|
1638
|
+
*Juan Manuel Ramallo*
|
1277
1639
|
|
1278
1640
|
## 2.14.1
|
1279
1641
|
|
@@ -1650,11 +2012,11 @@ _Note: This release includes an underlying change to Slots that may affect incor
|
|
1650
2012
|
|
1651
2013
|
*Rainer Borene*
|
1652
2014
|
|
2015
|
+
<!-- vale off -->
|
1653
2016
|
* Fix edge case issue with extracting variants from less conventional source_locations.
|
1654
2017
|
|
1655
|
-
<!-- vale proselint.GenderBias = NO -->
|
1656
2018
|
*Ryan Workman*
|
1657
|
-
<!-- vale
|
2019
|
+
<!-- vale on -->
|
1658
2020
|
|
1659
2021
|
## v1.6.0
|
1660
2022
|
|
@@ -1672,7 +2034,7 @@ _Note: This release includes an underlying change to Slots that may affect incor
|
|
1672
2034
|
|
1673
2035
|
* Template-less variants fall back to default template.
|
1674
2036
|
|
1675
|
-
*Asger Behncke Jacobsen
|
2037
|
+
*Asger Behncke Jacobsen, Cesario Uy*
|
1676
2038
|
|
1677
2039
|
* Generated tests use new naming convention.
|
1678
2040
|
|
@@ -1688,11 +2050,11 @@ _Note: This release includes an underlying change to Slots that may affect incor
|
|
1688
2050
|
|
1689
2051
|
## v1.5.3
|
1690
2052
|
|
2053
|
+
<!-- vale off -->
|
1691
2054
|
* Add support for RSpec to generators.
|
1692
2055
|
|
1693
|
-
<!-- vale proselint.GenderBias = NO -->
|
1694
2056
|
*Dylan Clark, Ryan Workman*
|
1695
|
-
<!-- vale
|
2057
|
+
<!-- vale on -->
|
1696
2058
|
|
1697
2059
|
* Require controllers as part of setting autoload paths.
|
1698
2060
|
|
@@ -1714,11 +2076,11 @@ _Note: This release includes an underlying change to Slots that may affect incor
|
|
1714
2076
|
|
1715
2077
|
Note: `actionview-component` is now loaded by requiring `actionview/component`, not `actionview/component/base`.
|
1716
2078
|
|
2079
|
+
<!-- vale off -->
|
1717
2080
|
* Fix issue with generating component method signatures.
|
1718
2081
|
|
1719
|
-
<!-- vale proselint.GenderBias = NO -->
|
1720
2082
|
*Ryan Workman, Dylan Clark*
|
1721
|
-
<!-- vale
|
2083
|
+
<!-- vale off -->
|
1722
2084
|
|
1723
2085
|
* Create component generator.
|
1724
2086
|
|
@@ -3,9 +3,7 @@
|
|
3
3
|
module ViewComponent
|
4
4
|
module AbstractGenerator
|
5
5
|
def copy_view_file
|
6
|
-
unless options["inline"]
|
7
|
-
template "component.html.#{engine_name}", destination
|
8
|
-
end
|
6
|
+
template "component.html.#{engine_name}", destination unless options["inline"]
|
9
7
|
end
|
10
8
|
|
11
9
|
private
|
@@ -31,7 +29,7 @@ module ViewComponent
|
|
31
29
|
end
|
32
30
|
|
33
31
|
def component_path
|
34
|
-
ViewComponent::Base.view_component_path
|
32
|
+
ViewComponent::Base.config.view_component_path
|
35
33
|
end
|
36
34
|
|
37
35
|
def stimulus_controller
|
@@ -44,7 +42,7 @@ module ViewComponent
|
|
44
42
|
end
|
45
43
|
|
46
44
|
def sidecar?
|
47
|
-
options["sidecar"] || ViewComponent::Base.generate.sidecar
|
45
|
+
options["sidecar"] || ViewComponent::Base.config.generate.sidecar
|
48
46
|
end
|
49
47
|
end
|
50
48
|
end
|
@@ -13,11 +13,12 @@ module Rails
|
|
13
13
|
check_class_collision suffix: "Component"
|
14
14
|
|
15
15
|
class_option :inline, type: :boolean, default: false
|
16
|
-
class_option :locale, type: :boolean, default: ViewComponent::Base.generate.locale
|
16
|
+
class_option :locale, type: :boolean, default: ViewComponent::Base.config.generate.locale
|
17
17
|
class_option :parent, type: :string, desc: "The parent class for the generated component"
|
18
|
-
class_option :preview, type: :boolean, default: ViewComponent::Base.generate.preview
|
18
|
+
class_option :preview, type: :boolean, default: ViewComponent::Base.config.generate.preview
|
19
19
|
class_option :sidecar, type: :boolean, default: false
|
20
|
-
class_option :stimulus, type: :boolean,
|
20
|
+
class_option :stimulus, type: :boolean,
|
21
|
+
default: ViewComponent::Base.config.generate.stimulus_controller
|
21
22
|
|
22
23
|
def create_component_file
|
23
24
|
template "component.rb", File.join(component_path, class_path, "#{file_name}_component.rb")
|
@@ -40,7 +41,7 @@ module Rails
|
|
40
41
|
def parent_class
|
41
42
|
return options[:parent] if options[:parent]
|
42
43
|
|
43
|
-
ViewComponent::Base.component_parent_class || default_parent_class
|
44
|
+
ViewComponent::Base.config.component_parent_class || default_parent_class
|
44
45
|
end
|
45
46
|
|
46
47
|
def initialize_signature
|
@@ -12,7 +12,7 @@ module Locale
|
|
12
12
|
class_option :sidecar, type: :boolean, default: false
|
13
13
|
|
14
14
|
def create_locale_file
|
15
|
-
if ViewComponent::Base.generate.distinct_locale_files
|
15
|
+
if ViewComponent::Base.config.generate.distinct_locale_files
|
16
16
|
I18n.available_locales.each do |locale|
|
17
17
|
create_file destination(locale), translations_hash([locale]).to_yaml
|
18
18
|
end
|
@@ -4,15 +4,22 @@ module Preview
|
|
4
4
|
module Generators
|
5
5
|
class ComponentGenerator < ::Rails::Generators::NamedBase
|
6
6
|
source_root File.expand_path("templates", __dir__)
|
7
|
+
class_option :preview_path, type: :string, desc: "Path for previews, required when multiple preview paths are configured", default: ViewComponent::Base.config.generate.preview_path
|
7
8
|
|
8
9
|
argument :attributes, type: :array, default: [], banner: "attribute"
|
9
10
|
check_class_collision suffix: "ComponentPreview"
|
10
11
|
|
11
12
|
def create_preview_file
|
12
|
-
preview_paths =
|
13
|
-
|
13
|
+
preview_paths = ViewComponent::Base.config.preview_paths
|
14
|
+
optional_path = options[:preview_path]
|
15
|
+
return if preview_paths.count > 1 && optional_path.blank?
|
16
|
+
|
17
|
+
path_prefix = if optional_path.present?
|
18
|
+
optional_path
|
19
|
+
else
|
20
|
+
preview_paths.one? ? preview_paths.first : "test/components/previews"
|
21
|
+
end
|
14
22
|
|
15
|
-
path_prefix = preview_paths.one? ? preview_paths.first : "test/components/previews"
|
16
23
|
template "component_preview.rb", File.join(path_prefix, class_path, "#{file_name}_component_preview.rb")
|
17
24
|
end
|
18
25
|
|