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

@houheaven/kit-react

v0.0.7

Published

后天堂 React 18+ 套件

Readme

@houheaven/kit-react

后天堂 React 18+ 组件套件,提供开箱即用的通用组件,支持按需引入与自动样式加载。

特性

  • React 18 + TypeScript:完整类型定义,JSX 中即得类型提示。
  • 统一根入口:通过具名导出按需引入 Layout、ImageDialog 和 Icon。
  • CSS 自动注入:无需手动 import 样式文件,构建时自动加载。
  • 双格式产物:同时输出 ESM (.js) 与 CJS (.cjs),兼容 Vite / Webpack / Rollup 等主流构建工具。

安装

pnpm add @houheaven/kit-react
# 或
npm install @houheaven/kit-react
# 或
yarn add @houheaven/kit-react

react >= 18、react-dom >= 18 与 react-router-dom >= 7,请在项目中自行安装。

使用

根入口引入

组件通过 @houheaven/kit-react 根入口导出。引入组件时无需手动导入 CSS,构建产物已自动注入。

import { ImageDialog, Layout } from "@houheaven/kit-react";
import { useState } from "react";

export default function App() {
  const [visible, setVisible] = useState(false);

  return (
    <Layout footerMode="within-viewport">
      <Layout.Header>
        <h1>页面标题</h1>
      </Layout.Header>
      <Layout.Content>
        <button type="button" onClick={() => setVisible(true)}>显示图片</button>
        <ImageDialog
          isOpen={visible}
          onOpenChange={setVisible}
          image="/path/to/qrcode.jpg"
          text="扫码关注"
        />
      </Layout.Content>
      <Layout.Footer>页面页脚</Layout.Footer>
    </Layout>
  );
}

Layout.RouterHeader 会读取路由信息生成页头,使用时需要在 React Router 路由上下文中渲染。

组件

Layout

Layout 用于组合页面页头、内容区和页脚。footerMode 控制内容区最小高度:below-fold(默认)让页脚跟随内容,within-viewport 将页脚高度计入首屏布局。

| 组件 | 用途 | | --- | --- | | Layout.Header | 自定义页头容器 | | Layout.RouterHeader | 根据路由信息生成的页头 | | Layout.Content | 页面内容区,默认内边距为 20px | | Layout.Footer | 自定义页脚容器 | | Layout.SiteFooter | 站点导航与版权页脚 |

Layout.SiteFooter 可通过 groups 和 copyright 提供自定义内容;设置 useHouheavenData 后使用内置站点数据。

import { Layout } from "@houheaven/kit-react";

export function Page() {
  return (
    <Layout>
      <Layout.Content>页面内容</Layout.Content>
      <Layout.SiteFooter useHouheavenData />
    </Layout>
  );
}

ImageDialog

图片弹窗组件,用于展示二维码等图片。受控使用 isOpen + onOpenChange,点击遮罩或按 ESC 键关闭。

Props

| 名称 | 类型 | 默认值 | 说明 | | --- | --- | --- | --- | | isOpen | boolean | — | 弹窗显隐状态(必填) | | onOpenChange | (next: boolean) => void | — | 显隐变更回调(必填) | | image | string | — | 图片地址(必填) | | text | string | "" | 图片下方说明文字 |

示例

import { ImageDialog } from "@houheaven/kit-react";
import { useState } from "react";

export function Preview() {
  const [visible, setVisible] = useState(false);
  return (
    <>
      <button type="button" onClick={() => setVisible(true)}>显示图片</button>
      <ImageDialog
        isOpen={visible}
        onOpenChange={setVisible}
        image="/path/to/qrcode.jpg"
        text="扫码关注"
      />
    </>
  );
}

产物结构

构建会为根入口和组件目录生成产物。组件请从 @houheaven/kit-react 根入口引入;需要手动导入合并样式时,可使用 @houheaven/kit-react/style.css。当前未开放组件子路径导入。

dist/
├── index.{js,cjs,d.ts}          # 全量桶入口
├── hh-footer/
│   ├── index.{js,cjs,d.ts}      # 子入口
│   └── style.css                # 独立样式
├── hh-image-dialog/
│   ├── index.{js,cjs,d.ts}
│   └── style.css
└── chunks/                       # 共享 chunk(自动 code-split)

开发

pnpm build         # 构建产物
pnpm dev           # 监听模式构建
pnpm typecheck     # 类型检查
pnpm clean         # 清理产物

License

MIT © 立树