Module: PhlexKit::Icons
- Defined in:
- lib/phlex_kit/icons.rb,
lib/phlex_kit/icons/remix.rb,
lib/phlex_kit/icons/lucide.rb,
lib/phlex_kit/icons/tabler.rb,
lib/phlex_kit/icons/phosphor.rb
Overview
Registry over the vendored icon data modules. Components (and hosts, via PhlexKit::Icon) look glyphs up by canonical semantic name — the per-library vocabulary mapping (Phosphor "caret-down", Remix "arrow-down-s-line", …) was resolved at generation time by scripts/generate_icons.rb.
HugeIcons is deliberately absent: its free set's terms forbid editing and redistribution of the artwork, so it cannot ship inside this MIT gem.
Defined Under Namespace
Modules: Lucide, Phosphor, Remix, Tabler
Constant Summary collapse
Class Method Summary collapse
-
.fetch(name, library: PhlexKit.config.icon_library) ⇒ Object
=> { elements:, view_box:, mode: :stroke|:fill, stroke_width: } Fails loud (KeyError) on an unknown library or glyph.
- .names ⇒ Object
Class Method Details
.fetch(name, library: PhlexKit.config.icon_library) ⇒ Object
=> { elements:, view_box:, mode: :stroke|:fill, stroke_width: } Fails loud (KeyError) on an unknown library or glyph.
26 27 28 29 30 31 32 33 34 |
# File 'lib/phlex_kit/icons.rb', line 26 def self.fetch(name, library: PhlexKit.config.icon_library) mod = MODULES.fetch(library.to_sym) do raise KeyError, "Unknown icon library #{library.inspect} — available: #{MODULES.keys.join(', ')}" end elements = mod::ICONS.fetch(name.to_sym) do raise KeyError, "Unknown icon #{name.inspect} in #{library} — available: #{mod::ICONS.keys.join(', ')}" end { elements: elements, view_box: mod::VIEW_BOX, mode: mod::MODE, stroke_width: mod::STROKE_WIDTH } end |