railsglyphs 1.0.4 → 1.1.0
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 +4 -4
- data/assets/icons/outline/discord.svg +3 -0
- data/assets/icons/solid/discord.svg +3 -0
- data/lib/railsglyphs/icon_helper.rb +26 -12
- data/lib/railsglyphs/railtie.rb +2 -0
- data/lib/railsglyphs/version.rb +1 -1
- metadata +20 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 00035e80912f083c7c53b1fefdaac993586bd3a063dcbd275d111aa4d5d61c7c
|
|
4
|
+
data.tar.gz: b0d227db6cbeec507d2bd81b9f18ed3e984f7aaf2b2221d940515741df175c80
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d073a2894b90baac869e514946f0a60392fa285c58b1476320dad8c5c5070c5fe38dd3c0b5156aec09b6c10a637ffd141bdedc10f47ae83893ea8f862143e6a7
|
|
7
|
+
data.tar.gz: a65cb54bda121227f38602601ab7261be2dcfd43100f1232a23c40bf41b48fc2e2f80357878c69703519d2fe556f41412bc912dc219e96f5b0242bc710c4b4a5
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 256 256" stroke-width="1.5" stroke="currentColor" aria-hidden="true" data-slot="icon">
|
|
2
|
+
<path d="M104,140a12,12,0,1,1-12-12A12,12,0,0,1,104,140Zm60-12a12,12,0,1,0,12,12A12,12,0,0,0,164,128Zm74.45,64.9-67,29.71a16.17,16.17,0,0,1-21.71-9.1l-8.11-22q-6.72.45-13.63.46t-13.63-.46l-8.11,22a16.18,16.18,0,0,1-21.71,9.1l-67-29.71a15.93,15.93,0,0,1-9.06-18.51L38,58A16.07,16.07,0,0,1,51,46.14l36.06-5.93a16.22,16.22,0,0,1,18.26,11.88l3.26,12.84Q118.11,64,128,64t19.4.93l3.26-12.84a16.21,16.21,0,0,1,18.26-11.88L205,46.14A16.07,16.07,0,0,1,218,58l29.53,116.38A15.93,15.93,0,0,1,238.45,192.9ZM232,178.28,202.47,62s0,0-.08,0L166.33,56a.17.17,0,0,0-.17,0l-2.83,11.14c5,.94,10,2.06,14.83,3.42A8,8,0,0,1,176,86.31a8.09,8.09,0,0,1-2.16-.3A172.25,172.25,0,0,0,128,80a172.25,172.25,0,0,0-45.84,6,8,8,0,1,1-4.32-15.4c4.82-1.36,9.78-2.48,14.82-3.42L89.83,56s0,0-.12,0h0L53.61,61.93a.17.17,0,0,0-.09,0L24,178.33,91,208a.23.23,0,0,0,.22,0L98,189.72a173.2,173.2,0,0,1-20.14-4.32A8,8,0,0,1,82.16,170,171.85,171.85,0,0,0,128,176a171.85,171.85,0,0,0,45.84-6,8,8,0,0,1,4.32,15.41A173.2,173.2,0,0,1,158,189.72L164.75,208a.22.22,0,0,0,.21,0Z"/>
|
|
3
|
+
</svg>
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor" aria-hidden="true" data-slot="icon">
|
|
2
|
+
<path fill-rule="evenodd" d="M247.51,174.39,218,58a16.08,16.08,0,0,0-13-11.88l-36.06-5.92a16.22,16.22,0,0,0-18.26,11.88l-.21.85a4,4,0,0,0,3.27,4.93,155.62,155.62,0,0,1,24.41,5.62,8.2,8.2,0,0,1,5.62,9.7,8,8,0,0,1-10.19,5.64,155.4,155.4,0,0,0-90.8-.1,8.22,8.22,0,0,1-10.28-4.81,8,8,0,0,1,5.08-10.33,156.85,156.85,0,0,1,24.72-5.72,4,4,0,0,0,3.27-4.93l-.21-.85A16.21,16.21,0,0,0,87.08,40.21L51,46.13A16.08,16.08,0,0,0,38,58L8.49,174.39a15.94,15.94,0,0,0,9.06,18.51l67,29.71a16.17,16.17,0,0,0,21.71-9.1l3.49-9.45a4,4,0,0,0-3.27-5.35,158.13,158.13,0,0,1-28.63-6.2,8.2,8.2,0,0,1-5.61-9.67,8,8,0,0,1,10.2-5.66,155.59,155.59,0,0,0,91.12,0,8,8,0,0,1,10.19,5.65,8.19,8.19,0,0,1-5.61,9.68,157.84,157.84,0,0,1-28.62,6.2,4,4,0,0,0-3.27,5.35l3.49,9.45a16.18,16.18,0,0,0,21.71,9.1l67-29.71A15.94,15.94,0,0,0,247.51,174.39ZM92,152a12,12,0,1,1,12-12A12,12,0,0,1,92,152Zm72,0a12,12,0,1,1,12-12A12,12,0,0,1,164,152Z" clip-rule="evenodd"/>
|
|
3
|
+
</svg>
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require
|
|
4
|
-
require 'digest'
|
|
5
|
-
require 'concurrent'
|
|
3
|
+
require "concurrent"
|
|
6
4
|
|
|
7
5
|
module RailsGlyphs
|
|
8
6
|
module IconHelper
|
|
@@ -10,7 +8,7 @@ module RailsGlyphs
|
|
|
10
8
|
|
|
11
9
|
# Returns the absolute path to the gem's asset directory
|
|
12
10
|
def self.gem_asset_path
|
|
13
|
-
File.expand_path(
|
|
11
|
+
File.expand_path("../../assets/icons", __dir__)
|
|
14
12
|
end
|
|
15
13
|
|
|
16
14
|
# Optionally allow the icon path to be overridden in the host app
|
|
@@ -20,32 +18,48 @@ module RailsGlyphs
|
|
|
20
18
|
|
|
21
19
|
def self.icon_base_path=(path)
|
|
22
20
|
@icon_base_path = path
|
|
21
|
+
@valid_styles = nil
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def self.valid_styles
|
|
25
|
+
@valid_styles ||= Dir.children(icon_base_path).select { |d| File.directory?(File.join(icon_base_path, d)) }
|
|
23
26
|
end
|
|
24
27
|
|
|
25
28
|
def icon(style, name, text = nil, html_options = {})
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
29
|
+
if text.is_a?(Hash)
|
|
30
|
+
html_options = text
|
|
31
|
+
text = nil
|
|
32
|
+
end
|
|
33
|
+
html_options = html_options.dup
|
|
34
|
+
height = html_options.delete(:size) || 24
|
|
35
|
+
width = height
|
|
36
|
+
|
|
37
|
+
raise ArgumentError, "Icon name cannot be blank." if name.to_s.strip.empty?
|
|
30
38
|
|
|
31
39
|
text = content_tag(:span, text, class: "icon-text") unless text.blank?
|
|
32
40
|
|
|
41
|
+
unless RailsGlyphs::IconHelper.valid_styles.include?(style.to_s)
|
|
42
|
+
raise ArgumentError,
|
|
43
|
+
"Unknown icon style '#{style}'. Valid styles: #{RailsGlyphs::IconHelper.valid_styles.join(", ")}"
|
|
44
|
+
end
|
|
45
|
+
|
|
33
46
|
svg_path = File.join(RailsGlyphs::IconHelper.icon_base_path, style.to_s, "#{name}.svg")
|
|
34
47
|
raise ArgumentError, "Icon '#{name}' with style '#{style}' not found at #{svg_path}." unless File.exist?(svg_path)
|
|
35
48
|
|
|
36
|
-
cache_key = "#{style}-#{name}-#{
|
|
49
|
+
cache_key = "#{style}-#{name}-#{height}-#{width}"
|
|
37
50
|
|
|
38
51
|
svg_content = ICON_CACHE[cache_key] ||= begin
|
|
39
52
|
svg = File.read(svg_path)
|
|
40
|
-
svg.gsub!(
|
|
53
|
+
svg.gsub!(/\s*(height|width|aria-hidden)="[^"]*"/, "")
|
|
54
|
+
svg.gsub!("<svg", "<svg style=\"display: inline-block;\" height=\"#{height}\" width=\"#{width}\"")
|
|
41
55
|
svg.html_safe
|
|
42
56
|
end
|
|
43
57
|
|
|
44
58
|
html_options[:class] = html_options[:class].strip if html_options[:class]
|
|
45
|
-
html_options[
|
|
59
|
+
html_options["aria-hidden"] = true unless html_options.key?("aria-hidden")
|
|
46
60
|
|
|
47
61
|
html = content_tag(:i, svg_content, html_options)
|
|
48
|
-
html <<
|
|
62
|
+
html << " ".html_safe << text.to_s unless text.blank?
|
|
49
63
|
html
|
|
50
64
|
end
|
|
51
65
|
end
|
data/lib/railsglyphs/railtie.rb
CHANGED
data/lib/railsglyphs/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: railsglyphs
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.0
|
|
4
|
+
version: 1.1.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Victor S. Keenan
|
|
8
8
|
bindir: bin
|
|
9
9
|
cert_chain: []
|
|
10
|
-
date:
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
11
11
|
dependencies:
|
|
12
12
|
- !ruby/object:Gem::Dependency
|
|
13
|
-
name:
|
|
13
|
+
name: actionview
|
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|
|
15
15
|
requirements:
|
|
16
16
|
- - ">="
|
|
@@ -23,6 +23,20 @@ dependencies:
|
|
|
23
23
|
- - ">="
|
|
24
24
|
- !ruby/object:Gem::Version
|
|
25
25
|
version: '6.0'
|
|
26
|
+
- !ruby/object:Gem::Dependency
|
|
27
|
+
name: concurrent-ruby
|
|
28
|
+
requirement: !ruby/object:Gem::Requirement
|
|
29
|
+
requirements:
|
|
30
|
+
- - ">="
|
|
31
|
+
- !ruby/object:Gem::Version
|
|
32
|
+
version: '0'
|
|
33
|
+
type: :runtime
|
|
34
|
+
prerelease: false
|
|
35
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
36
|
+
requirements:
|
|
37
|
+
- - ">="
|
|
38
|
+
- !ruby/object:Gem::Version
|
|
39
|
+
version: '0'
|
|
26
40
|
description: RailsGlyphs is an essential SVG icon library built exclusively for Ruby
|
|
27
41
|
on Rails projects!
|
|
28
42
|
email:
|
|
@@ -181,6 +195,7 @@ files:
|
|
|
181
195
|
- assets/icons/outline/cursor-arrow-ripple.svg
|
|
182
196
|
- assets/icons/outline/device-phone-mobile.svg
|
|
183
197
|
- assets/icons/outline/device-tablet.svg
|
|
198
|
+
- assets/icons/outline/discord.svg
|
|
184
199
|
- assets/icons/outline/divide.svg
|
|
185
200
|
- assets/icons/outline/document-arrow-down.svg
|
|
186
201
|
- assets/icons/outline/document-arrow-up.svg
|
|
@@ -515,6 +530,7 @@ files:
|
|
|
515
530
|
- assets/icons/solid/cursor-arrow-ripple.svg
|
|
516
531
|
- assets/icons/solid/device-phone-mobile.svg
|
|
517
532
|
- assets/icons/solid/device-tablet.svg
|
|
533
|
+
- assets/icons/solid/discord.svg
|
|
518
534
|
- assets/icons/solid/divide.svg
|
|
519
535
|
- assets/icons/solid/document-arrow-down.svg
|
|
520
536
|
- assets/icons/solid/document-arrow-up.svg
|
|
@@ -727,7 +743,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
727
743
|
- !ruby/object:Gem::Version
|
|
728
744
|
version: '0'
|
|
729
745
|
requirements: []
|
|
730
|
-
rubygems_version:
|
|
746
|
+
rubygems_version: 4.0.8
|
|
731
747
|
specification_version: 4
|
|
732
748
|
summary: RailsGlyphs — the essential Rails SVG icon library
|
|
733
749
|
test_files: []
|