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

@dmstr/vue-shufflejs-plugin

v0.5.0

Published

A "ShuffleJs" plugin for Vue.js

Downloads

33

Readme

vue-shufflejs-plugin

vue2

A Vue.js plugin for Shuffle.js library. Note: This project is still under development!

The plugin use and require the following packages:

Documentation

Installation

The preferred way to install this extension is through yarn or npm.

Either run

yarn add https://git.hrzg.de/dmstr/vue-shufflejs-plugin.git#0.5.0

or via npm

npm install https://git.hrzg.de/dmstr/vue-shufflejs-plugin.git#0.5.0 --save

Usage

The following types are supported:

The following example renders the Shuffle.js plugin with Filter, Search and Sort options. Please check the Shuffle.js documentation for available options supported by the plugin.

Bundler (Webpack, etc.)

import Vue from 'vue'
import VueShuffle from 'vue-shufflejs-plugin'
// You need a specific loader for CSS files like https://github.com/webpack/css-loader
import 'vue-shufflejs-plugin/dist/vue-shufflejs-plugin.css'

Vue.use(VueShuffle)

Bootstrap

Bootstrap is defined as peer dependency in packages.json file. If you working in a project without Bootstrap you must install it manually and add following css files via Import or Link Tag to your project:

  • bootstrap/dist/css/bootstrap.min.css
  • bootstrap/dist/css/bootstrap-theme.min.css
Bootstrap icon font issue (only needed if Bootstrap is bundled in dist source):

Add

yarn add url-loader --dev

or via npm

npm install url-loader --save-dev

Updated module rules section in webpack config and add:

{
  test: /\.(woff2?|eot|ttf|otf|svg)(\?.*)?$/,
  loader: 'url-loader'
}

Browser

<!-- Include after Vue -->
<!-- Local files -->

<!--
Add Bootstrap CSS files if needed, see Bootstrap section above
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap-theme.min.css" integrity="sha384-rHyoN1iRsVXV4nD0JutlnGaslCJuC7uwjduW9SVrLvRYooPp2bWYgmgJQIXwl/Sp" crossorigin="anonymous">
-->

<link rel="stylesheet" href="vue-shufflejs-plugin/dist/vue-shufflejs-plugin.css"></link>
<script src="vue-shufflejs-plugin/dist/vue-shufflejs-plugin.js"></script>

Use component in Vue app

import axios from 'axios'

export default {
  name: 'app',
  data () {
    return {
      settingsApiUrl: 'http://__PROJECT_URL__/api/settings?internalDetailPath=1',
      settings: null,
      products: {
        data: null,
        option: null,
        filter: null
      }
    }
  },
  created () {
    axios.get(this.settingsApiUrl)
      .then((response) => {
        this.settings = response.data

        axios.get(this.settings.baseUrl + this.settings.endpoints.data)
          .then((response) => {
            this.products.data = response.data
          })
          .catch((error) => {
            console.error(error)
          })

        axios.get(this.settings.baseUrl + this.settings.endpoints.option)
          .then((response) => {
            this.products.option = response.data
          })
          .catch((error) => {
            console.error(error)
          })

        axios.get(this.settings.baseUrl + this.settings.endpoints.filter)
          .then((response) => {
            this.products.filter = response.data
          })
          .catch((error) => {
            console.error(error)
          })
      })
      .catch((error) => {
        console.error(error)
      })
  }
}
<vue-shuffle :settings="settings" :products="products"></vue-shuffle>
Settings API response
settings: {
  "baseUrl": "http://__PROJECT_URL__",
  "imageApiPath": "/filefly/api?action=stream&path=",
  "imgBaseUrl": "http://img.workbench.oneba.se",
  "imgHostPrefix": "http://__PROJECT_URL__/img/stream",
  "imgHostSuffix": ",p2",
  "detailPath": false, // or '/de/frontend/products/detail?productId='
  "endpoints": {
    "settings": "/api/settings",
    "data": "/api/product-data",
    "option": "/api/product-option",
    "filter": "/api/product-filter"
  },
  "languages": [
    "de",
    "en"
  ],
  "enabledFilter": true,
  "enabledFilterOptions": false,
  "filterMode": "and", // or "or", is ignored if "enabledFilterOptions" is set to false
  "enabledSearch": true,
  "enabledSort": true
}

Tests

WIP!

Devlopment

WIP!

# serve with hot reload at localhost:8080
yarn run dev

# distribution build with minification
yarn run build

# build the documentation into docs
yarn run docs

# run unit tests
yarn run test

# run unit tests watch
yarn run unit-watch

For detailed explanation on how things work, checkout the guide and docs for vue-loader.

Further Information

Shuffle.js has lots of configuration options, please check the Shuffle.js library website.

Credits

License

The MIT License (MIT). Please see License File for more information.