phlex-icons 2.19.0 → 2.20.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/.rubocop.yml +5 -1
- data/README.md +44 -0
- data/lib/phlex-icons/bootstrap/bluesky.rb +23 -0
- data/lib/phlex-icons/bootstrap/calendar3_event_fill.rb +1 -2
- data/lib/phlex-icons/bootstrap/calendar3_range_fill.rb +1 -2
- data/lib/phlex-icons/bootstrap/calendar3_week_fill.rb +1 -2
- data/lib/phlex-icons/bootstrap.rb +2 -1
- data/lib/phlex-icons/configuration.rb +24 -1
- data/lib/phlex-icons/icon.rb +31 -0
- data/lib/phlex-icons/lucide/air_vent.rb +2 -2
- data/lib/phlex-icons/lucide/bell_electric.rb +4 -4
- data/lib/phlex-icons/lucide/brush_cleaning.rb +30 -0
- data/lib/phlex-icons/lucide/clock_plus.rb +25 -0
- data/lib/phlex-icons/lucide/dumbbell.rb +5 -5
- data/lib/phlex-icons/lucide/expand.rb +4 -4
- data/lib/phlex-icons/lucide/guitar.rb +1 -2
- data/lib/phlex-icons/lucide/hamburger.rb +28 -0
- data/lib/phlex-icons/lucide/laptop.rb +2 -1
- data/lib/phlex-icons/lucide/locate_off.rb +7 -13
- data/lib/phlex-icons/lucide/mail.rb +2 -2
- data/lib/phlex-icons/lucide/menu.rb +3 -3
- data/lib/phlex-icons/lucide/package_2.rb +7 -2
- data/lib/phlex-icons/lucide/panda.rb +32 -0
- data/lib/phlex-icons/lucide/phone.rb +1 -1
- data/lib/phlex-icons/lucide/phone_call.rb +3 -3
- data/lib/phlex-icons/lucide/phone_forwarded.rb +3 -3
- data/lib/phlex-icons/lucide/phone_incoming.rb +3 -3
- data/lib/phlex-icons/lucide/phone_missed.rb +3 -3
- data/lib/phlex-icons/lucide/phone_off.rb +6 -2
- data/lib/phlex-icons/lucide/phone_outgoing.rb +3 -3
- data/lib/phlex-icons/lucide/search.rb +1 -1
- data/lib/phlex-icons/lucide/soap_dispenser_droplet.rb +33 -0
- data/lib/phlex-icons/lucide/touchpad_off.rb +4 -4
- data/lib/phlex-icons/lucide/users.rb +2 -2
- data/lib/phlex-icons/lucide.rb +6 -1
- data/lib/phlex-icons/name_parser.rb +117 -0
- data/lib/phlex-icons/railtie.rb +17 -0
- data/lib/phlex-icons/version.rb +1 -1
- data/lib/phlex-icons.rb +3 -0
- metadata +11 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 749cb77a5eb52772aa93c55c21834a9d2a308a66e474cef4bba38695151b0ce2
|
4
|
+
data.tar.gz: 7229614c96873d3eea04ad16ecf2349cfd5da50bb32d80578eca766d80a0d064
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8f266c6389113a2624f50fb48b2bdba2a1669acf007327229b1d193f59afabbe9bdb0f4add8de18a793b0ebd8fb700c5f086e8ed91bb8e0c183ebd1e719a1d4e
|
7
|
+
data.tar.gz: 65ff6d73da76fe7cb6a24433c35ec7115f33e1b782aa937e6cffba375fa44e9e5056c39cda8b344fdea5e8a05b0fba72012811c36abd79fce36939ecbd084528
|
data/.rubocop.yml
CHANGED
data/README.md
CHANGED
@@ -62,11 +62,15 @@ The gem provides global configuration options, and per icons pack configuration
|
|
62
62
|
```ruby
|
63
63
|
PhlexIcons.configure do |config|
|
64
64
|
config.default_classes = 'size-6'
|
65
|
+
config.helper_method_name = :phlex_icon # Default: :phlex_icon
|
66
|
+
config.default_pack = :hero # Default: nil. Accepts :symbol, "string", or Class (e.g., PhlexIcons::Hero)
|
65
67
|
end
|
66
68
|
|
67
69
|
# OR
|
68
70
|
|
69
71
|
PhlexIcons.configuration.default_classes = 'size-6'
|
72
|
+
PhlexIcons.configuration.helper_method_name = :phlex_icon
|
73
|
+
PhlexIcons.configuration.default_pack = :hero
|
70
74
|
```
|
71
75
|
|
72
76
|
### Bootstrap Icons configuration
|
@@ -153,6 +157,9 @@ class PhlexIcons < Phlex::HTML
|
|
153
157
|
Radix::Home(class: 'size-4')
|
154
158
|
Remix::HomeLine(class: 'size-4')
|
155
159
|
Tabler::Home(variant: :filled, class: 'size-4')
|
160
|
+
|
161
|
+
# or with a string
|
162
|
+
Icon('bootstrap/house', class: 'size-4')
|
156
163
|
end
|
157
164
|
end
|
158
165
|
end
|
@@ -174,11 +181,48 @@ class PhlexIcons < Phlex::HTML
|
|
174
181
|
render PhlexIcons::Radix::Home.new(class: 'size-4')
|
175
182
|
render PhlexIcons::Remix::HomeLine.new(class: 'size-4')
|
176
183
|
render PhlexIcons::Tabler::Home.new(variant: :filled, class: 'size-4')
|
184
|
+
|
185
|
+
# or with a string
|
186
|
+
render PhlexIcons::Icon('bootstrap/house', class: 'size-4')
|
177
187
|
end
|
178
188
|
end
|
179
189
|
end
|
180
190
|
```
|
181
191
|
|
192
|
+
### Rails View Helper
|
193
|
+
|
194
|
+
`phlex-icons` provides a convenient helper method to render icons directly in your ERB or Phlex views.
|
195
|
+
|
196
|
+
By default, the helper method is named `phlex_icon`, but is configurable.
|
197
|
+
|
198
|
+
```erb
|
199
|
+
<%# Render a Bootstrap house icon with default size %>
|
200
|
+
<%= phlex_icon 'bootstrap/house' %>
|
201
|
+
|
202
|
+
<%# Render a Heroicons solid home icon with a specific class %>
|
203
|
+
<%= phlex_icon 'hero/home', variant: :solid, class: 'w-5 h-5 text-blue-500' %>
|
204
|
+
|
205
|
+
<%# Render a Tabler home icon, filled variant %>
|
206
|
+
<%= phlex_icon 'tabler/home:filled' %>
|
207
|
+
|
208
|
+
<%# If default_pack = :hero, render a Heroicons home icon %>
|
209
|
+
<%= phlex_icon 'home', class: 'w-6 h-6' %>
|
210
|
+
|
211
|
+
<%# Render a Flag icon (rectangle variant is default for flags if not configured otherwise) %>
|
212
|
+
<%= phlex_icon 'flag/sa' %>
|
213
|
+
|
214
|
+
<%# Render a custom icon %>
|
215
|
+
<%= phlex_icon 'custom/my_awesome_icon:variant_name' %>
|
216
|
+
```
|
217
|
+
|
218
|
+
The first argument is the icon identifier. Such as: `'pack/icon_name:variant'`.
|
219
|
+
|
220
|
+
* If `default_pack` is configured, you can omit the pack name (e.g., `'icon_name:variant'` instead of `'pack/icon_name:variant'`).
|
221
|
+
* The `:variant` part is optional.
|
222
|
+
* Examples: `'hero/house:solid'`, `'house:solid'`, `'house'`
|
223
|
+
|
224
|
+
Subsequent arguments are passed as options to the icon component, such as `variant`, `class`, etc.
|
225
|
+
|
182
226
|
### Specific icon pack(s)
|
183
227
|
|
184
228
|
Let's say you want to use only Heroicons and Flag Icons, you can use the following gems:
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# rubocop:disable Layout/LineLength
|
4
|
+
module PhlexIcons
|
5
|
+
module Bootstrap
|
6
|
+
class Bluesky < Base
|
7
|
+
def view_template
|
8
|
+
svg(
|
9
|
+
**attrs,
|
10
|
+
xmlns: 'http://www.w3.org/2000/svg',
|
11
|
+
fill: 'currentColor',
|
12
|
+
viewbox: '0 0 16 16'
|
13
|
+
) do |s|
|
14
|
+
s.path(
|
15
|
+
d:
|
16
|
+
'M3.468 1.948C5.303 3.325 7.276 6.118 8 7.616c.725-1.498 2.698-4.29 4.532-5.668C13.855.955 16 .186 16 2.632c0 .489-.28 4.105-.444 4.692-.572 2.04-2.653 2.561-4.504 2.246 3.236.551 4.06 2.375 2.281 4.2-3.376 3.464-4.852-.87-5.23-1.98-.07-.204-.103-.3-.103-.218 0-.081-.033.014-.102.218-.379 1.11-1.855 5.444-5.231 1.98-1.778-1.825-.955-3.65 2.28-4.2-1.85.315-3.932-.205-4.503-2.246C.28 6.737 0 3.12 0 2.632 0 .186 2.145.955 3.468 1.948'
|
17
|
+
)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
# rubocop:enable Layout/LineLength
|
@@ -12,9 +12,8 @@ module PhlexIcons
|
|
12
12
|
viewbox: '0 0 16 16'
|
13
13
|
) do |s|
|
14
14
|
s.path(
|
15
|
-
fill_rule: 'evenodd',
|
16
15
|
d:
|
17
|
-
'
|
16
|
+
'M16 14a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V3h16zm-3-9a1 1 0 1 0 0 2 1 1 0 0 0 0-2m1-5a2 2 0 0 1 2 2H0a2 2 0 0 1 2-2z'
|
18
17
|
)
|
19
18
|
end
|
20
19
|
end
|
@@ -12,9 +12,8 @@ module PhlexIcons
|
|
12
12
|
viewbox: '0 0 16 16'
|
13
13
|
) do |s|
|
14
14
|
s.path(
|
15
|
-
fill_rule: 'evenodd',
|
16
15
|
d:
|
17
|
-
'
|
16
|
+
'M16 5h-6a1 1 0 0 0 0 2h6v7a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2v-4h6a1 1 0 0 0 0-2H0V3h16zm-2-5a2 2 0 0 1 2 2H0a2 2 0 0 1 2-2z'
|
18
17
|
)
|
19
18
|
end
|
20
19
|
end
|
@@ -12,9 +12,8 @@ module PhlexIcons
|
|
12
12
|
viewbox: '0 0 16 16'
|
13
13
|
) do |s|
|
14
14
|
s.path(
|
15
|
-
fill_rule: 'evenodd',
|
16
15
|
d:
|
17
|
-
'
|
16
|
+
'M16 14a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V3h16zM3 8a1 1 0 1 0 0 2 1 1 0 0 0 0-2m3 0a1 1 0 1 0 0 2 1 1 0 0 0 0-2m4-3a1 1 0 1 0 0 2 1 1 0 0 0 0-2m3 0a1 1 0 1 0 0 2 1 1 0 0 0 0-2m1-5a2 2 0 0 1 2 2H0a2 2 0 0 1 2-2z'
|
18
17
|
)
|
19
18
|
end
|
20
19
|
end
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
module PhlexIcons
|
4
4
|
module Bootstrap # rubocop:disable Metrics/ModuleLength
|
5
|
-
VERSION = '1.
|
5
|
+
VERSION = '1.12.1'
|
6
6
|
VARIANTS = nil
|
7
7
|
|
8
8
|
extend Phlex::Kit
|
@@ -201,6 +201,7 @@ module PhlexIcons
|
|
201
201
|
autoload :BinocularsFill, 'phlex-icons/bootstrap/binoculars_fill'
|
202
202
|
autoload :BlockquoteLeft, 'phlex-icons/bootstrap/blockquote_left'
|
203
203
|
autoload :BlockquoteRight, 'phlex-icons/bootstrap/blockquote_right'
|
204
|
+
autoload :Bluesky, 'phlex-icons/bootstrap/bluesky'
|
204
205
|
autoload :Bluetooth, 'phlex-icons/bootstrap/bluetooth'
|
205
206
|
autoload :BodyText, 'phlex-icons/bootstrap/body_text'
|
206
207
|
autoload :Book, 'phlex-icons/bootstrap/book'
|
@@ -2,10 +2,33 @@
|
|
2
2
|
|
3
3
|
module PhlexIcons
|
4
4
|
class Configuration
|
5
|
-
attr_accessor :default_variant, :default_classes
|
5
|
+
attr_accessor :default_variant, :default_classes, :helper_method_name
|
6
|
+
attr_reader :default_pack
|
6
7
|
|
7
8
|
def initialize(default_classes: 'size-6')
|
8
9
|
@default_classes = default_classes
|
10
|
+
@helper_method_name = :phlex_icon
|
11
|
+
@default_pack = nil
|
12
|
+
end
|
13
|
+
|
14
|
+
# Custom setter for default_pack
|
15
|
+
# Accepts Class (PhlexIcons::Hero), String ('hero'), or Symbol (:hero)
|
16
|
+
#
|
17
|
+
# @param value [Class, String, Symbol, nil] The value to set the default pack to.
|
18
|
+
# @raise [ArgumentError] If the value is not a Class, String, Symbol, or nil.
|
19
|
+
def default_pack=(value)
|
20
|
+
@default_pack = case value
|
21
|
+
when Class
|
22
|
+
# Extract 'Hero' from PhlexIcons::Hero, lowercase, symbolize
|
23
|
+
value.name.split('::').last&.downcase&.to_sym
|
24
|
+
when String, Symbol
|
25
|
+
value.to_sym
|
26
|
+
when nil
|
27
|
+
nil
|
28
|
+
else
|
29
|
+
raise ArgumentError,
|
30
|
+
"Invalid type for default_pack: #{value.class}. Expected Class, String, Symbol, or nil."
|
31
|
+
end
|
9
32
|
end
|
10
33
|
end
|
11
34
|
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative 'name_parser'
|
4
|
+
|
5
|
+
module PhlexIcons
|
6
|
+
extend Phlex::Kit
|
7
|
+
|
8
|
+
class Icon < Phlex::SVG
|
9
|
+
# Factory method to create an icon component instance.
|
10
|
+
# Parses the name string, finds the corresponding class, and initializes it with options.
|
11
|
+
# @param name [String] Icon identifier (e.g., "hero/house:solid", "lucide/arrow-right").
|
12
|
+
# @param options [Hash] HTML attributes and options for the icon component.
|
13
|
+
# @return [Phlex::SVG] An instance of the resolved icon component.
|
14
|
+
# @raise [ArgumentError] If the name format is invalid or default pack is missing.
|
15
|
+
# @raise [NameError] If the corresponding icon class cannot be found.
|
16
|
+
def initialize(name, **options)
|
17
|
+
@name = name
|
18
|
+
@options = options&.transform_keys(&:to_sym) || {}
|
19
|
+
super()
|
20
|
+
end
|
21
|
+
|
22
|
+
def view_template
|
23
|
+
parser = PhlexIcons::NameParser.new(@name)
|
24
|
+
|
25
|
+
# Prioritize variant from the name string over options hash
|
26
|
+
@options[:variant] = parser.variant_name if parser.variant_name
|
27
|
+
|
28
|
+
render parser.klass.new(**@options)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -14,13 +14,13 @@ module PhlexIcons
|
|
14
14
|
stroke_linecap: 'round',
|
15
15
|
stroke_linejoin: 'round'
|
16
16
|
) do |s|
|
17
|
+
s.path(d: 'M18 17.5a2.5 2.5 0 1 1-4 2.03V12')
|
17
18
|
s.path(
|
18
19
|
d:
|
19
20
|
'M6 12H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v5a2 2 0 0 1-2 2h-2'
|
20
21
|
)
|
21
22
|
s.path(d: 'M6 8h12')
|
22
|
-
s.path(d: '
|
23
|
-
s.path(d: 'M6.6 15.6A2 2 0 1 0 10 17v-5')
|
23
|
+
s.path(d: 'M6.6 15.572A2 2 0 1 0 10 17v-5')
|
24
24
|
end
|
25
25
|
end
|
26
26
|
end
|
@@ -14,12 +14,12 @@ module PhlexIcons
|
|
14
14
|
stroke_linecap: 'round',
|
15
15
|
stroke_linejoin: 'round'
|
16
16
|
) do |s|
|
17
|
-
s.path(d: 'M18.
|
17
|
+
s.path(d: 'M18.518 17.347A7 7 0 0 1 14 19')
|
18
|
+
s.path(d: 'M18.8 4A11 11 0 0 1 20 9')
|
18
19
|
s.path(d: 'M9 9h.01')
|
19
|
-
s.circle(cx: '9', cy: '9', r: '7')
|
20
|
-
s.rect(width: '10', height: '6', x: '4', y: '16', rx: '2')
|
21
|
-
s.path(d: 'M14 19c3 0 4.6-1.6 4.6-1.6')
|
22
20
|
s.circle(cx: '20', cy: '16', r: '2')
|
21
|
+
s.circle(cx: '9', cy: '9', r: '7')
|
22
|
+
s.rect(x: '4', y: '16', width: '10', height: '6', rx: '2')
|
23
23
|
end
|
24
24
|
end
|
25
25
|
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# rubocop:disable Layout/LineLength
|
4
|
+
module PhlexIcons
|
5
|
+
module Lucide
|
6
|
+
class BrushCleaning < Base
|
7
|
+
def view_template
|
8
|
+
svg(
|
9
|
+
**attrs,
|
10
|
+
xmlns: 'http://www.w3.org/2000/svg',
|
11
|
+
viewbox: '0 0 24 24',
|
12
|
+
fill: 'none',
|
13
|
+
stroke: 'currentColor',
|
14
|
+
stroke_width: '2',
|
15
|
+
stroke_linecap: 'round',
|
16
|
+
stroke_linejoin: 'round'
|
17
|
+
) do |s|
|
18
|
+
s.path(d: 'm16 22-1-4')
|
19
|
+
s.path(
|
20
|
+
d:
|
21
|
+
'M19 13.99a1 1 0 0 0 1-1V12a2 2 0 0 0-2-2h-3a1 1 0 0 1-1-1V4a2 2 0 0 0-4 0v5a1 1 0 0 1-1 1H6a2 2 0 0 0-2 2v.99a1 1 0 0 0 1 1'
|
22
|
+
)
|
23
|
+
s.path(d: 'M5 14h14l1.973 6.767A1 1 0 0 1 20 22H4a1 1 0 0 1-.973-1.233z')
|
24
|
+
s.path(d: 'm8 22 1-4')
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
# rubocop:enable Layout/LineLength
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module PhlexIcons
|
4
|
+
module Lucide
|
5
|
+
class ClockPlus < Base
|
6
|
+
def view_template
|
7
|
+
svg(
|
8
|
+
**attrs,
|
9
|
+
xmlns: 'http://www.w3.org/2000/svg',
|
10
|
+
viewbox: '0 0 24 24',
|
11
|
+
fill: 'none',
|
12
|
+
stroke: 'currentColor',
|
13
|
+
stroke_width: '2',
|
14
|
+
stroke_linecap: 'round',
|
15
|
+
stroke_linejoin: 'round'
|
16
|
+
) do |s|
|
17
|
+
s.path(d: 'M12 6v6l3.644 1.822')
|
18
|
+
s.path(d: 'M16 19h6')
|
19
|
+
s.path(d: 'M19 16v6')
|
20
|
+
s.path(d: 'M21.92 13.267a10 10 0 1 0-8.653 8.653')
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -15,17 +15,17 @@ module PhlexIcons
|
|
15
15
|
stroke_linecap: 'round',
|
16
16
|
stroke_linejoin: 'round'
|
17
17
|
) do |s|
|
18
|
-
s.path(d: 'M14.4 14.4 9.6 9.6')
|
19
18
|
s.path(
|
20
19
|
d:
|
21
|
-
'
|
20
|
+
'M17.596 12.768a2 2 0 1 0 2.829-2.829l-1.768-1.767a2 2 0 0 0 2.828-2.829l-2.828-2.828a2 2 0 0 0-2.829 2.828l-1.767-1.768a2 2 0 1 0-2.829 2.829z'
|
22
21
|
)
|
23
|
-
s.path(d: '
|
24
|
-
s.path(d: '
|
22
|
+
s.path(d: 'm2.5 21.5 1.4-1.4')
|
23
|
+
s.path(d: 'm20.1 3.9 1.4-1.4')
|
25
24
|
s.path(
|
26
25
|
d:
|
27
|
-
'
|
26
|
+
'M5.343 21.485a2 2 0 1 0 2.829-2.828l1.767 1.768a2 2 0 1 0 2.829-2.829l-6.364-6.364a2 2 0 1 0-2.829 2.829l1.768 1.767a2 2 0 0 0-2.828 2.829z'
|
28
27
|
)
|
28
|
+
s.path(d: 'm9.6 14.4 4.8-4.8')
|
29
29
|
end
|
30
30
|
end
|
31
31
|
end
|
@@ -16,11 +16,11 @@ module PhlexIcons
|
|
16
16
|
) do |s|
|
17
17
|
s.path(d: 'm15 15 6 6')
|
18
18
|
s.path(d: 'm15 9 6-6')
|
19
|
-
s.path(d: 'M21
|
20
|
-
s.path(d: 'M21
|
21
|
-
s.path(d: 'M3
|
19
|
+
s.path(d: 'M21 16v5h-5')
|
20
|
+
s.path(d: 'M21 8V3h-5')
|
21
|
+
s.path(d: 'M3 16v5h5')
|
22
22
|
s.path(d: 'm3 21 6-6')
|
23
|
-
s.path(d: 'M3
|
23
|
+
s.path(d: 'M3 8V3h5')
|
24
24
|
s.path(d: 'M9 9 3 3')
|
25
25
|
end
|
26
26
|
end
|
@@ -23,9 +23,8 @@ module PhlexIcons
|
|
23
23
|
s.path(d: 'm6 16 2 2')
|
24
24
|
s.path(
|
25
25
|
d:
|
26
|
-
'M8.
|
26
|
+
'M8.23 9.85A3 3 0 0 1 11 8a5 5 0 0 1 5 5 3 3 0 0 1-1.85 2.77l-.92.38A2 2 0 0 0 12 18a4 4 0 0 1-4 4 6 6 0 0 1-6-6 4 4 0 0 1 4-4 2 2 0 0 0 1.85-1.23z'
|
27
27
|
)
|
28
|
-
s.circle(cx: '11.5', cy: '12.5', r: '.5', fill: 'currentColor')
|
29
28
|
end
|
30
29
|
end
|
31
30
|
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module PhlexIcons
|
4
|
+
module Lucide
|
5
|
+
class Hamburger < Base
|
6
|
+
def view_template
|
7
|
+
svg(
|
8
|
+
**attrs,
|
9
|
+
xmlns: 'http://www.w3.org/2000/svg',
|
10
|
+
viewbox: '0 0 24 24',
|
11
|
+
fill: 'none',
|
12
|
+
stroke: 'currentColor',
|
13
|
+
stroke_width: '2',
|
14
|
+
stroke_linecap: 'round',
|
15
|
+
stroke_linejoin: 'round'
|
16
|
+
) do |s|
|
17
|
+
s.path(d: 'M12 16H4a2 2 0 1 1 0-4h16a2 2 0 1 1 0 4h-4.25')
|
18
|
+
s.path(d: 'M5 12a2 2 0 0 1-2-2 9 7 0 0 1 18 0 2 2 0 0 1-2 2')
|
19
|
+
s.path(
|
20
|
+
d:
|
21
|
+
'M5 16a2 2 0 0 0-2 2 3 3 0 0 0 3 3h12a3 3 0 0 0 3-3 2 2 0 0 0-2-2q0 0 0 0'
|
22
|
+
)
|
23
|
+
s.path(d: 'm6.67 12 6.13 4.6a2 2 0 0 0 2.8-.4l3.15-4.2')
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -17,8 +17,9 @@ module PhlexIcons
|
|
17
17
|
) do |s|
|
18
18
|
s.path(
|
19
19
|
d:
|
20
|
-
'
|
20
|
+
'M18 5a2 2 0 0 1 2 2v8.526a2 2 0 0 0 .212.897l1.068 2.127a1 1 0 0 1-.9 1.45H3.62a1 1 0 0 1-.9-1.45l1.068-2.127A2 2 0 0 0 4 15.526V7a2 2 0 0 1 2-2z'
|
21
21
|
)
|
22
|
+
s.path(d: 'M20.054 15.987H3.946')
|
22
23
|
end
|
23
24
|
end
|
24
25
|
end
|
@@ -14,19 +14,13 @@ module PhlexIcons
|
|
14
14
|
stroke_linecap: 'round',
|
15
15
|
stroke_linejoin: 'round'
|
16
16
|
) do |s|
|
17
|
-
s.
|
18
|
-
s.
|
19
|
-
s.
|
20
|
-
s.
|
21
|
-
s.path(
|
22
|
-
|
23
|
-
|
24
|
-
)
|
25
|
-
s.path(
|
26
|
-
d:
|
27
|
-
'M18.71 13.96c.19-.63.29-1.29.29-1.96 0-3.87-3.13-7-7-7-.67 0-1.33.1-1.96.29'
|
28
|
-
)
|
29
|
-
s.line(x1: '2', x2: '22', y1: '2', y2: '22')
|
17
|
+
s.path(d: 'M12 19v3')
|
18
|
+
s.path(d: 'M12 2v3')
|
19
|
+
s.path(d: 'M18.89 13.24a7 7 0 0 0-8.13-8.13')
|
20
|
+
s.path(d: 'M19 12h3')
|
21
|
+
s.path(d: 'M2 12h3')
|
22
|
+
s.path(d: 'm2 2 20 20')
|
23
|
+
s.path(d: 'M7.05 7.05a7 7 0 0 0 9.9 9.9')
|
30
24
|
end
|
31
25
|
end
|
32
26
|
end
|
@@ -14,8 +14,8 @@ module PhlexIcons
|
|
14
14
|
stroke_linecap: 'round',
|
15
15
|
stroke_linejoin: 'round'
|
16
16
|
) do |s|
|
17
|
-
s.
|
18
|
-
s.
|
17
|
+
s.path(d: 'm22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7')
|
18
|
+
s.rect(x: '2', y: '4', width: '20', height: '16', rx: '2')
|
19
19
|
end
|
20
20
|
end
|
21
21
|
end
|
@@ -14,9 +14,9 @@ module PhlexIcons
|
|
14
14
|
stroke_linecap: 'round',
|
15
15
|
stroke_linejoin: 'round'
|
16
16
|
) do |s|
|
17
|
-
s.
|
18
|
-
s.
|
19
|
-
s.
|
17
|
+
s.path(d: 'M4 12h16')
|
18
|
+
s.path(d: 'M4 18h16')
|
19
|
+
s.path(d: 'M4 6h16')
|
20
20
|
end
|
21
21
|
end
|
22
22
|
end
|
@@ -1,5 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
# rubocop:disable Layout/LineLength
|
3
4
|
module PhlexIcons
|
4
5
|
module Lucide
|
5
6
|
class Package2 < Base
|
@@ -14,11 +15,15 @@ module PhlexIcons
|
|
14
15
|
stroke_linecap: 'round',
|
15
16
|
stroke_linejoin: 'round'
|
16
17
|
) do |s|
|
17
|
-
s.path(d: 'M3 9h18v10a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V9Z')
|
18
|
-
s.path(d: 'm3 9 2.45-4.9A2 2 0 0 1 7.24 3h9.52a2 2 0 0 1 1.8 1.1L21 9')
|
19
18
|
s.path(d: 'M12 3v6')
|
19
|
+
s.path(
|
20
|
+
d:
|
21
|
+
'M16.76 3a2 2 0 0 1 1.8 1.1l2.23 4.479a2 2 0 0 1 .21.891V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V9.472a2 2 0 0 1 .211-.894L5.45 4.1A2 2 0 0 1 7.24 3z'
|
22
|
+
)
|
23
|
+
s.path(d: 'M3.054 9.013h17.893')
|
20
24
|
end
|
21
25
|
end
|
22
26
|
end
|
23
27
|
end
|
24
28
|
end
|
29
|
+
# rubocop:enable Layout/LineLength
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# rubocop:disable Layout/LineLength
|
4
|
+
module PhlexIcons
|
5
|
+
module Lucide
|
6
|
+
class Panda < Base
|
7
|
+
def view_template
|
8
|
+
svg(
|
9
|
+
**attrs,
|
10
|
+
xmlns: 'http://www.w3.org/2000/svg',
|
11
|
+
viewbox: '0 0 24 24',
|
12
|
+
fill: 'none',
|
13
|
+
stroke: 'currentColor',
|
14
|
+
stroke_width: '2',
|
15
|
+
stroke_linecap: 'round',
|
16
|
+
stroke_linejoin: 'round'
|
17
|
+
) do |s|
|
18
|
+
s.path(d: 'M11.25 17.25h1.5L12 18z')
|
19
|
+
s.path(d: 'm15 12 2 2')
|
20
|
+
s.path(d: 'M18 6.5a.5.5 0 0 0-.5-.5')
|
21
|
+
s.path(
|
22
|
+
d:
|
23
|
+
'M20.69 9.67a4.5 4.5 0 1 0-7.04-5.5 8.35 8.35 0 0 0-3.3 0 4.5 4.5 0 1 0-7.04 5.5C2.49 11.2 2 12.88 2 14.5 2 19.47 6.48 22 12 22s10-2.53 10-7.5c0-1.62-.48-3.3-1.3-4.83'
|
24
|
+
)
|
25
|
+
s.path(d: 'M6 6.5a.495.495 0 0 1 .5-.5')
|
26
|
+
s.path(d: 'm9 12-2 2')
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
# rubocop:enable Layout/LineLength
|
@@ -17,7 +17,7 @@ module PhlexIcons
|
|
17
17
|
) do |s|
|
18
18
|
s.path(
|
19
19
|
d:
|
20
|
-
'
|
20
|
+
'M13.832 16.568a1 1 0 0 0 1.213-.303l.355-.465A2 2 0 0 1 17 15h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2A18 18 0 0 1 2 4a2 2 0 0 1 2-2h3a2 2 0 0 1 2 2v3a2 2 0 0 1-.8 1.6l-.468.351a1 1 0 0 0-.292 1.233 14 14 0 0 0 6.392 6.384'
|
21
21
|
)
|
22
22
|
end
|
23
23
|
end
|
@@ -15,12 +15,12 @@ module PhlexIcons
|
|
15
15
|
stroke_linecap: 'round',
|
16
16
|
stroke_linejoin: 'round'
|
17
17
|
) do |s|
|
18
|
+
s.path(d: 'M13 2a9 9 0 0 1 9 9')
|
19
|
+
s.path(d: 'M13 6a5 5 0 0 1 5 5')
|
18
20
|
s.path(
|
19
21
|
d:
|
20
|
-
'
|
22
|
+
'M13.832 16.568a1 1 0 0 0 1.213-.303l.355-.465A2 2 0 0 1 17 15h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2A18 18 0 0 1 2 4a2 2 0 0 1 2-2h3a2 2 0 0 1 2 2v3a2 2 0 0 1-.8 1.6l-.468.351a1 1 0 0 0-.292 1.233 14 14 0 0 0 6.392 6.384'
|
21
23
|
)
|
22
|
-
s.path(d: 'M14.05 2a9 9 0 0 1 8 7.94')
|
23
|
-
s.path(d: 'M14.05 6A5 5 0 0 1 18 10')
|
24
24
|
end
|
25
25
|
end
|
26
26
|
end
|
@@ -15,11 +15,11 @@ module PhlexIcons
|
|
15
15
|
stroke_linecap: 'round',
|
16
16
|
stroke_linejoin: 'round'
|
17
17
|
) do |s|
|
18
|
-
s.
|
19
|
-
s.
|
18
|
+
s.path(d: 'M14 6h8')
|
19
|
+
s.path(d: 'm18 2 4 4-4 4')
|
20
20
|
s.path(
|
21
21
|
d:
|
22
|
-
'
|
22
|
+
'M13.832 16.568a1 1 0 0 0 1.213-.303l.355-.465A2 2 0 0 1 17 15h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2A18 18 0 0 1 2 4a2 2 0 0 1 2-2h3a2 2 0 0 1 2 2v3a2 2 0 0 1-.8 1.6l-.468.351a1 1 0 0 0-.292 1.233 14 14 0 0 0 6.392 6.384'
|
23
23
|
)
|
24
24
|
end
|
25
25
|
end
|
@@ -15,11 +15,11 @@ module PhlexIcons
|
|
15
15
|
stroke_linecap: 'round',
|
16
16
|
stroke_linejoin: 'round'
|
17
17
|
) do |s|
|
18
|
-
s.
|
19
|
-
s.
|
18
|
+
s.path(d: 'M16 2v6h6')
|
19
|
+
s.path(d: 'm22 2-6 6')
|
20
20
|
s.path(
|
21
21
|
d:
|
22
|
-
'
|
22
|
+
'M13.832 16.568a1 1 0 0 0 1.213-.303l.355-.465A2 2 0 0 1 17 15h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2A18 18 0 0 1 2 4a2 2 0 0 1 2-2h3a2 2 0 0 1 2 2v3a2 2 0 0 1-.8 1.6l-.468.351a1 1 0 0 0-.292 1.233 14 14 0 0 0 6.392 6.384'
|
23
23
|
)
|
24
24
|
end
|
25
25
|
end
|
@@ -15,11 +15,11 @@ module PhlexIcons
|
|
15
15
|
stroke_linecap: 'round',
|
16
16
|
stroke_linejoin: 'round'
|
17
17
|
) do |s|
|
18
|
-
s.
|
19
|
-
s.
|
18
|
+
s.path(d: 'm16 2 6 6')
|
19
|
+
s.path(d: 'm22 2-6 6')
|
20
20
|
s.path(
|
21
21
|
d:
|
22
|
-
'
|
22
|
+
'M13.832 16.568a1 1 0 0 0 1.213-.303l.355-.465A2 2 0 0 1 17 15h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2A18 18 0 0 1 2 4a2 2 0 0 1 2-2h3a2 2 0 0 1 2 2v3a2 2 0 0 1-.8 1.6l-.468.351a1 1 0 0 0-.292 1.233 14 14 0 0 0 6.392 6.384'
|
23
23
|
)
|
24
24
|
end
|
25
25
|
end
|
@@ -17,9 +17,13 @@ module PhlexIcons
|
|
17
17
|
) do |s|
|
18
18
|
s.path(
|
19
19
|
d:
|
20
|
-
'M10.
|
20
|
+
'M10.1 13.9a14 14 0 0 0 3.732 2.668 1 1 0 0 0 1.213-.303l.355-.465A2 2 0 0 1 17 15h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2 18 18 0 0 1-12.728-5.272'
|
21
|
+
)
|
22
|
+
s.path(d: 'M22 2 2 22')
|
23
|
+
s.path(
|
24
|
+
d:
|
25
|
+
'M4.76 13.582A18 18 0 0 1 2 4a2 2 0 0 1 2-2h3a2 2 0 0 1 2 2v3a2 2 0 0 1-.8 1.6l-.468.351a1 1 0 0 0-.292 1.233 14 14 0 0 0 .244.473'
|
21
26
|
)
|
22
|
-
s.line(x1: '22', x2: '2', y1: '2', y2: '22')
|
23
27
|
end
|
24
28
|
end
|
25
29
|
end
|
@@ -15,11 +15,11 @@ module PhlexIcons
|
|
15
15
|
stroke_linecap: 'round',
|
16
16
|
stroke_linejoin: 'round'
|
17
17
|
) do |s|
|
18
|
-
s.
|
19
|
-
s.
|
18
|
+
s.path(d: 'm16 8 6-6')
|
19
|
+
s.path(d: 'M22 8V2h-6')
|
20
20
|
s.path(
|
21
21
|
d:
|
22
|
-
'
|
22
|
+
'M13.832 16.568a1 1 0 0 0 1.213-.303l.355-.465A2 2 0 0 1 17 15h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2A18 18 0 0 1 2 4a2 2 0 0 1 2-2h3a2 2 0 0 1 2 2v3a2 2 0 0 1-.8 1.6l-.468.351a1 1 0 0 0-.292 1.233 14 14 0 0 0 6.392 6.384'
|
23
23
|
)
|
24
24
|
end
|
25
25
|
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# rubocop:disable Layout/LineLength
|
4
|
+
module PhlexIcons
|
5
|
+
module Lucide
|
6
|
+
class SoapDispenserDroplet < Base
|
7
|
+
def view_template
|
8
|
+
svg(
|
9
|
+
**attrs,
|
10
|
+
xmlns: 'http://www.w3.org/2000/svg',
|
11
|
+
viewbox: '0 0 24 24',
|
12
|
+
fill: 'none',
|
13
|
+
stroke: 'currentColor',
|
14
|
+
stroke_width: '2',
|
15
|
+
stroke_linecap: 'round',
|
16
|
+
stroke_linejoin: 'round'
|
17
|
+
) do |s|
|
18
|
+
s.path(d: 'M10.5 2v4')
|
19
|
+
s.path(d: 'M14 2H7a2 2 0 0 0-2 2')
|
20
|
+
s.path(
|
21
|
+
d:
|
22
|
+
'M19.29 14.76A6.67 6.67 0 0 1 17 11a6.6 6.6 0 0 1-2.29 3.76c-1.15.92-1.71 2.04-1.71 3.19 0 2.22 1.8 4.05 4 4.05s4-1.83 4-4.05c0-1.16-.57-2.26-1.71-3.19'
|
23
|
+
)
|
24
|
+
s.path(
|
25
|
+
d:
|
26
|
+
'M9.607 21H6a2 2 0 0 1-2-2v-7a2 2 0 0 1 2-2h7V7a1 1 0 0 0-1-1H9a1 1 0 0 0-1 1v3'
|
27
|
+
)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
# rubocop:enable Layout/LineLength
|
@@ -14,12 +14,12 @@ module PhlexIcons
|
|
14
14
|
stroke_linecap: 'round',
|
15
15
|
stroke_linejoin: 'round'
|
16
16
|
) do |s|
|
17
|
-
s.path(d: 'M4 4a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h16')
|
18
|
-
s.path(d: 'M2 14h12')
|
19
|
-
s.path(d: 'M22 14h-2')
|
20
17
|
s.path(d: 'M12 20v-6')
|
18
|
+
s.path(d: 'M19.656 14H22')
|
19
|
+
s.path(d: 'M2 14h12')
|
21
20
|
s.path(d: 'm2 2 20 20')
|
22
|
-
s.path(d: '
|
21
|
+
s.path(d: 'M20 20H4a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2')
|
22
|
+
s.path(d: 'M9.656 4H20a2 2 0 0 1 2 2v10.344')
|
23
23
|
end
|
24
24
|
end
|
25
25
|
end
|
@@ -15,9 +15,9 @@ module PhlexIcons
|
|
15
15
|
stroke_linejoin: 'round'
|
16
16
|
) do |s|
|
17
17
|
s.path(d: 'M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2')
|
18
|
-
s.
|
18
|
+
s.path(d: 'M16 3.128a4 4 0 0 1 0 7.744')
|
19
19
|
s.path(d: 'M22 21v-2a4 4 0 0 0-3-3.87')
|
20
|
-
s.
|
20
|
+
s.circle(cx: '9', cy: '7', r: '4')
|
21
21
|
end
|
22
22
|
end
|
23
23
|
end
|
data/lib/phlex-icons/lucide.rb
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
module PhlexIcons
|
4
4
|
module Lucide # rubocop:disable Metrics/ModuleLength
|
5
|
-
VERSION = '0.
|
5
|
+
VERSION = '0.508.0'
|
6
6
|
VARIANTS = nil
|
7
7
|
|
8
8
|
extend Phlex::Kit
|
@@ -242,6 +242,7 @@ module PhlexIcons
|
|
242
242
|
autoload :BriefcaseMedical, 'phlex-icons/lucide/briefcase_medical'
|
243
243
|
autoload :BringToFront, 'phlex-icons/lucide/bring_to_front'
|
244
244
|
autoload :Brush, 'phlex-icons/lucide/brush'
|
245
|
+
autoload :BrushCleaning, 'phlex-icons/lucide/brush_cleaning'
|
245
246
|
autoload :Bubbles, 'phlex-icons/lucide/bubbles'
|
246
247
|
autoload :Bug, 'phlex-icons/lucide/bug'
|
247
248
|
autoload :BugOff, 'phlex-icons/lucide/bug_off'
|
@@ -417,6 +418,7 @@ module PhlexIcons
|
|
417
418
|
autoload :ClockArrowDown, 'phlex-icons/lucide/clock_arrow_down'
|
418
419
|
autoload :ClockArrowUp, 'phlex-icons/lucide/clock_arrow_up'
|
419
420
|
autoload :ClockFading, 'phlex-icons/lucide/clock_fading'
|
421
|
+
autoload :ClockPlus, 'phlex-icons/lucide/clock_plus'
|
420
422
|
autoload :Cloud, 'phlex-icons/lucide/cloud'
|
421
423
|
autoload :CloudAlert, 'phlex-icons/lucide/cloud_alert'
|
422
424
|
autoload :CloudCog, 'phlex-icons/lucide/cloud_cog'
|
@@ -742,6 +744,7 @@ module PhlexIcons
|
|
742
744
|
autoload :Group, 'phlex-icons/lucide/group'
|
743
745
|
autoload :Guitar, 'phlex-icons/lucide/guitar'
|
744
746
|
autoload :Ham, 'phlex-icons/lucide/ham'
|
747
|
+
autoload :Hamburger, 'phlex-icons/lucide/hamburger'
|
745
748
|
autoload :Hammer, 'phlex-icons/lucide/hammer'
|
746
749
|
autoload :Hand, 'phlex-icons/lucide/hand'
|
747
750
|
autoload :HandCoins, 'phlex-icons/lucide/hand_coins'
|
@@ -1047,6 +1050,7 @@ module PhlexIcons
|
|
1047
1050
|
autoload :Paintbrush, 'phlex-icons/lucide/paintbrush'
|
1048
1051
|
autoload :PaintbrushVertical, 'phlex-icons/lucide/paintbrush_vertical'
|
1049
1052
|
autoload :Palette, 'phlex-icons/lucide/palette'
|
1053
|
+
autoload :Panda, 'phlex-icons/lucide/panda'
|
1050
1054
|
autoload :PanelBottom, 'phlex-icons/lucide/panel_bottom'
|
1051
1055
|
autoload :PanelBottomClose, 'phlex-icons/lucide/panel_bottom_close'
|
1052
1056
|
autoload :PanelBottomDashed, 'phlex-icons/lucide/panel_bottom_dashed'
|
@@ -1298,6 +1302,7 @@ module PhlexIcons
|
|
1298
1302
|
autoload :SmilePlus, 'phlex-icons/lucide/smile_plus'
|
1299
1303
|
autoload :Snail, 'phlex-icons/lucide/snail'
|
1300
1304
|
autoload :Snowflake, 'phlex-icons/lucide/snowflake'
|
1305
|
+
autoload :SoapDispenserDroplet, 'phlex-icons/lucide/soap_dispenser_droplet'
|
1301
1306
|
autoload :Sofa, 'phlex-icons/lucide/sofa'
|
1302
1307
|
autoload :Soup, 'phlex-icons/lucide/soup'
|
1303
1308
|
autoload :Space, 'phlex-icons/lucide/space'
|
@@ -0,0 +1,117 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module PhlexIcons
|
4
|
+
class NameParser
|
5
|
+
attr_reader :pack_name, :icon_name, :variant_name, :identifier, :klass
|
6
|
+
|
7
|
+
# Initializes the parser with the full icon identifier string (e.g., "hero/arrow-right:solid").
|
8
|
+
# Parses the string into pack, icon, and variant components.
|
9
|
+
# Determines and validates the corresponding icon component class.
|
10
|
+
# @param identifier [String] The full icon identifier.
|
11
|
+
# @raise [ArgumentError] If the name format is invalid or default pack is missing.
|
12
|
+
# @raise [NameError] If the corresponding icon class cannot be found.
|
13
|
+
def initialize(identifier)
|
14
|
+
@identifier = identifier.to_s
|
15
|
+
@pack_name, @icon_name, @variant_name = parse(@identifier)
|
16
|
+
@klass = find_icon_class(@pack_name, @icon_name)
|
17
|
+
end
|
18
|
+
|
19
|
+
private
|
20
|
+
|
21
|
+
# Performs the core parsing logic.
|
22
|
+
# @param identifier [String] The full icon identifier.
|
23
|
+
# @return [Array<String, String, Symbol, nil>] An array containing [pack_name, icon_name, variant_name].
|
24
|
+
def parse(identifier)
|
25
|
+
name_part, variant = identifier.split(':', 2)
|
26
|
+
|
27
|
+
# Check if the part before ':' (or the whole string if no ':') is empty
|
28
|
+
if name_part.nil? || name_part.strip.empty?
|
29
|
+
raise ArgumentError,
|
30
|
+
"Invalid icon name format. Could not determine pack or icon name from '#{identifier}'."
|
31
|
+
end
|
32
|
+
|
33
|
+
parsed_variant = variant&.empty? ? nil : variant&.to_sym
|
34
|
+
pack, icon = parse_pack_and_icon(name_part)
|
35
|
+
|
36
|
+
validate_identifier_parts(pack, icon, identifier)
|
37
|
+
|
38
|
+
[pack, icon, parsed_variant]
|
39
|
+
end
|
40
|
+
|
41
|
+
# Extracts the pack and icon names from the part before the variant separator (':').
|
42
|
+
# @param name_part [String] The part of the name string before ':'.
|
43
|
+
# @return [Array<String, String>] An array containing [pack_name, icon_name].
|
44
|
+
def parse_pack_and_icon(name_part)
|
45
|
+
if name_part.include?('/')
|
46
|
+
# If split results in empty parts, they will be caught by validate_identifier_parts later
|
47
|
+
name_part.split('/', 2)
|
48
|
+
else
|
49
|
+
# If name_part is just the icon, it cannot be empty (checked in `parse`)
|
50
|
+
[get_default_pack_name_or_raise(name_part), name_part]
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
# Retrieves the configured default pack name or raises an error if not set.
|
55
|
+
# @param icon_name_part [String] The icon name used when the pack prefix is missing (for error message).
|
56
|
+
# @return [String] The default pack name.
|
57
|
+
# @raise [ArgumentError] If PhlexIcons.configuration.default_pack is not configured.
|
58
|
+
def get_default_pack_name_or_raise(icon_name_part)
|
59
|
+
# Assumes PhlexIcons.configuration is available.
|
60
|
+
# Consider requiring 'phlex_icons/configuration' explicitly if needed outside Rails context.
|
61
|
+
default_pack_name = defined?(PhlexIcons.configuration) ? PhlexIcons.configuration&.default_pack&.to_s : nil
|
62
|
+
unless default_pack_name && !default_pack_name.empty?
|
63
|
+
raise ArgumentError,
|
64
|
+
"Icon name '#{icon_name_part}' is missing the pack name prefix (e.g., 'hero/'), " \
|
65
|
+
'and no `default_pack` is configured in PhlexIcons.'
|
66
|
+
end
|
67
|
+
default_pack_name
|
68
|
+
end
|
69
|
+
|
70
|
+
# Validates that both pack and icon name parts were successfully extracted.
|
71
|
+
# @param pack [String, nil] The extracted pack name.
|
72
|
+
# @param icon [String, nil] The extracted icon name.
|
73
|
+
# @param identifier [String] The original full identifier (for error message).
|
74
|
+
# @raise [ArgumentError] If either pack or icon is missing or empty.
|
75
|
+
def validate_identifier_parts(pack, icon, identifier)
|
76
|
+
return if pack && !pack.empty? && icon && !icon.empty?
|
77
|
+
|
78
|
+
raise ArgumentError,
|
79
|
+
"Invalid icon name format. Could not determine pack or icon name from '#{identifier}'."
|
80
|
+
end
|
81
|
+
|
82
|
+
# Finds the PhlexIcon component class based on pack and icon names.
|
83
|
+
# @param pack_name [String] The kebab-case pack name (e.g., "hero").
|
84
|
+
# @param icon_name [String] The kebab-case icon name (e.g., "arrow-right").
|
85
|
+
# @return [Class] The icon component class.
|
86
|
+
# @raise [NameError] If the corresponding icon class cannot be found.
|
87
|
+
def find_icon_class(pack_name, icon_name)
|
88
|
+
class_name = build_icon_class_name(pack_name, icon_name)
|
89
|
+
find_and_validate_icon_class(class_name, pack_name, icon_name)
|
90
|
+
end
|
91
|
+
|
92
|
+
# Constructs the full Ruby class name for an icon component.
|
93
|
+
# @param pack_name [String] The kebab-case pack name (e.g., "hero").
|
94
|
+
# @param icon_name [String] The kebab-case icon name (e.g., "arrow-right").
|
95
|
+
# @return [String] The CamelCase class name (e.g., "PhlexIcons::Hero::ArrowRight").
|
96
|
+
def build_icon_class_name(pack_name, icon_name)
|
97
|
+
pack_module_name = pack_name.split('-').map(&:capitalize).join
|
98
|
+
icon_class_name = icon_name.split('-').map(&:capitalize).join
|
99
|
+
"PhlexIcons::#{pack_module_name}::#{icon_class_name}"
|
100
|
+
end
|
101
|
+
|
102
|
+
# Attempts to find the icon class by its name and validates its existence.
|
103
|
+
# @param class_name [String] The full class name to find.
|
104
|
+
# @param pack_name [String] Original pack name (for error message).
|
105
|
+
# @param icon_name [String] Original icon name (for error message).
|
106
|
+
# @return [Class] The found icon component class.
|
107
|
+
# @raise [NameError] If the class cannot be found.
|
108
|
+
def find_and_validate_icon_class(class_name, pack_name, icon_name)
|
109
|
+
Object.const_get(class_name)
|
110
|
+
rescue NameError
|
111
|
+
raise NameError,
|
112
|
+
"Could not find icon component class '#{class_name}'. " \
|
113
|
+
"Make sure the pack ('#{pack_name}') and name ('#{icon_name}') " \
|
114
|
+
'are correct and the corresponding file is loaded.'
|
115
|
+
end
|
116
|
+
end
|
117
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative 'configuration'
|
4
|
+
|
5
|
+
module PhlexIcons
|
6
|
+
class Railtie < ::Rails::Railtie
|
7
|
+
initializer 'phlex_icons.view_helpers' do
|
8
|
+
ActiveSupport.on_load(:action_view) do
|
9
|
+
helper_method_name = PhlexIcons.configuration.helper_method_name
|
10
|
+
|
11
|
+
define_method helper_method_name do |name, **options|
|
12
|
+
PhlexIcons::Icon.call(name, **options)&.html_safe
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
data/lib/phlex-icons/version.rb
CHANGED
data/lib/phlex-icons.rb
CHANGED
@@ -18,6 +18,9 @@ require_relative 'phlex-icons/radix'
|
|
18
18
|
require_relative 'phlex-icons/remix'
|
19
19
|
require_relative 'phlex-icons/tabler'
|
20
20
|
|
21
|
+
require_relative 'phlex-icons/icon'
|
22
|
+
require_relative 'phlex-icons/railtie' if defined?(Rails)
|
23
|
+
|
21
24
|
module PhlexIcons
|
22
25
|
class << self
|
23
26
|
def configuration
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: phlex-icons
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.20.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ali Hamdi Ali Fadel
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-
|
11
|
+
date: 2025-05-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: phlex
|
@@ -245,6 +245,7 @@ files:
|
|
245
245
|
- lib/phlex-icons/bootstrap/binoculars_fill.rb
|
246
246
|
- lib/phlex-icons/bootstrap/blockquote_left.rb
|
247
247
|
- lib/phlex-icons/bootstrap/blockquote_right.rb
|
248
|
+
- lib/phlex-icons/bootstrap/bluesky.rb
|
248
249
|
- lib/phlex-icons/bootstrap/bluetooth.rb
|
249
250
|
- lib/phlex-icons/bootstrap/body_text.rb
|
250
251
|
- lib/phlex-icons/bootstrap/book.rb
|
@@ -3896,6 +3897,7 @@ files:
|
|
3896
3897
|
- lib/phlex-icons/hero/x_mark.rb
|
3897
3898
|
- lib/phlex-icons/hero/x_mark_outline.rb
|
3898
3899
|
- lib/phlex-icons/hero/x_mark_solid.rb
|
3900
|
+
- lib/phlex-icons/icon.rb
|
3899
3901
|
- lib/phlex-icons/lucide.rb
|
3900
3902
|
- lib/phlex-icons/lucide/a_arrow_down.rb
|
3901
3903
|
- lib/phlex-icons/lucide/a_arrow_up.rb
|
@@ -4130,6 +4132,7 @@ files:
|
|
4130
4132
|
- lib/phlex-icons/lucide/briefcase_medical.rb
|
4131
4133
|
- lib/phlex-icons/lucide/bring_to_front.rb
|
4132
4134
|
- lib/phlex-icons/lucide/brush.rb
|
4135
|
+
- lib/phlex-icons/lucide/brush_cleaning.rb
|
4133
4136
|
- lib/phlex-icons/lucide/bubbles.rb
|
4134
4137
|
- lib/phlex-icons/lucide/bug.rb
|
4135
4138
|
- lib/phlex-icons/lucide/bug_off.rb
|
@@ -4305,6 +4308,7 @@ files:
|
|
4305
4308
|
- lib/phlex-icons/lucide/clock_arrow_down.rb
|
4306
4309
|
- lib/phlex-icons/lucide/clock_arrow_up.rb
|
4307
4310
|
- lib/phlex-icons/lucide/clock_fading.rb
|
4311
|
+
- lib/phlex-icons/lucide/clock_plus.rb
|
4308
4312
|
- lib/phlex-icons/lucide/cloud.rb
|
4309
4313
|
- lib/phlex-icons/lucide/cloud_alert.rb
|
4310
4314
|
- lib/phlex-icons/lucide/cloud_cog.rb
|
@@ -4630,6 +4634,7 @@ files:
|
|
4630
4634
|
- lib/phlex-icons/lucide/group.rb
|
4631
4635
|
- lib/phlex-icons/lucide/guitar.rb
|
4632
4636
|
- lib/phlex-icons/lucide/ham.rb
|
4637
|
+
- lib/phlex-icons/lucide/hamburger.rb
|
4633
4638
|
- lib/phlex-icons/lucide/hammer.rb
|
4634
4639
|
- lib/phlex-icons/lucide/hand.rb
|
4635
4640
|
- lib/phlex-icons/lucide/hand_coins.rb
|
@@ -4935,6 +4940,7 @@ files:
|
|
4935
4940
|
- lib/phlex-icons/lucide/paintbrush.rb
|
4936
4941
|
- lib/phlex-icons/lucide/paintbrush_vertical.rb
|
4937
4942
|
- lib/phlex-icons/lucide/palette.rb
|
4943
|
+
- lib/phlex-icons/lucide/panda.rb
|
4938
4944
|
- lib/phlex-icons/lucide/panel_bottom.rb
|
4939
4945
|
- lib/phlex-icons/lucide/panel_bottom_close.rb
|
4940
4946
|
- lib/phlex-icons/lucide/panel_bottom_dashed.rb
|
@@ -5186,6 +5192,7 @@ files:
|
|
5186
5192
|
- lib/phlex-icons/lucide/smile_plus.rb
|
5187
5193
|
- lib/phlex-icons/lucide/snail.rb
|
5188
5194
|
- lib/phlex-icons/lucide/snowflake.rb
|
5195
|
+
- lib/phlex-icons/lucide/soap_dispenser_droplet.rb
|
5189
5196
|
- lib/phlex-icons/lucide/sofa.rb
|
5190
5197
|
- lib/phlex-icons/lucide/soup.rb
|
5191
5198
|
- lib/phlex-icons/lucide/space.rb
|
@@ -18208,6 +18215,7 @@ files:
|
|
18208
18215
|
- lib/phlex-icons/material/zoom_out_round.rb
|
18209
18216
|
- lib/phlex-icons/material/zoom_out_sharp.rb
|
18210
18217
|
- lib/phlex-icons/material/zoom_out_two_tone.rb
|
18218
|
+
- lib/phlex-icons/name_parser.rb
|
18211
18219
|
- lib/phlex-icons/radix.rb
|
18212
18220
|
- lib/phlex-icons/radix/accessibility.rb
|
18213
18221
|
- lib/phlex-icons/radix/activity_log.rb
|
@@ -18528,6 +18536,7 @@ files:
|
|
18528
18536
|
- lib/phlex-icons/radix/width.rb
|
18529
18537
|
- lib/phlex-icons/radix/zoom_in.rb
|
18530
18538
|
- lib/phlex-icons/radix/zoom_out.rb
|
18539
|
+
- lib/phlex-icons/railtie.rb
|
18531
18540
|
- lib/phlex-icons/remix.rb
|
18532
18541
|
- lib/phlex-icons/remix/a_b.rb
|
18533
18542
|
- lib/phlex-icons/remix/accessibility_fill.rb
|