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

darrell-photo-gallery

v1.1.0

Published

一个基于 react hoos 开发的 仿石墨的 图片放大插件

Downloads

7

Readme

darrell-photo-gallery

因为最近工作需要预览制作一个图片预览的插件,在查看了很多产品(掘金、知乎、简书、石墨等)的图片预览之后,还是觉得石墨的图片预览符合我们的产品需求。

介绍

这是一个基于 React Hoos 开发的 仿石墨的图片 放大预览插件。

在社区找了很久之后,没有找到相关的轮子,于是自己撸了一个。

插件的功能是当你的设备支持 canvas 的时候,就使用 canvas 进行绘图,当不支持 canvas 的时候就直接显示图片。

支持功能

  • [x] 放大图片
  • [x] 缩小图片
  • [x] 原尺寸大小显示
  • [x] 适应屏幕
  • [ ] 下载图片

预览

安装

// 安装
npm install darrell-photo-gallery -D

// 在项目中使用

import PhotoGallery from 'darrell-photo-gallery';
import 'darrell-photo-gallery/lib/main.min.css';

使用

<PhotoGallery
 visible={visible}
 imgData={ImgData}
 currentImg = {9}
 hideModal={
  () => {
    setVisible(false);
  }
 }
/>

目前支持四个参数:

  • visibleboolean,预览插件的显示隐藏

  • imgDataobject,具体属性如下

    interface Img {
      url: string;
      size?: string;
      width?: string;
      height?: string;
      [propName: string]: any;
    }
  • currentImgnumber,当前图片在图片数组中是第几张

  • hideModalhideModal?(): void;,是一个函数,关闭图片预览弹窗