vident-phlex 0.3.0 → 0.5.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: d4e8d218ff27fd79fd3b3e911d5fa114a662bc987fbb26779217c0f648025175
4
+ data.tar.gz: 763f089c29d75951024ee5798161a36f9e5c9b43e1097708eee6b28b86a8a19e
5
5
  SHA512:
6
- metadata.gz: '089ed6bb5951a0732656353a2debf807b28ae869a0d175b4443c8245bd9545236e63e7aa209b13a01e6f93cccabeeba96f812c07150cfe5e629b73541acd8c94'
7
- data.tar.gz: 4ebc7801536958604147ef70869421b35158641032238e84e1927b8de923ab964fd8b12e4e2bbe7af07558a901a8ece54e289f2f079cce158cd3598afeb8d027
6
+ metadata.gz: fb83362567723c505c3d81cae0a54318a3ff3506caf95e760951ea7dbf1f8aec14baabc7ac36143add59ca0839adc16b9c1b0c86dc4072ea03b4aceb872def90
7
+ data.tar.gz: 34705a2691748b230e6af3dcc0f7876310a369c2b8f17c02f436e5e8d65e2d2a908c0d37c8e88f6a628087124630a5b15f673c61afbad5b0a77f665b0b2947ed
@@ -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.5.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.5.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-04-19 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
@@ -79,7 +99,7 @@ dependencies:
79
99
  version: 0.8.1
80
100
  - - "<"
81
101
  - !ruby/object:Gem::Version
82
- version: '1'
102
+ version: '2'
83
103
  type: :runtime
84
104
  prerelease: false
85
105
  version_requirements: !ruby/object:Gem::Requirement
@@ -89,7 +109,7 @@ dependencies:
89
109
  version: 0.8.1
90
110
  - - "<"
91
111
  - !ruby/object:Gem::Version
92
- version: '1'
112
+ version: '2'
93
113
  description: Vident with Phlex
94
114
  email:
95
115
  - stevegeek@gmail.com
@@ -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