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

@j2only/slide-unlock

v0.5.10

Published

Vue.js slide to unlock component. Protect users from accidental clicks or protect your web app from bot attack.

Downloads

3,277

Readme

@j2only/slide-unlock

npm publish npm npm bundle size (scoped) CodeFactor Grade TypeScript contributions welcome

Vue.js slide to unlock component. Protect users from accidental clicks or protect your web app from bot attack. Written entirely on Vue 3 Composition API with Typescript and Vite. Coated with tests using Cypress. Compatible only with Vue.js 3.x.

You can check a DEMO HERE

Preview

Test coverage

| Statements | Branches | Functions | Lines | | ---------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------ | | Statements | Branches | Functions | Lines |

Installation

Install this component via package manager:

yarn add @j2only/slide-unlock

or

npm install --save @j2only/slide-unlock

https://nodei.co/npm/@j2only/slide-unlock.png?downloads=true&downloadRank=true&stars=true

Usage

Import the component in your app and pass some settings:

<template>
    <slide-unlock
        ref="vueslideunlock"
        :auto-width="true"
        :circle="true"
        :width="400"
        :height="60"
        text="slide to unlock"
        success-text="success"
        name="slideunlock"
        @completed="complete()"
    />
</template>

<script>
import SlideUnlock from "@j2only/slide-unlock"

export default {
    components: {
        SlideUnlock
    }
}
</script>

As you can see, the component accepts some props:

| Prop | Type | Default | Description | | ----------- | ------- | ----------------- | --------------------------------------------------------------------- | | autoWidth | Boolean | true | Auto width for component | | circle | Boolean | true | All parts of component will be with border-radius and rounded handler | | disabled | Boolean | false | Disable interaction with component | | noanimate | Boolean | false | Disable css animations (but not css transitions) | | width | Number | 400 | Width of element (ignored if autoWidth is true) | | height | Number | 60 | Height of element | | position | Number | 0 | Progress percent (to emulate sliding) | | text | String | "slide to unlock" | Text on element | | successText | String | "success" | Text on element when slide is completed | | name | String | "slideunlock" | Unique ID, in case of using several components on one page |

Also, you can customize some styles via CSS Variables:

| Variable | Default | Description | | ------------------------------- | ------- | ------------------------------------------------ | | --su-size-text | 24px | Font size of text on element | | --su-size-padding | 6px | Padding on element from progressbar | | --su-color-bg | #ebebeb | Background color of element. | | --su-color-progress-normal-bg | #cacaca | Color of progressbar | | --su-color-progress-complete-bg | #42b983 | Color of progressbar when slide is completed | | --su-color-text-normal | #4F4F4F | Color of text on element | | --su-color-text-complete | #FEFEFE | Color of text on element when slide is completed | | --su-color-handler-bg | #FFFFFF | Color of handler | | --su-icon-handler | base64 | Icon of handler |

Events

<template>
    <slide-unlock ... @completed="alert('Unlocked!')" />
</template>

Emitted when pass verify, the handler swiped to the right side.

Reset state

If you want to reset the state of a component, you need to assign a ref to the component

<template>
    <slide-unlock ref="vueSlideUnlockRef" />
</template>

And then you need to call the "reset" method

const vueSlideUnlockRef = ref()

const resetComponent = () => {
    vueSlideUnlockRef.value.reset()
}

Completed state

If you want to get the сompleted state of a component, you need to call the "complete" method

const unlockComponent = () => {
    vueSlideUnlockRef.value.complete()
}

Licensing

MIT License