phlex 1.3.1 → 1.4.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of phlex might be problematic. Click here for more details.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9cd9fd26d33fcf92978a26d9d94b81485871fa3f54c98639eb4ba5932960df84
4
- data.tar.gz: c8f0ded1ee9cd43c12e8358af687b7fe4f21e732031ca4fb009020dfaaeb72b5
3
+ metadata.gz: a8a6c8dfab161746b6b4e04d403fead1f2477f195ff27e72365838f169ecc287
4
+ data.tar.gz: e9e9da3414eba5fc53d5440b16c0eecf47d4fc5d09a178fe44c9acab3f554119
5
5
  SHA512:
6
- metadata.gz: 890ccb499d210d332f5b2213bfdce51bd1e2212c550b20b0d9de3d1698205ca45b82e86e7850dc037e07a43e3da70a011e27d2310618f203882a00b32750704d
7
- data.tar.gz: fd9794d862a27ddaafa53c1f0d5fcecd3a967391083e2073922a2e83cbc19db7f95f4d19dd5db64b3c186e5c1c6292a6cef71dc05842c7216bd1e9b07046edc8
6
+ metadata.gz: 043c059dd8ce067a50df40c293d61475892acc934a4efdd18bedae7094ebaea3c9dd11a4bc5e5b7779120d38966964a2725dcd17de3dca2de48c50e837e2e8fd
7
+ data.tar.gz: 00edaf160d669c8f62f40c4f66faf17a6b76b2428648be0d7c7977ad629b119a146cfacffc8636312f87e46b77cdfc3074fe39ade0b4ff45ee10e874f0459a31
data/.rubocop.yml CHANGED
@@ -5,27 +5,5 @@ inherit_from:
5
5
  AllCops:
6
6
  TargetRubyVersion: 2.7
7
7
 
8
- Style/PercentLiteralDelimiters:
9
- Enabled: false
10
-
11
- Layout/CaseIndentation:
12
- Enabled: false
13
-
14
- Style/StringConcatenation:
15
- Enabled: false
16
-
17
- Style/CaseEquality:
18
- Enabled: false
19
-
20
- Security/Eval:
21
- Enabled: false
22
-
23
- Style/MethodCallWithoutArgsParentheses:
24
- Enabled: false
25
-
26
- Style/MixinUsage:
27
- Enabled: false
28
-
29
- Style/AccessModifierDeclarations:
30
- Enabled: true
31
- EnforcedStyle: inline
8
+ Style/ExplicitBlockArgument:
9
+ Enabled: false
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 3.2.0
1
+ 3.2.1
data/Gemfile CHANGED
@@ -10,6 +10,7 @@ gem "sus"
10
10
  gem "zeitwerk"
11
11
  gem "benchmark-ips"
12
12
  gem "erb"
13
+ gem "ruby-lsp"
13
14
 
14
15
  group :test do
15
16
  gem "i18n"
data/README.md CHANGED
@@ -43,3 +43,4 @@ Thanks [Logology](https://www.logology.co) for sponsoring our logo.
43
43
  - [hoshi](https://github.com/pete/hoshi)
44
44
  - [hyperstack](https://github.com/hyperstack-org/hyperstack)
45
45
  - [clearwater](https://github.com/clearwater-rb/clearwater)
46
+ - [paggio](https://github.com/opal/paggio)
@@ -13,4 +13,10 @@ module ViewHelper
13
13
  Class.new(Phlex::HTML, &block)
14
14
  end
15
15
  end
16
+
17
+ def svg_view(&block)
18
+ let :view do
19
+ Class.new(Phlex::SVG, &block)
20
+ end
21
+ end
16
22
  end
@@ -1,15 +1,13 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module Phlex
4
- module BlackHole
5
- extend self
3
+ module Phlex::BlackHole
4
+ extend self
6
5
 
7
- def <<(anything)
8
- self
9
- end
6
+ def <<(anything)
7
+ self
8
+ end
10
9
 
11
- def length
12
- 0
13
- end
10
+ def length
11
+ 0
14
12
  end
15
13
  end
@@ -1,9 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module Phlex
4
- module Callable
5
- def to_proc
6
- method(:call).to_proc
7
- end
3
+ module Phlex::Callable
4
+ def to_proc
5
+ method(:call).to_proc
8
6
  end
9
7
  end
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module Phlex
4
- module DeferredRender
5
- # This module doesn't do anything. Phlex::HTML#call checks for its inclusion in the ancestry instead.
6
- end
3
+ module Phlex::DeferredRender
4
+ # This module doesn't do anything. Phlex::HTML#call checks for its inclusion in the ancestry instead.
7
5
  end
@@ -1,57 +1,63 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  if Gem::Version.new(RUBY_VERSION) < Gem::Version.new("3.0")
4
- using Overrides::Symbol::Name
4
+ using Phlex::Overrides::Symbol::Name
5
5
  end
6
6
 
7
- module Phlex
8
- module Elements
9
- def register_element(element, tag: element.name.tr("_", "-"))
10
- class_eval(<<-RUBY, __FILE__, __LINE__ + 1)
11
- # frozen_string_literal: true
12
-
13
- def #{element}(**attributes, &block)
14
- if attributes.length > 0
15
- if block_given?
16
- @_target << "<#{tag}" << (Phlex::ATTRIBUTE_CACHE[attributes.hash] || __attributes__(**attributes)) << ">"
17
- yield_content(&block)
18
- @_target << "</#{tag}>"
19
- else
20
- @_target << "<#{tag}" << (Phlex::ATTRIBUTE_CACHE[attributes.hash] || __attributes__(**attributes)) << "></#{tag}>"
21
- end
22
- else
23
- if block_given?
24
- @_target << "<#{tag}>"
25
- yield_content(&block)
26
- @_target << "</#{tag}>"
27
- else
28
- @_target << "<#{tag}></#{tag}>"
29
- end
30
- end
31
-
32
- nil
33
- end
34
-
35
- alias_method :_#{element}, :#{element}
36
- RUBY
37
- end
38
-
39
- def register_void_element(element, tag: element.name.tr("_", "-"))
40
- class_eval(<<-RUBY, __FILE__, __LINE__ + 1)
41
- # frozen_string_literal: true
42
-
43
- def #{element}(**attributes)
44
- if attributes.length > 0
45
- @_target << "<#{tag}" << (Phlex::ATTRIBUTE_CACHE[attributes.hash] || __attributes__(**attributes)) << ">"
46
- else
47
- @_target << "<#{tag}>"
48
- end
49
-
50
- nil
51
- end
52
-
53
- alias_method :_#{element}, :#{element}
54
- RUBY
55
- end
7
+ module Phlex::Elements
8
+ def register_element(element, tag: element.name.tr("_", "-"))
9
+ class_eval(<<-RUBY, __FILE__, __LINE__ + 1)
10
+ # frozen_string_literal: true
11
+
12
+ def #{element}(**attributes, &block)
13
+ if attributes.length > 0
14
+ if block_given?
15
+ @_target << "<#{tag}" << (Phlex::ATTRIBUTE_CACHE[attributes.hash] || __attributes__(**attributes)) << ">"
16
+ yield_content(&block)
17
+ @_target << "</#{tag}>"
18
+ else
19
+ @_target << "<#{tag}" << (Phlex::ATTRIBUTE_CACHE[attributes.hash] || __attributes__(**attributes)) << "></#{tag}>"
20
+ end
21
+ else
22
+ if block_given?
23
+ @_target << "<#{tag}>"
24
+ yield_content(&block)
25
+ @_target << "</#{tag}>"
26
+ else
27
+ @_target << "<#{tag}></#{tag}>"
28
+ end
29
+ end
30
+
31
+ nil
32
+ end
33
+
34
+ alias_method :_#{element}, :#{element}
35
+ RUBY
36
+
37
+ self::REGISTERED_ELEMENTS[element] = tag
38
+
39
+ element
40
+ end
41
+
42
+ def register_void_element(element, tag: element.name.tr("_", "-"))
43
+ class_eval(<<-RUBY, __FILE__, __LINE__ + 1)
44
+ # frozen_string_literal: true
45
+
46
+ def #{element}(**attributes)
47
+ if attributes.length > 0
48
+ @_target << "<#{tag}" << (Phlex::ATTRIBUTE_CACHE[attributes.hash] || __attributes__(**attributes)) << ">"
49
+ else
50
+ @_target << "<#{tag}>"
51
+ end
52
+
53
+ nil
54
+ end
55
+
56
+ alias_method :_#{element}, :#{element}
57
+ RUBY
58
+
59
+ self::REGISTERED_ELEMENTS[element] = tag
60
+
61
+ element
56
62
  end
57
63
  end
data/lib/phlex/helpers.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  if Gem::Version.new(RUBY_VERSION) < Gem::Version.new("3.0")
4
- using Overrides::Symbol::Name
4
+ using Phlex::Overrides::Symbol::Name
5
5
  end
6
6
 
7
7
  module Phlex::Helpers
@@ -25,7 +25,10 @@ module Phlex::Helpers
25
25
  end
26
26
  end
27
27
 
28
- tokens.join(" ")
28
+ tokens = tokens.select(&:itself).join(" ")
29
+ tokens.strip!
30
+ tokens.gsub!(/\s+/, " ")
31
+ tokens
29
32
  end
30
33
 
31
34
  private def __append_token__(tokens, token)