@neoncitylights/typed-css-utils
TypeScript icon, indicating that this package has built-in type declarations

0.2.0 • Public • Published

Typed CSS utils

License: MIT GitHub deployments Node.js workflow NPM package

This library provides a set of utilities extending the csstype package to help you write typed CSS in TypeScript.

Currently, there's basic support for the following W3C standards:

Install

npm install @neoncitylights/typed-css-utils

Usage

Using TypeScript, you can receive type intelliSense, which provides autocomplete suggestions for:

  • CSS property names and values (through csstype)
  • Media feature names (e.g prefers-color-scheme, aspect-ratio)
import { matchMediaFeature, cssSupports } from '@neoncitylights/typed-css-utils';

// equivalent to window.matchMedia('(prefers-color-scheme: dark)');
const userPrefersDark: MediaQueryList = matchMediaFeature('prefers-color-scheme', 'dark');

// TypeScript support, which provides strongly typed CSS property
// names and values using the `csstype` package
const supportsGrid: boolean = cssSupports('display', 'grid');
const supportsFlex: boolean = cssSupports('display', 'flex');

License

This library is licensed under the MIT License.

Readme

Keywords

Package Sidebar

Install

npm i @neoncitylights/typed-css-utils

Weekly Downloads

0

Version

0.2.0

License

MIT

Unpacked Size

29.7 kB

Total Files

7

Last publish

Collaborators

  • neoncitylights