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

@upcloudx/ui

v0.5.0

Published

UpCloudX 通用业务 UI 组件库 & Hooks

Readme

@upcloudx/ui

UpCloudX 通用业务 UI 组件库 & Hooks,基于 Vue 3 + Radix Vue,适用于中后台管理系统。

安装

pnpm add @upcloudx/ui

peerDependencies:

pnpm add vue dayjs

使用

<script setup lang="ts">
import { DataTable, SearchBar, StatusTag, useServerPagination } from '@upcloudx/ui';
</script>

样式随组件自动注入,无需手动引入 CSS 文件。

组件

| 组件 | 说明 | |------|------| | PageHeader | 带返回按钮的页面标题 | | SectionTitle | 带左侧色块装饰的分区标题 | | StatusTag | 业务状态标签,支持内置预设和自定义映射 | | ActionButtons | 表格操作列按钮组,超出自动收纳到下拉菜单 | | CopyText | 带一键复制功能的文本展示 | | EmptyState | 统一空状态占位(默认/搜索无结果/加载失败) | | DataTable | 封装分页、加载状态、空状态的业务数据表格 | | SearchBar | 列表页搜索/筛选栏,支持 input/select/date-range/date-picker | | DetailCard | 支持只读/编辑切换的详情信息卡片 | | FormModal | 封装表单的新增/编辑弹窗 | | StepForm | 多步骤向导表单 | | StatCard | 统计数据卡片,支持趋势箭头和骨架屏 | | CurrencyDisplay | 货币格式化展示,支持正负值着色 | | TabsPage | 带 Tab 切换的页面容器,支持 sessionStorage 持久化 |

Hooks

| Hook | 说明 | |------|------| | useConfirmAction | 二次确认弹窗(删除/停用等危险操作) | | useConfirm / confirmDelete | 快捷确认/删除确认 | | useListSearch | 列表页搜索/重置联动 | | useServerPagination | 服务端分页状态管理 | | useModalForm | 表单弹窗生命周期管理(打开回显/关闭重置/提交验证) | | useStatusMapper | 状态码到文本/颜色的映射工具 | | useProviderType | 厂商类型格式化(aws→AWS, cloudflare→Cloudflare) | | useDictData | 字典数据加载 | | useUtcTime | UTC 时间格式化为本地时间 | | useUserOptions | 用户列表 Select options | | useCustomerOptions | 客户列表 Select options + Map 查找 | | useDomainOptions | 域名列表 Select options | | usePagination | 前端分页 |

组件示例

DataTable + SearchBar

<template>
  <SearchBar
    :fields="[
      { key: 'name', label: '名称', type: 'input', placeholder: '请输入名称' },
      { key: 'status', label: '状态', type: 'select', options: statusOptions },
    ]"
    :loading="loading"
    @search="handleSearch"
    @reset="handleReset"
  />
  <DataTable
    :columns="columns"
    :data-source="list"
    :loading="loading"
    :total="total"
    :page-num="currentPage"
    :page-size="pageSize"
    @page-change="handlePageChange"
  >
    <template #bodyCell="{ column, record }">
      <StatusTag v-if="column.key === 'status'" :status="record.status" preset="domain" />
      <ActionButtons
        v-if="column.key === 'action'"
        :actions="[
          { label: '编辑', onClick: () => handleEdit(record) },
          { label: '删除', onClick: () => handleDelete(record), danger: true },
        ]"
      />
    </template>
  </DataTable>
</template>

useServerPagination + useListSearch

import { useServerPagination, useListSearch, useConfirmAction } from '@upcloudx/ui';

const { currentPage, pageSize, total, paginationConfig, resetPage, setTotal } =
  useServerPagination({ loadFn: loadData });

const { handleSearch, handleReset } = useListSearch({
  formRef,
  resetPage,
  loadFn: loadData,
});

const { confirmDelete } = useConfirmAction();

StatusTag 预设

<!-- 域名状态 -->
<StatusTag :status="4" preset="domain" />

<!-- 证书状态 -->
<StatusTag :status="2" preset="certificate" />

<!-- 自定义映射 -->
<StatusTag
  :status="record.status"
  :status-map="{ 0: { text: '待审核', color: 'processing' }, 1: { text: '已通过', color: 'success' } }"
/>

迁移说明(v0.4.0)

从 v0.3.x 升级时,ant-design-vue 不再是 peerDependency,可以从项目中移除(如果没有其他地方使用)。

组件 API 保持不变,无需修改业务代码。

开发

# 安装依赖
pnpm install

# 构建
pnpm build

# 监听模式
pnpm dev

发布

推送 tag 自动触发 GitHub Actions 发布到 npm:

# 修改 package.json 中的 version
git add -A && git commit -m "release: v0.x.x"
git tag v0.x.x
git push origin main --tags

License

MIT