# `LedgerUI.Icons.Hugeicons`
[🔗](https://github.com/devaction-labs/ledger_ui/blob/v0.2.0/lib/ledger_ui/icons/hugeicons.ex#L1)

Reads Hugeicons Stroke Rounded SVGs and converts them to the kit's stroke format.

Upstream files hard-code `stroke="#141B34"`, `stroke-width="1.5"` and the line caps on every
shape. The kit's dictionary (`priv/icons.json`) keeps only the shapes and lets the `.lu-i` rule of
`ledger.css` supply `stroke: currentColor`, the 1.5 width and the round caps, so `convert/1` does
the same: it keeps the geometry, drops the stroke attributes and the `fill="none"`, and turns a
solid fill into `fill="currentColor" stroke="none"`. Only shape elements and a fixed list of
attributes survive, so a vendored file can never inject script or styles.

`names_in/1` finds the icon names a source file uses, for `mix ledger_ui.icons sync`.

# `convert`

```elixir
@spec convert(binary()) :: {:ok, String.t()} | {:error, :no_shapes}
```

Converts an upstream SVG to the kit's format: the inner shapes only, as a string.

Returns `{:ok, inner}` or `{:error, :no_shapes}`.

    iex> svg = ~s(<svg viewBox="0 0 24 24" fill="none"><path d="M1 1L2 2" stroke="#141B34" stroke-width="1.5"/></svg>)
    iex> LedgerUI.Icons.Hugeicons.convert(svg)
    {:ok, ~s(<path d="M1 1L2 2"/>)}

# `inner`

```elixir
@spec inner(binary()) :: {:ok, String.t()} | :error
```

The inner shapes of a vendored file (what `wrap/1` wrote), or `:error` when it is not an SVG.
Run through `convert/1` again, so a hand-edited file is sanitized the same way.

# `names_in`

```elixir
@spec names_in(String.t()) :: [String.t()]
```

Sorted, unique icon names (without `huge-`) used by `<.icon name="...">` or written as `huge-*`.

# `scan`

```elixir
@spec scan([String.t()]) :: [String.t()]
```

Names in every source file under `roots`.

# `strip_prefix`

```elixir
@spec strip_prefix(String.t()) :: String.t()
```

`"huge-x"`, `"hugeicons:x"` and `"x"` all become `"x"`.

# `valid_name?`

```elixir
@spec valid_name?(String.t()) :: boolean()
```

Whether `name` looks like an upstream file name (`search-01`).

# `wrap`

```elixir
@spec wrap(String.t()) :: String.t()
```

Wraps converted inner shapes in a standalone `<svg>` (what the task vendors).

---

*Consult [api-reference.md](api-reference.md) for complete listing*
