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

@avcs/autosuggest

v1.7.5

Published

A JavaScript plugin to implement IDE like autocompletion in input, textarea or contenteditable fields.

Downloads

1,779

Readme

AutoSuggest

A JavaScript plugin to implement IDE like autocompletion in input, textarea or contenteditable fields.

Demo | Documentation

Features

General

  1. Supports input, textarea and contenteditable fields
  2. No external dependencies like jquery or bootstrap
  3. Can add and remove inputs dynamically.

Trigger

  1. Can use any character or any sequence of characters as a trigger.
  2. If no trigger is passed will use space as a trigger.
  3. Trigger character will also be removed when inserting a suggestion except for the above case.

Suggestions

  1. Can supply an array of strings as Suggestions.
  2. Can supply an array of objects as Suggestions to get fine control over the behavior of suggestions.
  3. Can pass HTML inside Suggestion.show if you want to design how the suggestion is shown in the dropdown.
  4. Can pass HTML in Suggestion.insertText if you want to show HTML as is in the contenteditable fields.
  5. Can pass HTML in Suggestion.insertHTML if you want to insert HTML as evaluated DOM elements in contenteditable fields.
  6. Can pass a Function in SuggestionList.values which will receive the keyword and generates Suggestions dynamically.
    • Supports Async allowing you to fetch suggestions over API calls, shows a loader until the callback is executed.
    • By default the plugin matches all suggestions that starts with keyword, if you want more control over matching, like fuzzy search, you can use Function to plug the behavior into the plugin.

Dropdown

  1. Current scroll states are considered when calculating the position of dropdown.
  2. Considers line-height of the trigger character (height in case of input) to determine the position of dropdown.
  3. Can use Up and Down arrows to navigate between multiple suggestions when dropdown is active
  4. Can use Enter or Tab key to insert the current selected Suggestion in the dropdown
  5. Can use Esc key to close the dropdown.
  6. Dropdown will be shown on keydown or mousedown inside the input field, when the value before the current selection ends with "trigger + keyword" (without spaces) and the immediate character after the selection does not belong to a-zA-Z0-9_ (Anything inside the selection will not be considered inside keyword)
  7. In case of contenteditable, if the selection spans over multiple nodes with different styles, the suggestion will be inserted into the first node, hence follows the style of the first node.