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

angular-pseudo-class

v0.1.10

Published

Take control on CSS pseudo-classes !

Downloads

3

Readme

Angular pseudo-class

Take control on CSS pseudo-classes !

Provides a set of jQuery, Angular and Sass features to easily control the CSS pseudo-classes in Javascript.

Install

npm install --save angular-pseudo-class

Import in Angular

import pseudoClass from 'angular-pseudo-class';

let app = angular.module('myApp', [
  pseudoClass
]);

If you use Sass, import the mixins (path to node_modules can be different).

@import "./node_modules/angular-pseudo-class/angular-pseudo-class";

Usage

Supported pseudo-classes

:construction: The module is still in development. The following pseudo-classes are supported:

  • active
  • hover
  • ... work in progress ...

Listen for pseudo-classes

:point_right: Feature from jquery-pseudo-class

$elem.onPseudoClass( pseudo_class, function_in, function_out );

$elem.onPseudoClass( {
    pseudo_class: [function_in, function_out],
    pseudo_class: [function_in, function_out],
    ...
} );

For exemple:

var $elem = $('.js-button');

$elem.onPseudoClass('hover',
    function(e) {
        $elem.html('Mouse is in');
    },
    function(e) {
        $elem.html('Mouse is out');
    }
);

Pseudo-class control

:warning: The pseudo-classes controlled by Js are slower than the standard CSS pseudo-classes. Use it only if you need it.

Make a component pseudo-classes controlled by the JS events. So it can be stopped, prevent or manually triggered. If no pseudo-classes are given, all supported pseudo-classes are controlled.

<button class = "js-button" pseudo-class-ctrl = "hover">
<!-- OR                 ... pseudo-class-ctrl = "active hover" ... -->
<!-- OR                 ... pseudo-class-ctrl ... -->
    My :hover is controlled !
</button>

In the CSS, the pseudo-class is triggered by:

.js-button.pseudo-class--hover {
    ...
}

With Sass:

.js-button {
    @include pseudo-class(hover) {
        ...
    }
}

Pseudo-class scope

In CSS, when you click on a child component, you clicked too on the parent. It can be undesired in some situations.

Make the child like out of his parent with pseudo-class-scope. If no pseudo-classes are given, all supported pseudo-classes are prevent.

<div class = "parent" pseudo-class-ctrl = "active">
    <a class = "child" pseudo-class-scope = "active"> I'm free ! </a>
    <!-- OR        ... pseudo-class-scope = "active hover" ... -->
    <!-- OR        ... pseudo-class-scope ... -->
</div>

For exemple, to color the background in grey or the link in red when you click on them.

.parent.pseudo-class--active {
    background: grey;
}

.child.pseudo-class--active {
    color: red;
}

With Sass:

.parent {
    @include pseudo-class(active) {
        background: grey;
    }
}

.child {
    @include pseudo-class(active) {
        color: red;
    }
}

Licence

This module is under the Apache 2.0 Licence. Please refer to the LICENCE file for more details.

Made with :heart: in Paris