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

@ziweijs/react

v0.3.0

Published

基于 @ziweijs/core 的 React 紫微斗数命盘组件

Readme

NPM Version NPM Downloads GitHub License Formatted with Biome

简介

@ziweijs/react 是基于 @ziweijs/core 构建的 React 组件,帮助你在 Web 项目中快速渲染北派紫微斗数命盘。库内置高分辨率的命盘栅格、十四主星 + 辅星布置、四化/自化标识等元素,并针对 React 的状态管理和上下文系统做了封装。

特性

  • 🌓 React 就绪:默认导出 <ZiWei /> 组件,传入姓名、阳历时间与性别即可绘制完整命盘。
  • 🎨 自适应布局:所有尺寸、字体、颜色均通过 ConfigContext 驱动,轻松自定义皮肤。
  • 🌏 多语言:与 @ziweijs/corei18n 体系一致,支持 zh-CN/zh-Hant 等语言切换。
  • ⚛️ hooks/工具集:提供 RuntimeContainer、配置上下文等工具,方便拓展自定义 UI。

截图

安装

pnpm add @ziweijs/react @ziweijs/core react react-dom

React 19.2+ 为 peer 依赖,请确保项目已升级。

快速上手

import ZiWei from "@ziweijs/react";

export default function Demo() {
  return (
    <div style={{ width: 720 }}>
      <ZiWei
        name="张三"
        gender="male"
        language="zh-CN"
        date="1990-05-21T10:30:00+08:00"
        width={720}
        height={720}
      />
    </div>
  );
}

组件会调用 @ziweijs/corebySolar 逻辑解析 ISO 字符串(含时区),完成紫微命盘排盘后渲染 SVG。

Props

| 属性 | 类型 | 说明 | | ------- | --------------------- | --------------------------------------- | | name | string | 命主姓名,仅用于展示。 | | gender| GenderKey | 性别(male/female)。 | | date | string | 阳历时间,推荐使用 YYYY-MM-DDTHH:mm:ssZ。 | | language | Language | 可选,命盘文案语言,默认 zh-CN。 | | width/height | number | 画布尺寸,默认 600。 |

更多样式可通过 ConfigContext 配合 RuntimeContainer 覆写,详见 packages/react/src/context

本地开发

pnpm install
pnpm dev --filter @ziweijs/react
  • 组件源代码:packages/react/src
  • Playground:packages/react/playground
  • 排盘核心:@ziweijs/core(workspace 依赖)

状态

🚧 积极开发中...

版权

本项目根据 MIT 开源许可证条款授权使用。