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

ts-image-viewer

v0.4.0

Published

browser image viewer with basic painting support

Downloads

13

Readme

ts-image-viewer 🖼️

Features

Getting started

Installation into your project

npm install ts-image-viewer

Running the simplest example

import {AnnotEventDetail, TsImageViewer, ImageLoadInfo } from "./ts-image-viewer";

async function run(): Promise<void> {  
  const viewer = new TsImageViewer({
    containerSelector: "#your-html-container-selector",
    userName: "your_username",
    fileButtons: ["open", "close"],
    annotChangeCallback: (detail: AnnotEventDetail) => console.log(detail.type),
  });

  // open some placeholder images for testing purposes 
  const infos: ImageLoadInfo[] = [];
  for (let i = 0; i < 100; i++) {
    infos.push({
      type: "URL",
      data: `https://via.placeholder.com/4000x3000/aaaaaa/fff.png?text=image${i}`,
      uuid: i + "",
    });
  } 
  viewer.openImagesAsync(infos);
} 

run();

⚠️for viewer to function properly its container element must have relative, absolute or fixed position!

⚠️saving images loaded using cross-origin requests is limited! you can read more on this here: https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_enabled_image#security_and_tainted_canvases

Changing the color scheme

To apply a custom color scheme to the viewer, assign color values to the following CSS variables. Default values are used for omitted variables.

:root {
  --tsimage-color-primary: rgba(77, 88, 115, 1);
  --tsimage-color-primary-tr: rgba(77, 88, 115, 0.9);
  --tsimage-color-secondary: rgb(113, 133, 150);
  --tsimage-color-secondary-tr: rgba(113, 133, 150, 0.9);
  --tsimage-color-accent: rgba(64, 72, 95, 1);
  --tsimage-color-shadow: rgba(0, 0, 0, 0.75);
  --tsimage-color-bg: rgba(128, 128, 128,1);
  --tsimage-color-fg-primary: rgba(255, 255, 255, 1);
  --tsimage-color-fg-secondary:rgba(187, 187, 187, 1);
  --tsimage-color-fg-accent: rgb(255, 204, 0);
  --tsimage-color-text-selection: rgba(104, 104, 128, 0.3);
}

Keyboard shortcuts

TODO list

External dependencies:

  • uuid