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 🙏

© 2026 – Pkg Stats / Ryan Hefner

semantic-icons

v0.3.2

Published

3000 curated SVG icons you can find with plain prose. Search runs in your page, with no request and no key.

Readme

semantic-icons

Given any word or phrase, return an SVG icon that semantically represents it. Known/common phrases resolve from a cache instantly; new phrases are generated on demand via an LLM, sanitized, and cached for reuse. If a phrase is too abstract or complex to represent as a simple icon, the tool returns simpler candidate phrases instead of guessing badly.

The package also ships 3000 curated icons drawn in one style. They answer most requests with no network call.

Status: library complete, edge function verified against a local stack. See docs/superpowers/specs/ for the design.

Structure

  • src/core.ts — platform-agnostic useSemanticIcon hook, request/response types, fetch client. Plain React, no native or DOM APIs.
  • src/native.tsx — <SemanticIcon> for React Native, via react-native-svg.
  • src/web.tsx — <SemanticIcon> for React / Next.js, renders sanitized inline SVG into the DOM.
  • supabase/functions/semantic-icon/ — Deno edge function (Supabase Functions runtime). Deployable source, not an npm package — copy or deploy into your own Supabase project's supabase/functions/.
  • supabase/migrations/ — SQL for the generated_icons cache table. Schema only; no seed data. Each consuming project supplies its own curated icons.

Curated icon library

The package ships 3000 icons drawn in one style, with prose search over them. The set answers most requests without a model call; the edge function stays for anything the set does not cover.

Every icon is a 24x24 mark on a 2-unit round-capped stroke. It carries a phrase, a category, a stated concept, and at least four keywords. The set covers 71 categories: the standard interface vocabulary, plus animals, food, weather, feelings, school, work, travel, and home.

import {
  searchIcons, findIcon, getIcon, categories, iconsInCategory, renderIconSvg,
} from 'semantic-icons/library';

findIcon('sleepy fox');                 // -> the closest IconEntry, or null
searchIcons('it is raining outside');   // -> ranked matches with scores
getIcon('umbrella');                    // -> the IconEntry with that name
categories();                           // -> the 71 category names
iconsInCategory('weather');             // -> every icon in one category
renderIconSvg(getIcon('umbrella')!.svg, { size: 32 });

ICONS holds the whole set. createIconIndex and searchIndex are the engine behind searchIcons; build your own index when you want to search a subset.

Search stems words, drops stopwords, and scores by keyword overlap, term rarity, and query coverage. On top of that it pays a bonus for an exact phrase, for an unstemmed match, and for a phrase found inside longer prose. Every icon carries synonyms and prose terms, so a whole sentence resolves as well as a single word:

| prose | answer | | --- | --- | | put on your raincoat | raincoat | | my phone battery is low | battery low | | the baby needs a nappy change | changing table | | where do we keep the first aid kit | first aid kit | | brush your teeth please | toothbrush |

npm run icons:probe asks whether the set answers at all. npm run icons:prose is the stricter gate: 64 labelled cases, each listing every phrase a caller would accept at rank 1, including cases where the honest answer is nothing.

Search is lexical, not vector. That is deliberate: it needs no key, no network and no model, so a curated phrase costs nothing. Two rules keep it honest at 3000 icons:

  • A term counts once per field, and at most twice across an icon's keywords. A long tag list widens reach without letting one word dominate, so an icon cannot steal another icon's own phrase.
  • Coverage is scored on a curve steeper than linear, so a mark that answers one word of a sentence ranks below one that answers most of it.

Search by meaning, when the words do not match

Lexical search cannot answer a word the set never names: petrichor, a barnacle. Migration 0003_icon_embeddings.sql adds pgvector and a match_icons function, and the edge function then searches by meaning between the cache miss and the model call:

exact phrase key  ->  nearest curated icon  ->  the model draws one

A hit returns source: 'nearest' with the phrase it matched and the cosine similarity, so a caller can show what it found and why. Nothing changes without a key: with no embedding provider the function skips the vector stage, and a deployment that has not run migration 0003 falls through to the model.

Two providers are supported, both at 1024 dimensions:

| provider | model | when | | --- | --- | --- | | Voyage | voyage-3 | preferred. The stronger retrieval model | | Cloudflare Workers AI | @cf/baai/bge-large-en-v1.5 | no second vendor, if the site is already on Cloudflare |

Voyage wins whenever VOYAGE_API_KEY is set. Otherwise the function uses CLOUDFLARE_ACCOUNT_ID and CLOUDFLARE_AI_TOKEN. EMBED_MODEL overrides the model of whichever provider is chosen.

Use one model on both sides. Equal width is not one space: a vector stored by one model and a query embedded by another does not error, it ranks nonsense. The model id is stored beside every vector and match_icons filters on it, so a mismatch returns nothing and the caller falls through to the model. To change model, re-run icons:embed and apply the seed again.

VOYAGE_API_KEY=... npm run icons:embed
# writes supabase/seeds/0002_icon_embeddings.sql

Answer from the set before the network

import { configureSemanticIcons } from 'semantic-icons';
import { createLocalResolver } from 'semantic-icons/library';

configureSemanticIcons({
  functionUrl,
  anonKey,
  resolveLocally: createLocalResolver(),   // raise minScore for stricter hits
});

useSemanticIcon then returns a curated icon at once, and calls the edge function only for a phrase the set does not cover.

How the set is built

  • docs/icon-taxonomy.md — the phrase list, grouped by category.
  • docs/icon-style-guide.md — the drawing contract every icon follows.
  • src/library/icons/*.json — the source of truth, one file per batch.
  • src/library/icons.generated.ts — the shipped set, generated.
  • supabase/seeds/0001_curated_icons.sql — the same icons as curated rows for the generated_icons cache.
npm run icons:plan     # slice the taxonomy into drawing batches
npm run icons:check    # validate every icon against the style rules
npm run icons:build    # regenerate the TypeScript set and the SQL seed
npm run icons:sheet    # write a contact sheet for visual review
npm run icons:report   # coverage per category, and shadowed phrases
npm run icons:probe    # answer 80 prose questions from the set
npm run icons:prose    # score 64 labelled prose cases at rank 1
npm run icons:embed    # compute the icon embeddings (needs an embedding key)
npm run icons:gallery  # write a browsable gallery page
npm run icons:site     # write the marketing site to site/index.html

Change an icon in src/library/icons/*.json, then run icons:check and icons:build. The generated files are never edited by hand.

The ui-* categories cover the standard interface vocabulary found in the Flowbite, Bootstrap, and Figma icon sets. Every icon here is drawn for this library; no artwork is copied from those sets, and brand logos are left out.

The SDK, with no framework

semantic-icons/sdk is the surface the React hook and the MCP server both sit on. It runs in Node and in the browser.

import { createSemanticIcons, isTooComplex } from 'semantic-icons/sdk';

const icons = createSemanticIcons({ functionUrl, anonKey });

icons.search('my phone battery is low');   // ranked matches with scores
icons.find('battery low');                 // the best entry, or null
icons.get('battery-low');                  // one entry by name
icons.categories();                        // the 71 group names
icons.inCategory('weather');               // every icon in one group
icons.render(icon, { size: 32 });          // the complete SVG string

const answer = await icons.resolve('a barnacle');
if (!isTooComplex(answer)) console.log(answer.origin);  // curated | generated

resolve reads the curated set first. It calls the edge function only when no curated match reaches minScore (default 8). Omit functionUrl to stay offline: resolve then throws for a phrase the set does not hold.

MCP server

The set is also an MCP server, so an assistant can search it and draw from it directly.

claude mcp add semantic-icons -- npx -y semantic-icons-mcp

| tool | what it does | | --- | --- | | search_icons | rank the set against a word, a phrase, or a sentence | | get_icon | one mark by name, with the complete SVG | | list_categories | the 71 groups and their counts | | list_category | every mark in one group | | resolve_icon | curated first, the model second |

Environment: SEMANTIC_ICONS_FUNCTION_URL, SEMANTIC_ICONS_ANON_KEY, SEMANTIC_ICONS_MIN_SCORE. Without a function URL the server stays offline and answers from the curated set only.

The site

npm run icons:site writes site/: one static page that holds the whole set, the real query engine, and a preview of the generation path, plus the favicon, the social card, robots.txt, sitemap.xml and cache headers. It needs no server, no key, and makes no request of its own.

It runs on Cloudflare Pages at semantic-icons.pages.dev, and it answers at semanticicons.com once the nameservers move. docs/deploy-site.md holds the state and the steps.

npm run icons:site     # build site/
npm run site:deploy    # push it, with wrangler
npm run site:upload    # push it with an asset token, no browser login

Install (once implemented)

npm install github:<you>/semantic-icons#<tag>
import { useSemanticIcon } from 'semantic-icons';
import { SemanticIcon } from 'semantic-icons/native'; // or 'semantic-icons/web'

Backend setup (per consuming project)

  1. Copy supabase/functions/semantic-icon/ into your project's supabase/functions/.
  2. Run the migration in supabase/migrations/ against your Supabase project.
  3. Set ANTHROPIC_API_KEY (and optionally AI_MOCK_MODE=true for tests) in your function's env.
  4. Seed your own curated icons into generated_icons (source: 'curated') for the phrases you already know you'll need.