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

@haklex/rich-renderer-image

v0.0.38

Published

Image renderer with blurhash and lightbox

Readme

@haklex/rich-renderer-image

图片渲染器,支持 Thumbhash 模糊占位、灯箱预览和编辑器内图片管理。

安装

pnpm add @haklex/rich-renderer-image @haklex/rich-editor

导出

export { ImageRenderer } from './ImageRenderer'
export { ImageEditRenderer } from './ImageEditRenderer'

功能

  • Thumbhash 模糊占位 + 渐显加载动画
  • 图片灯箱(react-photo-view)
  • 图片说明(caption)
  • 加载 / 错误状态
  • 编辑模式:替换、元信息编辑、复制、删除、下载

架构

ImageRenderer          — 静态渲染(灯箱 + thumbhash)
ImageEditRenderer      — 编辑模式入口,mode !== 'editor' 时回退到 ImageRenderer
├── ImageEditContext    — Jotai Provider,管理编辑状态 atoms
├── ImageEditToolbar   — 悬浮工具栏(元信息 / 替换 / 打开 / 复制 / 下载 / 删除)
├── EditMetaPopover    — 编辑 src / alt / caption
├── ReplacePopover     — 替换图片(上传 / URL)
├── ReplacePanel       — Upload / URL 切换面板
├── useImageActions    — 所有编辑操作 hooks
└── atoms              — Jotai atoms(src, loadState, hovering, replace 状态等)

使用

import { ImageRenderer } from '@haklex/rich-renderer-image'
import type { RendererConfig } from '@haklex/rich-editor'

// 静态渲染
const config: RendererConfig = {
  Image: ImageRenderer,
}

// 编辑模式
import { ImageEditRenderer } from '@haklex/rich-renderer-image'

const editConfig: RendererConfig = {
  Image: ImageEditRenderer,
}

样式

Vanilla Extract CSS-in-TS。所有样式类通过 semanticClassNames 导出语义化 class 名,便于外部覆盖。

加载动画:img 初始 opacity: 0,加载完成后通过 imageVisible class 施加 opacity: 1 + mask 渐显动画。

依赖

| 包 | 用途 | |---|------| | @haklex/rich-editor | 核心类型、节点操作、上传上下文 | | @haklex/rich-editor-ui | Popover、SegmentedControl | | jotai | 编辑状态管理 | | lucide-react | 工具栏图标 | | react-photo-view | 灯箱 | | thumbhash | 模糊占位图解码 |

License

MIT