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 🙏

© 2025 – Pkg Stats / Ryan Hefner

d2s-ui-react

v1.0.9

Published

React components based on d2s-ui

Readme

d2s-ui-react

React components based on d2s-ui

Table of contents

Preface

For item images to render, the project needs access to a copy of Diablo II's extracted data. Suggest reading through the next two sections, and checking out the working example, prior to integrating with another project.

Data directory

  • Download Ladik's CASC Viewer
  • Choose "open storage" and select D2R's data directory, e.g...
    • C:\Program Files (x86)\Diablo II Resurrected\Data
  • Right click "data" in the navigation pane, then export
  • When we refer to "d2d" below, we're referring to that exported data directory
-d2d
--global
--local

Working example (clone repo)

git clone [email protected]:d2r-app/d2s-ui-react.git
cd d2s-ui-react
cp -r [your-d2d] svr/d2d
cp [your-hero-save-file] hero.d2s
npm i
node svr/api
(open new terminal)
npm start

If you receive the error sh: 1: sass: not found, then install sass... sudo apt install sass

Example Hero

Integration (install via npm)

Installation

Example project structure with existing API:

```
-project
--src
--svr
---api.js
```
npm i d2s-ui-react
tar xzf node_modules/d2s-ui-react/dist/d2s.tar.gz -C svr
echo "/svr/d2s" >> .gitignore
  • Note the the newly created/ignored d2s directory
    • It contains d2s and a modified d2s-ui API

Usage, client-side

import { Hero } from 'd2s-ui-react';
<Hero hero={parsedSaveFile} onClose={optionalCloseFunction}>

Include onClose for a "close hero" button.

You must also include one of the following two Hero attributes for item images to render:

  • api="/api/d2s/img"
    • Web API for responding to d2s-ui image requests
    • See Express App below
  • handleImgReq={yourAPI.d2sAPI.handleImgReq}
    • Local API for responding to d2s-ui image requests
    • See Native App below

Usage, server-side (Express App)

const d2sAPI = require('./d2s/api');
const yourApp = express();
d2sAPI.init({ app: yourApp });

This configures an Express route for /api/d2s/img

Usage, server-side (Native App)

const d2sAPI = require('./d2s/api');
const yourAPI = {...};
d2sAPI.init({ api: yourAPI });

This exposes d2sAPI's image handler as yourAPI.d2sAPI.handleImgReq

Usage, parsing save files

const d2s = require('./d2s');
const hero = await d2s.read(await fs.promises.readFile('hero.d2s'), d2s.constants));

Dev

To update d2s...

Download d2s.bundle.js and constants_99.bundle.js from a d2s release, then combine:

cd ~/Downloads
rm index.js
for f in d2s.bundle.js constants_99.bundle.js; do (cat ${f}; echo) >> index.js; done
echo -e "\nd2s.constants = constants_99.constants;\nmodule.exports = d2s;\n" >> index.js
cp index.js /d2s-ui-react/svr/d2s/

To build d2s-ui-react...

Execute npm run build (creates dist/)