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

jamal

v1.2.1

Published

> Notice: I did some updates and documentation is not capable enough to explain all capabilities. Best way to understand is digging around examples which is at the below of this documentation.

Downloads

38

Readme

Notice: I did some updates and documentation is not capable enough to explain all capabilities. Best way to understand is digging around examples which is at the below of this documentation.

JaMaL stands for JML which is javascript markup language. "a"'s are just filling.

Jamal (Arabic: جمال‎ Jamāl/Ǧamāl ) is an Arabic masculine given name, meaning "beauty". The use of this name is widespread across the Muslim world. In Egypt the name is pronounced [ɡæˈmæːl] and so is normally spelled Gamal . Tunisians may spell it Jamel. Source

Table Of Contents


Philosophy

JaMaL is for creating html content with javascript functions. A "J" function takes three arguments which are attributes, children and debug config. Just this. No need to know fancy observers, reducers or something like that.

Why "JaMaL"?

Obviously i'm not arab or arab fan or things like that. I made a library called jml.js which stands for javascript markup language. I wanted to remake of that library and didn't wanted to find a new name. But jml and jml.js already picked on npm so i needed to little changes and thats where JaMaL came from. I just filled gaps with a's. After that i needed a new logo with that middle eastern name so i used Launchaco Logo Maker to make a logo that makes sense with new name.

Logo Credits:
font name: amita-regular
font link: https://fonts.google.com/specimen/Amita
font author: Eduardo Tunni
font author site: http://www.tipo.net.ar/

icon designer: Brittnee Snodgrass
icon designer link: /brittnee.snodgrass

What is it for?

Simply; creating dom nodes with programmatic way. Complex way: There soo many javascript frameworks hanging around and i wanted to make a protest to this community. You don't need a framework for every thing, just use jQuery or write yourself.

Simply; you have an ajax call and this call appends new content to your DOM. Don't write html yourself, just use a jml tag function to render content.

☮ Respects to Vanilla.js 💚💜💝

Whom is it for?

Of course this is not for huge projects. It was just a hobby to me so i hope same for you to.

Basic Usage

I'm don't know how to describe its lifecycle in english. I'm not best at it. But i think it explains itself:

<div id="root"></div>
<script src="./jml.min.js"></script>
<script>
    Jml.initialize({
        customTags: ['theme', 'example', 'akinozgen', 'profile-image', 'user-avatar']
    });

    const jmlInstance = new Jml.create('#root', jDiv({ class: 'container blog-post' }, [
        jArticle({ class: 'article-body' }, [
            jImg({ src: 'http://placehold.it/200x200' }, []),
            jP({ style: 'margin-bottom: 10px' }, ['lorem....']),
            jA({ href: '#', target: '_blank' }, ['Click Me!'])
        ])
    ]));

    jmlInstance.render();
</script>

JMLInstance

JMLInstance returns an object that has five elements. They are:

  • body: dom element that selected by given selector.
  • render: render method renders markup to body
  • clear: truncates body
  • getRef: returns dom element by provided _id. _id is randomly created by jml.
  • markup: created dom content.

jSomething functions

jSomething functions are totally html tags can be used as functions. For example html has article tag, jml has jArticle tag. Also jSomething tags can be created by given custom tags in jmlInstance.initialize method.

jSomething methods also has config options. Currently it has just two options, debug and inspect. Debug option gives information about jSomething function runtime, inspect options puts debugger in that jSomething method.

Accessing refs

Your jmlInstance object has property called getRef. Which is a function, takes string for _id attribute. This method returns a reference from actual dom tree so you can easily inspect your actual dom.

Usage:

    jmlInstance.getRef('_c0dq6bv4v');
    // output
    // <th _id="_c0dq6bv4v">Username</th>

Nesting

Everything is jSomething method, a jSomething method takes an argument which can be another jSomething method. So you need to understand nesting carefuly. Also all jSomething methods returns an HTMLElement object

There is some complex example:

Nesting Example

And thats actual render:

Rendered table

jSomething functions overloads (ex. jTable)

jTable(): HTMLElement;
jTable(children: string|HTMLElement): HTMLElement;
jTable(children: Array<string|HTMLElement>): HTMLElement;
jTable(attributes: Object<string, string|number|function>, children: string|HTMLElement): HTMLElement;
jTable(attributes: Object<string, string|number|function>, children: Array<string|HTMLElement>): HTMLElement;

Callbacks

A jSomething functions second args (which is an array) can be mapped with .map, .filter or functions like that. One obligation: it must be an array after all.

Get Started

Clone project to you local machine. Install dependencies with npm install or yarn command.

CDN

<script src="https://unpkg.com/jamal@latest/build/src.min.js"></script>

NPM Package

JaMaL on NPM

$ npm install jamal

Development

Run yarn watch command and open http://localhost:8080 from your browser and get started. No not modify src/index.js unless you know what you're doing. src/index.js file is main jml library file. If you want to use jml (not developing it) import another script or write it inside html file.

Examples

| Bootstrap 4 Boilerplate | Promise API Call | Components Example | Character Counter | |--------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------| | Edit Bootstrap 4 Boilerplate | Edit y7qj526o21 | Edit example-components | Edit Character Counter |


| 1.2.0 Updates | |---------------------------------------------------------------| | See On Codepen |

To-Do

  • [x] onEvents for jSomething methods.
  • [x] NPM package update.
  • [x] Remove customTag necessity.
  • [x] More flexible parameter passing for jSomething functions.
  • [x] Promise based async children ~~and parameters~~ support.
  • [ ] Two way binding for children.
  • [ ] HTML to JML tool.