view_component 3.23.1 → 3.24.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.
- checksums.yaml +4 -4
- data/docs/CHANGELOG.md +12 -0
- data/lib/rails/generators/component/component_generator.rb +1 -1
- data/lib/rails/generators/component/templates/component.rb.tt +16 -0
- data/lib/rails/generators/erb/templates/component.html.erb.tt +1 -0
- data/lib/rails/generators/haml/templates/component.html.haml.tt +1 -0
- data/lib/rails/generators/preview/templates/component_preview.rb.tt +9 -0
- data/lib/rails/generators/rspec/templates/component_spec.rb.tt +15 -0
- data/lib/rails/generators/slim/templates/component.html.slim.tt +1 -0
- data/lib/rails/generators/stimulus/templates/component_controller.js.tt +7 -0
- data/lib/rails/generators/stimulus/templates/component_controller.ts.tt +9 -0
- data/lib/rails/generators/tailwindcss/templates/component.html.erb.tt +1 -0
- data/lib/rails/generators/test_unit/templates/component_test.rb.tt +12 -0
- data/lib/view_component/collection.rb +1 -0
- data/lib/view_component/inline_template.rb +1 -0
- data/lib/view_component/version.rb +2 -2
- metadata +14 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: e50fc0d9c23700e9ca13233ffda7dd983deeaf93200325e81a25852866c115f5
|
|
4
|
+
data.tar.gz: c326352446cf7303cf0a5fb4967ffb391fdf363a272f31d88a9a074619230668
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 61d508fd6b1ad6b4c53d85e55e972567b3cd08139380d48966f39be19e04803f480b368f3bdf82f9597ab4f487d2f9141bcf7ffff25b2542fbe4312d7c0d53e8
|
|
7
|
+
data.tar.gz: 546ec854a8ec8f8fbb611a4d45d4d645fcae74f4a5f467a4531d7492ac05695270eeb369f0eca180d67b7b29a427e0053ad456fc037d5fbc9e950d4012aa4d66
|
data/docs/CHANGELOG.md
CHANGED
|
@@ -10,6 +10,18 @@ nav_order: 6
|
|
|
10
10
|
|
|
11
11
|
## main
|
|
12
12
|
|
|
13
|
+
## 3.24.0
|
|
14
|
+
|
|
15
|
+
* Add Rails 8.1 support to ViewComponent v3.
|
|
16
|
+
|
|
17
|
+
*Hans Lemuet*
|
|
18
|
+
|
|
19
|
+
## 3.23.2
|
|
20
|
+
|
|
21
|
+
* Include .tt files in published gem. Fixes templates not being available when using generators.
|
|
22
|
+
|
|
23
|
+
*Florian Aßmann*
|
|
24
|
+
|
|
13
25
|
## 3.23.1
|
|
14
26
|
|
|
15
27
|
* Restore Rake tasks in published gem.
|
|
@@ -22,7 +22,7 @@ module Rails
|
|
|
22
22
|
class_option :skip_suffix, type: :boolean, default: false
|
|
23
23
|
|
|
24
24
|
def create_component_file
|
|
25
|
-
template "component.rb", File.join(component_path, class_path, "#{file_name}#{options[:skip_suffix]
|
|
25
|
+
template "component.rb", File.join(component_path, class_path, "#{file_name}#{"_component" unless options[:skip_suffix]}.rb")
|
|
26
26
|
end
|
|
27
27
|
|
|
28
28
|
hook_for :test_framework
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
<% module_namespacing do -%>
|
|
4
|
+
class <%= class_name %><%= options[:skip_suffix] ? "" : "Component" %> < <%= parent_class %>
|
|
5
|
+
<%- if initialize_signature -%>
|
|
6
|
+
def initialize(<%= initialize_signature %>)
|
|
7
|
+
<%= initialize_body %>
|
|
8
|
+
end
|
|
9
|
+
<%- end -%>
|
|
10
|
+
<%- if initialize_call_method_for_inline? -%>
|
|
11
|
+
def call
|
|
12
|
+
content_tag :h1, "Hello world!"<%= ", data: { controller: \"#{stimulus_controller}\" }" if options["stimulus"] %>
|
|
13
|
+
end
|
|
14
|
+
<%- end -%>
|
|
15
|
+
end
|
|
16
|
+
<% end -%>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<div<%= data_attributes %>>Add <%= class_name %> template here</div>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
%div Add <%= class_name %> template here
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "rails_helper"
|
|
4
|
+
|
|
5
|
+
RSpec.describe <%= namespaced? ? "#{namespace.name}::" : '' %><%= class_name %>Component, type: :component do
|
|
6
|
+
pending "add some examples to (or delete) #{__FILE__}"
|
|
7
|
+
|
|
8
|
+
# it "renders something useful" do
|
|
9
|
+
# expect(
|
|
10
|
+
# render_inline(described_class.new(attr: "value")) { "Hello, components!" }.css("p").to_html
|
|
11
|
+
# ).to include(
|
|
12
|
+
# "Hello, components!"
|
|
13
|
+
# )
|
|
14
|
+
# end
|
|
15
|
+
end
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
div Add <%= class_name %> template here
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<div<%= data_attributes %>>Add <%= class_name %> template here</div>
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "test_helper"
|
|
4
|
+
|
|
5
|
+
class <%= namespaced? ? "#{namespace.name}::" : '' %><%= class_name %>ComponentTest < ViewComponent::TestCase
|
|
6
|
+
def test_component_renders_something_useful
|
|
7
|
+
# assert_equal(
|
|
8
|
+
# %(<span>Hello, components!</span>),
|
|
9
|
+
# render_inline(<%= class_name %>Component.new(message: "Hello, components!")).css("span").to_html
|
|
10
|
+
# )
|
|
11
|
+
end
|
|
12
|
+
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: view_component
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 3.
|
|
4
|
+
version: 3.24.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- ViewComponent Team
|
|
@@ -18,7 +18,7 @@ dependencies:
|
|
|
18
18
|
version: 5.2.0
|
|
19
19
|
- - "<"
|
|
20
20
|
- !ruby/object:Gem::Version
|
|
21
|
-
version: '8.
|
|
21
|
+
version: '8.2'
|
|
22
22
|
type: :runtime
|
|
23
23
|
prerelease: false
|
|
24
24
|
version_requirements: !ruby/object:Gem::Requirement
|
|
@@ -28,7 +28,7 @@ dependencies:
|
|
|
28
28
|
version: 5.2.0
|
|
29
29
|
- - "<"
|
|
30
30
|
- !ruby/object:Gem::Version
|
|
31
|
-
version: '8.
|
|
31
|
+
version: '8.2'
|
|
32
32
|
- !ruby/object:Gem::Dependency
|
|
33
33
|
name: method_source
|
|
34
34
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -581,15 +581,25 @@ files:
|
|
|
581
581
|
- docs/CHANGELOG.md
|
|
582
582
|
- lib/rails/generators/abstract_generator.rb
|
|
583
583
|
- lib/rails/generators/component/component_generator.rb
|
|
584
|
+
- lib/rails/generators/component/templates/component.rb.tt
|
|
584
585
|
- lib/rails/generators/erb/component_generator.rb
|
|
586
|
+
- lib/rails/generators/erb/templates/component.html.erb.tt
|
|
585
587
|
- lib/rails/generators/haml/component_generator.rb
|
|
588
|
+
- lib/rails/generators/haml/templates/component.html.haml.tt
|
|
586
589
|
- lib/rails/generators/locale/component_generator.rb
|
|
587
590
|
- lib/rails/generators/preview/component_generator.rb
|
|
591
|
+
- lib/rails/generators/preview/templates/component_preview.rb.tt
|
|
588
592
|
- lib/rails/generators/rspec/component_generator.rb
|
|
593
|
+
- lib/rails/generators/rspec/templates/component_spec.rb.tt
|
|
589
594
|
- lib/rails/generators/slim/component_generator.rb
|
|
595
|
+
- lib/rails/generators/slim/templates/component.html.slim.tt
|
|
590
596
|
- lib/rails/generators/stimulus/component_generator.rb
|
|
597
|
+
- lib/rails/generators/stimulus/templates/component_controller.js.tt
|
|
598
|
+
- lib/rails/generators/stimulus/templates/component_controller.ts.tt
|
|
591
599
|
- lib/rails/generators/tailwindcss/component_generator.rb
|
|
600
|
+
- lib/rails/generators/tailwindcss/templates/component.html.erb.tt
|
|
592
601
|
- lib/rails/generators/test_unit/component_generator.rb
|
|
602
|
+
- lib/rails/generators/test_unit/templates/component_test.rb.tt
|
|
593
603
|
- lib/view_component.rb
|
|
594
604
|
- lib/view_component/base.rb
|
|
595
605
|
- lib/view_component/capture_compatibility.rb
|
|
@@ -645,7 +655,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
645
655
|
- !ruby/object:Gem::Version
|
|
646
656
|
version: '0'
|
|
647
657
|
requirements: []
|
|
648
|
-
rubygems_version: 3.
|
|
658
|
+
rubygems_version: 3.7.2
|
|
649
659
|
specification_version: 4
|
|
650
660
|
summary: A framework for building reusable, testable & encapsulated view components
|
|
651
661
|
in Ruby on Rails.
|