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

@any-design/turnstile

v0.2.1

Published

A Cloudflare Turnstile wrapper in Vue 3.

Downloads

15

Readme

@any-design/turnstile

A Cloudflare Turnstile wrapper in Vue 3.

Compatible with form in @any-design/anyui.

Usage

Install

$ npm i @any-design/turnstile

Import

<template>
  <turnstile siteKey="SITE_KEY"></turnstile>
</template>

<script steup lang="ts">
import Turnstile from '@any-design/turnstile';
import '@any-design/turnstile/dist/main.css'; // if you want to use the default placeholder style
</script>

Props

This component takes the following props:

  • siteKey (required, type: String): The site key from your Turnstile project.

  • callbackName (type: String, default: 'onTurnstileLoaded'): The global callback function name when the Turnstile JS SDK is loaded.

  • modelValue (type: String, default: ''): Use v-model to sync the response of the verification.

  • action (type: String): The action when you verify.

  • size (type: String, optional values: 'normal' | 'compact', default: 'normal'): The size of the widget.

  • theme (type: String, optional values: 'light' | 'dark' | 'auto', default: 'auto'): The theme of the widget.

  • appearance (type: String, optional values: 'always' | 'execute' | 'interaction-only', default: 'always'): How the widget is shown.

  • renderOnMount (type: Boolean, default: true): If set to false, the component will not render on mount. Instead, you need to manually call the render method.

  • autoReset (type: Boolean, default: true): If set to true, the widget will automatically reset after the response expired.

  • resetInterval (type: Number, default: 295000): The interval before automatically reset. Only enabled when autoReset is true.

  • placeholder (type: Boolean, default: true): Render a placeholder while the Turnstile is loading.

  • loadingText (type: String, default: ''): The loading text which will be displayed in the placeholder.

  • readyDelay: (type: Number, default: 1000): The ready event (also the actual render timing) will be delayed due to the Turnstile rendering mechanism.

Events

This component will emit the following events:

  • verify: This gets triggered when the verification completes. The failure could be caused by no response or error during verification. The argument will be { result: boolean, response?: string }.

  • expire: This is emitted when the response expired.

  • error: This is emitted when an error occurred during rendering or verifying.

  • ready: This is emitted when the Turnstile SDK is ready and the widget is rendered.

  • unsupported: This is emitted when the Turnstile reported that the browser is not supported.

  • update:modelValue: This is emitted when the modelValue updates. Often used in v-model.

Exposed Methods

The Turnstile component exposes two methods for you to interact with it.

  • render: Call this method to manually render the Turnstile. It's useful when renderOnMount is set to false.

  • reset: Call this method to manually reset the Turnstile, it will also reset the value of the modelValue.

License

MIT