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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 16a94da266921e0bd3ed59abdba704b4edf68873959d74c0d3caad66d3aac082
4
- data.tar.gz: 0520dc669a3c0d1bda117d7a2f1932f6f2b31726a55e44be87062c49c004cd64
3
+ metadata.gz: 79672f93bd1c3bfa2dae00890f833c5dfb63dec49585dd79453f6592f9f47520
4
+ data.tar.gz: e6fe55dfe963ce0e7f4d793c93b67aefa92c99ee834c17c35644a9ea8b746886
5
5
  SHA512:
6
- metadata.gz: 63ebe85255f6d35c49108590e6d939c1ea21971bfaa8bd476f5f5854073916692d602173e5f607db3aefbbc46cee3ef467232efb4c0231ca85a8c691b1a27ea5
7
- data.tar.gz: 6e4cbef0047c2d3daf22f06b024bca4af0b12fdea8146f9bc1217bc27fa3d318049681b99f5e6030bf42017922fdb82ca0a1255b4aa367f43d793f9d4a0a8528
6
+ metadata.gz: 311478a282f72c7b703594ec119dfc2686ec8cd3c6d6e97ff9fab9a32638e09eacefdc82a3808c581e48ab2af4cbfb26f66c7064cb614367cb4916fdf3b7df76
7
+ data.tar.gz: 3c059cb40bfa81c45a60bc9d107be8402923f92f0a8e1b50c6cdfcad88a4da6407244f1e5220d58f59a938c3d77e748ec22f360b8cf49041279616138ac4397d
data/docs/CHANGELOG.md CHANGED
@@ -10,6 +10,12 @@ nav_order: 6
10
10
 
11
11
  ## main
12
12
 
13
+ ## 3.23.2
14
+
15
+ * Include .tt files in published gem. Fixes templates not being available when using generators.
16
+
17
+ *Florian Aßmann*
18
+
13
19
  ## 3.23.1
14
20
 
15
21
  * Restore Rake tasks in published gem.
@@ -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,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ <% module_namespacing do -%>
4
+ class <%= class_name %>ComponentPreview < ViewComponent::Preview
5
+ def default
6
+ render(<%= class_name %>Component.new<%= "(#{render_signature})" if render_signature %>)
7
+ end
8
+ end
9
+ <% end -%>
@@ -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,7 @@
1
+ import { Controller } from "<%= stimulus_module %>";
2
+
3
+ export default class extends Controller {
4
+ connect() {
5
+ console.log("Hello, Stimulus!", this.element);
6
+ }
7
+ }
@@ -0,0 +1,9 @@
1
+ import { Controller } from "<%= stimulus_module %>";
2
+
3
+ export default class extends Controller {
4
+ declare element: HTMLElement;
5
+
6
+ connect() {
7
+ console.log("Hello, Stimulus!", this.element);
8
+ }
9
+ }
@@ -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
@@ -4,7 +4,7 @@ module ViewComponent
4
4
  module VERSION
5
5
  MAJOR = 3
6
6
  MINOR = 23
7
- PATCH = 1
7
+ PATCH = 2
8
8
  PRE = nil
9
9
 
10
10
  STRING = [MAJOR, MINOR, PATCH, PRE].compact.join(".")
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.1
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