view_component 3.23.1 → 3.23.2
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 +6 -0
- 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/version.rb +1 -1
- metadata +11 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 79672f93bd1c3bfa2dae00890f833c5dfb63dec49585dd79453f6592f9f47520
|
4
|
+
data.tar.gz: e6fe55dfe963ce0e7f4d793c93b67aefa92c99ee834c17c35644a9ea8b746886
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 311478a282f72c7b703594ec119dfc2686ec8cd3c6d6e97ff9fab9a32638e09eacefdc82a3808c581e48ab2af4cbfb26f66c7064cb614367cb4916fdf3b7df76
|
7
|
+
data.tar.gz: 3c059cb40bfa81c45a60bc9d107be8402923f92f0a8e1b50c6cdfcad88a4da6407244f1e5220d58f59a938c3d77e748ec22f360b8cf49041279616138ac4397d
|
data/docs/CHANGELOG.md
CHANGED
@@ -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.23.
|
4
|
+
version: 3.23.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ViewComponent Team
|
@@ -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
|