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

presentation-dom

v3.0.3

Published

The Augmented.js Next - Presentation Dom Module.

Downloads

49

Readme

presentation-core

Augmented.js Presentation Dom Module

API

Table of Contents

$

Augmented jQuery-like selectors usinge native selectors</br/> Will return a nodelist for all selections unless only one is found.

Examples

$("#myElement");
$("section#main header");
  - or start from Element:
$("header", mainSectionEl);

Dom

DOM related functions

getViewportHeight

Gets the height of the browser viewport

Returns number The height of the viewport

getViewportWidth

Gets the width of the browser viewport

Returns number The width of the viewport

setValue

Sets the value of an element Will detect the correct method to do so by element type

Parameters

  • el (string | Node) el Element or string of element selector
  • value string Value to set (or HTML)
  • onlyText boolean Value will set as text only

getValue

Gets the value of an element Will detect the correct method to do so by element type

Parameters

  • el (string | Node) el Element or string of element selector

Returns string Returns the value of the element (or HTML)

selector

Selector function Supports full query selection

Parameters

  • query string Element or string of element selector

Returns Node Returns the element (or first of type)

selectors

Selectors function Supports full query selection

Parameters

  • query string Element or string of element selector

Returns NodeList Returns all the nodes selected

query

Query function Supports full query selection but acts like jQuery

Parameters

  • query string Element or string of element selector
  • el (string | Node) el Element to start from (optional)

Returns (NodeList | Node) Returns all the nodes selected

hide

Hides an element

Parameters

  • el (string | Node) el Element or string of element selector

show

Shows an element

Parameters

  • el (string | Node) el Element or string of element selector
  • display string Value to set for "display" property (optional)

setClass

Sets the class attribute (completely)

Parameters

  • el (string | Node) el Element or string of element selector
  • cls string the class value

addClass

Adds a class attribute

Parameters

  • el (string | Node) el Element or string of element selector
  • cls string the class value

removeClass

Remove a class attribute

Parameters

  • el (string | Node) el Element or string of element selector
  • cls string the class value

replaceClass

Replace a class attribute with a new one

Parameters

  • el (string | Node) el Element or string of element selector
  • oldCls string the old class value
  • newCls string the new class value

containsClass

Returns true if it contains the class

Parameters

  • el (string | Node) Element or string of element selector
  • cls string the class value

Returns boolean Returns true is contains class

toggleClass

Toggle class on element

Parameters

empty

Empty a element container

Parameters

  • el (string | Node) Element or string of element selector

injectTemplate

injectTemplate method - Injects a template element at a mount point

Parameters

  • template string The template selector
  • mount Node The mount point as Document.Element or String

stringToHTML

Convert a template string into HTML DOM nodes

Parameters

  • str String The template string

Returns Node The template HTML

getAttributes

Create an array of the attributes on an element

Parameters

  • attributes NamedNodeMap The attributes on an element

Returns Array The attributes on an element as an array of key/value pairs

createDOMMap

Create a DOM Tree Map for an element

Parameters

  • element Node The element to map
  • isSVG Boolean If true, node is within an SVG

Returns Array A DOM tree map

addAttributes

Add attributes to an element

Parameters

  • elem Node The element
  • atts Array The attributes to add

diffAtts

Diff the attributes on an existing element versus the template

Parameters

  • template Object The new template
  • existing Object The existing DOM node

makeElem

Make an HTML element

Parameters

  • elem Object The element details

Returns Node The HTML element

diff

Diff the existing DOM node versus the template

Parameters

  • templateMap Array A DOM tree map of the template content
  • domMap Array A DOM tree map of the existing DOM node
  • elem Node The element to render content into