view_component 2.18.0 → 2.20.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of view_component might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/CHANGELOG.md +129 -77
- data/README.md +161 -40
- data/app/views/view_components/preview.html.erb +5 -1
- data/lib/rails/generators/test_unit/templates/component_test.rb.tt +1 -1
- data/lib/view_component.rb +1 -0
- data/lib/view_component/base.rb +17 -185
- data/lib/view_component/collection.rb +2 -0
- data/lib/view_component/compiler.rb +214 -0
- data/lib/view_component/engine.rb +9 -4
- data/lib/view_component/preview.rb +6 -15
- data/lib/view_component/previewable.rb +10 -0
- data/lib/view_component/test_helpers.rb +4 -0
- data/lib/view_component/version.rb +1 -1
- metadata +20 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '09c638fb23b5832cf8ce411d1a07b50d2d56087858d8186ee2d4248c7e0576de'
|
4
|
+
data.tar.gz: b7ea4f439d382228a7c6911b2c0b959be52c7443cd4885a9d91159b55764d8b7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 43d6768b641f4fcb4f7a86488312400f6cb1922722f5654a98bebda771dbdc1a544e84d64b719880c822fec94621f1d402f6eaa805a21d383cab227b630b6503
|
7
|
+
data.tar.gz: 152a9f7ad4a6de0fa37df958d8a1877822bdf96f97ef81cbeebd9afb6224155e37725eb71338dd908061c0f0799e0cbf5dcf7c0c39d805ad5c471335649f4b97
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,58 @@
|
|
1
|
-
#
|
1
|
+
# CHANGELOG
|
2
2
|
|
3
|
-
|
3
|
+
## master
|
4
|
+
|
5
|
+
## 2.20.0
|
6
|
+
|
7
|
+
* Don't add `/test/components/previews` to preview_paths if directory doesn't exist.
|
8
|
+
|
9
|
+
*Andy Holland*
|
10
|
+
|
11
|
+
* Add `preview_controller` option to override the controller used for component previews.
|
12
|
+
|
13
|
+
*Matt Swanson, Blake Williams, Juan Manuel Ramallo*
|
14
|
+
|
15
|
+
## 2.19.1
|
16
|
+
|
17
|
+
* Check if `Rails.application` is loaded.
|
18
|
+
|
19
|
+
*Gleydson Tavares*
|
20
|
+
|
21
|
+
* Add documentation for webpack configuration when using Stimulus controllers.
|
22
|
+
|
23
|
+
*Ciprian Redinciuc*
|
24
|
+
|
25
|
+
## 2.19.0
|
26
|
+
|
27
|
+
* Extend documentation for using Stimulus within sidecar directories.
|
28
|
+
|
29
|
+
*Ciprian Redinciuc*
|
30
|
+
|
31
|
+
* Subclassed components inherit templates from parent.
|
32
|
+
|
33
|
+
*Blake Williams*
|
34
|
+
|
35
|
+
* Fix uninitialized constant error from `with_collection` when `eager_load` is disabled.
|
36
|
+
|
37
|
+
*Josh Gross*
|
38
|
+
|
39
|
+
## 2.18.2
|
40
|
+
|
41
|
+
* Raise an error if controller or view context is accessed during initialize as they are only available in render.
|
42
|
+
|
43
|
+
*Julian Nadeau*
|
44
|
+
|
45
|
+
* Collate test coverage across CI builds, ensuring 100% test coverage.
|
46
|
+
|
47
|
+
*Joel Hawksley*
|
48
|
+
|
49
|
+
## 2.18.1
|
50
|
+
|
51
|
+
* Fix bug where previews didn't work when monkey patch was disabled.
|
52
|
+
|
53
|
+
*Mixer Gutierrez*
|
54
|
+
|
55
|
+
## 2.18.0
|
4
56
|
|
5
57
|
* Fix auto-loading of previews (changes no longer require a server restart)
|
6
58
|
|
@@ -14,31 +66,31 @@
|
|
14
66
|
|
15
67
|
*Brad Parker*
|
16
68
|
|
17
|
-
|
69
|
+
## 2.17.1
|
18
70
|
|
19
71
|
* Fix bug where rendering Slot with empty block resulted in error.
|
20
72
|
|
21
73
|
*Joel Hawksley*
|
22
74
|
|
23
|
-
|
75
|
+
## 2.17.0
|
24
76
|
|
25
77
|
* Slots return stripped HTML, removing leading and trailing whitespace.
|
26
78
|
|
27
79
|
*Jason Long, Joel Hawksley*
|
28
80
|
|
29
|
-
|
81
|
+
## 2.16.0
|
30
82
|
|
31
83
|
* Add `--sidecar` option to the erb, haml and slim generators. Places the generated template in the sidecar directory.
|
32
84
|
|
33
85
|
*Michael van Rooijen*
|
34
86
|
|
35
|
-
|
87
|
+
## 2.15.0
|
36
88
|
|
37
89
|
* Add support for templates as ViewComponent::Preview examples.
|
38
90
|
|
39
91
|
*Juan Manuel Ramallo
|
40
92
|
|
41
|
-
|
93
|
+
## 2.14.1
|
42
94
|
|
43
95
|
* Allow using `render_inline` in test when the render monkey patch is disabled with `config.view_component.render_monkey_patch_enabled = false` in versions of Rails < 6.1.
|
44
96
|
|
@@ -48,14 +100,14 @@
|
|
48
100
|
|
49
101
|
Fixes:
|
50
102
|
|
51
|
-
```
|
103
|
+
```console
|
52
104
|
view_component/lib/view_component/slotable.rb:98: warning: Using the last argument as keyword parameters is deprecated; maybe ** should be added to the call
|
53
105
|
view_component/test/app/components/slots_component.rb:18: warning: The called method `initialize' is defined here
|
54
106
|
```
|
55
107
|
|
56
108
|
*Eileen M. Uchitelle*
|
57
109
|
|
58
|
-
|
110
|
+
## 2.14.0
|
59
111
|
|
60
112
|
* Add `config.preview_paths` to support multiple locations of component preview files. Deprecate `config.preview_path`.
|
61
113
|
|
@@ -65,25 +117,25 @@
|
|
65
117
|
|
66
118
|
*Richard Macklin*
|
67
119
|
|
68
|
-
|
120
|
+
## 2.13.0
|
69
121
|
|
70
122
|
* Add the ability to disable the render monkey patch with `config.view_component.render_monkey_patch_enabled`. In versions of Rails < 6.1, add `render_component` and `render_component_to_string` methods which can be used for rendering components instead of `render`.
|
71
123
|
|
72
124
|
*Johannes Engl*
|
73
125
|
|
74
|
-
|
126
|
+
## 2.12.0
|
75
127
|
|
76
128
|
* Implement Slots as potential successor to Content Areas.
|
77
129
|
|
78
130
|
*Jens Ljungblad, Brian Bugh, Jon Palmer, Joel Hawksley*
|
79
131
|
|
80
|
-
|
132
|
+
## 2.11.1
|
81
133
|
|
82
134
|
* Fix kwarg warnings in Ruby 2.7.
|
83
135
|
|
84
136
|
*Joel Hawksley*
|
85
137
|
|
86
|
-
|
138
|
+
## 2.11.0
|
87
139
|
|
88
140
|
* Ensure Rails configuration is available within components.
|
89
141
|
|
@@ -93,25 +145,25 @@
|
|
93
145
|
|
94
146
|
*Franco Sebregondi*
|
95
147
|
|
96
|
-
|
148
|
+
## 2.10.0
|
97
149
|
|
98
150
|
* Raise an `ArgumentError` with a helpful message when Ruby cannot parse a component class.
|
99
151
|
|
100
152
|
*Max Beizer*
|
101
153
|
|
102
|
-
|
154
|
+
## 2.9.0
|
103
155
|
|
104
156
|
* Cache components per-request in development, preventing unnecessary recompilation during a single request.
|
105
157
|
|
106
158
|
*Felipe Sateler*
|
107
159
|
|
108
|
-
|
160
|
+
## 2.8.0
|
109
161
|
|
110
162
|
* Add `before_render`, deprecating `before_render_check`.
|
111
163
|
|
112
164
|
*Joel Hawksley*
|
113
165
|
|
114
|
-
|
166
|
+
## 2.7.0
|
115
167
|
|
116
168
|
* Add `rendered_component` method to `ViewComponent::TestHelpers` which exposes the raw output of the rendered component.
|
117
169
|
|
@@ -121,7 +173,7 @@
|
|
121
173
|
|
122
174
|
*Jon Palmer*
|
123
175
|
|
124
|
-
|
176
|
+
## 2.6.0
|
125
177
|
|
126
178
|
* Add `config.view_component.preview_route` to set the endpoint for component previews. By default `/rails/view_components` is used.
|
127
179
|
|
@@ -131,13 +183,13 @@
|
|
131
183
|
|
132
184
|
*Joel Hawksley*
|
133
185
|
|
134
|
-
|
186
|
+
## 2.5.1
|
135
187
|
|
136
188
|
* Compile component before rendering collection.
|
137
189
|
|
138
190
|
*Rainer Borene*
|
139
191
|
|
140
|
-
|
192
|
+
## v2.5.0
|
141
193
|
|
142
194
|
* Add counter variables when rendering collections.
|
143
195
|
|
@@ -147,7 +199,7 @@
|
|
147
199
|
|
148
200
|
*Fabio Cantoni*
|
149
201
|
|
150
|
-
|
202
|
+
## v2.4.0
|
151
203
|
|
152
204
|
* Add `#render_to_string` support.
|
153
205
|
|
@@ -165,7 +217,7 @@
|
|
165
217
|
|
166
218
|
*Richard Macklin*
|
167
219
|
|
168
|
-
|
220
|
+
## v2.3.0
|
169
221
|
|
170
222
|
* Allow using inline render method(s) defined on a parent.
|
171
223
|
|
@@ -179,19 +231,19 @@
|
|
179
231
|
|
180
232
|
*Juan Manuel Ramallo*
|
181
233
|
|
182
|
-
|
234
|
+
## v2.2.2
|
183
235
|
|
184
236
|
* Add `Base.format` for better compatibility with `ActionView::Template`.
|
185
237
|
|
186
238
|
*Joel Hawksley*
|
187
239
|
|
188
|
-
|
240
|
+
## v2.2.1
|
189
241
|
|
190
242
|
* Fix bug where template could not be found if `inherited` was redefined.
|
191
243
|
|
192
244
|
*Joel Hawksley*
|
193
245
|
|
194
|
-
|
246
|
+
## v2.2.0
|
195
247
|
|
196
248
|
* Add support for `config.action_view.annotate_template_file_names` (coming in Rails 6.1).
|
197
249
|
|
@@ -201,25 +253,25 @@
|
|
201
253
|
|
202
254
|
*Vasiliy Ermolovich*
|
203
255
|
|
204
|
-
|
256
|
+
## v2.1.0
|
205
257
|
|
206
258
|
* Support rendering collections (e.g., `render(MyComponent.with_collection(@items))`).
|
207
259
|
|
208
260
|
*Tim Clem*
|
209
261
|
|
210
|
-
|
262
|
+
## v2.0.0
|
211
263
|
|
212
264
|
* Move to `ViewComponent` namespace, removing all references to `ActionView`.
|
213
265
|
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
266
|
+
* The gem name is now `view_component`.
|
267
|
+
* ViewComponent previews are now accessed at `/rails/view_components`.
|
268
|
+
* ViewComponents can _only_ be rendered with the instance syntax: `render(MyComponent.new)`. Support for all other syntaxes has been removed.
|
269
|
+
* ActiveModel::Validations have been removed. ViewComponent generators no longer include validations.
|
270
|
+
* In Rails 6.1, no monkey patching is used.
|
271
|
+
* `to_component_class` has been removed.
|
272
|
+
* All gem configuration is now in `config.view_component`.
|
221
273
|
|
222
|
-
|
274
|
+
## v1.17.0
|
223
275
|
|
224
276
|
* Support Ruby 2.4 in CI.
|
225
277
|
|
@@ -233,7 +285,7 @@
|
|
233
285
|
|
234
286
|
*Joel Hawksley*
|
235
287
|
|
236
|
-
|
288
|
+
## v1.16.0
|
237
289
|
|
238
290
|
* Add `refute_component_rendered` test helper.
|
239
291
|
|
@@ -247,7 +299,7 @@
|
|
247
299
|
|
248
300
|
*Rainer Borene*
|
249
301
|
|
250
|
-
|
302
|
+
## v1.15.0
|
251
303
|
|
252
304
|
* Re-introduce ActionView::Component::TestHelpers.
|
253
305
|
|
@@ -271,19 +323,19 @@
|
|
271
323
|
|
272
324
|
*Sean Doyle*
|
273
325
|
|
274
|
-
|
326
|
+
## v1.14.1
|
275
327
|
|
276
328
|
* Fix bug where generator created invalid test code.
|
277
329
|
|
278
330
|
*Joel Hawksley*
|
279
331
|
|
280
|
-
|
332
|
+
## v1.14.0
|
281
333
|
|
282
334
|
* Rename ActionView::Component::Base to ViewComponent::Base
|
283
335
|
|
284
336
|
*Joel Hawksley*
|
285
337
|
|
286
|
-
|
338
|
+
## v1.13.0
|
287
339
|
|
288
340
|
* Allow components to be rendered inside controllers.
|
289
341
|
|
@@ -293,7 +345,7 @@
|
|
293
345
|
|
294
346
|
*Blake Williams*
|
295
347
|
|
296
|
-
|
348
|
+
## v1.12.0
|
297
349
|
|
298
350
|
* Revert: Remove initializer requirement for Ruby 2.7+
|
299
351
|
|
@@ -307,13 +359,13 @@
|
|
307
359
|
|
308
360
|
*Joel Hawksley*
|
309
361
|
|
310
|
-
|
362
|
+
## v1.11.1
|
311
363
|
|
312
364
|
* Relax Capybara requirement.
|
313
365
|
|
314
366
|
*Joel Hawksley*
|
315
367
|
|
316
|
-
|
368
|
+
## v1.11.0
|
317
369
|
|
318
370
|
* Add support for Capybara matchers.
|
319
371
|
|
@@ -323,25 +375,25 @@
|
|
323
375
|
|
324
376
|
*Asger Behncke Jacobsen*
|
325
377
|
|
326
|
-
|
378
|
+
## v1.10.0
|
327
379
|
|
328
380
|
* Deprecate all `render` syntaxes except for `render(MyComponent.new(foo: :bar))`
|
329
381
|
|
330
382
|
*Joel Hawksley*
|
331
383
|
|
332
|
-
|
384
|
+
## v1.9.0
|
333
385
|
|
334
386
|
* Remove initializer requirement for Ruby 2.7+
|
335
387
|
|
336
388
|
*Dylan Clark*
|
337
389
|
|
338
|
-
|
390
|
+
## v1.8.1
|
339
391
|
|
340
392
|
* Run validation checks before calling `#render?`.
|
341
393
|
|
342
394
|
*Ash Wilson*
|
343
395
|
|
344
|
-
|
396
|
+
## v1.8.0
|
345
397
|
|
346
398
|
* Remove the unneeded ComponentExamplesController and simplify preview rendering.
|
347
399
|
|
@@ -367,7 +419,7 @@
|
|
367
419
|
|
368
420
|
*Sergey Malykh*
|
369
421
|
|
370
|
-
|
422
|
+
## v1.7.0
|
371
423
|
|
372
424
|
* Simplify validation of templates and compilation.
|
373
425
|
|
@@ -377,7 +429,7 @@
|
|
377
429
|
|
378
430
|
*Jon Palmer*
|
379
431
|
|
380
|
-
|
432
|
+
## v1.6.2
|
381
433
|
|
382
434
|
* Fix Uninitialized Constant error.
|
383
435
|
|
@@ -391,7 +443,7 @@
|
|
391
443
|
|
392
444
|
*Justin Coyne*
|
393
445
|
|
394
|
-
|
446
|
+
## v1.6.1
|
395
447
|
|
396
448
|
* Allow Previews to have no layout.
|
397
449
|
|
@@ -417,7 +469,7 @@
|
|
417
469
|
|
418
470
|
*Ryan Workman*
|
419
471
|
|
420
|
-
|
472
|
+
## v1.6.0
|
421
473
|
|
422
474
|
* Avoid dropping elements in the render_inline test helper.
|
423
475
|
|
@@ -447,7 +499,7 @@
|
|
447
499
|
|
448
500
|
*Vinicius Stock*
|
449
501
|
|
450
|
-
|
502
|
+
## v1.5.3
|
451
503
|
|
452
504
|
* Add support for RSpec to generators.
|
453
505
|
|
@@ -457,19 +509,19 @@
|
|
457
509
|
|
458
510
|
*Joel Hawksley*
|
459
511
|
|
460
|
-
|
512
|
+
## v1.5.2
|
461
513
|
|
462
514
|
* Disable eager loading initializer.
|
463
515
|
|
464
516
|
*Kasper Meyer*
|
465
517
|
|
466
|
-
|
518
|
+
## v1.5.1
|
467
519
|
|
468
520
|
* Update railties class to work with Rails 6.
|
469
521
|
|
470
522
|
*Juan Manuel Ramallo*
|
471
523
|
|
472
|
-
|
524
|
+
## v1.5.0
|
473
525
|
|
474
526
|
Note: `actionview-component` is now loaded by requiring `actionview/component`, not `actionview/component/base`.
|
475
527
|
|
@@ -489,7 +541,7 @@ Note: `actionview-component` is now loaded by requiring `actionview/component`,
|
|
489
541
|
|
490
542
|
*Juan Manuel Ramallo*
|
491
543
|
|
492
|
-
|
544
|
+
## v1.4.0
|
493
545
|
|
494
546
|
* Fix bug where components broke in application paths with periods.
|
495
547
|
|
@@ -511,7 +563,7 @@ Note: `actionview-component` is now loaded by requiring `actionview/component`,
|
|
511
563
|
|
512
564
|
*Elia Schito*
|
513
565
|
|
514
|
-
|
566
|
+
## v1.3.6
|
515
567
|
|
516
568
|
* Allow template file names without format.
|
517
569
|
|
@@ -521,7 +573,7 @@ Note: `actionview-component` is now loaded by requiring `actionview/component`,
|
|
521
573
|
|
522
574
|
*Juan Manuel Ramallo*
|
523
575
|
|
524
|
-
|
576
|
+
## v1.3.5
|
525
577
|
|
526
578
|
* Re-expose `controller` method.
|
527
579
|
|
@@ -535,7 +587,7 @@ Note: `actionview-component` is now loaded by requiring `actionview/component`,
|
|
535
587
|
|
536
588
|
*ars moriendi*
|
537
589
|
|
538
|
-
|
590
|
+
## v1.3.4
|
539
591
|
|
540
592
|
* Template errors surface correct file and line number.
|
541
593
|
|
@@ -545,57 +597,57 @@ Note: `actionview-component` is now loaded by requiring `actionview/component`,
|
|
545
597
|
|
546
598
|
*Joel Hawksley*
|
547
599
|
|
548
|
-
|
600
|
+
## v1.3.3
|
549
601
|
|
550
|
-
*
|
602
|
+
* Do not raise error when sidecar files that are not templates exist.
|
551
603
|
|
552
604
|
*Joel Hawksley*
|
553
605
|
|
554
|
-
|
606
|
+
## v1.3.2
|
555
607
|
|
556
|
-
*
|
608
|
+
* Support rendering views from inside component templates.
|
557
609
|
|
558
610
|
*Patrick Sinclair*
|
559
611
|
|
560
|
-
|
612
|
+
## v1.3.1
|
561
613
|
|
562
|
-
*
|
614
|
+
* Fix bug where rendering nested content caused an error.
|
563
615
|
|
564
616
|
*Joel Hawksley, Aaron Patterson*
|
565
617
|
|
566
|
-
|
618
|
+
## v1.3.0
|
567
619
|
|
568
|
-
*
|
620
|
+
* Components are rendered with enough controller context to support rendering of partials and forms.
|
569
621
|
|
570
622
|
*Patrick Sinclair, Joel Hawksley, Aaron Patterson*
|
571
623
|
|
572
|
-
|
624
|
+
## v1.2.1
|
573
625
|
|
574
|
-
*
|
626
|
+
* `actionview-component` is now tested against Ruby 2.3/2.4 and Rails 5.0.0.
|
575
627
|
|
576
|
-
|
628
|
+
## v1.2.0
|
577
629
|
|
578
|
-
*
|
630
|
+
* The `render_component` test helper has been renamed to `render_inline`. `render_component` has been deprecated and will be removed in v2.0.0.
|
579
631
|
|
580
632
|
*Joel Hawksley*
|
581
633
|
|
582
|
-
*
|
634
|
+
* Components are now rendered with `render MyComponent, foo: :bar` syntax. The existing `render MyComponent.new(foo: :bar)` syntax has been deprecated and will be removed in v2.0.0.
|
583
635
|
|
584
636
|
*Joel Hawksley*
|
585
637
|
|
586
|
-
|
638
|
+
## v1.1.0
|
587
639
|
|
588
|
-
*
|
640
|
+
* Components now inherit from ActionView::Component::Base
|
589
641
|
|
590
642
|
*Joel Hawksley*
|
591
643
|
|
592
|
-
|
644
|
+
## v1.0.1
|
593
645
|
|
594
|
-
*
|
646
|
+
* Always recompile component templates outside production.
|
595
647
|
|
596
648
|
*Joel Hawksley, John Hawthorn*
|
597
649
|
|
598
|
-
|
650
|
+
## v1.0.0
|
599
651
|
|
600
652
|
This release extracts the `ActionView::Component` library from the GitHub application.
|
601
653
|
|