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 🙏

© 2024 – Pkg Stats / Ryan Hefner

@creenv/slider

v1.0.6

Published

A simple slider, used by @creenv/gui

Downloads

20

Readme

Creenv slider

A simple and fully customizable slider, in native javascript. No need for complexity.

Usage

var Slider = require("@creenv/slider");

var callbackChange = function (val) {
  console.log("value has changed: "+val);
}

var callbackChangeFinished = function (val) {
  console.log("user has finished sliding: "+val);
}

var mySlider = new Slider(0, 100, 0.5, 10, callbackChange, callbackChangeFinished);
document.body.appendChild(mySlider.dom);

Custom the style

The css of the slider will be inserted into the < head > tags, within < style > tags identified by id="creenv-slider-style", right at the beginning. You can overwrite any of these rules to apply you own rules. Only 3 classes are used by @creenv/slider:

| Class | What ? | |---|---| | .creenv-slider-container | The container of the whole slider. Its background-color will be the background color of the slider | | .creenv-slider-progress | The progress bar. Its width will be programatically set to match the value of the slider | | .creenv-slider-cursor | The draggable cursor |

Constructor

Slider(min: number, max: number, step: number, value: number, callbackChange: function, callbackChangeFinished: function, vertical: boolean)

| Parameter | Type | What? | Default value | | --- | --- | --- | --- | | min | number | The left value of the slider | 0 | | max | number | The right value of the slider | 100 | | step | number | Step between each possible value | 0.5 | | value | number | Default value the slider can take | 10 | | callbackChange | function | Callback function called when a change is detected to the value. Set it to undefined if you don't want any action | ()=>{} | | callbackChangeFinished | function | Callback function called when the user is done sliding. Will only be triggered when mouseclick is released. Set it to undefined if you don't want any action | ()=>{} | | vertical | bolean | If set to true, the slider will be vertical. It will need a container which height will be the desired slider's height | false |

Accessible (read/write) class members

| Member | Type | What ? | |---|---|---| | .value | number | Current value of the slider | | .min | number | The left value of the slider | | .max | number | The right value of the slider | | .step | number | The step between each possible value | | .onChange | function | Called when value changes because of user input | | .onChangeFinished | function | Called when value change is finished | | .dom | HTMLElement | The dom element representing the entire slider component | | .x | number | X Offset of the slider, from the left of the window. If vertical is set to true, Y of the slider | | .width | number | Width, in px, of the slider. If vertical is set to true, height of the slider | | .container | HTMLElement | DOM element of the container (=.dom) | | .progress | HTMLElement | DOM element of the progress bar inside the container | | .cursor | HTMLElement | DOM element of the cursor inside the container |