0.9.8 • Published 3 years ago

@aesthetic/style v0.9.8

Weekly downloads
1
License
MIT
Repository
github
Last release
3 years ago

Aesthetic - CSS-in-JS Style Engine

Build Status npm version npm deps

A low-level, high-performance, atomic-based CSS-in-JS solution. Can be used stand-alone but has been designed to power additional abstractions or APIs.

import { createClientEngine } from '@aesthetic/style';

// Instantiate a client side (DOM) engine
const engine = createClientEngine();

// Render a style decleration into individual atomic class names
const className = engine.renderRule({
	margin: 0,
	textAlign: 'center',
	color: 'var(--color)',
	backgroundColor: 'transparent',
	border: '2px solid #eee',

	':hover': {
		borderColor: '#fff',
	},

	'@media': {
		'(max-width: 600px)': {
			display: 'block',
		},
	},

	'@variants': {
		'size:small': {
			fontSize: 14,
			padding: '4px 10px',
		},
		'size:default': {
			fontSize: 16,
			padding: '6px 12px',
		},
		'size:large': {
			fontSize: 18,
			padding: '8px 14px',
		},
	},
});

className.result; // -> a b c d e f g
className.variants; // -> [h i, j k, l m]

Features

  • 5.8kb minified and gzipped (35.4kb original).
  • Atomic based CSS. One declaration per class name.
  • Variants and compound variants for complex styling.
  • Specificity ranking so the intended property is always rendered.
  • Font faces, keyframes, imports, and other globals are rendered before normal declarations.
  • Media and support queries are grouped and rendered after normal declarations.
  • Media queries are sorted mobile-first.
  • Injection buffering for increased performance and reduced paints.
  • Style declarations support pseudos, attributes, conditional at-rules, and nested declarations.
  • Deterministic or atomic incremental CSS class names.
  • Right-to-left (RTL) integration (with addon).
  • Vendor prefixing for browsers with >= 1% market share (with addon).
  • Unit suffixing for numerical values.
  • First-class CSS variables support.
  • Server-side rendering and client-side hydration.
  • Framework and library agnostic. Can be used stand-alone.

Installation

yarn add @aesthetic/style

Documentation

https://aestheticsuite.dev/docs/packages/style

0.9.8

3 years ago

0.9.7

3 years ago

0.9.6

3 years ago

0.9.5

3 years ago

0.9.4

3 years ago

0.9.3

3 years ago

0.9.2

3 years ago

0.9.0

3 years ago

0.9.1

3 years ago

0.8.1

3 years ago

0.8.0

3 years ago

0.7.0

3 years ago

0.6.7

3 years ago

0.6.6

3 years ago

0.6.5

3 years ago

0.6.4

3 years ago

0.6.3

3 years ago

0.6.2

3 years ago

0.6.1

3 years ago

0.6.0

3 years ago

0.5.3

3 years ago

0.5.2

3 years ago

0.5.0

4 years ago

0.5.1

4 years ago

0.4.5

4 years ago

0.4.4

4 years ago

0.4.3

4 years ago

0.4.2

4 years ago

0.4.1

4 years ago

0.4.0

4 years ago

0.3.0

4 years ago

0.2.4

4 years ago

0.2.3

4 years ago

0.2.2

4 years ago

0.2.1

4 years ago

0.2.0

4 years ago

0.1.5

4 years ago

0.1.4

4 years ago

0.1.3

4 years ago

0.1.2

4 years ago

0.1.0

4 years ago

0.1.1

4 years ago

0.0.5

4 years ago

0.0.6

4 years ago

0.0.4

4 years ago

0.0.3

4 years ago

0.0.2

4 years ago

0.0.1

4 years ago