view_component 2.17.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.

Files changed (42) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGELOG.md +582 -0
  3. data/LICENSE.txt +21 -0
  4. data/README.md +1000 -0
  5. data/app/controllers/view_components_controller.rb +71 -0
  6. data/app/views/view_components/index.html.erb +8 -0
  7. data/app/views/view_components/preview.html.erb +1 -0
  8. data/app/views/view_components/previews.html.erb +6 -0
  9. data/lib/rails/generators/component/USAGE +13 -0
  10. data/lib/rails/generators/component/component_generator.rb +42 -0
  11. data/lib/rails/generators/component/templates/component.rb.tt +7 -0
  12. data/lib/rails/generators/erb/component_generator.rb +30 -0
  13. data/lib/rails/generators/erb/templates/component.html.erb.tt +1 -0
  14. data/lib/rails/generators/haml/component_generator.rb +30 -0
  15. data/lib/rails/generators/haml/templates/component.html.haml.tt +1 -0
  16. data/lib/rails/generators/rspec/component_generator.rb +19 -0
  17. data/lib/rails/generators/rspec/templates/component_spec.rb.tt +13 -0
  18. data/lib/rails/generators/slim/component_generator.rb +30 -0
  19. data/lib/rails/generators/slim/templates/component.html.slim.tt +1 -0
  20. data/lib/rails/generators/test_unit/component_generator.rb +20 -0
  21. data/lib/rails/generators/test_unit/templates/component_test.rb.tt +10 -0
  22. data/lib/view_component.rb +14 -0
  23. data/lib/view_component/base.rb +458 -0
  24. data/lib/view_component/collection.rb +41 -0
  25. data/lib/view_component/compile_cache.rb +24 -0
  26. data/lib/view_component/engine.rb +101 -0
  27. data/lib/view_component/preview.rb +111 -0
  28. data/lib/view_component/preview_template_error.rb +6 -0
  29. data/lib/view_component/previewable.rb +38 -0
  30. data/lib/view_component/render_component_helper.rb +9 -0
  31. data/lib/view_component/render_component_to_string_helper.rb +9 -0
  32. data/lib/view_component/render_monkey_patch.rb +13 -0
  33. data/lib/view_component/render_to_string_monkey_patch.rb +13 -0
  34. data/lib/view_component/rendering_component_helper.rb +9 -0
  35. data/lib/view_component/rendering_monkey_patch.rb +13 -0
  36. data/lib/view_component/slot.rb +7 -0
  37. data/lib/view_component/slotable.rb +121 -0
  38. data/lib/view_component/template_error.rb +9 -0
  39. data/lib/view_component/test_case.rb +9 -0
  40. data/lib/view_component/test_helpers.rb +49 -0
  41. data/lib/view_component/version.rb +11 -0
  42. metadata +244 -0
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 63cae604f99ce706878da0fb00ddfdde223bbb1431e33e3096448e4e65b569af
4
+ data.tar.gz: 2017fe3d3b8b2979fb5854fbb40cecc5b4c760953377a8e45ceccfbcc1eb01c3
5
+ SHA512:
6
+ metadata.gz: ce31c6c2f4668c683ce037c9dc1e2de1e462e3ac5301176a70bf5ab4d7d10cafe33d611f00fd55e13f707b6c19e1731c1c18978ba5e0bc05c35c5986159ac5ef
7
+ data.tar.gz: 0fde2e678e6d671e77812f197180bcef3e90ac1e87615dede2890359bb9a594a490edbe43eee43ed60e568826e616cf16e59392427f952c35497dc3516e16bc3
@@ -0,0 +1,582 @@
1
+ # master
2
+
3
+ # 2.17.0
4
+
5
+ * Slots return stripped HTML, removing leading and trailing whitespace.
6
+
7
+ *Jason Long, Joel Hawksley*
8
+
9
+ # 2.16.0
10
+
11
+ * Add `--sidecar` option to the erb, haml and slim generators. Places the generated template in the sidecar directory.
12
+
13
+ *Michael van Rooijen*
14
+
15
+ # 2.15.0
16
+
17
+ * Add support for templates as ViewComponent::Preview examples.
18
+
19
+ *Juan Manuel Ramallo
20
+
21
+ # 2.14.1
22
+
23
+ * 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.
24
+
25
+ *Clément Joubert*
26
+
27
+ * Fix kwargs warnings in slotable.
28
+
29
+ Fixes:
30
+
31
+ ```
32
+ 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
33
+ view_component/test/app/components/slots_component.rb:18: warning: The called method `initialize' is defined here
34
+ ```
35
+
36
+ *Eileen M. Uchitelle*
37
+
38
+ # 2.14.0
39
+
40
+ * Add `config.preview_paths` to support multiple locations of component preview files. Deprecate `config.preview_path`.
41
+
42
+ *Tomas Celizna*
43
+
44
+ * Only print warning about a missing capybara dependency if the `DEBUG` environment variable is set.
45
+
46
+ *Richard Macklin*
47
+
48
+ # 2.13.0
49
+
50
+ * 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`.
51
+
52
+ *Johannes Engl*
53
+
54
+ # 2.12.0
55
+
56
+ * Implement Slots as potential successor to Content Areas.
57
+
58
+ *Jens Ljungblad, Brian Bugh, Jon Palmer, Joel Hawksley*
59
+
60
+ # 2.11.1
61
+
62
+ * Fix kwarg warnings in Ruby 2.7.
63
+
64
+ *Joel Hawksley*
65
+
66
+ # 2.11.0
67
+
68
+ * Ensure Rails configuration is available within components.
69
+
70
+ *Trevor Broaddus*
71
+
72
+ * Fix bug where global Rails helpers are inaccessible from nested components. Before, `helpers` was pointing to parent component.
73
+
74
+ *Franco Sebregondi*
75
+
76
+ # 2.10.0
77
+
78
+ * Raise an `ArgumentError` with a helpful message when Ruby cannot parse a component class.
79
+
80
+ *Max Beizer*
81
+
82
+ # 2.9.0
83
+
84
+ * Cache components per-request in development, preventing unnecessary recompilation during a single request.
85
+
86
+ *Felipe Sateler*
87
+
88
+ # 2.8.0
89
+
90
+ * Add `before_render`, deprecating `before_render_check`.
91
+
92
+ *Joel Hawksley*
93
+
94
+ # 2.7.0
95
+
96
+ * Add `rendered_component` method to `ViewComponent::TestHelpers` which exposes the raw output of the rendered component.
97
+
98
+ *Richard Macklin*
99
+
100
+ * Support sidecar directories for views and other assets.
101
+
102
+ *Jon Palmer*
103
+
104
+ # 2.6.0
105
+
106
+ * Add `config.view_component.preview_route` to set the endpoint for component previews. By default `/rails/view_components` is used.
107
+
108
+ *Juan Manuel Ramallo*
109
+
110
+ * Raise error when initializer omits with_collection_parameter.
111
+
112
+ *Joel Hawksley*
113
+
114
+ # 2.5.1
115
+
116
+ * Compile component before rendering collection.
117
+
118
+ *Rainer Borene*
119
+
120
+ # v2.5.0
121
+
122
+ * Add counter variables when rendering collections.
123
+
124
+ *Frank S*
125
+
126
+ * Add the ability to access params from preview examples.
127
+
128
+ *Fabio Cantoni*
129
+
130
+ # v2.4.0
131
+
132
+ * Add `#render_to_string` support.
133
+
134
+ *Jarod Reid*
135
+
136
+ * Declare explicit dependency on `activesupport`.
137
+
138
+ *Richard Macklin*
139
+
140
+ * Remove `autoload`s of internal modules (`Previewable`, `RenderMonkeyPatch`, `RenderingMonkeyPatch`).
141
+
142
+ *Richard Macklin*
143
+
144
+ * Remove `capybara` dependency.
145
+
146
+ *Richard Macklin*
147
+
148
+ # v2.3.0
149
+
150
+ * Allow using inline render method(s) defined on a parent.
151
+
152
+ *Simon Rand*
153
+
154
+ * Fix bug where inline variant render methods would never be called.
155
+
156
+ *Simon Rand*
157
+
158
+ * ViewComponent preview index views use Rails internal layout instead of application's layout
159
+
160
+ *Juan Manuel Ramallo*
161
+
162
+ # v2.2.2
163
+
164
+ * Add `Base.format` for better compatibility with `ActionView::Template`.
165
+
166
+ *Joel Hawksley*
167
+
168
+ # v2.2.1
169
+
170
+ * Fix bug where template could not be found if `inherited` was redefined.
171
+
172
+ *Joel Hawksley*
173
+
174
+ # v2.2.0
175
+
176
+ * Add support for `config.action_view.annotate_template_file_names` (coming in Rails 6.1).
177
+
178
+ *Joel Hawksley*
179
+
180
+ * Remove initializer requirement from the component.
181
+
182
+ *Vasiliy Ermolovich*
183
+
184
+ # v2.1.0
185
+
186
+ * Support rendering collections (e.g., `render(MyComponent.with_collection(@items))`).
187
+
188
+ *Tim Clem*
189
+
190
+ # v2.0.0
191
+
192
+ * Move to `ViewComponent` namespace, removing all references to `ActionView`.
193
+
194
+ * The gem name is now `view_component`.
195
+ * ViewComponent previews are now accessed at `/rails/view_components`.
196
+ * ViewComponents can _only_ be rendered with the instance syntax: `render(MyComponent.new)`. Support for all other syntaxes has been removed.
197
+ * ActiveModel::Validations have been removed. ViewComponent generators no longer include validations.
198
+ * In Rails 6.1, no monkey patching is used.
199
+ * `to_component_class` has been removed.
200
+ * All gem configuration is now in `config.view_component`.
201
+
202
+ # v1.17.0
203
+
204
+ * Support Ruby 2.4 in CI.
205
+
206
+ *Andrew Mason*
207
+
208
+ * ViewComponent generators do not not prompt for content requirement.
209
+
210
+ *Joel Hawksley*
211
+
212
+ * Add post-install message that gem has been renamed to `view_component`.
213
+
214
+ *Joel Hawksley*
215
+
216
+ # v1.16.0
217
+
218
+ * Add `refute_component_rendered` test helper.
219
+
220
+ *Joel Hawksley*
221
+
222
+ * Check for Rails before invocation.
223
+
224
+ *Dave Paola*
225
+
226
+ * Allow components to be rendered without a template file (aka inline component).
227
+
228
+ *Rainer Borene*
229
+
230
+ # v1.15.0
231
+
232
+ * Re-introduce ActionView::Component::TestHelpers.
233
+
234
+ *Joel Hawksley*
235
+
236
+ * Bypass monkey patch on Rails 6.1 builds.
237
+
238
+ *Joel Hawksley*
239
+
240
+ * Make `ActionView::Helpers::TagHelper` available in Previews.
241
+
242
+ ```ruby
243
+ def with_html_content
244
+ render(MyComponent.new) do
245
+ tag.div do
246
+ content_tag(:span, "Hello")
247
+ end
248
+ end
249
+ end
250
+ ```
251
+
252
+ *Sean Doyle*
253
+
254
+ # v1.14.1
255
+
256
+ * Fix bug where generator created invalid test code.
257
+
258
+ *Joel Hawksley*
259
+
260
+ # v1.14.0
261
+
262
+ * Rename ActionView::Component::Base to ViewComponent::Base
263
+
264
+ *Joel Hawksley*
265
+
266
+ # v1.13.0
267
+
268
+ * Allow components to be rendered inside controllers.
269
+
270
+ *Joel Hawksley*
271
+
272
+ * Improve backtraces from exceptions raised in templates.
273
+
274
+ *Blake Williams*
275
+
276
+ # v1.12.0
277
+
278
+ * Revert: Remove initializer requirement for Ruby 2.7+
279
+
280
+ *Joel Hawksley*
281
+
282
+ * Restructure Railtie into Engine
283
+
284
+ *Sean Doyle*
285
+
286
+ * Allow components to override before_render_check
287
+
288
+ *Joel Hawksley*
289
+
290
+ # v1.11.1
291
+
292
+ * Relax Capybara requirement.
293
+
294
+ *Joel Hawksley*
295
+
296
+ # v1.11.0
297
+
298
+ * Add support for Capybara matchers.
299
+
300
+ *Joel Hawksley*
301
+
302
+ * Add erb, haml, & slim template generators
303
+
304
+ *Asger Behncke Jacobsen*
305
+
306
+ # v1.10.0
307
+
308
+ * Deprecate all `render` syntaxes except for `render(MyComponent.new(foo: :bar))`
309
+
310
+ *Joel Hawksley*
311
+
312
+ # v1.9.0
313
+
314
+ * Remove initializer requirement for Ruby 2.7+
315
+
316
+ *Dylan Clark*
317
+
318
+ # v1.8.1
319
+
320
+ * Run validation checks before calling `#render?`.
321
+
322
+ *Ash Wilson*
323
+
324
+ # v1.8.0
325
+
326
+ * Remove the unneeded ComponentExamplesController and simplify preview rendering.
327
+
328
+ *Jon Palmer*
329
+
330
+ * Add `#render?` hook to easily allow components to be no-ops.
331
+
332
+ *Kyle Fox*
333
+
334
+ * Don't assume ApplicationController exists.
335
+
336
+ *Jon Palmer*
337
+
338
+ * Allow some additional checks to overrided render?
339
+
340
+ *Sergey Malykh*
341
+
342
+ * Fix generator placing namespaced components in the root directory.
343
+
344
+ *Asger Behncke Jacobsen*
345
+
346
+ * Fix cache test.
347
+
348
+ *Sergey Malykh*
349
+
350
+ # v1.7.0
351
+
352
+ * Simplify validation of templates and compilation.
353
+
354
+ *Jon Palmer*
355
+
356
+ * Add support for multiple content areas.
357
+
358
+ *Jon Palmer*
359
+
360
+ # v1.6.2
361
+
362
+ * Fix Uninitialized Constant error.
363
+
364
+ *Jon Palmer*
365
+
366
+ * Add basic github issue and PR templates.
367
+
368
+ *Dylan Clark*
369
+
370
+ * Update readme phrasing around previews.
371
+
372
+ *Justin Coyne*
373
+
374
+ # v1.6.1
375
+
376
+ * Allow Previews to have no layout.
377
+
378
+ *Jon Palmer*
379
+
380
+ * Bump rack from 2.0.7 to 2.0.8.
381
+
382
+ *Dependabot*
383
+
384
+ * Compile components on application boot when eager loading is enabled.
385
+
386
+ *Joel Hawksley*
387
+
388
+ * Previews support content blocks.
389
+
390
+ *Cesario Uy*
391
+
392
+ * Follow Rails conventions. (refactor)
393
+
394
+ *Rainer Borene*
395
+
396
+ * Fix edge case issue with extracting variants from less conventional source_locations.
397
+
398
+ *Ryan Workman*
399
+
400
+ # v1.6.0
401
+
402
+ * Avoid dropping elements in the render_inline test helper.
403
+
404
+ *@dark-panda*
405
+
406
+ * Add test for helpers.asset_url.
407
+
408
+ *Christopher Coleman*
409
+
410
+ * Add rudimentary compatibility with better_html.
411
+
412
+ *Joel Hawksley*
413
+
414
+ * Template-less variants fall back to default template.
415
+
416
+ *Asger Behncke Jacobsen*, *Cesario Uy*
417
+
418
+ * Generated tests use new naming convention.
419
+
420
+ *Simon Træls Ravn*
421
+
422
+ * Eliminate sqlite dependency.
423
+
424
+ *Simon Dawson*
425
+
426
+ * Add support for rendering components via #to_component_class
427
+
428
+ *Vinicius Stock*
429
+
430
+ # v1.5.3
431
+
432
+ * Add support for RSpec to generators.
433
+
434
+ *Dylan Clark, Ryan Workman*
435
+
436
+ * Require controllers as part of setting autoload paths.
437
+
438
+ *Joel Hawksley*
439
+
440
+ # v1.5.2
441
+
442
+ * Disable eager loading initializer.
443
+
444
+ *Kasper Meyer*
445
+
446
+ # v1.5.1
447
+
448
+ * Update railties class to work with Rails 6.
449
+
450
+ *Juan Manuel Ramallo*
451
+
452
+ # v1.5.0
453
+
454
+ Note: `actionview-component` is now loaded by requiring `actionview/component`, not `actionview/component/base`.
455
+
456
+ * Fix issue with generating component method signatures.
457
+
458
+ *Ryan Workman, Dylan Clark*
459
+
460
+ * Create component generator.
461
+
462
+ *Vinicius Stock*
463
+
464
+ * Add helpers proxy.
465
+
466
+ *Kasper Meyer*
467
+
468
+ * Introduce ActionView::Component::Previews.
469
+
470
+ *Juan Manuel Ramallo*
471
+
472
+ # v1.4.0
473
+
474
+ * Fix bug where components broke in application paths with periods.
475
+
476
+ *Anton, Joel Hawksley*
477
+
478
+ * Add support for `cache_if` in component templates.
479
+
480
+ *Aaron Patterson, Joel Hawksley*
481
+
482
+ * Add support for variants.
483
+
484
+ *Juan Manuel Ramallo*
485
+
486
+ * Fix bug in virtual path lookup.
487
+
488
+ *Juan Manuel Ramallo*
489
+
490
+ * Preselect the rendered component in render_inline.
491
+
492
+ *Elia Schito*
493
+
494
+ # v1.3.6
495
+
496
+ * Allow template file names without format.
497
+
498
+ *Joel Hawksley*
499
+
500
+ * Add support for translations.
501
+
502
+ *Juan Manuel Ramallo*
503
+
504
+ # v1.3.5
505
+
506
+ * Re-expose `controller` method.
507
+
508
+ *Michael Emhofer, Joel Hawksley*
509
+
510
+ * Gem version numbers are now accessible through `ActionView::Component::VERSION`
511
+
512
+ *Richard Macklin*
513
+
514
+ * Fix typo in README
515
+
516
+ *ars moriendi*
517
+
518
+ # v1.3.4
519
+
520
+ * Template errors surface correct file and line number.
521
+
522
+ *Justin Coyne*
523
+
524
+ * Allow access to `request` inside components.
525
+
526
+ *Joel Hawksley*
527
+
528
+ # v1.3.3
529
+
530
+ * Do not raise error when sidecar files that are not templates exist.
531
+
532
+ *Joel Hawksley*
533
+
534
+ # v1.3.2
535
+
536
+ * Support rendering views from inside component templates.
537
+
538
+ *Patrick Sinclair*
539
+
540
+ # v1.3.1
541
+
542
+ * Fix bug where rendering nested content caused an error.
543
+
544
+ *Joel Hawksley, Aaron Patterson*
545
+
546
+ # v1.3.0
547
+
548
+ * Components are rendered with enough controller context to support rendering of partials and forms.
549
+
550
+ *Patrick Sinclair, Joel Hawksley, Aaron Patterson*
551
+
552
+ # v1.2.1
553
+
554
+ * `actionview-component` is now tested against Ruby 2.3/2.4 and Rails 5.0.0.
555
+
556
+ # v1.2.0
557
+
558
+ * The `render_component` test helper has been renamed to `render_inline`. `render_component` has been deprecated and will be removed in v2.0.0.
559
+
560
+ *Joel Hawksley*
561
+
562
+ * 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.
563
+
564
+ *Joel Hawksley*
565
+
566
+ # v1.1.0
567
+
568
+ * Components now inherit from ActionView::Component::Base
569
+
570
+ *Joel Hawksley*
571
+
572
+ # v1.0.1
573
+
574
+ * Always recompile component templates outside production.
575
+
576
+ *Joel Hawksley, John Hawthorn*
577
+
578
+ # v1.0.0
579
+
580
+ This release extracts the `ActionView::Component` library from the GitHub application.
581
+
582
+ It will be published on RubyGems under the existing `actionview-component` gem name, as @chancancode has passed us ownership of the gem.