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 🙏

© 2026 – Pkg Stats / Ryan Hefner

minsky-component

v1.0.1

Published

Dom element wrapper to improve and normalise element management throughout the projects

Readme

Component

Dom element wrapper to improve and normalise element management throughout the projects

A class that follows provides a consistent way of creating components inside the MINSKY framework all while instantly providing access to a state manager and a listener manager. Manager instances will only be created the first time they are requested through their getters. Elements can be swapped at runtime using the setter, the class will automatically remove and re-add the css classes so the new component would match the current state of the instance. States and listeners should automatically be removed on destruction leaving no trace of its existence on the element it managed.

Class type: Component

Dependencies

  • Event Dispatcher 1.0.0
  • DomState manager 1.0.0
  • Plugin Manager 1.0.0
  • String Utils

Getting started

Component will mostly be extended, as intended to ensure clarity inside the codebase.

export default class CustomComponent extends Component {

	// constructor
	constructor (args, objectName = 'Custom Component') {

		// run super constructor
		super(args, objectName);
	}

	// methods
	destroy() {
		// super destroy
		super.destroy();
	}
}

Constructor Parameters

Args

Type: Object Default: {}

Config options that will be used when instance is created

ObjectName

Type: String Default: 'Component'

Object name that will be used as recognisable identifier and as prefix in logs


Interface

Options

el

Type: DomElement Default: null

The element the instance has to manage.

states

Type: Object Default: {}

State definitions in case the element should have some.

Properties

el

Type: DomElement Default: null

The element the instance has to manage. Is a setter that will add/remove classes when the element changes at runtime (should be avoided as every instance should be bound to its element)

states

Type: DomStateManager Default: DomStateManager

Manager instance that handles the states. Is a getter that will create the instance on first call, so no manager will be created if a component doesn’t have any states.

ready

Type: Boolean Default: false

Sets the ready state of the component. It will add/remove a ready class to the dom element using a camelCase version of the Object Name.

plugins

Type: PluginManager Default: PluginManager instance

Manages plugins for the component if any (wip)

… EventDispatcher properties

Methods

Constructor

Parameters: Args:object, objectName:String Return: Self

Creates the class, sets the element and applies the given state definitions if any. Sets ready to true if construction was successful.

refresh

Parameters: none Return: undefined

Empty placeholder function

Destroy

Parameters: none Return: undefined

Destroys the instance and tries to remove all traces of the element it managed.

getCssClass (exported)

Parameters: name:String Return: String

Creates a camelCase version of name provided.

getReadyClass (exported)

Parameters: name:String Return: String

Generates a correct ready css class.

forceDomEl (exported)

Parameters: tpl:String Return: DomElement

Turns tpl-strings into DomElements

… EventDispatcher methods

Events

elementChange

Parameters: Event

When the element property has changed successfully.

readyStateChange

Parameters: Event

When the component’s ready state is set to true.


To Do

  • Move the undocumented convert object to a utils file