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

@4tw/vue-drop-zone

v3.1.0

Published

A vue component for drag'n'drop upload using uppy.io

Downloads

75

Readme

vue-drop-zone

A vue component for drag'n'drop upload using uppy.io.

Installation

yarn add @4tw/vue-drop-zone

Usage

Wrap the component you want to be droppable with the DropZone component. Use the v-model binding to display a list of all the files. The files list also includes the progess and other metadata.

<DropZone>
  <div
      id="this-is-droppable"
      v-model="files"></div>
</DropZone>
<ul>
  <li v-for="file in files">
    {{ file.name }}
  </li>
</ul>
import DropZone from '@4tw/vue-drop-zone'

{
  name: 'MyDropZone',
  data() {
    return { files: [] };
  },
  components: { DropZone }
}

Properties

  • endpoint[String:document.URL]: Describes the endpoint where the dropzone should upload the files to
  • uploader[Object:{ uploader:Class, options:Object }]: Describes the uploader to be used. Uppy already provides two uploaders for XHR: https://uppy.io/docs/xhr-upload/#Options or TUS: https://uppy.io/docs/tus/#Options.
  • options[Object:{}]:
    • uppy[Object:{}] for the uppy client options (https://uppy.io/docs/uppy/#Options),
    • preventUpload[Boolean:false] when set to true, the upload is not triggered automatically when dropping a file
  • v-model[Array:[]]: Use the v-model to have a list of uppy files in the current state (https://uppy.io/docs/uppy/#uppy-getFile-fileID)
  • file-browser[Boolean:false]: Define if the dropzone should also be clickable to allow the user to select the files using the native file browser.
  • multiple[Boolean:true]: Define if multiple files can be uploaded.

Uppy Client

The client sits on every drop-zone instance and can be retrieved using a ref:

<DropZone ref="dropzone" />
this.$refs.dropzone.client.uppy.pauseAll();
this.$refs.dropzone.client.uppy.retryAll();

See https://uppy.io/docs/uppy/#Methods for all the available methods. It is not recommended to mess with the plugins. Also try to avoid using close and reset. The state of the client is managed by the client itself.

Events

  • client-initialized: Triggers when the drop-zone client has been initialized. Use this event to customize the client.
  • entered: Triggers when the mouse pointer enters the dropping area
  • left: Triggers when the mouse poiter has left the dropping area
  • dropped: Triggers when the files are dropped
  • success: Triggers when the upload successfully finished
  • error(File file): Triggers when the upload fails. Also provides the file
  • upload(File[] files): Triggers when preventUpload is set to true and the upload would start. Also provides the files being uploaded that failed the first as an event argument.

Development

yarn install

Compiles and hot-reloads for development

yarn run serve

Compiles and minifies for production

yarn run build

Lints and fixes files

yarn run lint

Run your unit tests

yarn run test:unit

Release

yarn run release