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

yggjs_rtoast

v1.0.2

Published

专为React打造的消息通知库 - A professional toast notification library for React

Readme

YggJS RToast

YggJS RToast Version License TypeScript

科技风 React 全局消息通知库

English | 中文

🎯 特性

  • 🎨 科技风设计:现代化视觉、渐变与发光、顺滑动画
  • ⚡ 轻量高效:零外部依赖,打包后体积极小
  • 🧰 简单 API:专注“全局用法”,开箱即用
  • 🧩 TypeScript 友好:完善的类型、清晰的签名
  • ♿ 无障碍设计:role="alert"、aria-live 支持
  • 🧪 示例与文档:提供完整示例与使用教程

📦 安装

# npm	npm i yggjs_rtoast
# yarn	yarn add yggjs_rtoast
# pnpm	pnpm add yggjs_rtoast
  • React 版本:推荐 React 18+(内部默认使用 createRoot)
  • 样式:通常会自动注入;若构建未收集到,可手动:
import 'yggjs_rtoast/dist/style.css'

🚀 快速开始

import { toast } from 'yggjs_rtoast/tech'

// 类型化入口(推荐)
toast.success('操作成功!')
toast.error('操作失败!')

// 通用入口(高度自定义)
const id = toast.toast('这是一条自定义消息', {
  type: 'info',
  duration: 4000,
  closable: true,
  animation: 'slide',
  pauseOnHover: true,
})

// 关闭
toast.dismiss(id)
toast.dismissAll()

订阅(只读数组,存入本地状态请浅拷贝):

import React from 'react'
import { toast } from 'yggjs_rtoast/tech'
import type { ToastData } from 'yggjs_rtoast/tech'

export function ToastCounter() {
  const [list, setList] = React.useState<ToastData[]>([])
  React.useEffect(() => {
    const off = toast.subscribe((arr) => setList([...arr]))
    return off
  }, [])
  return <span>当前消息:{list.length}</span>
}

📚 API

全局实例 toast(ToastAPI):

  • subscribe(listener: (toasts: ReadonlyArray) => void): () => void
  • toast(message: React.ReactNode, options?: ToastOptions): string
  • success/error/warning/info/debug(message, options?): string
  • dismiss(id: string): void
  • dismissAll(): void
  • getToasts(): ReadonlyArray

ToastOptions

  • type?: 'success' | 'error' | 'warning' | 'info' | 'debug'(默认 'info')
  • duration?: number(默认 4000,0 表示不自动关闭)
  • closable?: boolean(默认 true)
  • icon?: React.ReactNode
  • className?: string
  • style?: React.CSSProperties
  • onClick?: () => void
  • onClose?: () => void
  • animation?: 'slide' | 'fade' | 'bounce' | 'zoom'(默认 'slide')
  • pauseOnHover?: boolean(默认 true)

ToastData(订阅与调试)

  • id: string
  • message: React.ReactNode
  • createdAt: number
  • 以及合并后的 ToastOptions 实际值

🎨 主题

  • 支持通过 className/style 覆盖样式
  • 可在后续版本提供 CSS 变量清单以便统一主题

📖 教程与示例

  • 使用教程(中文):docs/使用教程/v0.1.0/使用教程.md
  • 示例项目:example/

🛠️ 开发

pnpm install
pnpm build
pnpm test
pnpm example # 运行示例

📄 许可证

MIT © YggJS