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

@deathmaz/phosphor-icons-vue-split

v0.2.1

Published

Phosphor Icons for Vue 3 with per-weight components for optimal tree-shaking

Downloads

432

Readme

@deathmaz/phosphor-icons-vue-split

Phosphor Icons for Vue 3 with per-weight components for optimal tree-shaking.

The original @phosphor-icons/vue bundles all 6 weights inside each icon component. Even if you only use the "regular" weight, the SVG data for all other weights is included in your bundle. This library splits each weight into its own component, so you only pay for what you use.

Installation

npm install @deathmaz/phosphor-icons-vue-split

Requires Vue 3.2.39 or later as a peer dependency.

Usage

<script lang="ts" setup>
import {
  PhHorseRegular,
  PhHeartFill,
  PhCubeDuotone,
} from "@deathmaz/phosphor-icons-vue-split";
</script>

<template>
  <PhHorseRegular />
  <PhHeartFill :size="32" color="hotpink" />
  <PhCubeDuotone :size="48" color="#333" />
</template>

Components follow the naming pattern Ph[IconName][Weight], where weight is one of:

| Weight | Example | | ---------- | ------------------- | | Thin | PhHeartThin | | Light | PhHeartLight | | Regular | PhHeartRegular | | Bold | PhHeartBold | | Fill | PhHeartFill | | Duotone | PhHeartDuotone |

All Phosphor icons are available across all 6 weights.

Props

All props are optional.

| Prop | Type | Default | Description | | ---------- | ------------------ | ---------------- | ------------------------------------- | | size | string \| number | "1em" | Width and height of the SVG | | color | string | "currentColor" | Fill color of the SVG | | mirrored | boolean | — | Horizontally flip the icon (for RTL) |

<PhArrowRightBold :size="24" color="red" :mirrored="true" />

Context provider

Use Vue's provide to set defaults for all icons in a subtree, avoiding repetitive props:

<script lang="ts" setup>
import { provide } from "vue";
import { PhHouseRegular, PhGearRegular } from "@deathmaz/phosphor-icons-vue-split";

provide("size", "24px");
provide("color", "#1a1a1a");
provide("mirrored", false);
</script>

<template>
  <!-- Both icons inherit size="24px" and color="#1a1a1a" -->
  <PhHouseRegular />
  <PhGearRegular />
</template>

Props on individual components override the injected context values.

Slots

Components accept a default slot for injecting arbitrary SVG elements (e.g., <title> for accessibility, <animate>, <filter>):

<PhHeartFill :size="32" color="red">
  <title>Favorite</title>
</PhHeartFill>

Attrs passthrough

Any additional attributes are forwarded to the root <svg> element via v-bind="$attrs":

<PhStarFill class="icon" data-testid="star" />

TypeScript

All components are fully typed. A general PhosphorIconComponent type covers any icon, while weight-specific branded types let you constrain props to a single weight:

import type {
  PhosphorIconComponent,
  PhosphorThinIcon,
  PhosphorRegularIcon,
  PhosphorFillIcon,
} from "@deathmaz/phosphor-icons-vue-split";

// Accept any icon
defineProps<{ icon: PhosphorIconComponent }>();

// Accept only regular-weight icons
defineProps<{ icon: PhosphorRegularIcon }>();

Available weight types: PhosphorThinIcon, PhosphorLightIcon, PhosphorRegularIcon, PhosphorBoldIcon, PhosphorFillIcon, PhosphorDuotoneIcon.

Bundle size

Each component contains only its weight's SVG path data. A typical component compiles to ~0.8 KB (gzipped), compared to ~4.4 KB per icon in the original library that bundles all weights.

The library uses sideEffects: false and Vite's preserveModules output, so bundlers can tree-shake unused components at the module level.

Development

Prerequisites

  • Node.js >= 20
  • npm

Setup

npm install

Scripts

| Script | Description | | ------------------- | --------------------------------------------- | | npm run build | Full pipeline: generate components + Vite build + type definitions | | npm run assemble | Generate Vue SFCs from @phosphor-icons/core SVGs | | npm run test | Run tests with Vitest | | npm run test:watch| Run tests in watch mode | | npm run lint | Lint with oxlint | | npm run typecheck | Type-check with TypeScript | | npm run check | Run typecheck + lint + build + test |

How it works

  1. npm run assemble reads SVG files from @phosphor-icons/core (installed as a dev dependency) and generates one Vue SFC per icon per weight into src/icons/. It also generates src/index.ts with named exports for all components, including alias re-exports from the Phosphor icon metadata.

  2. npm run build runs the assemble step, then builds the library with Vite in library mode (preserveModules: true so each component is a separate .mjs file), and finally generates TypeScript type definitions.

Generated files (src/icons/, src/index.ts, dist/) are gitignored — they are produced fresh from @phosphor-icons/core on each build.

License

MIT — Icon designs by Phosphor Icons.