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

evoke.js

v1.2.1

Published

Module for creating and organizing html elements.

Downloads

3

Readme

Evoke · npm version GitHub license

Evoke is a lightweight JavaScript module for dynamic creation of html elements. It uses a virtual DOM which makes designing front-end a breeze.

Installation

  • Use Evoke as a <script> tag from a CDN
  • Add Evoke package npm i evoke.js --only=prod from npm

Usage

import Evoke from 'evoke.js' // import the Evoke module
const root = Evoke.create('section', 'body', 'mainContext', undefined, 'theme-dark', undefined, {style: 'display: flex;'})
const myDiv = Evoke.create('div', root, 'newContext', 'myDivID')
Evoke.create('p', 'myDiv', 'newContext', undefined, ['no-magin', 'p-2', 'col-md-12'], 'Hello  World!')
const independantDiv = Evoke.create()
independantDiv.innerHTML = "Extending my website..."
// Evoke.deleteContext('newContext') // Deletes the "Hello World!"

The regular DOM syntax can still be used on elements that are created with evoke.

List of static methods

  • Evoke.create() creates a new html element.
  • Evoke.update() is work in progress.
  • Evoke.delete(element) deletes the element object.
  • Evoke.createContext() creates a new context.
  • Evoke.deleteContext() deletes the desired context and the elements within it.
  • Evoke.contexts is the getter function to view all contexts.

The create function

Please note that the order of parameters is fixed.

/**
* The Evoke.create() function
* @param {string} elementType          - string that specifies the type of html element to be created
* @param {object or a string} parent   - parent element of the element being created
* @param {string} context              - internal sorting structure
* @param {string} id                   - the ID attribute of the html element
* @param {string or an array} classes  - a singular class or a list of classes of the html element
* @param {string} text                 - the text content of the html element
* @param {object} attributes           - an object of which the key is the attribute name with it's assigned value
* @return {object}                     - returns the html element object
*/
create(elementType = 'div', parent = 'body', context = undefined, id = undefined, classes = undefined, text = undefined, attributes = undefined) {
  ...
}

The undefined value or omitting parameters will revert to Evoke's default settings / parameters.

Understanding Context

Context is the way Evoke sorts the created html elements. Think of it as a connecting tag between a group of elements.
A new context will be created by filling the context parameter when creating a new element. If the parameter is omitted, Evoke will deal with this for you.
A new context can also be created with the Evoke.createContext('contextName') function which takes a string for it's parameter.
To delete all elements within a context use Evoke.deleteContext('contextName')

Contributing

Evoke was originally written by Zaharija and Bunny Eluvade.
Big thanks to all our other contributors who made this possible.
Keeping it simple and lightweight is the number 1 priority. Don't add any unnecessary libraries.

License

This project is licensed under the MIT License.