Launch Week Day 2: Introducing Reports: An Extensible Reporting Framework for Socket Data.Learn More
Socket
Book a DemoSign in
Socket

@aesthetic/core

Package Overview
Dependencies
Maintainers
1
Versions
59
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@aesthetic/core

Aesthetic is a powerful type-safe, framework agnostic, CSS-in-JS library for styling components.

latest
Source
npmnpm
Version
0.11.1
Version published
Weekly downloads
89
-57.21%
Maintainers
1
Weekly downloads
 
Created
Source

Aesthetic - Core API

Build Status npm version npm deps

Unifies a design system and a CSS-in-JS engine into a powerful framework agnostic API.

import { Aesthetic } from '@aesthetic/core';
import dayTheme from './design/system/dayTheme';
import nightTheme from './design/system/nightTheme';

const aesthetic = new Aesthetic({
	defaultUnit: 'px',
	deterministicClasses: false,
});

// Register a theme (provided by the design system)
aesthetic.registerDefaultTheme('day', dayTheme);

// Register a theme that has global styles
aesthetic.registerTheme('night', nightTheme, (css) => ({
	'@root': css.mixin('root', {
		backgroundColor: css.var('palette-neutral-bg-base'),
		height: '100%',
	}),
}));

// Create a component style sheet
const styleSheet = aesthetic.createStyleSheet((css) => ({
	button: {
		textAlign: 'center',
		display: 'inline-block',
		padding: css.var('spacing-df'),
	},
}));

// Render the style sheet into the document
const classNames = aesthetic.renderStyleSheet(styleSheet);

Though the core API is framework agnostic and can be used stand-alone, it's encouraged to use a framework integration package for better ergonomics.

Features

Supports all features provided by unified packages, while also providing...

  • Register, manage, and activate themes, powered by the design system.
  • Automatically activates a theme based on a users preferences (color scheme, contrast, etc).
  • Scopes active theme styles and CSS variables to the body to avoid global scope pollution.
  • Factories and renders component and theme style sheets.
  • Supports color scheme, contrast, and theme variants for style sheets.
  • Renders font faces, keyframes, and CSS imports.
  • Handles server-side rendering and client-side hydration.
  • Integrates with the React framework.

Requirements

  • IE 11+

Installation

yarn add @aesthetic/core

Documentation

https://aestheticsuite.dev

Keywords

aesthetic

FAQs

Package last updated on 07 Jul 2021

Did you know?

Socket

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.

Install

Related posts