New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

ember-class-modifier

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ember-class-modifier

Ember: Declarative class management modifier

latest
Source
npmnpm
Version
1.0.0
Version published
Weekly downloads
4
-60%
Maintainers
1
Weekly downloads
 
Created
Source

ember-class-modifier

This class modifier made for declarative class management for DOM elements.

Why?

    <div 
        class="
            ui flat item 
            {{if this.loading ' loading'}} 
            {{if this.hasErrors ' error'}}">
    </div>

To

    <div {{class 'ui flat item'
        loading=this.loading
        error=this.hasErrors
    }}></div>

Compatibility

  • Ember.js v3.12 or above
  • Ember CLI v2.13 or above
  • Node.js v10 or above

FastBoot support

Currently, modifiers don't work in FastBoot. To prevent "Blinking" you can add critical classes as standard class attribute. After modifier initialization it node.classList will be replaced.

   <div 
        class="ui flat item"
        {{class 'ui flat item'
            loading=this.loading
            error=this.hasErrors
        }}>
    </div>

Installation

ember install ember-class-modifier

Usage

  • Modifier rewrite all classes in element.
<div {{class 'my-name'}}></div>
{{!-- Rendered AS: --}}
<div class="my-name"></div>
<div {{class 'my-name' 'gold-color'}}></div>
{{!-- Rendered AS: --}}
<div class="my-name gold-color"></div>
<div {{class my-name=false}}></div>
{{!-- Rendered AS: --}}
<div></div>
<div {{class my-name=true}}></div>
{{!-- Rendered AS: --}}
<div class="my-name"></div>
<div {{class 'red-dot' my-name=true}}></div>
{{!-- Rendered AS: --}}
<div class="red-dot my-name"></div>
<div {{class (array 'class-one' 'class-two')}}></div>
{{!-- Rendered AS: --}}
<div class="class-one class-two"></div>

Contributing

See the Contributing guide for details.

License

This project is licensed under the MIT License.

Keywords

ember-addon

FAQs

Package last updated on 04 Jul 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts