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

react-image-annotate-mngo

v0.8.72

Published

This library is available at [react-image-annotate-mngo](https://www.npmjs.com/package/react-image-annotate-mngo)

Downloads

65

Readme

react-image-annotate-mngo

This library is available at react-image-annotate-mngo

Demo

annotate.mngo.in

Brief:

A JavaScript React Library (npm package ) which provides an area over an image to annotation/markup/write. One can easily annotate over image in react.js by installing react-image-annotate-mngo package

Screenshots:

Usage

<MNgoImageAnnotate
    isViewMode={boolean}
    isDarkMode={boolean}

    compIdx={number}
    compMaxHeight={string}
    compMaxWidth={number}
    
    image={string | Image}
    imgWidth={number}
    loc={number[]}
    
    loadingRenderer={string | ReactElement}
    errorRenderer={string | ReactElement}

    textInputField={(textInputVal: string, setTextInputVal: Dispatch<SetStateAction<string>>) => ReactElement}
    shapes={{ [key: string]: any }}
    annotations={any[]}
    onChange={(data: { [key: string]: any }) => void}
/>

props example

  1. isViewMode to load component in view (non-editable mode)

  2. isDarkMode to enable dark mode?, default value is false

  3. compIdx unique index of the component when using MNgoImageAnnotate multiple time in view/screen/oage

  4. compMaxHeight max height allowed to component (max height component can go to)

  5. compMaxWidth max width allowed to component (max width component can go to)

  6. image image of type JS Image object or image url/link, e.g. https://tinypng.com/images/social/website.jpg

  7. imgWidth width of the image, default value is 900

  8. loc loc represents co-ordinates of visible portion of the image, i.e. [x1, y1, x2, y2]

  9. loadingRenderer ReactElement or string to display while image is loading/downloading, default value is "loading"

  10. errorRenderer ReactElement or string to display when image could not be loaded, default value is "something went wrong"

  11. textInputField a function to render Text Tool Input Field, e.g.

       function (textInputVal, setTextInputVal) => {
           return (
               <textarea
                   autoFocus
                   className="sa-h-[50px] sa-w-[95%] sa-resize-none sa-border-[lightgrey] sa-shadow-md sa-rounded-md"
                   value={textInputVal}
                   onChange={(e) => setTextInputVal(e.target.value)}
               />
           )
       }
  12. shapes shape button in tool bar

        {
            <shape type | title>: { btnIcon: <string | Image>, img: <string | Image> },
        }
    
    
    e.g.
    
    
        {
            tick: { btnIcon: tickShape, img: tickShape },
            cross: { btnIcon: crossShape, img: crossShape },
        }
  13. annotations array of annotations present on the image

        [
            {
                "type": <shape type or title>,
                "pos": { "x": number, "y": number },
                "size": { "height": number, "width": number },
            },
            {
                "type": "pencil,
                "pts": [number, number][],
            },
            {
                "type": "pencil,
                "pos": { "x": number, "y": number },
                "size": { "height": number, "width": number },
                "html": string,
            }
        ]
    
    
    e.g.
    
    
        [
            {
                "type": "cross",
                "pos": { "x": 757, "y": 224 },
                "size": { "height": 50, "width": 50 },
            },
            {
                "type": "pencil",
                "pts":[ [878,96],[878,98],[878,102],[878,122],[878,168],[874,224],[872,281],[872,331],[872,363] ],
            },
            {
                "type": "pencil",
                "pos": { "x": 408, "y": 115 },
                "size": { "height": 62 , "width": 126},
                "html": "hello world",
            }
        ]
  14. onChange callback function run when any change is done on annotations

    onChange (annotationData: object) => void
    
    `annotationData` is { imgWidth: number, annotations: annotations[]}

Installation

  1. npm install
  2. npm start

Available Scripts

In the project directory, you can run

npm start

Runs the app in the development mode Open http://localhost:5173 to view it in the browser.

npm run lib-build

it is for final package build which create dist folder.

npm publish

to publish the project on npm

Note: do npm run lib-build before npm publish because it publishes dist folder as defined as key main, module, files in package.json, and do not forget to login in npm using npm login

npm run build-publish

this command make build of the project and publishes it, basically it is combination of npm run babel-build and npm publish

License

All rights reserved under MNgo.