Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
ember-computed-style
Advanced tools
Provides a simple computed property for Ember Compontents which emits CSS properties
Provides a simple computed property mixin for Ember Components to compute styles from objects similar how it can be done in React.
Take this example code:
import computedStyle from 'ember-computed-style';
export default Ember.Component.extend({
style: computedStyle('styleProperties'),
styleProperties: {
position: 'absolute',
top: 10,
left: 50
},
attributeBindings: ['style'],
});
This will set style to a CSS style string computed from the returned object from the handler function. The value of this will be correctly encoded as:
position: absolute; top: 10px; left: 50px;
Properties which are not designated to have a unit value will be left as is,
otherwise px
unit will be added if they're a Number.
You can also compute it from multiple property bindings, if each of them return an object keyed on the CSS property name:
import computedStyle from 'ember-computed-style';
export default Ember.Component.extend({
style: computedStyle('horizontalPosition', 'verticalPosition', 'positionType'),
positionType: {
position: 'absolute'
},
verticalPosition: computed('targetRect', function() {
const targetRect = this.get('targetRect');
return {top: targetRect.top + 10};
}),
horizontalPosition: computed(function() {
return {left: 50};
}),
attributeBindings: ['style'],
});
ember install ember-computed-style
npm run lint:js
npm run lint:js -- --fix
ember test
– Runs the test suite on the current Ember version
ember test --server
– Runs the test suite in "watch mode"
ember try:each
– Runs the test suite against multiple Ember versions
npm test
(Runs ember try:testall
to test your addon against multiple Ember versions)
ember test
ember test --server
ember serve
For more information on using ember-cli, visit https://ember-cli.com/.
This project is licensed under the MIT License.
FAQs
Provides a simple computed property for Ember Compontents which emits CSS properties
The npm package ember-computed-style receives a total of 63 weekly downloads. As such, ember-computed-style popularity was classified as not popular.
We found that ember-computed-style demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.