vident-view_component 1.0.0.alpha4 → 1.0.0.beta2

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: ad0c1b7dc1807d2f8de65971bad127b5f886a138faae6fd1951d89743e328950
4
- data.tar.gz: 4ef05f134343065a200c5c109a1d87849c99c37982adf45f79a0b117e5577150
3
+ metadata.gz: 04f65c3476a4173c32cc063c60eaaef6d588d0c66a6e94d9ae1237e8130ccf12
4
+ data.tar.gz: 40731bc5242a66c80a5a71b731adb97ef4c5f558da0580aff635c80a707171d4
5
5
  SHA512:
6
- metadata.gz: b868e1dd942a08188a935630cbdd3c0b39f773b0e42327c32c9960877914c3887920ec22caf1a3e830c17f821d4e4c0b333b09119bb16edf4b0d57bd607b3dd0
7
- data.tar.gz: f844a54d9699129aacf5fb9ae13af2ae7997c7ea31d4b5c28f947a0a3eede588823acc99bd7b4f8924880fa234d48ec396e259d5f2cf8d5412036d109cb014b6
6
+ metadata.gz: fca4cc83f6bb06224ef3e3925f246459067bd12c72797b3542517c49092262f649ba1f2547fa169b93638ff64a7fce14cec943b780db4dd8864cd4a5d8e3439b
7
+ data.tar.gz: dbeb376b521f65809985226254496164ca5454f5988f376d0345a438578e8fe5a1497e10f9dfff1fba9ab1adc5af3abe711613c03c98406242fdcc66c0bdba09
data/CHANGELOG.md CHANGED
@@ -6,6 +6,26 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/)
6
6
  and this project adheres to [Semantic Versioning](http://semver.org/).
7
7
 
8
8
 
9
+ ## [1.0.0.beta2] - 2026-04-16
10
+
11
+ ### Breaking
12
+
13
+ - Renamed the `tag(...)` helper to `child_element(...)` (and the internal `Vident::TagHelper` module to `Vident::ChildElementHelper`). The old name shadowed Rails' own `tag(name, options)` positional API, which breaks Rails helpers like `hidden_field_tag` and `image_tag` when called inside vident components. Rename any `component.tag(...)` calls to `component.child_element(...)`.
14
+
15
+ ### Fixed
16
+
17
+ - `stimulus_outlet` parser now accepts `(String, String)` arguments so string-keyed outlets produced by the DSL actually render.
18
+
19
+ ## [1.0.0.beta1] - 2026-04-16
20
+
21
+ ### Fixed
22
+
23
+ - `tag(...)` singular stimulus kwargs (e.g. `stimulus_action: [:click, :foo]`) no longer splat `[event, handler]` tuples into two bare handlers (#19).
24
+ - `vident-view_component`'s `tag(...)` now emits void elements (`:input`, `:img`, `:br`, etc.) without a closing tag (#19).
25
+ - `vident-view_component`'s `tag(...)` without a block no longer renders the options hash as element content (#19).
26
+ - `stimulus_targets:` prop now accepts `Array` entries (e.g. `[[controller_path, :name]]`), matching `stimulus_actions:` (#20).
27
+ - `stimulus do ... outlets(...)` DSL now accepts a positional `Hash`, allowing string keys (e.g. stimulus identifiers containing `--`) that cannot be Ruby kwarg keys (#21).
28
+
9
29
  ## [1.0.0.alpha4] - 2025-12-12
10
30
 
11
31
  - Update to `view_component` 4
data/README.md CHANGED
@@ -93,7 +93,7 @@ class ButtonComponent < Vident::ViewComponent::Base
93
93
  def call
94
94
  root_element do |component|
95
95
  # Wire up targets etc
96
- component.tag(:span, stimulus_target: :status) do
96
+ component.child_element(:span, stimulus_target: :status) do
97
97
  @text
98
98
  end
99
99
  end
@@ -483,13 +483,13 @@ or you can use tag helpers to generate HTML with Stimulus attributes:
483
483
  <% end %>
484
484
  <%= content_tag(:span, class: "...", data: {**greeter.stimulus_target(:output)}) %>
485
485
 
486
- <%# OR use the vident tag helper %>
486
+ <%# OR use the vident child_element helper %>
487
487
 
488
- <%= greeter.tag(:input, stimulus_target: :name, type: "text", class: "...") %>
489
- <%= greeter.tag(:button, stimulus_action: [:click, :greet], class: "...") do %>
488
+ <%= greeter.child_element(:input, stimulus_target: :name, type: "text", class: "...") %>
489
+ <%= greeter.child_element(:button, stimulus_action: [:click, :greet], class: "...") do %>
490
490
  <%= @cta %>
491
491
  <% end %>
492
- <%= greeter.tag(:span, stimulus_target: :output, class: "...") %>
492
+ <%= greeter.child_element(:span, stimulus_target: :output, class: "...") %>
493
493
  ```
494
494
 
495
495
  or in your Phlex templates:
@@ -498,7 +498,7 @@ or in your Phlex templates:
498
498
  root_element do |greeter|
499
499
  input(type: "text", data: {**greeter.stimulus_target(:name)}, class: %(...))
500
500
  trigger_or_default(greeter)
501
- greeter.tag(:span, stimulus_target: :output, class: "ml-4 #{greeter.class_list_for_stimulus_classes(:pre_click)}") do
501
+ greeter.child_element(:span, stimulus_target: :output, class: "ml-4 #{greeter.class_list_for_stimulus_classes(:pre_click)}") do
502
502
  plain %( ... )
503
503
  end
504
504
  end
@@ -102,10 +102,16 @@ module Vident
102
102
 
103
103
  private
104
104
 
105
- def generate_tag(tag_name, stimulus_data_attributes, options, &block)
105
+ def generate_child_element(tag_name, stimulus_data_attributes, options, &block)
106
106
  options[:data] ||= {}
107
107
  options[:data].merge!(stimulus_data_attributes)
108
- view_context.content_tag(tag_name, options, &block)
108
+ if SELF_CLOSING_TAGS.include?(tag_name.to_sym)
109
+ view_context.tag(tag_name, options)
110
+ elsif block
111
+ view_context.content_tag(tag_name, view_context.capture(&block), options)
112
+ else
113
+ view_context.content_tag(tag_name, nil, options)
114
+ end
109
115
  end
110
116
 
111
117
  def escape_attribute_name_for_html(name)
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vident-view_component
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0.alpha4
4
+ version: 1.0.0.beta2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stephen Ierodiaconou
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2025-12-12 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: railties
@@ -55,14 +55,14 @@ dependencies:
55
55
  requirements:
56
56
  - - "~>"
57
57
  - !ruby/object:Gem::Version
58
- version: 1.0.0.alpha4
58
+ version: 1.0.0.beta2
59
59
  type: :runtime
60
60
  prerelease: false
61
61
  version_requirements: !ruby/object:Gem::Requirement
62
62
  requirements:
63
63
  - - "~>"
64
64
  - !ruby/object:Gem::Version
65
- version: 1.0.0.alpha4
65
+ version: 1.0.0.beta2
66
66
  - !ruby/object:Gem::Dependency
67
67
  name: view_component
68
68
  requirement: !ruby/object:Gem::Requirement
@@ -118,7 +118,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
118
118
  - !ruby/object:Gem::Version
119
119
  version: '0'
120
120
  requirements: []
121
- rubygems_version: 3.6.2
121
+ rubygems_version: 4.0.3
122
122
  specification_version: 4
123
123
  summary: Vident with ViewComponent
124
124
  test_files: []