fluent-icons 1.0.0.167 → 1.0.1.167

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: 47f9adf18081f57fe7946500d30b3b91028394736bd40f20cf5a85623d42cb57
4
- data.tar.gz: 272de7ff539a3c40691723c0739477ebdd46908c232882672425c8f8d0772ad9
3
+ metadata.gz: c3b24a031cb21dade8a20d9f62abfe29a397574c8528e947cc225f98a5c76998
4
+ data.tar.gz: 0f82fdefe98f8ccc8e8fafb3d31ac8e98296c10fcb3a1adc99b355a4b47907ae
5
5
  SHA512:
6
- metadata.gz: e8e350e9d9858b6e656463377a4957bdad5d6692c1eb9e48c064723174ed8962bafa73191e32b0160394dfa591a64b1d57d119e16b29b46b0d97edd3cee51e27
7
- data.tar.gz: 22c4dd33f7b99e71fd748cac0ffce4ed043809f9c9b374c9924b07f027da3512bde1c090f3ae606dd4b8436f82b008b838b3eb6c78591de83e704f5c5de6afe8
6
+ metadata.gz: 4267ee4274d38cc6ad4196d97ff64df55cb96c905ef109b786d697cccead20d1631f54286568a07b52a7fdf0257725b0f339cc9b48d42bf03ad3ac7948ebd992
7
+ data.tar.gz: fcc0cb81f92d22414c60a3b0db28c7689785df39a9fa65c230dd2583bc15515fe7f4f1833c09407212574aaa85b74e79270b3c07d0bc6fa36aa031ab3e4b14b3
@@ -4,41 +4,48 @@ module FluentIcons
4
4
 
5
5
  def initialize(symbol, options = {})
6
6
  @symbol = symbol.to_s
7
- @style = (options[:style] || 'regular').to_s
8
- @weight = (options[:weight] || 20).to_s
9
- @prefix = (options[:prefix] || 'fluent').to_s
10
7
 
11
- if (fluent = get_fluent_path(@symbol, style, weight, options))
12
- @path = fluent[:path]
13
- @width = fluent[:width] || 20
14
- @height = fluent[:height] || 20
15
- @keywords = fluent[:keywords] || []
16
- @options = options.dup
17
-
18
- @options.merge!({
19
- class: classes,
20
- viewBox: viewbox,
21
- version: '1.1'
22
- })
8
+ @style = (options.delete(:style) || 'regular').to_s
9
+ @weight = (options.delete(:weight) || 20).to_s
10
+ @prefix = (options.delete(:prefix) || 'fluent').to_s
23
11
 
24
- @options.merge!(a11y)
12
+ if (fluent = get_fluent_path(@symbol, style, weight))[:path].nil?
13
+ @path = "<path d=\"M7 4.5C7 4.67123 6.98278 4.83844 6.94999 5H10C10.5523 5 11 5.44772 11 6V8H10C9.49278 8 9.02965 8.18882 8.67709 8.5C8.61444 8.55529 8.55529 8.61444 8.5 8.67709C8.18882 9.02965 8 9.49278 8 10V11H6C5.44772 11 5 10.5523 5 10V6.94999C4.83844 6.98278 4.67123 7 4.5 7C4.32877 7 4.16155 6.98278 4 6.94999V10C4 11.1046 4.89543 12 6 12H8V14C8 14.5072 8.18882 14.9703 8.5 15.3229C8.68196 15.5291 8.90577 15.6974 9.15812 15.8147C9.0548 15.3934 9 14.9531 9 14.5C9 14.3821 9.00371 14.265 9.01102 14.149C9.00376 14.1004 9 14.0506 9 14V10C9 9.44772 9.44772 9 10 9H14C14.0506 9 14.1004 9.00376 14.149 9.01102C14.265 9.00371 14.3821 9 14.5 9C14.9531 9 15.3934 9.0548 15.8147 9.15812C15.6974 8.90577 15.5291 8.68196 15.3229 8.5C14.9703 8.18882 14.5072 8 14 8H12V6C12 4.89543 11.1046 4 10 4H6.94999C6.98278 4.16155 7 4.32877 7 4.5ZM6 4.5C6 5.32843 5.32843 6 4.5 6C3.67157 6 3 5.32843 3 4.5C3 3.67157 3.67157 3 4.5 3C5.32843 3 6 3.67157 6 4.5ZM17 4.5C17 5.32843 16.3284 6 15.5 6C14.6716 6 14 5.32843 14 4.5C14 3.67157 14.6716 3 15.5 3C16.3284 3 17 3.67157 17 4.5ZM6 15.5C6 16.3284 5.32843 17 4.5 17C3.67157 17 3 16.3284 3 15.5C3 14.6716 3.67157 14 4.5 14C5.32843 14 6 14.6716 6 15.5ZM19 14.5C19 16.9853 16.9853 19 14.5 19C12.0147 19 10 16.9853 10 14.5C10 12.0147 12.0147 10 14.5 10C16.9853 10 19 12.0147 19 14.5ZM16.3536 13.3536C16.5488 13.1583 16.5488 12.8417 16.3536 12.6464C16.1583 12.4512 15.8417 12.4512 15.6464 12.6464L14.5 13.7929L13.3536 12.6464C13.1583 12.4512 12.8417 12.4512 12.6464 12.6464C12.4512 12.8417 12.4512 13.1583 12.6464 13.3536L13.7929 14.5L12.6464 15.6464C12.4512 15.8417 12.4512 16.1583 12.6464 16.3536C12.8417 16.5488 13.1583 16.5488 13.3536 16.3536L14.5 15.2071L15.6464 16.3536C15.8417 16.5488 16.1583 16.5488 16.3536 16.3536C16.5488 16.1583 16.5488 15.8417 16.3536 15.6464L15.2071 14.5L16.3536 13.3536Z\" fill=\"currentColor\" />"
25
14
  else
26
- raise "Couldn't find octicon symbol for #{ @symbol.inspect }"
15
+ @path = fluent[:path]
27
16
  end
17
+
18
+ @width = (options[:width] || weight).to_i
19
+ @height = (options[:height] || weight).to_i
20
+ @options = options.dup
21
+
22
+ @options.merge!({
23
+ class: classes,
24
+ viewBox: [0, 0, width, height].join(' ').to_s,
25
+ version: '1.1'
26
+ })
27
+
28
+ @options.merge!(a11y)
28
29
  end
29
30
 
30
31
  def to_svg
31
- "<svg #{ html_attributes }>#{ @path }</svg>".strip
32
+ "<svg fill=\"none\" width=\"#{ width }\" height=\"#{ height }\" #{ html_attributes } xmlns=\"http://www.w3.org/2000/svg\">#{ @path }</svg>".strip
32
33
  end
33
34
 
34
- private
35
+ private
35
36
 
36
37
  def html_attributes
37
38
  attrs = ''
38
- options.each { |attr, value| attrs += "#{ attr }='#{ value }' " }
39
+
40
+ options.each { |attr, value| attrs += "#{ attr }=\"#{ value }\" " }
41
+
39
42
  attrs.strip
40
43
  end
41
44
 
45
+ def classes
46
+ "#{ prefix } #{ prefix }-#{ symbol } #{ options[:class] } ".strip
47
+ end
48
+
42
49
  def a11y
43
50
  accessible = { }
44
51
 
@@ -51,15 +58,7 @@ module FluentIcons
51
58
  accessible
52
59
  end
53
60
 
54
- def classes
55
- "#{ prefix } #{ prefix }-#{ symbol } #{ options[:class] } ".strip
56
- end
57
-
58
- def viewbox
59
- [0, 0, width, height].join(' ').to_s
60
- end
61
-
62
- def get_fluent_path(symbol, style, weight, options = {})
61
+ def get_fluent_path(symbol, style, weight)
63
62
  if (icon = FluentIcons::SYMBOLS[symbol])
64
63
 
65
64
  return {
@@ -12,12 +12,10 @@ module FluentIcons
12
12
  cache_key = [symbol, options]
13
13
 
14
14
  unless (tag = fluent_helper_cache[cache_key])
15
- icon = FluentIcons::Fluent.new(symbol, options)
16
-
17
- tag = content_tag(:svg, icon.path.html_safe, icon.options).freeze # rubocop:disable Rails/OutputSafety
18
- fluent_helper_cache[cache_key] = tag
15
+ fluent_helper_cache[cache_key] = FluentIcons::Fluent.new(symbol, options).to_svg
19
16
  end
20
17
 
21
18
  tag
22
19
  end
20
+ alias_method :fluent_icon, :fluent
23
21
  end
@@ -1,4 +1,4 @@
1
1
  module FluentIcons
2
2
  FLUENT_UI_ICONS_VERSION = '1.1.167'.freeze
3
- VERSION = '1.0.0.167'.freeze
3
+ VERSION = '1.0.1.167'.freeze
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-icons
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0.167
4
+ version: 1.0.1.167
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vlad Radulescu
@@ -14,42 +14,30 @@ dependencies:
14
14
  name: railties
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
18
- - !ruby/object:Gem::Version
19
- version: '5'
20
- - - ">"
17
+ - - ">="
21
18
  - !ruby/object:Gem::Version
22
- version: '5'
19
+ version: '6'
23
20
  type: :runtime
24
21
  prerelease: false
25
22
  version_requirements: !ruby/object:Gem::Requirement
26
23
  requirements:
27
- - - "~>"
28
- - !ruby/object:Gem::Version
29
- version: '5'
30
- - - ">"
24
+ - - ">="
31
25
  - !ruby/object:Gem::Version
32
- version: '5'
26
+ version: '6'
33
27
  - !ruby/object:Gem::Dependency
34
28
  name: actionview
35
29
  requirement: !ruby/object:Gem::Requirement
36
30
  requirements:
37
- - - "~>"
38
- - !ruby/object:Gem::Version
39
- version: '5'
40
- - - ">"
31
+ - - ">="
41
32
  - !ruby/object:Gem::Version
42
- version: '5'
33
+ version: '6'
43
34
  type: :runtime
44
35
  prerelease: false
45
36
  version_requirements: !ruby/object:Gem::Requirement
46
37
  requirements:
47
- - - "~>"
48
- - !ruby/object:Gem::Version
49
- version: '5'
50
- - - ">"
38
+ - - ">="
51
39
  - !ruby/object:Gem::Version
52
- version: '5'
40
+ version: '6'
53
41
  - !ruby/object:Gem::Dependency
54
42
  name: git
55
43
  requirement: !ruby/object:Gem::Requirement