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 🙏

© 2026 – Pkg Stats / Ryan Hefner

junte-encapsuler

v0.0.48

Published

## Version

Readme

Junte Encapsuler

Version

npm v0.0.26

##Installation

  • Install Junte Encapsuler with npm install junte-encapsuler --save

  • Once installed you need add some scripts to package.json for encapsulate your components

"encapsuler": "mkdir -p src/scripts && cp ./node_modules/junte-encapsuler/encapsulation.ts./src/scripts",
"encapsulation": "gulp build --gulpfile ./src/scripts/encapsulation.ts",
"encapsulation:watch": "gulp build --gulpfile ./src/scripts/encapsulation.ts --watch"

  • Use npm run encapsuler for copy gulpfile from node_modules to your_project/scripts/encapsulation.ts

  • Use npm run encapsulation (:watch) for encapsulate your components templates and styles.

##Encapsulation

###[host] and [child-of] attributes:

In order for our encapsulation to work, you need to adds the host='selector' attribute using @HostBinding, this will provide an encapsulation of component styles.

To encapsulate the styles of elements inside a component, our encapsulator automatically adds the child-of='selector' attribute to them.

###[child-host] attribute:

To override the styles of the encapsulated component, use the [child-host=#{'$child-selector'}] attribute in the parent's scss file

##Examples

Bind host attribute to test.component.ts file

@HostBinding('attr.host') host = 'app-test-host';

Add this host to any loaded scss style (variables.scss for example)

$app-test-host: 'app-test-host';

Change templateUrl and remove styleUrls to test.encapsulated

templateUrl: './test.encapsulated.html'

Import encapsulated style to global loaded styles

@import "components/test/test.encapsulated";

###[host] and [child-of] example:

test.component.html before

<h1>Test component</h1>
<form>
    <input type="text">
    <button>Test button</button>
</form>

test.encapsulated.html after:

<h1 child-of="app-test-host">Test component</h1>
<form child-of="app-test-host">
    <input child-of="app-test-host" type="text"/>
    <button child-of="app-test-host">Test button</button>
</form>

test.component.scss before:

@import "variables";

:host {
    display: block;
    padding: 16px;
    border: 1px solid $primary-color;
}

h1 {
    color: $primary-color;
}

form {
    background-color: $secondary-background;
    padding: 8px;

    input {
    margin-right: 16px;
    border-radius: $corner-normal;
    padding: 8px 16px;
  }

  button {
    background-color: $primary-color;
    color: white;
    border-radius: $corner-normal;
    padding: 8px 16px;
  }
}

test.encapsulated.scss after:

@import "variables";

app-test[host=#{$app-test-host}] {
    display: block;
    padding: 16px;
    border: 1px solid $primary-color;
}

h1[child-of=#{$app-test-host}] {
    color: $primary-color;
}

form[child-of=#{$app-test-host}] {
    background-color: $secondary-background;
    padding: 8px;

    input[child-of=#{$app-test-host}] {
    margin-right: 16px;
    border-radius: $corner-normal;
    padding: 8px 16px;
  }

  button[child-of=#{$app-test-host}] {
    background-color: $primary-color;
    color: white;
    border-radius: $corner-normal;
    padding: 8px 16px;
  }
}

###[child-host] example:

test-child.component.scss before:

@import "variables";

:host {
    display: block;
    background-color: #4F4F4F;
    padding: 16px;
    margin: 8px 0;
    color: white;
}

test-child.encapsulated.scss after:

@import "variables";

app-test-child[host=#{$app-test-child-host}] {
    display: block;
    background-color: #4F4F4F;
    padding: 16px;
    margin: 8px 0;
    color: white;
}

test-parent.component.scss before:

@import "variables";

:host {
    display: block;
    background-color: #E9E9E9;
    padding: 16px;
    margin: 8px 0;
}

app-test-child[child-host=#{$app-test-child-host}] {
    background-color: white;
    color: #4F4F4F;
}

test-parent.encapsulated.scss after:

@import "variables";

app-test-parent[host=#{$app-test-parent-host}] {
    display: block;
    background-color: #E9E9E9;
    padding: 16px;
    margin: 8px 0;
}

app-test-child[host=#{$app-test-child-host}][child-of=#{$app-test-parent-host}] {
    background-color: white;
    color: #4F4F4F;
}