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

vue-selection

v0.0.5

Published

Simple, lightweight and modern library library for making visual DOM Selections.

Readme

Selection

Selection.js is an simple, lightweight, and modern library for making visual DOM Selections.

Quick demo: https://simonwep.github.io/selection

Features

  • Supports touch devices
  • Simple usage
  • No jQuery
  • Nodejs support
  • Lightweight, 3KB gzipped

Install via npm

$ npm install @simonwep/selection-js --save

Or simply include it via script tag:

<script src="selection.min.js"></script>

Usage


const options = {

  // All elemets with the class 'selectable' selectable.
  selectables: ['.selectable']
};
const selection = Selection.create(options);

It's reccommended to also specify a bounding area for the selection (see 'Options').


Options

const selection = new Selection({  

    // Class for the selection-area-element
    // Default: 'selection-area'
    class: 'selection',

    // px, how many pixels the point should move before starting the selection
    // Default: 0
    startThreshold: 10,

    // Disable the selection functionality for touch devices
    // Default: false
    disableTouch: false,

    // Query selectors from elements from which the siblings can be selected
    // Default: Empty array
    containers: [],

    // Query selectors from elements which can be selected
    // Default: Empty array
    selectables: [],

    // Query selectors for elements from where a selection can be start
    // Default: ['html']
    startareas: [],

    // Query selectors for elements which will be used as boundarys for the selection
    // Default: ['html']
    boundarys: [],

    // Element selection stardet             
    onStart(evt) {
        evt.selection;
        evt.eventName;
        evt.areaElement;
        evt.originalEvent;
        evt.selectedElements;
        evt.changedElements;
    },

    // Element selection move
    onMove(evt) {
       // Same properties as onStart
    },

    // Element selection stopped
    onStop(evt) {
       // Same properties as onStart
    },

    // Element selection has stardet
    startFilter(evt) {
        evt.selection; // This selection instance
        evt.eventName; // The event name
        evt.element;   // The element from where the user stardet the selection

        // return false to cancel the selection process
    },

    // Element selection has stardet
    selectionFilter(evt) {
        evt.selection; // This selection instance
        evt.eventName; // The event name
        evt.element;   // The element which is in the current selection

        // return true to keep the element
    },
});

Methods

  • selection.option(name:String) - Returns the option by name.
  • selection.option(name:String, value:Mixed) - Set a new option value.
  • selection.disable() - Disable the functionality to make selections.
  • selection.enable() - Enable the functionality to make selections.

Events

start / stop / move event

  • selection:Selection - Current selection object.
  • eventName:String - The event name.
  • areaElement:HTMLElement - The selection element.
  • originalEvent:Event - The original mouse-event.
  • selectedElements:Array[HTMLElements] - Array with currently selected HTMLElements.
  • changedElements:Object
    • added:Array[HTMLElements] - Elements which are added to selectedElements since the last interaction (mousemove).
    • removed:Array[HTMLElements] - Elements which are removed from selectedElements since last interaction (mousemove).

Filter event

  • selection:Selection - Current selection object.
  • eventName:String - The event name.
  • element:HTMLElement - HTMLElement from which the selection starts.

Static methods

Selection

  • Selection.create(options:Object):Selection - Creates a new instance.

Selection.utils

  • on(el:HTMLElement, event:String, fn:Function) - Attach an event handler function.
  • off(el:HTMLElement, event:String, fn:Function) - Remove an event handler.
  • css(el:HTMLElement):Object - Get all css properties from this element.
  • css(el:HTMLElement, attr:String):Mixed - Get the value from a style property.
  • css(el:HTMLElement, attr:String, val:String) - Set a specific style property.
  • css(el:HTMLElement, attr:Object) - Set multiple style properties.
  • intersects(ela:HTMLElement, elb:HTMLElement):Boolean - Check if an HTMLElement intersects another.
  • selectAll(selector:String|Array):Array - Returns all HTMLElements which were selected by the selector.
  • eventPath(evt:DOMEvent):NodeList - Event.composedPath() ponyfill.