npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@choiceform/icons-core

v1.0.1

Published

Core utilities for generating icon libraries from SVG files

Readme

@choiceform/icons-core

Core utilities for Choiceform SVG icons.

Installation

# npm
npm install @choiceform/icons-core

# pnpm
pnpm add @choiceform/icons-core

# yarn
yarn add @choiceform/icons-core

How to use

The icons-core package provides core utilities used by all Choiceform icon framework implementations. It contains common helpers, types, and SVG processing functions.

Most end users won't need to import from this package directly, as each framework-specific package (icons-react, icons-vue, etc.) wraps these utilities in appropriate framework components.

Example (for library developers)

import {
  processIcon,
  IconNode,
  IconAttributes,
  readConfigFile,
} from "@choiceform/icons-core";

// Process a raw SVG string into an IconNode object
const svg = "<svg>...</svg>";
const iconNode = processIcon(svg, "MyIcon");

// Create a framework-specific component using the IconNode
function createIconComponent(iconNode) {
  return function MyIcon(attributes) {
    // Merge default and custom attributes
    const mergedAttrs = {
      ...getDefaultAttributes(),
      ...attributes,
    };

    // Turn the IconNode into an appropriate component for your framework
    return buildComponentFromIconNode(iconNode, mergedAttrs);
  };
}

Exports

| Export | Type | Description | | ---------------------- | ----------- | ------------------------------------------------ | | processIcon | function | Processes raw SVG string into an IconNode | | getDefaultAttributes | function | Returns default attributes for icons | | readConfigFile | function | Reads and parses the icon-config.json file | | IconNode | interface | Type definition for internal icon representation | | IconAttributes | interface | Type definition for icon attributes | | IconMetadata | interface | Type definition for icon metadata information |

For Framework Package Creators

This package is primarily for developers who are creating framework-specific icon packages.

Creating a new framework implementation

  1. Import the core utilities and types from this package
  2. Create wrapper components for your framework
  3. Use the processIcon utility to handle raw SVG content
  4. Apply your framework-specific component structure

Features

  • Shared Utilities: Common code shared between all icon packages
  • TypeScript Support: Full TypeScript definitions
  • SVG Processing: Utilities for parsing and manipulating SVG content
  • Consistent Implementation: Ensures consistent behavior across frameworks
  • Configuration Management: Utilities for reading and applying icon configuration

Public API Types

Here are the most important types exported by the library:

interface IconNode {
  tag: string;
  attrs: Record<string, string>;
  children?: IconNode[];
}

interface IconAttributes {
  width?: string | number;
  height?: string | number;
  color?: string;
  title?: string;
  [key: string]: any;
}

interface IconMetadata {
  name: string;
  category?: string;
  tags?: string[];
  filename: string;
  width?: string;
  height?: string;
  optimizedSvg: string;
}