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

@bonosoft/sveltekit-codeentry

v0.0.3

Published

Code Entry component for SvelteKit

Downloads

22

Readme

Code Entry for SvelteKit

With this module, you are able to add Code entry form element to you Sveltekit site.

Install

Use your package manager to install the module:

npm install @bonosoft/sveltekit-codeentry

Adding Code entry to a svelte file in SvelteKit

Now you can start adding code entry components to your pages.

<script lang="ts">
  import CodeEntry from "@bonosoft/sveltekit-codeentry"
</script>

<CodeEntry />

You will now have a 6 digit Time based ontime password element.

The Code Entry can be modefied by adding different parameters.

Use without a Html Form

The codeentry is a list of numeric form input elements. By using the on:code event, triggered by the entry of the last digit, you dont have to include it in a form.

<script lang="ts">
    let result = '';
    function handleClicked({ detail }: CustomEvent<string>) {
        result = detail;
    }
</script>

<CodeEntry on:code={handleClicked} />
<p>Received code by event: "{result}"</p>

Code Entry

Use with a Html Form

If you want to add the code entry with other elements in a form, simply do not handle the on:code event.

<CodeEntry idPrefix="ce1" />

The input digit elements will have name attributes like "ce1-0, ... ce1-6". If you have more code entry instances on your page, you can use the idPrefix to set the prefix for both ID and Name attibutes on all input elements.

Front, back, select and border colors, for use in dark mode

You can override style with CSS, or use the attributes for chaning the colors used to draw the code entry digits.

<CodeEntry idPrefix="ce2" textColor="#060" bgColor="#9F9" borderColor="#696" borderSelectColor="#0F0"/>


<CodeEntry idPrefix="ce3" textColor="#F92" bgColor="#333" borderColor="#666"/>

Code Entry

Digits count, size, border width and radius settings

You can set the number of digits to show. For a low number you might want to increase the size (default font size is 4.5) and to make room for a large number of digits, you might want a small size.

You can also change then border width and border coner radius for the digits.

    <CodeEntry idPrefix="ce4" count="2" fontSize="9.5" borderWidth=10 borderRadius=40 />

    <CodeEntry idPrefix="ce5" count="10" fontSize="2" borderRadius="8"/>

Code Entry

Use as a password by hiding entry digits

If the code is not a onetime code, but a pin code used as password, you will want to change the input type to password so the entered digits are not shown.

<script lang="ts">
    let passwordResult = '';
</script>

<CodeEntry idPrefix="ce6" type="password"  on:code={({ detail }) => passwordResult=detail} />
<p>Received code by event: "{passwordResult}"</p>

Code Entry

Handles copy and paste and quick entering

If the user copy and pastes a code into a CodeEntry digit element, it will automatically distribute the code to following digits.

It will also distribute digits if a user types more than one number into a digit really fast.

If the code distribution fills all the digits, the code event will be send with the complete code. If the pasted code is longer than the number of digits, the last digit will be overwritten multiple times. Normally this will only trigger the event once, but some browsers might trigger the last code twice.