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

vue-directive-window

v0.8.0

Published

Vue.js directive that enhance your Modal Window, support drag, resize and maximize.

Downloads

82

Readme

Vue.js directive that enhance your Modal Window, support drag, resize and maximize.

vue-directive-window requires your Node.js version >= 8.

Installation

There are two ways of installation, from CDN and from npm, you can choose which you like.

CDN

<script src="https://unpkg.com/vue-directive-window/dist/vue-directive-window.umd.min.js"></script>

npm

npm install vue-directive-window

Local document

npm start

Hello World

vue-directive-window provides two ways to use:

  • Vue Custom Directive
  • general javascript class library

Vue Custom Directive

<template>
  <div v-window="windowParams">
    <!-- container content -->
  </div>
</template>
<script>
import VueDirectiveWindow from 'vue-directive-window';
Vue.use(VueDirectiveWindow); // When you take the CDN way, you don't need to import anything; you may use `Vue.use(window['vue-directive-window'])` instead.
export default {
  data() {
    return {
      windowParams: {
        movable: false,
        resizable: ['left', 'left-top'],
      },
    };
  },
}
</script>

Javascript Class Library

<div class="demo-window" v-window="windowParams">
  <!-- container content -->
</div>
import { enhanceWindow } from 'vue-directive-window'; // When you take the CDN way, you may use `const enhanceWindow = window['vue-directive-window'].enhanceWindow;` instead.

const windowParams = {
  movable: false
  resizable: ['left', 'left-top']
};

enhanceWindow(document.querySelector('.demo-window'), windowParams);

Browser Compatibility

| IE10 | IE11 | Chrome | | :---: | :---: | :---: | | OK | OK | OK |

Parameters

minWidth

  • Type: Number
  • Default: 100
  • Description: window's minimum width(px)

maxWidth

  • Type: Number
  • Description: window's maximum width(px)

minHeight

  • Type: Number
  • Default: 100
  • Description: window's minimum height(px)

maxHeight

  • Type: Number
  • Description: window's maximum height(px)

movable

  • Type: Boolean/String
  • Default: true
  • Accepted Values:true/false/'horizontal'/'vertical'
  • Description: Is drag feature available; when set movable to 'vertical', users will be only allow to make vertical drag; for the same reason, 'horizontal' means only allow horizontal drag; when set true, both directions are available.

resizable

  • Type: Boolean/Array
  • Default: true
  • Accepted Values: left-top/left-bottom/left/right-top/right-bottom/right/top/bottom
  • Description: is resize feature available; when it is true, it means you could resize the window from every eight directions; when it is an Array value which contain String value, like ['left', 'left-top'] you could resize the window only from targeted directions.

customMoveHandler

  • Type: String/Element
  • Description: custom drag handler. When it is null, you could move the window by dragging every inch of this window. Otherwise, when it is a String value, vue-directive-window will use document.querySelector(customMoveHandler) to get the handler's Element; in that case, you could move the window only by dragging the handler.

customMaximizeHandler

  • Type: String/Element
  • Description: maximize feature's handler. When it is a String value, vue-directive-window will use document.querySelector(customMoveHandler) to get the handler.

maximizeCallback

  • Type: Function
  • Description: window maximizeCallback function; there is one parameter, which means if it is current maximize(Boolean).

moveStartCallback

  • Type: Function
  • Description: triggers when drag&move start.

movingCallback

  • Type: Function
  • Description: triggers multiple times during drag&move going.

moveEndCallback

  • Type: Function
  • Description: triggers when drag&move end.

Author

👤 Array Huang

Give a ⭐️ if this project helped you!

📝 License

Copyright © 2019 Array Huang. This project is MIT licensed.