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

@artisfy/inputjs

v1.0.19

Published

Handle reactively updating the DOM

Downloads

25

Readme

DESCRIPTION

This library handles input of data and syncs it with other element's data attributes.

EXAMPLE ORDER OF EVENTS

  1. use switch.js to open an inline edit popover
  2. data is synced from the source element to the popover (inputElementEventListener.js)
  3. input is written and synced with a parent (inputElementEventListener.js)
  4. choices are made and synced with a parent (choiceEventListener.js)
  5. form is submitted and data is synced back to the source element (saveEventListener.js)

FILES AND THEIR RESPONSIBILITIES

  • choiceEventListener.js
    • listens for click event on [data-i-key][data-i-value] elements and sets the value to a data attribute on a parent element
  • createFlatObject.js
    • flattens a nested object/array into an object. duplicate keys are overwritten.
  • fileUploadEventListener.js
    • handles ajax file upload of images to a popover inline edit area
  • inboundDataSyncEventListener.js
    • this is weirdly named. when an inline edit popover is activated, this syncs the data from the source element to the popover's data
  • index.js
    • initializes all the code. runs all the watch functions on page load.
  • inputElementEventListener.js
    • syncs data from a text input to its parent component's data attribute
  • optionsData.js
    • an empty object that can be loaded from any component here. it's loaded into init functions inside index.js
  • onSave.js
    • stores functions passed into onSave() in an array. calls these functions whenever data is synced AND has been flagged as a save-worthy event. also contains a helper function callSaveFunction for manually triggering the save of an element.
  • removeEventListener.js
    • listens for click on a [data-i-remove] element (which will be inside an inline edit popover) and removes the associated source element (i.e. the element that triggered and syncs with the popover)
  • saveEventListener.js
    • listens for a submit event on a [data-i-sync] form (which will be inside an inline edit popover) and syncs the data from this form to the source element (i.e. the element that triggered and syncs with the popover)
  • syncData.js
    • the most important functions in this library. syncDataToElement takes an object of flat data and syncs it to the data attributes of a passed in element. syncDataBetweenElements extracts the data from one element and syncs it to another element.
  • watchHelpers.js
    • callMultipleWatchFunctions allows passing in elements with data-w attributes that can have special functions on them that need to be called every time their data is updated. these functions are also called inside syncDataToElement, which means the watch functions are all triggered whenever data is synced into their corresponding data attribute