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

@zov-chatui/chat-parsers

v1.0.0

Published

Chat content parsers for React applications - Mermaid charts, file attachments, images, and data charts

Readme

@zov-chatui/chat-parsers

一个强大的 React 组件库,用于解析和渲染 Markdown 图表、文件附件和图片。

功能特性

  • Mermaid 图表渲染 - 支持 27+ 种图表类型
  • 文件附件渲染 - 支持文本、PDF、图片等多种文件类型
  • 图片渲染 - 支持全屏查看、缩放、拖拽等功能
  • 数据图表渲染 - 基于 Recharts 的图表组件
  • 主题支持 - 支持浅色/深色主题
  • 响应式设计 - 完美适配移动端和桌面端

安装

yarn add @zov-chatui/chat-parsers

使用

基础使用

import React from 'react';
import { ThemeProvider } from '@zov-chatui/chat-parsers';
import { MermaidRenderer, FileRenderer, ImageRenderer, ChartRenderer } from '@zov-chatui/chat-parsers';

function App() {
  return (
    <ThemeProvider defaultMode="auto">
      {/* Mermaid 图表 */}
      <MermaidRenderer code={`
        flowchart TD
          A[开始] --> B[处理]
          B --> C[结束]
      `} />
      
      {/* 文件渲染 */}
      <FileRenderer 
        fileName="example.txt"
        fileSize={1024}
        fileType="text/plain"
        content="文件内容..."
      />
      
      {/* 图片渲染 */}
      <ImageRenderer 
        src="https://example.com/image.png"
        alt="示例图片"
      />
      
      {/* 数据图表 */}
      <ChartRenderer 
        data={[
          { name: '一月', value: 400 },
          { name: '二月', value: 300 },
        ]}
        type="line"
      />
    </ThemeProvider>
  );
}

Mermaid 图表

支持的图表类型包括:

  • 流程图 (flowchart, graph)
  • 时序图 (sequenceDiagram)
  • 类图 (classDiagram)
  • 状态图 (stateDiagram)
  • 甘特图 (gantt)
  • 饼图 (pie)
  • 思维导图 (mindmap)
  • C4 模型图表
  • 以及更多...

文件渲染器

支持的文件类型:

  • 文本文件 (.txt, .md, .json, .csv)
  • PDF 文件
  • 图片文件
  • Office 文档

图片渲染器

功能:

  • 全屏查看
  • 缩放和拖拽
  • 下载功能
  • 响应式设计

API 文档

MermaidRenderer

interface MermaidRendererProps {
  code: string; // Mermaid 图表代码
}

FileRenderer

interface FileRendererProps {
  fileName?: string;
  fileSize?: number;
  fileType?: string;
  content?: string; // 文本内容
  downloadUrl?: string; // 下载链接
}

ImageRenderer

interface ImageRendererProps {
  src: string; // 图片 URL
  alt?: string;
  width?: number;
  height?: number;
}

ChartRenderer

interface ChartRendererProps {
  data?: any[]; // 图表数据
  type?: 'line' | 'area' | 'bar' | 'pie';
  width?: number;
  height?: number;
}

主题定制

import { ThemeProvider, lightTheme, darkTheme } from '@zov-chatui/chat-parsers';

// 使用自定义主题
const customTheme = {
  ...lightTheme,
  colors: {
    ...lightTheme.colors,
    primary: '#your-color',
  },
};

<ThemeProvider defaultMode="light">
  {/* 你的组件 */}
</ThemeProvider>

许可证

MIT

贡献

欢迎提交 Issue 和 Pull Request!