npm.io
2.0.0-rc.70 • Published yesterday

@master/css-engine

Licence
MIT
Version
2.0.0-rc.70
Deps
3
Size
208 kB
Vulns
0
Weekly
783

@master/css-engine

The manifest-driven Master CSS engine.

Installation

npm install @master/css-engine

Responsibility

@master/css-engine executes MasterCSSManifest values. It owns class matching, value parsing, selector and at-rule parsing/generation, variable and animation insertion, cascade layers, rule priority sorting, hydration manifest generation, CSS text emission, and built-in key/namespace registries.

This package does not discover project files, resolve CSS imports, compile CSS directives, or integrate with frameworks.

API

MasterCSS
import { MasterCSS } from '@master/css-engine'

const css = MasterCSS.create({ manifest })

css.add('text:center', 'font:semibold')
console.log(css.text)
API Description
MasterCSS.create({ manifest, emittedGlobals }) Creates a MasterCSS instance.
css.add(...classNames) Adds class names and generated rules.
css.remove(...classNames) Removes class names and unused rules.
css.createRule(className) Creates one generated rule without inserting it.
css.createRules(className) Creates all generated rule branches without inserting them.
css.refresh(manifest?) Refreshes with a compiled manifest.
css.reset() Clears rules and state.
css.text Generated CSS text.
Compiler helpers

@master/css-engine/compiler exposes parse, generate, inspect, and built-in registry helpers used by the compiler, language tooling, docs, and tests.

import {
    builtinKeyAliases,
    builtinNativeValueNamespaces,
    compareRulePriority,
} from '@master/css-engine/compiler'
  • @master/css is the public facade over this package and the default preset.
  • @master/css-compiler lowers CSS directives into manifests.
  • @master/css-runtime runs the engine against live browser DOM roots.

Keywords