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

nucleo-glass-icons

v0.1.11

Published

Icon component package for React and Vue, built on the open-source SVG Glass Icons by Nucleo.

Readme

Icon Library

本组件基于 Nucleoapp 提供的开源 SVG Glass Icons 封装而成,旨在方便在项目中直接使用这些图标。

所有图标均来自 Nucleoapp,你也可以前往其官方网站复制并粘贴 SVG 代码进行使用。

特性

  • 🌳 Tree-shaking 友好 - 只打包你使用的图标
  • ⚛️ 多框架支持 - 支持 React 和 Vue
  • 📦 动态导入 - 避免一次性打包所有图标
  • 🎯 TypeScript 支持 - 完整的类型定义和智能提示
  • 🔧 灵活样式 - 支持自定义大小、类名
  • 🎨 渐变颜色 - 支持自定义渐变停止颜色

安装

npm install nucleo-glass-icons
# 或
pnpm add nucleo-glass-icons
# 或
yarn add nucleo-glass-icons

使用方法

React

import { AppStack } from 'nucleo-glass-icons/react'
import React from 'react'

function App() {
  return (
    <div>
      {/* 基本使用 */}
      <AppStack />

      {/* 自定义大小 */}
      <AppStack size={32} />

      {/* 使用 className */}
      <AppStack className="my-icon" />

      {/* 内联样式 */}
      <AppStack style={{ margin: '10px' }} />

      {/* 自定义渐变颜色 */}
      <AppStack stopColor1="#3b82f6" stopColor2="#1e40af" />

      {/* 组合使用 */}
      <AppStack
        size={48}
        className="custom-icon"
        stopColor1="#ef4444"
        stopColor2="#dc2626"
      />
    </div>
  )
}

Vue

<script setup>
import { AppStack } from 'nucleo-glass-icons/vue'
</script>

<template>
  <div>
    <!-- 基本使用 -->
    <AppStack />

    <!-- 自定义大小 -->
    <AppStack :size="32" />

    <!-- 使用 class -->
    <AppStack class="my-icon" />

    <!-- 内联样式 -->
    <AppStack :style="{ margin: '10px' }" />

    <!-- 自定义渐变颜色 -->
    <AppStack stop-color1="#3b82f6" stop-color2="#1e40af" />

    <!-- 组合使用 -->
    <AppStack
      :size="48"
      class="custom-icon"
      stop-color1="#ef4444"
      stop-color2="#dc2626"
    />
  </div>
</template>

批量导入

// React
import { IconNames, Icons } from 'nucleo-glass-icons/react'

// Vue
import { IconNames, Icons } from 'nucleo-glass-icons/vue'

// 所有图标
console.log(Icons) // { AppStack: Component, ... }

// 所有图标名称
console.log(IconNames) // ['AppStack', ... ]

Props

React 组件

| 属性 | 类型 | 默认值 | 描述 | |------|------|--------|------| | size | number \| string | 24 | 图标大小(宽度和高度) | | className | string | - | CSS 类名 | | style | React.CSSProperties \| Record<string, any> \| string | - | 内联样式 | | stopColor1 | string | '#575757' | 第一个渐变停止颜色(替换 #575757) | | stopColor2 | string | '#151515' | 第二个渐变停止颜色(替换 #151515) |

Vue 组件

| 属性 | 类型 | 默认值 | 描述 | |------|------|--------|------| | size | number \| string | 24 | 图标大小(宽度和高度) | | class | string | - | CSS 类名 | | style | object \| string | - | 内联样式 | | stopColor1 | string | '#575757' | 第一个渐变停止颜色(替换 #575757) | | stopColor2 | string | '#151515' | 第二个渐变停止颜色(替换 #151515) |

渐变颜色说明

图标中的渐变颜色会自动替换:

  • stop-color="#575757" → 使用 stopColor1 的值
  • stop-color="#151515" → 使用 stopColor2 的值

示例:

// 原始 SVG 中的渐变
<linearGradient id="1752500502790-2257412_heart_existing_0_ik394vb0b" x1="8.505" y1="3" x2="8.505" y2="21.733" gradientUnits="userSpaceOnUse">
  <stop stop-color="#575757"></stop>
  <stop offset="1" stop-color="#151515"></stop>
</linearGradient>
// 使用自定义颜色后
<AppStack stopColor1="#3b82f6" stopColor2="#1e40af" />
// 会生成:
// <stop stop-color="#3b82f6"></stop>
// <stop offset="1" stop-color="#1e40af"></stop>

注意: 一个 SVG 中可能有多个相同的 stop-color 值,都会被替换为对应的变量。

开发

构建

pnpm run build

构建过程会自动:

  1. public/icons/index.json 读取图标数据
  2. 生成 React 和 Vue 图标组件
  3. 打包所有构建产物
  4. 自动清理临时生成的文件

技术栈

  • 构建工具: Rolldown
  • 包分析: rollup-plugin-visualizer
  • SVG 优化: SVGO
  • 类型检查: TypeScript

许可证

MIT