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

pojostyle

v1.0.4

Published

Build css style tags through the expressive use of javascript pojos.

Downloads

2

Readme

PojoStyle is a alpha stage tool to help build js pojos that define css classes and then from which build out those css class defintion into a style tag.

-= PojoStyle methods =-

gIts is "get items"

sIt is "set item". Sets a j-css item. A j-css item is javascript pojo whose key (aka identifier) is css selector (selector only or selectory and media query) and its value is an object whose properties are the respective media query, the respective selector, and the respective items styling (pojo notation of a css style defintion) gIt is "get item". Gets a j-css item. gIts is "get items". Gets all the j-css item created in a object scope - typically respective to the style tag which is intended to be built.

bId is "build identifier". Used to generate and returning a identifier for setting a key with sIt(...) or getting a j-css item with jIt(...).

sBs is "set base". Set the current or last used selector base (a resused fragment of the some first part of a selector). gBs is "get base". Set the current or last used selector base (a resused fragment of the some first part of a selector).

gMd is "get media query". Gets the media query property value for designated item or the last item. gSl is "get selector". Gets the selector property value for designated item or the last item. getSty is "get style. Gets the style property value for designated item or the last item.

getKeys. Gets all the item related closure attributes for the module. Typically reflects the attributes set of the last set j-css item. Usefull for resuse in current item. resetAll. Resets all the item related closure attributes for the module to there default values (empty string), and pass in selector base.

addToStyleTag. Add the module closures current object of j-css items to a new or existing style tag. The optional second parameter designates the id of the to-be-created or existing style tag.

// Helpers uCk is "use comment key". Use this function to set the key name of a property of the style object to comment and a uniqueId. The respective value is a comment to show up in the css item in the style tag. uCm is "use comment". Use this function to set the aforementioned comment value: uCf is "use comment from" Use this function to create a standardized "from" comment value. "From" is typically the identifier of the j-css item. It should be placed above all the css properties of that item.

mob is "merge objects". Use this function to merge to javascript pojos into one. The advantage of mob(obj1, obj2) is overriden keys are placed in the order of keys at the point where the overriding occurs not at the point of the overridden key. This is helpful for producing css styles based on the merger of objects and being able to see what was the source of a properties values

border: "solid .1rem #f00"

Here's an example of sIt, bId, uCk, uCm, uCf and mob work together.

const secondaryHeaderTextFrag = {
    [uCk()]: uCf("secondaryHeaderTextFrag"),
    color: "#555",
    fontSize: "1rem",       
}

// Note current selector base is ".ArticleComponent"
sIt(1, '.articleHeader', {
    mob(secondaryHeaderTextFrag, {
        [uCk()]: uCf( bId(1, " .articleHeader") ),
        padding: 1.4rem,
        [uCk()]: uCm("Override color"),
        color: "#777"
    })
})

...which has this result in the style tag:

.ArticleComponent .articleHeader {
    /* FROM: secondaryHeaderTextFrag */
    font-size: 1rem;

    /* FROM: ArticleComponent .articleHeader */
    padding: 1.4rem;
    /* Override color */
    color #777;
}