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-preloaders

v2.0.0

Published

Stable, Flexible and Fully Customizable Vue preloaders library

Downloads

147

Readme

Important!

in 2.0, nuxt module has been removed. The reason is that you don't really need it. Just use it as a vue plugin.

Vue Preloaders

Stable, Flexible and Fully Customizable Vue preloaders library.
Attach your preloader at any time, to any element easily and quickly.

vue-preloaders app use case

Demo

https://vue-preloaders.netlify.com/

vue-preloaders form use case

Capabilities

  • Attach a stunning preloader to any element with one line of code.
  • Super simple usage with the ability to be super advanced and smart.
  • Can contain:
    • Component
    • Asset
    • HTML
    • Text
    • Any of them together
  • Modify props of the injected component.
  • Modify any aspect of any element and their wrappers.
  • Have a list of preset preloaders for easy use.
  • Change options of already-opened preloader.
  • Smart deepMerge between all options:
    • User default options.
    • User default loader options (loader from loaders map).
    • Open() loader options (loader from loaders map).
    • Open() options.
  • Separate preloaders custom styling via custom class name.
  • Customize transition.
  • Close easily with returned callback.

And more!

vue-preloaders showcase

Installation

npm install vue-preloaders --save

Mount

vue-preloaders instance is bound to this and app.

Vue

main.js

import 'vue-preloaders/dist/vue-preloaders.css'
import VuePreloaders from 'vue-preloaders'

Vue.use(VuePreloaders, /*{ options }*/)

Usage

Open

Gets: Object with options from the options list below.
Returns: callback for closing the opened preloader.

If no container was set, it will fallback to the body element.

this.$preloaders.open(/*{ options }*/)
const close = this.$preloaders.open(/*{ options }*/)
setTimeout(close, 1000)

Close

Gets: Object with container key.

If no container was set, the preloader on the body tag will be closed (if it exists).

this.$preloaders.close(/*{ options: { container } }*/)

Options

loaders

Use it only in the library init.
Map of default, preset preloaders.

{
    ...
    loaders: { //Object
        myAwesomeLoader: {
            container: '#app',
            cssStyle: { backgroundColor: 'pink' },
            overlayStyle: { opacity: 1 },
            component: MyAwesomeLoaderComponent
        },
        anotherAwesomeLoader: {
            html: '<div class="my-loader">Loader injected html</div>',
            text: 'This is my loader',
        }
    }
    ...
}

loader

Loader to use from 'loaders' map.

{
    ...
    loader: 'myAwesomeLoader' //String
    ...
}

container

Element to be injected to.

{
    ...
    container: '.class-name' //String(selector) / Element
    ...
}

cssClass

Binds class for preloader's root element.

{
    ...
    cssClass: 'test' //String
    ...
}

cssStyle

Binds style for preloader's root element.

{
    ...
    cssStyle: { dispaly: 'block' } //Object
    ...
}

overlayStyle

Binds style for preloader's overlay element.

{
    ...
    overlayStyle: { backgroundColor: 'pink', opacity: 0.5 } //Object
    ...
}

component

Inject component to preloader.

import MyAwesomeComp from '../components/MyAwesomeComp'
{
    ...
    component: MyAwesomeComp
    ...
}

componentStyle

Binds style for preloader's injected component.

{
    ...
    overlayStyle: { textAlign: 'center' } //Object
    ...
}

componentProps

Binds props for preloader's injected component.

{
    ...
    componentProps: { isCentered: true } //Object
    ...
}

assetWrapperStyle

Binds style for preloader's asset wrapper element.

{
    ...
    assetWrapperStyle: { width: '50px' } //Object
    ...
}

assetSrc

Inject src for preloader's image tag.

{
    ...
    assetSrc: 'https://www.random-image.com' //String
    ...
}

assetStyle

Binds style for preloader's asset element.

{
    ...
    assetStyle: { width: '100%', maxWidth: '30px' } //Object
    ...
}

text

Inject text to preloader.

{
    ...
    text: 'My text' //String
    ...
}

textStyle

Binds style for preloader's text element.

{
    ...
    textStyle: { textAlign: 'center' } //Object
    ...
}

html

Inject HTML to preloader.

{
    ...
    html: '<div class="my-class">Test</div>' //String
    ...
}

htmlStyle

Binds style for preloader's injected HTML element.

{
    ...
    htmlStyle: { backgroundColor: 'orange' } //Object
    ...
}

Transition

Customize the transition of the preloader.
More info: https://vuejs.org/v2/guide/transitions.html

Transition name is: preloaders

/* Default Transition */ 

.preloaders-enter-active, .preloaders-leave-active {
    transition: opacity 150ms;
}
.preloaders-enter, .preloaders-leave-to {
    opacity: 0;
}

Please make sure when you edit the transition classes, that the specificity is higher.
More info: https://developer.mozilla.org/en-US/docs/Web/CSS/Specificity

Have fun! :)