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 🙏

© 2025 – Pkg Stats / Ryan Hefner

passepartout

v0.0.12

Published

Web Application Microframework

Downloads

8

Readme

passepartout

A Web Application Microframework with a size of only 11kb, with a React like architecture and default support for Promises. It has a centralized Model and doesn’t require a compile step for JSX.

All you need to know...

Bundler

Install it ...

npm i passepartout

then import it ...

import passepartout from 'passepartout';
// or common.js
const passepartout = require('passepartout');

Browser

Add CDN ...

<script src="https://unpkg.com/[email protected]"></script>

... and use it directly in the browser

View

Works like JSX but with the standard Javascript arrays and objects

const view = [
  [{ _: 'h1' }, 'This is a h1 heading text'],
  [{ _: 'a', href: 'https://passepartout.js.org' }, 'this is a link']
];

passepartout({ view });

Node

You can define the node on which the view gets added.

const node = document.getElementById('app');

passepartout({ view, node });

or just use a query

passepartout({ view, node: '#app' });

if nothing is specified the node defaults to document.body

Elements

| Simple Elements | Output | | :-------------------------- | :----------------------------- | | [] | <div></div> | | ['text'] | <div>text</div> | | ['text', 'text 2'] | <div>texttext2</div> | | [{id: 'content'}, 'text'] | <div id="content">text</div> | | [{_: 'h1'}, 'text'] | <h1>text</h1> | | [{_: '!'}, 'text'] | <!--text--> |

Styles

[
  { _: 'h1', style: { fontSize: '30px', color: 'red' } },
  'This is A styled heading'
];

Output

<h1 style="font-size: 30px">This is A styled heading</h1>

Nesting

Elements can be nested:

[
  { id: 'content' },
  [{ _: 'h1' }, 'this is a heading'],
  [{ _: 'a' }, 'this is a link']
];

Output

<div id="content">
  <h1>this is a heading</h1>
  <a>this is a link</a>
</div>

Promises

Promises work to

[
  { id: 'content' },
  fetch('https://example.com').then(response => response.text())
];

As the Promise resolves the view gets updated

Model

You can pass in a model

const model = { title: 'this title is defined in the model' };

passepartout({ model, view });

the model is now accessable via a function

const view = [
  ({ model }) => [{ _: 'h1' }, model.title],
  [{ _: 'a', href: 'https://passepartout.js.org' }, 'this is a link']
];

Output

<div>
  <h1>this title is defined in the model</h1>
  <a href="https://passepartout.js.org">this is a link</a>
</div>

Controller

If you want to make your site reactive you need a controller, which updates your model.

const model = { counter: 0 };

const controller = {
  countUp: ({ model }) => ({ counter: model.counter + 1 })
};

passepartout({ model, view, controller });

Then you can access the controller too through the model, now you can assign it for example to an onclick event

const view = [
  ({ model, controller }) => [
    { _: 'button', onclick: controller.countUp() },
    'clicked ',
    model.counter,
    ' times'
  ]
];

Output

<div><button>clicked 0 times</button></div>

...

<div><button>clicked n times</button></div>

The arguments and the event are accessable too on controller side:

const controller = {
  countUp: ({ model, args, event }) => ({ counter: model.counter + 1 })
};

Event & Arguments

args is an array of all arguments passed to the controller function

event is the dispatched event for example the click event

The return of the function in this example ({ counter: model.counter + 1 }) gets deepmerged to the current model, and the view gets automaticly updated.