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