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

fuzzy-area

v1.2.3

Published

simple plain js textarea fuzzy autocomplete with option to defne prefix

Downloads

21

Readme

Custom multiple autocomplete

Updated to get extra features:

  1. Autocomplete prefix
  2. To trigger autocomplete apply with Enter or Tab
  3. Fuzzy search

Change triggers

Update prefixes.js

export const prefixes = [" ", "sm:", "md:"];

Change autocomplete aka suggestions

export const suggestions = [
    "white",
    "yellow",
    "blue",
    "red",
    "green",
    "black",
    "brown",
    "azure",
    "ivory",
    "teal",
];

Basic markup

<div class="container" id="fuzzyarea">
    <textarea class="container__textarea"></textarea>
</div>
// index.js

import { initializeFuzzyArea } from 'fuzzy-area';

// Initialize with default ID (#fuzzyarea)
initializeFuzzyArea();

// Initialize options
initializeFuzzyArea({ 
    containerId: 'myCustomContainerId', // Custom container id
    maxSuggestions: 20,                 // Number of maximum suggestions
    resize: true,                       // Resize height of text area as text grow
    prefixMention: ["@", "#", ":"],     // Trigger prefix suggestions
});

Props

| Property | Type | Default | Description | |------------------|----------|--------------|--------------------------------------------------------------------------------------------------| | containerId | string | 'fuzzyarea' | ID of the container in which textarea exists, which is to be made autocomplete. | | textareaId | string | null | ID of the textarea, which is to be made autocomplete. If not provided then uses textarea in container. | | waitForElement | boolean | false | Should it wait for the element to exist in the DOM, useful for dynamically added textareas. | | maxSuggestions | number | Default is 10 | Change number of maximum suggestions. | | resize | boolean | Default false | Resize heght of text area as you type | | prefixMention | array | Default is @ | add away of cherasters to use to get suggestions for prefixes |

Preview

Suggestions

Suggestions after prefix

Prefix autocomplete

Credits:

This is modified solution from phuoc.ng

Changelog

1.2.3

  • Package JSON fix

1.2.2

  • Updated readme and example

1.2.0

  • change prefix autocomplete trigger

1.1.1

  • Fixed readme file

1.1.0

  • Fixed removing extra space when adding prefix
  • Allow suggestion after prefix without extra space in between

1.0.17

  • Added height resize

1.0.16

  • Added autocomplete for prefix on "@"
  • Removed autocomplete on right arrrow →

1.0.15

  • Fixed keeping prefix after update suggestion

1.0.14

  • Fixed suggestion replacment. It was deleting word only up till where the cursor is

1.0.13

  • Updated readme

1.0.12

  • Add option to change number max of suggestions

1.0.11

  • added option to pass custom textarea id

1.0.10 - 1.0.6

  • Refactor

1.0.5

  • moved suggestions and prefix to the new files

1.0.4 - 1.0.3

  • Refactor

1.0.2

  • Clean up

1.0.1

  • update to read global variables if declared

1.0.1

  • release