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-wild-swipe

v0.9.4

Published

> :trophy: All credits go to Ana Tudor for her post on [CSS Tricks](https://css-tricks.com/): [Simple Swipe with Vanilla JavaScript](https://css-tricks.com/simple-swipe-with-vanilla-javascript/)

Downloads

17

Readme

Vue Simple Swipe

:trophy: All credits go to Ana Tudor for her post on CSS Tricks: Simple Swipe with Vanilla JavaScript

This is a simple swipe component for Vue.js. Online demo here.

What's here

Caveats

As I'm rather new to Vue, and don't know (yet) how to package icons along with the JS component, you need to add a CSS file and a fonts folder to your project.

You can find them in the src/styles folder of this repo, or from the example's repo.

Just import the icons.css file from your main component, as shown here

Install

npm install vue-wild-swipe

Example

<script>
import Vue from "vue";
import VueWildSwipe from "vue-wild-swipe";

const imageSets = [
  [
    "https://images.unsplash.com/photo-1611514615258-c1d33efb091c?ixid=MXwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHw%3D&ixlib=rb-1.2.1&auto=format&fit=crop&w=800&q=80",
    "https://images.unsplash.com/photo-1611456645963-149eaae07d47?ixid=MXwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHw%3D&ixlib=rb-1.2.1&auto=format&fit=crop&w=1350&q=80",
    "https://images.unsplash.com/photo-1611433634706-39c25bb5b39f?ixid=MXwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHw%3D&ixlib=rb-1.2.1&auto=format&fit=crop&w=634&q=80",
  ],
  [
    "https://images.unsplash.com/photo-1611513418382-7dd6487cc28f?ixid=MXwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHw%3D&ixlib=rb-1.2.1&auto=format&fit=crop&w=658&q=80",
    "https://images.unsplash.com/photo-1611513160864-03606aae8f8d?ixid=MXwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHw%3D&ixlib=rb-1.2.1&auto=format&fit=crop&w=1350&q=80",
    "https://images.unsplash.com/photo-1611477408172-216f82fdda49?ixid=MXwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHw%3D&ixlib=rb-1.2.1&auto=format&fit=crop&w=1352&q=80",
    "https://images.unsplash.com/photo-1611443558105-3031b7fa945d?ixid=MXwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHw%3D&ixlib=rb-1.2.1&auto=format&fit=crop&w=675&q=80",
  ],
];

export default Vue.extend({
  name: "ServeDev",
  components: {
    VueWildSwipe,
  },
  data: function () {
    return {
      images: imageSets[0],
      setIndex: 0,
      showSwiper: true,
    };
  },
  methods: {
    changeImages() {
      this.setIndex = (this.setIndex + 1) % 2;
      this.images = imageSets[this.setIndex];
    },
    toggleSwiper() {
      this.showSwiper = !this.showSwiper;
    },
  },
});
</script>

<template>
  <div id="app">
    <vue-wild-swipe v-if="showSwiper" :images="images" />

    <div class="controls">
      <button type="button" @click="changeImages">Change images</button>
      <button type="button" @click="toggleSwiper">Toggle swiper</button>
    </div>
  </div>
</template>

<style>
body {
  margin: 0;
}

.controls {
  text-align: center;
}
</style>

Props

The component accepts the following props:

  • images: an array of image URLs (required)
  • arrows: a boolean indicating whether to show the previous & next arrows (optional, default true)
  • bullets: a boolean indicating whether to show bullets beneath the images (optional, default true)
  • keys: a boolean indicating if left & right directions should show the previous & next image (optional, default true)

Changelog

  • 0.9.1 First working version
  • 0.9.2 Add example to readme
  • 0.9.3 Add arrows, bullets, key controls
  • 0.9.4 Improve readme (document props, caveats, reference online demo)