protos-icon 0.2.0 → 0.3.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/CHANGELOG.md +5 -0
- data/assets/inhouse/facebook.svg +9 -0
- data/assets/inhouse/twitter.svg +9 -0
- data/assets/inhouse/youtube.svg +9 -0
- data/lib/protos/icon/component.rb +15 -0
- data/lib/protos/icon/heroicons.rb +29 -0
- data/lib/protos/icon/inhouse.rb +22 -0
- data/lib/protos/icon/version.rb +1 -1
- data/lib/protos/icon.rb +23 -32
- data/protos-icon.gemspec +1 -0
- metadata +10 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cb262274d7a7863a8af407ae211479020a4f08e34c4e7b4837f9ae3daf7c4eb6
|
4
|
+
data.tar.gz: 867bf51e20c59e6b1e2b9f4a2d5cbecc5fbd760f9574dd0179ef364862dbf2c6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0a72f28c09bdac1413de90a59fcb77b2d07d0607ede4be84ddda56e7a63fa9a1f314c00b7d9996edfaf77a305285112a3ab6fe5b77f5f6395e117034a1a10a4e
|
7
|
+
data.tar.gz: 0a0e57768b4d1311cf083856caa3de2b09ca08caf388fd9e0cc92e0c3846007ec72c5e7d3d19313b20d23fc0eb70d4e939cd1ec383af27d2aa75c02c0fbc7047
|
data/CHANGELOG.md
CHANGED
@@ -0,0 +1,9 @@
|
|
1
|
+
<svg
|
2
|
+
xmlns="http://www.w3.org/2000/svg"
|
3
|
+
width="24"
|
4
|
+
height="24"
|
5
|
+
viewBox="0 0 24 24"
|
6
|
+
class="fill-current">
|
7
|
+
<path d="M9 8h-3v4h3v12h5v-12h3.642l.358-4h-4v-1.667c0-.955.192-1.333 1.115-1.333h2.885v-5h-3.808c-3.596 0-5.192 1.583-5.192 4.615v3.385z">
|
8
|
+
</path>
|
9
|
+
</svg>
|
@@ -0,0 +1,9 @@
|
|
1
|
+
<svg
|
2
|
+
xmlns="http://www.w3.org/2000/svg"
|
3
|
+
width="24"
|
4
|
+
height="24"
|
5
|
+
viewBox="0 0 24 24"
|
6
|
+
class="fill-current">
|
7
|
+
<path d="M24 4.557c-.883.392-1.832.656-2.828.775 1.017-.609 1.798-1.574 2.165-2.724-.951.564-2.005.974-3.127 1.195-.897-.957-2.178-1.555-3.594-1.555-3.179 0-5.515 2.966-4.797 6.045-4.091-.205-7.719-2.165-10.148-5.144-1.29 2.213-.669 5.108 1.523 6.574-.806-.026-1.566-.247-2.229-.616-.054 2.281 1.581 4.415 3.949 4.89-.693.188-1.452.232-2.224.084.626 1.956 2.444 3.379 4.6 3.419-2.07 1.623-4.678 2.348-7.29 2.04 2.179 1.397 4.768 2.212 7.548 2.212 9.142 0 14.307-7.721 13.995-14.646.962-.695 1.797-1.562 2.457-2.549z">
|
8
|
+
</path>
|
9
|
+
</svg>
|
@@ -0,0 +1,9 @@
|
|
1
|
+
<svg
|
2
|
+
xmlns="http://www.w3.org/2000/svg"
|
3
|
+
width="24"
|
4
|
+
height="24"
|
5
|
+
viewBox="0 0 24 24"
|
6
|
+
class="fill-current">
|
7
|
+
<path d="M19.615 3.184c-3.604-.246-11.631-.245-15.23 0-3.897.266-4.356 2.62-4.385 8.816.029 6.185.484 8.549 4.385 8.816 3.6.245 11.626.246 15.23 0 3.897-.266 4.356-2.62 4.385-8.816-.029-6.185-.484-8.549-4.385-8.816zm-10.615 12.816v-8l8 3.993-8 4.007z">
|
8
|
+
</path>
|
9
|
+
</svg>
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Protos
|
4
|
+
module Icon
|
5
|
+
module Heroicons
|
6
|
+
def self.build(name, variant: :solid)
|
7
|
+
filepath = lookup(name, variant:)
|
8
|
+
Component.new(filepath)
|
9
|
+
end
|
10
|
+
|
11
|
+
def self.lookup(name, variant: :solid)
|
12
|
+
filepath = Pathname.new(GEM_ROOT)
|
13
|
+
filepath = case variant
|
14
|
+
when :solid then filepath.join("assets/heroicons/24/solid")
|
15
|
+
when :outline then filepath.join("assets/heroicons/24/outline")
|
16
|
+
when :mini then filepath.join("assets/heroicons/20/solid")
|
17
|
+
when :micro then filepath.join("assets/heroicons/16/solid")
|
18
|
+
else raise ArgumentError, "Unknown variant: #{variant}"
|
19
|
+
end
|
20
|
+
|
21
|
+
filepath
|
22
|
+
.join("#{name}.svg")
|
23
|
+
.tap do |path|
|
24
|
+
File.exist?(path) or raise MissingIcon, "Unknown icon: #{name}"
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Protos
|
4
|
+
module Icon
|
5
|
+
module Inhouse
|
6
|
+
def self.build(name)
|
7
|
+
filepath = lookup(name)
|
8
|
+
Component.new(filepath)
|
9
|
+
end
|
10
|
+
|
11
|
+
def self.lookup(name)
|
12
|
+
assets = Pathname.new(GEM_ROOT).join("assets/inhouse")
|
13
|
+
|
14
|
+
assets
|
15
|
+
.join("#{name}.svg")
|
16
|
+
.tap do |path|
|
17
|
+
File.exist?(path) or raise MissingIcon, "Unknown icon: #{name}"
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
data/lib/protos/icon/version.rb
CHANGED
data/lib/protos/icon.rb
CHANGED
@@ -3,54 +3,45 @@
|
|
3
3
|
require "phlex"
|
4
4
|
|
5
5
|
require_relative "icon/version"
|
6
|
+
require_relative "icon/heroicons"
|
7
|
+
require_relative "icon/inhouse"
|
8
|
+
require_relative "icon/component"
|
6
9
|
|
7
10
|
module Protos
|
8
11
|
module Icon
|
9
12
|
# Your code goes here...
|
13
|
+
class Error < StandardError; end
|
14
|
+
MissingIcon = Class.new(Error)
|
10
15
|
|
11
16
|
GEM_ROOT = Pathname.new(__dir__).join("..", "..").expand_path
|
12
17
|
public_constant :GEM_ROOT
|
13
18
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
end
|
19
|
+
def self.heroicon(name, variant: :solid)
|
20
|
+
Heroicons.build(name, variant:)
|
21
|
+
end
|
18
22
|
|
19
|
-
|
20
|
-
|
21
|
-
end
|
23
|
+
def self.inhouse(name, **)
|
24
|
+
Inhouse.build(name)
|
22
25
|
end
|
23
26
|
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
def self.lookup(name, variant: :solid)
|
31
|
-
filepath = Pathname.new(GEM_ROOT)
|
32
|
-
filepath = case variant
|
33
|
-
when :solid then filepath.join("assets/heroicons/24/solid")
|
34
|
-
when :outline then filepath.join("assets/heroicons/24/outline")
|
35
|
-
when :mini then filepath.join("assets/heroicons/20/solid")
|
36
|
-
when :micro then filepath.join("assets/heroicons/16/solid")
|
37
|
-
else raise ArgumentError, "Unknown variant: #{variant}"
|
38
|
-
end
|
39
|
-
|
40
|
-
filepath
|
41
|
-
.join("#{name}.svg")
|
42
|
-
.tap do |path|
|
43
|
-
File.exist?(path) or raise ArgumentError, "Unknown icon: #{name}"
|
44
|
-
end
|
45
|
-
end
|
27
|
+
def self.build(name, ...)
|
28
|
+
component = maybe(Heroicons, name, ...)
|
29
|
+
component ||= maybe(Inhouse, name, ...)
|
30
|
+
raise MissingIcon, "Could not find an icon for #{name}" unless component
|
31
|
+
|
32
|
+
component
|
46
33
|
end
|
47
34
|
|
48
|
-
def self.
|
49
|
-
|
35
|
+
def self.maybe(mod, name, ...)
|
36
|
+
mod.build(name, ...)
|
37
|
+
rescue MissingIcon
|
38
|
+
nil
|
50
39
|
end
|
51
40
|
|
52
41
|
def icon(...)
|
53
|
-
|
42
|
+
raise MissingIcon unless component = Protos::Icon.build(...)
|
43
|
+
|
44
|
+
render component
|
54
45
|
end
|
55
46
|
end
|
56
47
|
end
|
data/protos-icon.gemspec
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: protos-icon
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nolan J Tait
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-12-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: phlex
|
@@ -1213,7 +1213,13 @@ files:
|
|
1213
1213
|
- assets/heroicons/24/solid/wrench.svg
|
1214
1214
|
- assets/heroicons/24/solid/x-circle.svg
|
1215
1215
|
- assets/heroicons/24/solid/x-mark.svg
|
1216
|
+
- assets/inhouse/facebook.svg
|
1217
|
+
- assets/inhouse/twitter.svg
|
1218
|
+
- assets/inhouse/youtube.svg
|
1216
1219
|
- lib/protos/icon.rb
|
1220
|
+
- lib/protos/icon/component.rb
|
1221
|
+
- lib/protos/icon/heroicons.rb
|
1222
|
+
- lib/protos/icon/inhouse.rb
|
1217
1223
|
- lib/protos/icon/version.rb
|
1218
1224
|
- protos-icon.gemspec
|
1219
1225
|
homepage: https://github.com/inhouse-work/protos-icon
|
@@ -1223,6 +1229,7 @@ metadata:
|
|
1223
1229
|
homepage_uri: https://github.com/inhouse-work/protos-icon
|
1224
1230
|
source_code_uri: https://github.com/inhouse-work/protos-icon
|
1225
1231
|
changelog_uri: https://github.com/inhouse-work/protos-icon
|
1232
|
+
rubygems_mfa_required: 'true'
|
1226
1233
|
post_install_message:
|
1227
1234
|
rdoc_options: []
|
1228
1235
|
require_paths:
|
@@ -1238,7 +1245,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
1238
1245
|
- !ruby/object:Gem::Version
|
1239
1246
|
version: '0'
|
1240
1247
|
requirements: []
|
1241
|
-
rubygems_version: 3.5.
|
1248
|
+
rubygems_version: 3.5.22
|
1242
1249
|
signing_key:
|
1243
1250
|
specification_version: 4
|
1244
1251
|
summary: ''
|