Closed lpotthast closed 1 year ago
This has potential, could this idea work well with #8?
I don't know the limitations of crates.io
; Would shipping/updating 15 different crates be easily automatable?
Hey @Carlosted, I think that the PR is now in a state which can be merged. Feel free to check it out. The following things have changed:
leptos-icons-core
was added, containing a shared data structure for svg icon data.leptos-icons-*
with * being the short name of the package, containing the parsed SVG data as conditionally compiled constants (using the shared data type to reduce wasm binary size).leptos-icons
crate resolves the icon data from the given enum variant and manually generates a leptos svg element (brings more control over which attributes are actually set and with what data).leptos-icons
crate brings an additional enum, containing a variant for each icon-package enum. From
implementations are generated to map from any leptos-icons-*
enum to the leptos-icons
enum variant containing that package-specific enum.That way, users can always specify icons like this:
use leptos_icons::*;
<LeptosIcon icon=BsIcon::BsFolder" />
using a package-specific enum, even though the LeptosIcon
component requires a value of its own enum. BsIcon
is in scope, as leptos_icons
reexports all package-specific crates. As soon as a user activates one icon using its feature, the enum from the corresponding icon-package will be in scope.
Work in progrss. I found it much easier to get rid of the individual components at this point. Try it out if you like. What do you think? Can elaborate further if you like. Splitting into multiple crates would be required at this point I think...