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

@rfkit/charts

v1.4.3

Published

Chart components for wireless monitoring web applications

Readme

rfkit-charts

服务于无线电监测产品的 Web 图表组件库。

  • 仓库名:rfkit-charts
  • npm 发布名:@rfkit/charts

安装

pnpm add @rfkit/charts

正式版本由源码仓库内的 Release PR 自动发布到 npm;仓库里的本地 publish:* 脚本只作为维护调试或应急入口,不属于常规发布流程。

发布入口

当前对外正式入口只有两个:

  • JS / TS:@rfkit/charts
  • CSS bridge:@rfkit/charts/tailwind-bridge.css

默认直接从包根导入组件即可。组件运行所需样式会随包根入口自动加载,普通消费方不需要额外引 CSS。

快速开始

公开组件默认通过 ref 暴露 Publish 能力,不走 publish prop。

import { useEffect, useRef } from 'react';
import {
  ChartType,
  PSType,
  Spectrum,
  type Publish
} from '@rfkit/charts';

export function Demo() {
  const chartRef = useRef<Publish>(null);

  useEffect(() => {
    chartRef.current?.({
      pstype: PSType.Spectrum,
      data: new Float32Array([12, 28, 19, 35, 17])
    });
  }, []);

  return <Spectrum ref={chartRef} type={ChartType.SingleFrequency} />;
}

Publish 使用方式

大多数图表的数据输入都通过组件 ref 返回的 Publish 函数完成。

import { useEffect, useRef } from 'react';
import {
  Gauge,
  PSType,
  type Publish
} from '@rfkit/charts';

export function GaugeDemo() {
  const gaugeRef = useRef<Publish>(null);

  useEffect(() => {
    gaugeRef.current?.({
      pstype: PSType.Gauge,
      value: 42,
      limit: 60
    });

    gaugeRef.current?.({
      pstype: PSType.Reset
    });
  }, []);

  return <Gauge ref={gaugeRef} />;
}

常用公开类型:

  • Publish
  • PublishData
  • PublishSpectrum
  • PublishHeatmap
  • PublishIQ
  • PublishLevelStream
  • PublishDial
  • PublishGauge
  • SetSeries
  • SetSegments
  • SetMarker

工具栏相关命名统一使用:

  • 工具栏枚举使用 ToolbarItemType
  • 组件参数使用 toolbar

主题接入

charts 只读取根节点上的两个契约:

  • theme="light" | "dark"
  • theme-follow-OS="true" | "false"

应用层直接写这两个属性即可:

document.documentElement.setAttribute('theme', 'dark');
document.documentElement.setAttribute('theme-follow-OS', 'false');

如果宿主已经在用 @rfkit/theme,通常不需要额外迁移,因为它写的也是同一套根契约。

initChartsTheme()

initChartsTheme() 现在只承担三件事:

  • 覆盖 charts 默认 tokens
  • 覆盖默认 sizes
  • 通过 onChange 订阅解析后的主题状态
import { initChartsTheme } from '@rfkit/charts';

initChartsTheme({
  onChange: ({ followOS, theme, contractTheme }) => {
    console.log(followOS, theme, contractTheme);
  },
  tokens: {
    semantic: {
      primary: {
        light: '#2A51F7',
        dark: '#4371F8'
      }
    }
  },
  sizes: {
    spacing: {
      base: {
        middle: '8px',
        small: '4px'
      }
    }
  }
});

读取和订阅主题状态

import {
  getChartsThemeState,
  subscribeChartsThemeChange
} from '@rfkit/charts';

const state = getChartsThemeState();
console.log(state.theme, state.preference);

const cleanup = subscribeChartsThemeChange((nextState) => {
  console.log(nextState.followOS, nextState.contractTheme);
});

cleanup();

tailwind-bridge.css

只有当宿主自己也在用 Tailwind CSS v4 + shadcn/ui,并且想复用 charts 的 canonical token 时,才需要额外引入:

@import "tailwindcss";
@import "@rfkit/charts/tailwind-bridge.css";

这份 bridge 的边界是:

  • 只做 canonical charts token 到 Tailwind / shadcn 语义色板的映射
  • 不包含全局 reset
  • 不再兜底旧 --theme-* 变量
  • 不负责替宿主生成 :root 上的 canonical token

非公开边界

以下内容不属于对外源码 API:

  • 任意 src/** 源码路径
  • test/** preview / example 宿主
  • 仓库内部工程文档

主题变更摘要

当前主题系统已经完成二阶段收口,外部需要注意的 breaking change 主要有:

  • initChartsTheme() 不再接受 themeConfigs / sizeConfigs / subscribeThemeChange
  • 新配置入口改为 tokens / sizes / onChange
  • applyChartsTheme()applyChartsThemePreference() 已移除
  • 默认运行时不再输出旧 --theme-* alias
  • @rfkit/charts/tailwind-bridge.css 不再暴露 deprecated bridge token

文档边界

  • 对外安装、接入方式、主题契约和常用用法以本文为准。
  • 精确公开 API 以 @rfkit/charts 包根导出的类型声明和编辑器智能提示为准。
  • npm 打包产物只同步根 README.md,不会把仓库内的 docs/* 一并作为公开文档入口发布。
  • 仓库内部专题文档只在源码仓库内维护,不属于发布包对外文档入口。