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

nd-image-viewer

v0.1.1

Published

react image viewer component

Readme

使用

example

npm install nd-image-viewer@^0.1.0 --save

或手工编辑 package.json

"dependencies": {¬                                                                                                                                                                                           
    "nd-image-viewer": "^0.1.0"¬
}¬

完整用法:

import 'babel-polyfill'
import React from 'react'
import { render } from 'react-dom'
import utils from 'nd-utils'
// ES6
import ImagePopup from './imgComponent/index'
let { bind } = utils.bindUtil

class ImageListElement extends React.Component {
    static displayName = 'ImageListElement'
    static propTypes = {
    }
    
    constructor(props) {
        super(props)
        this._onImageClick = bind(this.onImageClick, this)
    }

    onImageClick(index, url, e) {
        this.refs.imagePopup.show(0)
    }

    render() {
        const imageData = [
            {
                title: '一只孤独的鲸',
                picUrl: 'https://betacs.101.com/v0.1/download?dentryId=cd478042-815f-42e7-a886-e16d925deff0&size=80',
                originalUrl: 'https://betacs.101.com/v0.1/download?dentryId=cd478042-815f-42e7-a886-e16d925deff0'
            },
            {
                title: '我是猫',
                picUrl: 'https://betacs.101.com/v0.1/download?dentryId=f7423d00-5ef0-4000-b531-fe5c2efae1a3&size=80',
                originalUrl: 'https://betacs.101.com/v0.1/download?dentryId=f7423d00-5ef0-4000-b531-fe5c2efae1a3'
            }
        ]
        return(
            <div>
                <span onClick={this._onImageClick}>click me</span>
                <ImagePopup ref='imagePopup' data={imageData} />
            </div>
        )
    }
}

render(
    <ImageListElement />,
    document.getElementById('root')
)

开发模式运行

npm start

编译

npm run build

测试及覆盖率

npm run test
npm run cover

组件配置说明

  1. package.json 里要指明 main
  2. webpack/production.config.js 里的输出路径要与 main 匹配
  3. webpack/dev.config.js 配置的入口为示例文件的入口而不是 lib 的入口,要注意区分
  4. webpack/dev.config.js 配置的入口为示例文件的入口而不是 lib 的入口,要注意区分
  5. 注意 webpack 的 output 配置, 加了 librarylibraryTarget