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

vue-dragdrop-directive

v1.0.1

Published

## Installation

Downloads

6

Readme

vue-dragdrop-directive

Installation

# will publish after 2018-08-15 15:00
npm install vue-dragdrop-directive

register in .js file:

import vueDragDrop from "vue-dragdrop-directive";

Vue.use(vueDragDrop);

Typical use

Movement

<!--
	v-drag-drop run in delegate mode by default.
	all of elements which has draggable="true" can be fire drag event under the v-drag-drop.
-->
<template>
	<div v-drag-drop class="container">
        <div draggable="true" class="draggable"></div>
    </div>
</template>

<style>
    .container {
        width: 800px; 
        height: 800px;
    }
    
    .draggable {
        /* v-dragdrop is a basic lib, you must write absolute your self*/ 
        position: absolute; 
        width: 100px; 
        height: 100px; 
        background-color: dodgerblue;
    }
</style>

Resize

<template>
	<div v-drag-drop="{handler:resizeHandler}" class="container">
        <div class="resizable">
            <!-- in this case draggable attribute set to a resize handler. -->
            <div draggable="true" class="resizer"></div>
    	</div>
    </div>
</template>

<script>
    export default {
        /**
         *	key point, v-drag-drop can set a props named "handler",
         * 	in this case handler is a function, when it is a function, it will be called on drag
         * 	
         *	@param el the dom element which on drag.
         *	@param container the dom element which mouse over in the container.
         *	@param distX the horizontal distance of mouse movement.
         *	@param distY the vertical distance of mouse movement.
         *	@param e the dom event object of "ondragover"
         */
        resizeHandler(el, container, distX, distY, e) {
            const style = el.parentNode.style;
            style.width = parseInt(style.width) + distX + "px";
            style.height = parseInt(style.height) + distY + "px";
            
            // you also can change scroll position like following code:
            // const parent = el.parentNode;
            // parent.scrollTo(parent.scrollLeft - distX, parent.scrollTop - distY);
        }
    }
</script>

<style>
    .container {
        width: 800px; 
        height: 800px;
    }
    
    .resizable {
        /* v-dragdrop is a basic lib, you must write absolute your self*/ 
        position: absolute; 
        width: 100px; 
        height: 100px; 
        background-color: dodgerblue;
    }
    
    .resizer {
        cursor: se-resize; 
        width: 11px; 
        height: 11px; 
        position: absolute; 
        background-color: yellow; 
        font-size: 0.1px; 
        display: block; 
        z-index: 90;
        right: 0;
        bottom: 0;
    }
</style>

Props

v-dragdrop support the following props:

  • allowOver (default is true)

    when it is false, the dom can not be listen ondragover event on the dom.

  • handler (default is undefined)

    handler is an extensibility, it can be write in three forms:

    • Function

      when it is a function, it will be called on drag.

    • Object

      coming soon.

      when it is a object, it will be contains two functions like following, requires at least one .

      {
          onDrag(currentDragElement, container, distX, distY, e) {
      		// call on drag.
          },
          onDrop(currentDragElement, e) {
               // call on drop.
          }
      }
    • Array

      when it is a array, the element must be a object which contains three functions like following:

      {
          match(currentDragElement) {
              // is required in array mode.
              // decide if onDrag/onDrop can be called for this element(currentDragElement)
          },
          onDrag(currentDragElement, container, distX, distY, e) {
      		// call on drag.
          },
          onDrop(currentDragElement, e) {
               // call on drop.
          }
      }