Security News
pnpm 10.0.0 Blocks Lifecycle Scripts by Default
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
@stylable/runtime
Advanced tools
[![npm version](https://img.shields.io/npm/v/@stylable/runtime.svg)](https://www.npmjs.com/package/@stylable/runtime)
@stylable/runtime
provides the utility that is used to create the stylesheet functions that apply classNames
and states
to the DOM. It also exposes an optional DOM renderer that is responsible for loading CSS in its correct order.
End-users will usually not add this package directly as a dependency themselves, and would instead receive it as a dependency of their chosen integration (e.g. @stylable/webpack-plugin
).
@stylable/runtime
exposes two methods, Stylesheet
and Renderer
.
The stylesheet function is returned when importing a Stylable stylesheet. It is used for creating the DOM-attributes required for CSS to be applied.
style(className: string, states?: StateMap, props: InheritedAttributes)
Argument | Type | Description | Required |
---|---|---|---|
className | string | className to be namespaced | true |
states | StateMap | object containing states and their values | false |
inheritedAttributes | InheritedAttributes | props passed to the root node from the parent component (automatically passing through className and data-* attributes) | false |
import style from './local.st.css';
props = {
className: "app1211903207--root",
"data-app1211903207-propstate": true
}
style('root');
// returns "{
// "className": "local1211372639--root"
// }"
style('root', {localState: true});
// returns "{
// "data-local1211372639-localstate": true,
// "className": "local1211372639--root"
// }"
style('root', {localState: true}, props);
// returns "{
// "data-local1211372639-localstate": true,
// "data-app1211903207-propstate": true,
// "className": "local1211372639--root app1211903207--root"
// }"
// The stylesheet function also exposes a map of classNames and their namespaced values.
style.root;
// returns "local1211372639--root"
Responsible for managing CSS files, linking to the document
and maintaining their correct order in your application.
Copyright (c) 2017 Wix.com Ltd. All Rights Reserved. Use of this source code is governed by a BSD license.
FAQs
Stylable runtime DOM integration
The npm package @stylable/runtime receives a total of 916 weekly downloads. As such, @stylable/runtime popularity was classified as not popular.
We found that @stylable/runtime demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 6 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.
Security News
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
Product
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.
Research
Security News
Socket researchers have discovered multiple malicious npm packages targeting Solana private keys, abusing Gmail to exfiltrate the data and drain Solana wallets.