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

@pixorize/pixorize-quetzalcoatl

v1.0.9

Published

Interactive image tool used in the Pixorize website

Downloads

11

Readme

Pixorize Quetzalcoatl

This is the code base of the interactive image tool used in the view page of the Pixorize website.

Inspiration

Quetzalcoatl is considered one of the most important deity in Mesoamerican culture, he's recognized as the god of life, light and wisdom, the same as Interactive images give life to Pixorize.

Instalation

npm install @pixorize/pixorize-quetzalcoatl

or

yarn add @pixorize/pixorize-quetzalcoatl

Usage

import PixorizeQuetzalcoatl from '@pixorize/pixorize-quetzalcoatl';

const data = {};
const imageUrl = 'https://via.placeholder.com/1280x720';
const parentNode = document.querySelector('#parent-node');

const interactiveImageLib = new PixorizeQuetzalcoatl(data, imageUrl, parentNode);

Documentation

Properties

@pixorize/pixorize-quetzalcoatl exposes a JavaScript class which is responsible of drawing the interactive image (canvas element and all its interaction). The class' constructor takes 3 parameters:

data: JSON The interactive image JSON data. There is one and only required property on this JSON which is simply called json, which should contain 2 properties: scale and dots. scale is the default zoom scale of the interactive image, and dots is the collection (array) of dots within the image. data should look like this:

{
  "json": {
    "scale": "1",
    "dots": [
      {
        "x": 725,
        "y": 623.5,
        "text": {
          "ops": [
            {
              "attributes": {
                "bold": true
              },
              "insert": "Component of TPP"
            },
            {
              "attributes": {
                "align": "center",
                "header": 2
              },
              "insert": "\n"
            },
            {
              "insert": "(TPP teepees)"
            },
            {
              "attributes": {
                "align": "center"
              },
              "insert": "\n"
            },
            {
              "insert": "\nThiamine is a component of the cofactor "
            },
            {
              "attributes": {
                "bold": true
              },
              "insert": "TPP"
            },
            {
              "insert": "\n"
            }
          ]
        },
        "type": "DOT"
      }
    ]
  }
}

imageUrl: string The image URL.

parentNode: HTMLElement The parent HTML element/node in which the interactive image will be inserted in. It is important to know that the parent node must have a valid width and height for the interactive image to be loaded. This library uses parent node's offsetWidth and offsetHeight values to display the canvas.

Instance methods

Once the class is instantiated, it exposes two useful methods.

onWindowsResize: void(newWidth: number, newHeight: number) Useful for having a responsive interactive image. This methods dynamically updates the width and height of the image based on the passed parameters. Here is common to pass parent node's new width and height.

destroy: void() Fully destroys the interactive image from the DOM (parent node still remains in the DOM).


License

License: MIT