Security News
Supply Chain Attack Detected in Solana's web3.js Library
A supply chain attack has been detected in versions 1.95.6 and 1.95.7 of the popular @solana/web3.js library.
minsky-dom-state-manager
Advanced tools
Manages states of dom elements, …
State isn’t always easy to track, especially when state changes have to run through different steps in specific order while also performing specific tasks like css class management. States can be defined in advance, called when necessary and listened to when activated. It will apply the defined classes and attributes to a dom element during the step change.
Class type: Manager
DomStateManager can both be instantiated and extended as one wishes.
// Init manager to manage states of .overlay
const mgr = new DomStateManager({
el: document.querySelector('.overlay'),
});
// add states
mgr.add('visible', [
{ addClass: 'overlay--prepareForShow' },
{ addClass: 'overlay--show', removeClass: 'overlay--prepareForShow' }
]);
mgr.add('hidden', [
{ addClass: 'overlay--prepareForHide', duration: 100 },
{ addClass: 'overlay--hidden', removeClass: 'overlay--prepareForHide' }
]);
Type: Object
Default: {}
Configuration of the instance that will be created
Type: DOM Element
Default: null
The element that needs to be managed
Type: Object
Default: null
A collection of state definition objects that will define what needs to happen when set. Property names of this object will be used as states, values will be used as step definitions of these states (must be array).
Type: Object
Default: null
Active state definition. Changes when different state is set using set() method. Changing this value directly with a state definition will automatically trigger the manager to go through all the steps.
Type: Object
Default: {}
Object collection of all the defined states that were added through the constructor or by using the add() method
Type: integer
Default: 0
Current step the instance is at during a state change.
Type: Array
Default: []
List of all the classes that can be found in the states.
Type: Boolean
Default: null
Flag that defines if the manager is running through steps of a state.
Type: String
Default: ''
Version of the class definition
Parameters: state [, steps]
Return: self
Adds a state to the state collection. States have an array of steps through which the manager will run when the state is activated.
Parameters: state [, args]
Return: self
Sets the given state and triggers the manager to run through all the steps. Immediate and instant can be passed in args to set the first step immediately or jump to the last step instantly.
Parameters: state
Return: state
Returns the requested state definition.
Parameters: none
Return: self
Applies the next step in the list of steps in the current state without applying anything. Won’t do anything if next step index exceeds the bounds of the step list.
Parameters: [none]
Return: self
Applies the next step in the list of steps in the current state and applies everything and will dispatch events. Won’t do anything if next step index exceeds the bounds of the step list.
Parameters: [none]
Return: self
Clears all the states and destroys the object, leaving the element like it was when constructed.
Parameters: Event
Dispatched when a new state was activated. Event data contains step index, current step and current state.
Parameters: Event
Dispatches when a new step was activated Event data contains step index, current step and current state.
Parameters: Event
Dispatched when a new state was activated. Event data contains step index, current step and current state.
Parameters: Event
Dispatches when a new step was activated Event data contains step index, current step and current state.
FAQs
Manages states of dom elements
We found that minsky-dom-state-manager demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
A supply chain attack has been detected in versions 1.95.6 and 1.95.7 of the popular @solana/web3.js library.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.