
Research
Security News
Malicious npm Packages Use Telegram to Exfiltrate BullX Credentials
Socket uncovers an npm Trojan stealing crypto wallets and BullX credentials via obfuscated code and Telegram exfiltration.
atomic-style
Advanced tools
This lib provides atomic classSets and dedupes atomic classes, it is an Atomizer friendly replacement for the classNames module.
The atomic style class sets helps to remove duplication when there are many components repeating the same style over and over but it should not be overused the Atomic prefered way it to have reusable components with explicit atomic classes, the dedupe feature provided by this lib is very usefull for that.
npm install --save atomic-style
Create some classSets to group atomic styles that are duplicated on your app.
// config/styles/btn.json
// the AtomicStyle is a simple object where the keys is the style name,
// and the values can be eather a string, object or array.
{
// you can use an Array
'btn': [
'H(30px) Lh(30px)',
'Bgc(#ccc)',
'C(#000)',
... // more styles
],
// you can use an String
'btn-blue': "Bgc(blue) C(#fff)",
// or you can use an object
'btn-lg': {
'H(50px)': true,
'Lh(50px)': true
}
}
Create a config file that load your classes.
// config/atomize.js
'use strict';
// atomize-style return a singlethon object where all your styles will be merged
var atomize = require('atomic-style');
atomize.set([
require('./styles/btn.json'),
require('./styles/foobar.json'),
... // all other styles
]);
module.exports = atomize;
Now you can use your config/atomize to get classSets and dedupe stuff.
// components/SomeComponent.jsx
var atomize = require('../config/atomize');
module.exports = React.createClass({
displayName: 'SomeComponent',
...
render: function () {
// #dedupe can be used to merge classes
var divClasses = atomize.dedupe('W(500px)', this.props.divClassName, {
'W(100%)': this.props.isFullScreen
});
var customBtnClasses = atomize.get('btn btn-lg', {
'C(#fff) Bgc(pink)': this.props.hasPinkBtn
});
return (
<div className={divClasses}>
<button className={atomize.get('btn')}>some button</button>
<button className={atomize.get('btn btn-blue')}>Blue Button</button>
<button className={customBtnClasses}>Large Custom Button</button>
</div>
)
}
});
The atomize.get
and atomize.dedupe
both guaranty no duplication of same style, for more details and examples check the tests.
Code licensed under the MIT license. See LICENSE file for terms.
FAQs
Atomic classSets and dedupe
The npm package atomic-style receives a total of 1 weekly downloads. As such, atomic-style popularity was classified as not popular.
We found that atomic-style demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers 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.
Research
Security News
Socket uncovers an npm Trojan stealing crypto wallets and BullX credentials via obfuscated code and Telegram exfiltration.
Research
Security News
Malicious npm packages posing as developer tools target macOS Cursor IDE users, stealing credentials and modifying files to gain persistent backdoor access.
Security News
AI-generated slop reports are making bug bounty triage harder, wasting maintainer time, and straining trust in vulnerability disclosure programs.