vident-phlex 0.3.0 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 01fdc288b02728f29b9cb62d423991a69571d8b65cb7c60a06fa884f6515cf52
4
- data.tar.gz: 7b0852b10647e0ad7e83ed025118d8fbe2487ff89f6b18420fdc5ef7ee01ffa4
3
+ metadata.gz: 491b0cefd3a8305411d28a0f622b26d23353110e3c6b14a1f2dcbee1e66778d3
4
+ data.tar.gz: 679f4b3f77509ea345f0c656cd47d401407e38289e786cb799cd415bd1a9d73f
5
5
  SHA512:
6
- metadata.gz: '089ed6bb5951a0732656353a2debf807b28ae869a0d175b4443c8245bd9545236e63e7aa209b13a01e6f93cccabeeba96f812c07150cfe5e629b73541acd8c94'
7
- data.tar.gz: 4ebc7801536958604147ef70869421b35158641032238e84e1927b8de923ab964fd8b12e4e2bbe7af07558a901a8ece54e289f2f079cce158cd3598afeb8d027
6
+ metadata.gz: bbb631b7ff3bc67bcdfda2452defaaedaea85ba97ba286ddf71c17a462c0973ef57e21426f5e46b4e22be11d9df359b87678b18a499dbac64cee8f4bc6deda9d
7
+ data.tar.gz: 2014550736235ba4d7f9375af0d8ee463943b7481e13855d63d12b47116c2a79e21073c03fdf0b1b4f8de7565d5a73208016292276ab25a2d522070a20c78224
@@ -23,7 +23,7 @@ module Vident
23
23
  parsed = parse_targets(Array.wrap(targets))
24
24
  options[:data] ||= {}
25
25
  options[:data].merge!(build_target_data_attributes(parsed))
26
- generate_tag(tag_name, **options, &block)
26
+ generate_tag(tag_name, nil, **options, &block)
27
27
  end
28
28
 
29
29
  # Build a tag with the attributes determined by this components properties and stimulus
@@ -33,18 +33,22 @@ module Vident
33
33
  tag_type = @element_tag.presence&.to_sym || :div
34
34
  raise ArgumentError, "Unsupported HTML tag name #{tag_type}" unless VALID_TAGS.include?(tag_type)
35
35
  options = @html_options&.dup || {}
36
+ block_content = capture(&block) if block # Evaluate before generating the outer tag options to ensure DSL methods are executed
36
37
  data_attrs = tag_data_attributes
37
38
  data_attrs = options[:data].present? ? data_attrs.merge(options[:data]) : data_attrs
38
39
  options = options.merge(id: @id) if @id
39
40
  options.except!(:data)
40
41
  options.merge!(data_attrs.transform_keys { |k| "data-#{k}" })
41
- generate_tag(tag_type, **options, &block)
42
+ generate_tag(tag_type, block_content, **options)
42
43
  end
43
44
 
44
45
  private
45
46
 
46
- def generate_tag(tag_type, **options, &block)
47
- send((tag_type == :template) ? :template_tag : tag_type, **options, &block)
47
+ def generate_tag(tag_type, content, **options, &block)
48
+ # FIXME: Content was generated by the block, we assume its safe but that might not be true!
49
+ method_name = (tag_type == :template) ? :template_tag : tag_type
50
+ block = proc { unsafe_raw content } if !block && content
51
+ send(method_name, **options, &block)
48
52
  end
49
53
  end
50
54
  end
@@ -1,5 +1,5 @@
1
1
  module Vident
2
2
  module Phlex
3
- VERSION = "0.3.0"
3
+ VERSION = "0.4.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,17 +1,17 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vident-phlex
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stephen Ierodiaconou
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-08-12 00:00:00.000000000 Z
11
+ date: 2024-02-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: rails
14
+ name: railties
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - ">="
@@ -19,7 +19,7 @@ dependencies:
19
19
  version: '7'
20
20
  - - "<"
21
21
  - !ruby/object:Gem::Version
22
- version: '8'
22
+ version: '8.0'
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
@@ -29,7 +29,27 @@ dependencies:
29
29
  version: '7'
30
30
  - - "<"
31
31
  - !ruby/object:Gem::Version
32
- version: '8'
32
+ version: '8.0'
33
+ - !ruby/object:Gem::Dependency
34
+ name: activesupport
35
+ requirement: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - ">="
38
+ - !ruby/object:Gem::Version
39
+ version: '7'
40
+ - - "<"
41
+ - !ruby/object:Gem::Version
42
+ version: '8.0'
43
+ type: :runtime
44
+ prerelease: false
45
+ version_requirements: !ruby/object:Gem::Requirement
46
+ requirements:
47
+ - - ">="
48
+ - !ruby/object:Gem::Version
49
+ version: '7'
50
+ - - "<"
51
+ - !ruby/object:Gem::Version
52
+ version: '8.0'
33
53
  - !ruby/object:Gem::Dependency
34
54
  name: vident
35
55
  requirement: !ruby/object:Gem::Requirement
@@ -128,7 +148,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
128
148
  - !ruby/object:Gem::Version
129
149
  version: '0'
130
150
  requirements: []
131
- rubygems_version: 3.4.10
151
+ rubygems_version: 3.5.3
132
152
  signing_key:
133
153
  specification_version: 4
134
154
  summary: Vident with Phlex