
Research
Two Malicious Rust Crates Impersonate Popular Logger to Steal Wallet Keys
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
dallas
La classe, dallas.
# React is a peer dependencie
npm i dallas react
The api provide a classe
wrapper function.
import { React, classe } from 'classe'
// classe takes 2 arguments
// an option and a render function
const Button = classe('my-button', props => <button {...props} />)
// this JSX:
<Button className='big' />
// render this dom
<button className='big my-button' />
React
is passed down for convenience
import { React, classe } from 'dallas'
import style from './Wrapper.module.css'
const Wrapper = classe([ 'container', style.Wrapper ])
// This JSX
<Wrapper />
// render this dom
<div class="container Wrapper__Wrapper_aQn7" />
The second argument (the render function) is optionnal
It will default to rendering the className to adiv
. props =>Merged class names !)
all keys that have strings
values genereate boolean flags as short hands for applying css classes.
// options can be passed last or first.
export const FlagClass = classe({
disabled: 'dis',
selected: 'bp-selected',
})
// this JSX
<FlagClass disabled selected />
// render this dom
<div class="dis bp-selected" />
// and this JSX
<FlagClass selected className="pouet"/>
// render this dom
<div class="pouet bp-selected" />
You can not use
className
orclassNames
as a flag.
A class matcher is a switch, it use a string or a function for more complex logic.
// options can be passed last or first.
export const Matcher = classe({
color: {
info: 'color-blue',
warning: 'color-yellow',
error: 'color-red',
},
status: data => data.endDate > Date.now() ? 'available' : 'unavailable'
})
// this JSX
<Matcher color="error" />
// render this dom
<div class="color-red" />
// and this JSX
<Matcher status={{ endDate: Date.now() + 1000 }} />
// render this dom
<div class="available" />
// while
<Matcher status={{ endDate: 0 }} />
// would render this dom
<div class="available" />
The render functions are memo
by default,
if you want not to memo
the function, use
either classe.noMemo
or classeNoMemo
.
consume (Boolean)
Passing the consume option to true
will remove props that are used for flags.
groups (RegExp)
A RegExp
used to match exclusive props together
export const Matcher = classe({
orange1: 'light-orange',
orange2: 'orange',
orange3: 'dark-orange',
groups: /^([a-z]+)([0-9]+)$/i,
})
// this JSX
<Matcher orange="1" />
// render this dom
<div class="light-orange" />
// this JSX
<Matcher orange3 />
// render this dom
<div class="dark-orange" />
// this JSX
<Matcher orange={2} />
// render this dom
<div class="orange" />
Groups are mutualy exclusives so once flags are matched together, only the last one will be applied:
// this JSX
<Matcher orange1 orange2 orange3 />
// render this dom
<div class="dark-orange" />
A special elemRef
props is checked to forward ref to the rendered element.
const ref = useRef(null)
<Matcher elemRef={ref} />
FAQs
A wrapper for applying classes
We found that dallas 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.
Research
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
Research
A malicious package uses a QR code as steganography in an innovative technique.
Research
/Security News
Socket identified 80 fake candidates targeting engineering roles, including suspected North Korean operators, exposing the new reality of hiring as a security function.