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

@blueking/status-tag

v1.2.3

Published

A framework-agnostic Status Tag Web Component with i18n support

Downloads

680

Readme

@blueking/status-tag

一个无框架依赖的状态标签 Web Component,支持国际化,适用于任何前端项目。

🔗 在线演示: Playground

✨ 特性

  • 无框架依赖 - 原生 Web Component,可在任何项目中使用
  • 3 种视觉形态 - Default (背景框)、Stroke (描边)、Filled (光晕)
  • 国际化支持 - 内置中英文,可扩展其他语言
  • 智能匹配 - 支持大小写不敏感的状态匹配
  • 自定义配置 - 支持自定义状态映射
  • TypeScript - 完整的类型支持

🚀 快速开始

NPM 安装

npm install @blueking/status-tag

基础使用

<!-- 引入组件 -->
<script type="module" src="node_modules/@blueking/status-tag/dist/status-tag.mjs"></script>

<!-- 使用组件 -->
<!-- 默认样式 -->
<status-tag status="running"></status-tag>

<!-- 描边样式 -->
<status-tag status="running" type="stroke"></status-tag>

<!-- 光晕样式 -->
<status-tag status="running" type="filled"></status-tag>

<!-- 纯文字(与 default 同色标签框,无前置圆点/加载图标) -->
<status-tag status="running" type="text"></status-tag>

后端返回什么就显示什么

未在 status-map 中匹配到的状态,会原样展示传入文本,无需为每个业务状态都预先配置:

<!-- 未命中映射:直接显示 "部署中",套用 unknown 主题兜底 -->
<status-tag status="部署中"></status-tag>

若还想让颜色也表达语义,用 theme 属性把颜色文本解耦(theme 优先级最高):

<status-tag status="部署中"   theme="loading"></status-tag>  <!-- 蓝色 + 旋转图标 -->
<status-tag status="审批通过" theme="running"></status-tag>  <!-- 绿色 -->
<status-tag status="连接失败" theme="danger"></status-tag>   <!-- 红色 -->

📚 API 文档

属性 (Attributes)

| 属性名 | 类型 | 必填 | 默认值 | 说明 | |--------|------|------|--------|------| | status | string | ✅ | - | 状态值(如:'running', 'stop', 'warning', 'failed' 等)。未匹配到映射时原样展示传入文本(后端返回什么就显示什么),并套用 unknown 主题作为兜底 | | theme | string | ❌ | '' | 主题覆盖,与 status 文本解耦。可选 'loading' \| 'running' \| 'unknown' \| 'warning' \| 'danger'。优先级最高,设置后覆盖 status-map 推导的主题;适用于「文本任意、颜色由前端决定」的场景 | | type | string | ❌ | '' | 样式类型:''(默认,带状态图标)、'text'(同色标签框仅文字)、'stroke'(描边圆点)、'filled'(光晕圆点) | | locale | string | ❌ | 'zh-CN' | 语言设置,支持 'zh-CN' 和 'en-US' | | status-map | string (JSON) | ❌ | - | 自定义状态映射配置(JSON 字符串) |

支持的状态

| 状态 | 中文文本 | 英文文本 | 主题颜色 | |------|----------|----------|------| | loading | 加载中 | Loading | 蓝色 | | running | 运行中 | Running | 绿色 | | stop | 已停止 | Stopped | 灰色 | | warning | 警告 | Warning | 橙色 | | failed | 失败 | Failed | 红色 | | unknown | 未知 | Unknown | 灰色 |

🎨 样式类型

  1. Default (默认): 带背景色的胶囊状标签,字体加粗。
  2. Stroke (描边): 无背景,仅图标带边框,字体常规,颜色 #4D4F56。
  3. Filled (光晕): 无背景,实心圆点带光晕,字体常规,颜色 #4D4F56。

📖 更多文档

📝 许可证

MIT License