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

icon-craft-wasm

v0.3.5

Published

WASM-based clip-path generator for IconCraft

Readme

IconCraft WASM

Rust source code for the IconCraft WASM module. This repository contains the private source code that builds the gospelo-iconcraft-wasm npm package.

Overview

A WebAssembly module that generates emboss-style decorative shapes from SVG icons. Creates smooth, 3D-looking clip-paths with highlights and shadows.

Shape Modes

| Mode | Description | |------|-------------| | Sticker | Jelly-based shape with paper-like noise texture, no highlights | | Jelly | Smooth, organic blob shape following icon contours | | Bubble | Perfect circle/sphere with glass-like highlights | | Wax | Irregular wax seal shape with pressed icon indent |

Build

Prerequisites

Build Commands

# Build WASM package
wasm-pack build --target web

# Output: pkg/

Build Output

pkg/
├── icon_craft_wasm.js       # JavaScript bindings
├── icon_craft_wasm.d.ts     # TypeScript definitions
├── icon_craft_wasm_bg.wasm  # WASM binary
└── package.json             # npm package config

Development

Run Tests

cargo test

WASM Tests

wasm-pack test --headless --firefox

Distribution

The built pkg/ directory is copied to the public repository for npm distribution:

# Copy binaries to public repository
cp pkg/*.js pkg/*.wasm pkg/*.d.ts ../iconcraft/packages/wasm/

Publishing

Publishing is done from the public repository:

cd ../iconcraft/packages/wasm
npm publish

Architecture

Core Pipeline

  1. SVG Parsing - Parse input SVG using usvg
  2. Rasterization - Render to bitmap with resvg + tiny-skia
  3. Contour Extraction - Find contours using imageproc
  4. Shape Processing - Convex hull, Gaussian blur, simplification
  5. Output Generation - CSS polygon, SVG path, emboss SVG

Key Dependencies

| Crate | Purpose | |-------|---------| | wasm-bindgen | Rust-JavaScript interop | | resvg / usvg | SVG parsing and rasterization | | tiny-skia | 2D graphics rendering | | image / imageproc | Image processing, contour detection | | serde | Serialization for JS interop |

API

Exported Functions

// Basic clip-path generation
generate_clippath(svg_content, mode, offset, resolution, simplify_epsilon) -> ClipPathResult

// With icon embedding
generate_clippath_with_icon(svg_content, mode, offset, resolution, simplify_epsilon, include_icon) -> ClipPathResult

// With custom color palette
generate_clippath_with_color(svg_content, mode, offset, resolution, simplify_epsilon, include_icon, base_color) -> ClipPathResult

// With rotation (shape follows rotated icon, shadow direction adjusted)
generate_clippath_with_rotation(svg_content, mode, offset, resolution, simplify_epsilon, include_icon, base_color, rotation_degrees) -> ClipPathResult

Result Structure

pub struct ClipPathResult {
    pub success: bool,
    pub clip_path: Option<String>,        // CSS polygon()
    pub inner_clip_path: Option<String>,  // For Wax mode
    pub highlight_clip_paths: Option<Vec<String>>,
    pub points_count: usize,
    pub mode: String,
    pub error: Option<String>,
    pub icon_layout: Option<IconLayout>,
    pub svg_paths: Option<SvgPaths>,
    pub emboss_svg: Option<String>,       // Complete emboss SVG
    pub icon_paths: Option<EmbossIconData>,
    pub rotation: f32,                    // Applied rotation (degrees)
}

License

Source code is private. Built binaries are distributed under MIT license.