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

ember-cli-stylist

v0.4.12

Published

Ember-cli addon to allow CSP-safe inline CSS styling

Downloads

1,771

Readme

ember-cli-stylist

Ember addon for a dynamic and safe "style" property

 npm version Code Climate

Install

  • Modern CLI versions

    ember install ember-cli-stylist

Usage

This addon helps component developers to provide HTML style attributes dynamically and safely. To use this just install and then in your component, mixin the shared-stylist mixin like so:

import SharedStylist from 'ember-cli-stylist/mixins/shared-stylist';
export default Ember.Component.extend(SharedStylist,{
  attributeBindings: ['stylist:style'],
  // your code here
}

or if you're using tagless component ...

import SharedStylist from 'ember-cli-stylist/mixins/shared-stylist';
export default Ember.Component.extend(SharedStylist,{
  tagName: '',
}
<div style={{stylist}}>
  Hello world
</div>

You can optionally include a property in your component styleBindings which will specify which styles you want proxied. If you don't specify then the default properties proxied are:

height width minHeight maxHeight minWidth maxWidth fontSize fontFamily fontWeight cursor display

With the Mixin added your component will now proxy style properties in a safe manner (aka, they will be escaped so XSS attacks are made much harder). For your component called my-component a container might use it like so:

{{my-component width='50%' height='100px' fontWeight=800}}

which would result in the style property being set to:

<div id="ember456" style="width: 50%; height: 100px; font-weight: 800px">

Property Aliasing

In many cases you may find yourself with a component which you would like to represent/serve as a style but it's name is something other than the style property name. With "aliasing" you can address this problem. For example:

styleBindings: [width::_width, height],

In this case we've stated our style should only listen for changes on _width and height but the name "_width" is an alias for the style property name "width".

Template Helpers

In addition to the core functionality for observing and projecting style properties to the DOM, this addon provides a few useful helper functions for working with classes.

  • classy - this allows your to list a set of properties which -- if there is a value adds the value with a space prepended.

Dependencies

None.

Version Compatibility

This may very well work with older version of Ember and Ember-CLI but it was intended for:

  • Ember 1.13.7+
  • Ember-CLI 1.13.7+

You can see the CI results at: Travis Reporting

Repo Contribution

We're open to your creative suggestions but please move past the "idea" stage and send us a PR so we can incorporate your ideas without killing ourselves. :)

Licensing

This component is free to use under the MIT license:

Copyright (c) 2015 LifeGadget Ltd

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.