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

reddev-rebalancing-slider

v0.1.6

Published

Rebalancing Slider is an ordered group of (n) Slider controls where n >= 1.

Readme

REDDEV REBALANCING SLIDERS SPECIFICATION

Rebalancing Slider is an ordered group of (n) Slider controls where n >= 1.

Each Slider has 0 or more Sliders above it and 0 or more Sliders below it, according to its order in the Rebalancing Slider.

Each Slider will always have an integer value between 0 and 100

Invariant: At all times, the total value of all the Sliders in a Rebalancing Slider is 100

When the user adjusts the value of a Slider, the values of the other Sliders in the Rebalancing Slider are adjusted according the the following business rules.

Changes are always made to the Sliders below first (i+1, i+2, ... up to n), and then when no more changes are possible, changes are then made to the Sliders above (i-1, i-2, ... down to 1).

SLIDERS BELOW

If the user decreases Slider(i), each Slider below is increased proportionally to its current value as related to the values of the other Sliders below. If the user increases the Slider, the Sliders below are decreased.

Example: If the Slider is increased by 10, and two sliders below, Slider(i+1) and Slider(i+2) have values of 5 and 10, they are reduced as follows. Slider(i+1) will be reduced by 5/15 = 1/3. 1/3 * 10 = 10/3, or rounded to the nearest integer, 3, so it will have a new value of 5 - 3 = 2. Slider(i+2) will be reduced by 10/15 = 2/3. 2/3 * 10 = 20/3, or rounded, 7, so it will have a new value of 10 - 7 = 3.

The bottom-most slider, Slider(n), can be computed using the invariant that all sliders must sum to 100, thus taking care of any integer rounding off-by-one errors.

Once a Slider below reaches 0 (in the case of the user increasing the Slider) or 100 (in the case of the user decreasing the slider), it is no longer included in the reduction or increase calculation.

Once all Sliders below reach their extreme, only then do then the Sliders above move.

Note that if the user reverses direction as they move Slider(i), the values of all Sliders remain, but the algo starts again with the Sliders below affected first.

SLIDERS ABOVE

Once the Sliders below have reached their extreme, then the Sliders are above adjust.

If the Slider that the user is moving is Slider(i, then Slider(i-1) is adjusted first until it reaches its exteme. Only then Slider(i-2) is adjusted, and this continues until Slider(1).

Note again that if the user reverses direction as they move the slider, the algo starts again with the Sliders below affected first, but the changes thus far to the Sliders above remain.

INSTALLATION & USAGE

Install with npm

    npm i reddev-rebalancing-slider

Add the following lines to your App.js:

import './App.css';
import {ReddevSlider} from 'reddev-rebalancing-slider'
import {useState} from "react";


//configure slider

const sliders = [{
    name: "NGO",
    color: "primary",
    defaultValue: 40,
    min: 10
}, {
    name: "Artist",
    color: "secondary",
    defaultValue: 30,
    min: 2
}, {
    name: "SiteOwner",
    color: "primary",
    defaultValue: 20,
    min: 1
}, {
    name: "Seller",
    color: "secondary",
    defaultValue: 10,
    min: 2
}, ]

function App() {
  //state to share slider value across all sliders
  const [slider, setSlider] = useState(sliders.map(a => a.defaultValue));
    
  return ( 
      <div className = "App" >
          <ReddevSlider sliders= {sliders} slider={slider} />                      
      </div>
  );
}

export default App;