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.
@vaadin/vaadin-themable-mixin
Advanced tools
@vaadin/vaadin-themable-mixin is a mixin for creating themable web components. It allows developers to define custom styles and themes for their components, making it easier to maintain a consistent look and feel across applications.
Custom CSS Properties
This feature allows developers to define custom CSS properties that can be used to style components. The code sample demonstrates how to create a custom property for the background color of a component.
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
class MyComponent extends ThemableMixin(HTMLElement) {
static get is() { return 'my-component'; }
static get styles() {
return [
css`
:host {
--my-component-background-color: white;
background-color: var(--my-component-background-color);
}
`
];
}
}
customElements.define(MyComponent.is, MyComponent);
Theme Variations
This feature allows components to support different theme variations. The code sample shows how to apply different styles when a 'dark' theme is applied to the component.
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
class MyComponent extends ThemableMixin(HTMLElement) {
static get is() { return 'my-component'; }
static get styles() {
return [
css`
:host([theme~="dark"]) {
background-color: black;
color: white;
}
`
];
}
}
customElements.define(MyComponent.is, MyComponent);
LitElement is a base class for creating fast, lightweight web components with Lit. It provides a simple way to define custom elements and manage their styles. Compared to @vaadin/vaadin-themable-mixin, LitElement offers a more comprehensive solution for building web components, including templating and reactive properties, but it also supports theming through CSS custom properties.
Styled-components is a library for React and React Native that allows developers to use component-level styles in their applications. It uses tagged template literals to style components. While it is not specifically for web components, it offers a similar approach to theming and styling as @vaadin/vaadin-themable-mixin, but within the React ecosystem.
A mixin to enable customization of Shadow DOM used by Vaadin components.
Apache License 2.0
FAQs
vaadin-themable-mixin
The npm package @vaadin/vaadin-themable-mixin receives a total of 84,838 weekly downloads. As such, @vaadin/vaadin-themable-mixin popularity was classified as popular.
We found that @vaadin/vaadin-themable-mixin demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 12 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.