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

exoteric

v2.7.7

Published

exoteric. Code components without opinions.

Downloads

5

Readme

🌿 exoteric npm npm downloads total

The tool of choice for the madding crowd

Tooling shouldn't be hard to understand.

Make components from cross-browser web standards without thinking too hard.

exoteric is a library to help.

Stats:

  • Built and gzipped: 17K

Why?

exoteric

/ˌɛksə(ʊ)ˈtɛrɪk/

adjective FORMAL

intended for or likely to be understood by the general public.

Kernighan's Law

Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.

(Brian Kernighan)

Kernighan's Law is named for Brian Kernighan and derived from a quote from Kernighan and Plauger's book The Elements of Programming Style:

Everyone knows that debugging is twice as hard as writing a program in the first place. So if you're as clever as you can be when you write it, how will you ever debug it?

While hyperbolic, Kernighan's Law makes the argument that simple code is to be preferred over complex code, because debugging any issues that arise in complex code may be costly or even infeasible.

So, what's this?

No JSX, no Shadow DOM, no fancy framworks, no opinions.

  • Just HTML, CSS and JavaScript—No JSX, no Shadow DOM, no fancy frameworks, no opinions.
  • Stop learning, stagnate!—Use the syntax you already know. Stop learning new things. Do more with what's already here.
  • Crazy and fun, but in a serious way—exoteric is the tool for people who don't want to think too hard to make UI.

To learn more...oh wait, you already know enough.

be exoteric

function Spin(n) {
  return e`  
    <div 
      wheel:passive=${spin}
      touchmove:passive=${move}
    >
      <h1>
        <progress 
          max=1000
          value=${n}
        ></progress>
        <hr>
        <input 
          input=${step}
          type=number 
          value=${n}>
    </div>
  `;
}

Still not bored?

You soon will be. Nothing notable here: Play with the full example on CodePen

See even more boring code in a 250 line TodoMVC test

Holy secular install mantras

Install exoteric with npm:

npm i --save exoteric

Parcel or Webpack exoteric and import:

import { e } from 'exoteric'

See a CodeSandbox how-to of above

Or import in a module:

<script type=module>
  import { e } from 'https://unpkg.com/exoteric'
</script>

See a CodePen how-to of above


Basic Examples

Components

Defining

const Title = state => e`<h1>${state}</h1>`

Nesting

const Parent = state => e`<main>${Title(state)}</main>`;

Inserting

Parent("Hello").to('body', 'beforeEnd');

Updating

Parent("Greetings");
let i = 1;
setTimeout(() => Parent(`${i++} 'Hi's`), 3000);

ToDo ~MVC~ Example

function App(state) {
  const {list} = state;
  return e`
    <header class=header>
      <h1>todos</h1>
      <input autofocus
        class=new-todo 
        placeholder="What needs to be done?"
        keydown=${newTodoIfEnter} 
      >
    </header>
    <main>
      ${TodoList(list)}
      ${Footer()}
    </main>
  `;
}

function TodoList(list) {
  return e`
    <ul class=todo-list>
      ${list.map(Todo)}
    </ul>
  `;
}

Updating on events

  function newTodoIfEnter(keyEvent) {
    if ( keyEvent.key !== 'Enter' ) return;
    
    State.todos.push(makeTodo(keyEvent.target.value));
    TodoList(State.todos);
    keyEvent.target.value = '';
  }

Properties

Do not exist.

Global State

is nothing special.

Routing

function changeHash(e) {
  e.preventDefault();
  history.replaceState(null,null,e.target.href);
  routeHash();
}

function routeHash() {
  switch(location.hash) {
    case "#/active":                listActive(); break;
    case "#/completed":             listCompleted(); break;
    case "#/":          default:    listAll(); break;
  }
}

function Routes() {
  return e`
    <ul class=filters>
      <li>
        <a href=#/ click=${changeHash}
          class=${location.hash == "#/" ? 'selected' : ''}>All</a>
      </li>
      <li>
        <a href=#/active click=${changeHash}
          class=${location.hash == "#/active" ? 'selected' : ''}>Active</a>
      </li>
      <li>
        <a href=#/completed click=${changeHash}
          class=${location.hash == "#/completed" ? 'selected' : ''}>Completed</a>
      </li>
    </ul>
  `
}

Most of the examples above are taken from in a 250 line TodoMVC test, the full code of which you can see here..

Can you hear the people sing