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

@sedeh/tagger

v3.0.0

Published

Have you ever been in need of a tagger that can tag a product or show a product as a favourite or some other purpose without writing much of a code? Tagger will tag items in the order being tagged. But wait. What if your user tag items in different days a

Downloads

9

Readme

Welcome to tagger!

Have you ever been in need of a tagger that can tag a product or show a product as a favourite or some other purpose without writing much of a code? Tagger will tag items in the order being tagged. But wait. What if your user tag items in different days and you care about segregating them by date when displaying them back in a seperate page. No worries, you can set the tagger to remember dates of entry as well!

Live Demo | NPM | Comments/Requests

MODULE:     TaggerModule
DIRECTIVE:  TaggerDirective
INTERFACE:  TagInfo
SERVICE:    TaggerService

DEPENDENCIES: 
	"font-awesome": "^4.7.0", 
	"@sedeh/wizard-storage": "^1.2.5"

Functionalities

Interfaces

interface TagInfo {
    tagDate: Date,
    taggedItem: any
}

Events

| Event |Details | |---------------------|----------------------------------------------------------------------| |taggerChanged |will be triggered once an item is tagged. will send TagInfo of trigger ID, item ID, and the entry date if dateEnabled attribute is set. Otherwise will only send tagger ID as event. |

Attributes

| Name |Details | |---------------------|----------------------------------------------------------------------| |tagIt |Title message to display when hovered on. default is 'tag it'. | |taggedIt |Title message to display when hovered on. default is 'tagged it'. | |taggedClass |Using Font-awesome or any other library, display icon to un-tag item. | |taggableClass |Using Font-awesome or any other library, display icon to tag item. | |taggerSize |Font size of the tag icon that displays the tag/un-tag font. | |sticky |If the tag icon should stick on targeted item or hid/unhide on mouse enter/exit. | |position |Position of tag icon on screen. choice of 'top:left', 'top:center', 'top:right', 'center:left', 'center:center', 'center:right', 'bottom:left', 'bottom:center', 'bottom:right' | |dateEnabled |Will instruct the tagger to keep a reference of tagged items along with tagged date. | |tagger |ID of the list in which tagged items should be added into. | |taggerTag |The information that should be stored in tag list. it can be a user ID, product id, SKU, image URL, video URL, or any other relevant information for the application. If JSON is supplied, it will be stored as string. Avoid using json as tag info to have a better performance on large data sets. |

Service methods

Recommend to only use hasTaggedItem, indexOfTaggedItem, getTaggedItems, and setTaggedItems unless if you are bypassing the tagger directive.

| Name |Details | |---------------------|----------------------------------------------------------------------| |tagItem |Will add the given info in tag list in session storage. | | |1) id: ID of the tag items list | | |2) info: the information to be stored (i.e, product id, url, ...) | |releaseTaggedItem |Will remove the given info out of tag list in session storage. | | |1) id: ID of the tag items list | | |2) info: the information to be stored (i.e, product id, url, ...) | |indexOfTaggedItem |Returns index of item in the list. | | |1) id: ID of the tag items list | | |2) info: the information to be stored (i.e, product id, url, ...) | |hasTaggedItem |Returns true if item is in the list. | | |1) id: ID of the tag items list | | |2) info: the information to be stored (i.e, product id, url, ...) | |getTaggedItems |Returns the list of items. | | |1) id: ID of the tag items list | |setTaggedItems |Sets the list of items in one shot. Good for initialization purpose. To reset the items, pass in an empty list. | | |1) id: ID of the tag items list | | |2) list: the tag items list |

Sample usage

how to use it on any html node?

Use tagger directive on a node
<span 
    tagger="image-box" 
    taggableClass="fa fa-tag" 
    taggedClass="fa fa-minus-square" 
    position="bottom:right" 
    [sticky]="true" 
    [dateEnabled]="true" 
    [taggerTag]="myImageUrl"
	(taggerChanged)="itemTagUpdate($event)">
	<img [src]="myImageUrl" height="100px" />
</span>

how to use it in conjunction with into-pipes?

Use both into and tagger directive.
<span 
    rawContent="https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ForBiggerJoyrides.mp4" 
    into="video:auto:100px:alt text"
    intoName="video 1" intoId="video1" 

    tagger="video-box"
    taggerTag="https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ForBiggerJoyrides.mp4"
    (taggerChanged)="itemTagUpdate($event)">
</span>

Once you receive the taggerChanged notification, use the TaggerService to retrieve the data for the tagger id sent to you as the event to save it in data base of your choice.

itemTagUpdate(event) {
    if (event.taggedItem) { // when tagger dateEnabled is set
        const list = this.taggerService.getTaggedItems(event.tagger);
        // save the list in database here..
    } else {
        const list = this.taggerService.getTaggedItems(event);
        // save the list in database here..
    }
}

Revision History

| Version | Description | |---------|-----------------------------------------------------------------------------------------------| | 3.0.0 | Updated to Angular 15. | | 2.0.0 | Updated to Angular 8. | | 1.0.3 | Removed un-necessary dependency to @angular/http | | 1.0.2 | Fixed an ADA issue. | | 1.0.1 | Added dateEnabled attribute to keep track of tag dates. | | 1.0.0 | Initial Release. |

alt text