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

ng-rough-notation

v1.2.4

Published

Angular directive wrapper for rough-notation

Downloads

33

Readme

ng-rough-notation

Licence NPM Tree Shaking Last commit

〽️ A simple and configurable directive to annotate elements.

Banner

This is an Angular 13 wrapper for rough-notation.

  • 😌 Easy to use
  • 🪶 Lightweight
  • 🎨 Customizable : colors, duration, delay, padding...
  • ⚙️ Convenient : local & global config

Demo

Demo page

StackBlitz sandbox

Installation

npm install ng-rough-notation

Add RoughNotationModule to your module imports :

import { RoughNotationModule } from 'ng-rough-notation';

@NgModule({
    ...
    imports: [RoughNotationModule],
})
export class AppModule {}

Usage

Use the roughNotation directive on any element :

<span roughNotation>Some content</span>

By default, highlight will be used.

Config object

You can provide a configuration object to the directive.

<span [roughNotation]="{ type: 'highlight', color: '#F44336' }"></span>

The config object should represent a partial RoughAnnotationConfigBase interface.

Every property is optional since a default config is predefined.

| Property | Type | Default value | | ----------------- | ------------------------------------------------------------ | ----------------------------------------- | | type | 'underline', 'box', 'circle', 'highlight', 'strike-through', 'crossed-off', 'bracket' | 'highlight' | | animate | boolean | true | | animationDuration | number | 800 | | animationDelay | number | 0 | | color | string | See Automatic colors | | strokeWidth | number | 1 | | padding | number, [number, number], [number, number, number, number] | 5 | | multiline | boolean | false | | iterations | number | 2 | | brackets | 'left', 'right', 'top', 'bottom', [...'left', 'right', 'top', 'bottom'] | 'right' |

Please refer to the official doc for property descriptions.

Inputs

| Name | Type | Default value | Description | | ---------------------- | --------- | ------------- | ------------------------------------------------------------ | | show | boolean | true | Sets the visibility of the annotation. | | annotatedTextColor | boolean | true | Specify the CSS color value the element should have only when it is annotated. Returns to its original color when the annotation is hidden. |

Outputs

| Name | Type | Description | | ------------------- | ----------------------- | ---------------------------------------------------- | | isShowingChange | EventEmitter<boolean> | Triggers each time the annotation visibility changes |

Instance

You can get a reference to the RoughNotationDirective instance.

<span roughNotation #instance="roughNotation"></span>

This is useful if you want to toggle programmatically the annotation.

| Method | Description | | ------------ | ----------------------------------------------------------- | | toggle() | Shows or hide the annotation according to its current state |

Automatic colors

A set of default colors is defined for each annotation type. It follows the scheme on the original website so you can omit the color property if you're happy with the defaults.

| Type | Default color | | :------------- | -------------------------------------------- | | highlight | #FFF176 | | circle | #0D47A1 | | box | #4A148C | | strike-through | #1B5E1F | | underline | #B71C1B | | crossed-off | #F57F17 | | bracket | #FF0000 |

Global configuration

You can provide a global default configuration for the whole module.

For that you can use the forRoot() method on the module.

RoughNotationModule.forRoot({
    type: 'circle',
    animationDuration: 1000,
})

Note: this global configuration will be overriden by the configurations provided to the roughNotation directives.

Annotation group

You can use the rough-notation-group component to wrap and toggle a bunch of annotations.

<rough-notation-group [show]="showGroup">
   <div>
      <span roughNotation>First annotation</span>
   </div>
   <div>
      <span [roughNotation]="{ type: 'underline' }">Second annotation</span>
   </div>
</rough-notation-group>