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

perfect-arrow

v0.0.2

Published

Perfect, declarative arrows. ⤵

Downloads

3

Readme

Perfect Arrow

A custom element to declaratively define arrows between HTML elements. Steve Ruiz's perfect-arrows powers to arrow layout and Sam Thor's viz-observer to observer the movement and resizing of elements.

[!WARNING]
This library is still in development. 🚧 Use at your own risk. It's also not published to NPM yet.

Usage

  1. Install the NPM package perfect-arrow using a package manager of your choice.

  2. Register the custom element and start using it in HTML

<div id="box1"></div>
<div id="box2"></div>
<perfect-arrow type="box" source="box1" target="box2"></perfect-arrow>

<script type="module">
  import { PerfectArrow } from 'perfect-arrow';

  // Register the `<perfect-arrow>` custom element.
  PerfectArrow.register();
</script>

API

Required attributes/properties

  • source: (String) A CSS selector for the element that is the source of the arrow.
  • target: (String) A CSS selector for the element that is the target of the arrow.

Optional attributes/properties

  • type: (String) The type of layout algorithm to use. 'box' will render the arrow around the border-box of each element. 'point' will render the arrow on the midpoint of each element. tab=readme-ov-file#getboxtoboxarrowx0-y0-w0-h0-x1-y1-w1-h1-options) and getArrow, respectively.
  • bow: (Number) A value representing the natural bow of the arrow. At 0, all lines will be straight.
  • stretch: (Number) The effect that the arrow's length will have, relative to its minStretch and maxStretch, on the bow of the arrow. At 0, the stretch will have no effect.
  • stretch-min: (Number) The length of the arrow where the line should be most stretched. Shorter distances than this will have no additional effect on the bow of the arrow.
  • stretch-max: (Number) The length of the arrow at which the stretch should have no effect.
  • pad-start: (Number) How far the arrow's starting point should be from the provided start point.
  • pad-end: (Number) How far the arrow's ending point should be from the provided end point.
  • flip: (Boolean) Whether to reflect the arrow's bow angle.
  • straights: (Boolean) Whether to use straight lines at 45 degree angles.

Default values

Here are the default values of optional attributes

<perfect-arrow
  type="box"
  bow="0"
  stretch=".25"
  stretch-min="50"
  stretch-max="420"
  pad-start="0"
  pad-end="20"
  straights
></perfect-arrow>

Extensibility

The custom element is easily extensible via class inheritance. You can update the name of the custom element, add new properties/attributes, override the render method, and add new arrow algorithms.