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

on-to-me

v0.0.49

Published

Connect web components together declaratively.

Downloads

39

Readme

on-to-me

on-to-me is a small (~1kb) bare-bones version of p-d.

Like p-et-alia components, one of the goals of on-to-me is to reduce, as much as possible, the gap between "First Meaningful Paint" and "Time to Interactive". on-to-me focuses squarely on that problem, whereas p-et-alia addresses larger issues. on-to-me will, in the future, provide some common functions used by p-et-alia.

Sample syntax:

<button data-test=hello>My button</button>
<on-to-me on=click to=[-text-content] me=1 val=target.dataset.test ></on-to-me>
<div -text-content></div>

Demo

Features supported:

Attributes: on, to, val, me, care-of, from, init-val, mutate-event, parse-val-as, init-event

mutate-event is used in conjunction with a web component like mut-obs, which can raise events when mutations occur.

init-val allows us to pass an initial value from the observed element (e.g. init-val=value for an input element) just before attaching the event handler.

init-event allows us to specify an event which the observed element fires, to (re-)apply the initVal.

Features not supported:

  1. Ability to stop blocking propagation -- always blocks propagation
  2. Using properties instead of attributes to define the orchestration.
  3. Debugging support
  4. Ability to override value from event, filter events.
  5. More

Running Locally

  1. Install node.js, git
  2. git clone https://github.com/bahrus/on-to-me
  3. Open command / terminal, cd to folder git was cloned to in step 2, run npm install
  4. Run npm install
  5. run npm run serve
  6. open http://localhost:3030/demo/dev.html

Bootstrapping

This component was designed to be small and simple, with no dependencies, a kind of "bootup" component that could, if needed, be replaced by a more sophisticated component, like p-d, once the download for p-d is complete. As such, it might be best to inline the minified version directly in index.html (or the equivalent):

<!DOCTYPE html>
<html lang="en">
<head>
    <script type=module>export function getPreviousSib(t){let e=t;for(;e&&e.hasAttribute("on");)e=e.previousElementSibling,null===e&&(e=t.parentElement);return e}export function nudge(t)...</script>
</head>
...
</html>

Bare import specifiers / bundling / import maps

  1. npm install --save on-to-me
  2. import on-to-me/on-to-me.js

CDN

<script type=module src=https://cdn.jsdelivr.net/npm/[email protected]/dist/on-to-me.min.js></script>