API Reference

@master/css-runtime

The core syntax parsing and runtime engine of Master CSS.


The Runtime extends the MasterCSS and only works in the browser environment.

Create a Master Runtime CSS instance with your custom configuration:

import { RuntimeCSS } from '@master/css-runtime'
const runtimeCSS = new RuntimeCSS(config)

.root

Observe the root element.

Default
document
Type
Document
ShadowRoot
runtimeCSS.root

.host

Observe the root's host element, usually this.root.host or document.documentElement.

Default
auto
( Read Only )
Type
Element
runtimeCSS.host

.container

Container for inserting style <style>.

Default
auto
( Read Only )
Type
HTMLElement
ShadowRoot
runtimeCSS.host

.observing

Observation state. true after .observe(); false after .disconnect().

Default
auto
( Read Only )
Type
boolean
runtimeCSS.observing

.observe()

Observe the class attribute changes of this.root and all descendant elements.

ArgumentTypeDefault
return
this
-
runtimeCSS.observe()

.disconnect()

Cancel the previous .observe() of this.root.

ArgumentTypeDefault
options?
MutationObserverInit
{ subtree: true, childList: true }
return
this
-
runtimeCSS.disconnect()

.refresh()

Refresh the Master Runtime CSS with the configuration.

ArgumentTypeDefault
config?
this.customConfig
return
this
-
css.refresh(config)

.reset()

Clear all rules and styles and reset to initial.

ArgumentTypeDefault
return
this
-
css.reset()

.destroy()

Destroy and remove the current instance from globalThis.runtimeCSSs.

ArgumentTypeDefault
return
this
-
css.reset()

Global

globalThis.runtimeCSS

Record the registered root document Runtime CSS instance; the field will be recorded only after executing css.observe().

Default
undefined
Type
RuntimeCSS

globalThis.runtimeCSSs

All objects instantiated via new RuntimeCSS().

Default
[]
Type
RuntimeCSS[]

globalThis.RuntimeCSS

Default
RuntimeCSS
Type
typeof RuntimeCSS

Functions

initCSSRuntime()

Initializes the Master CSS runtime rendering engine.

ArgumentTypeDefault
config?
undefined
return
MasterCSS
-
import { initCSSRuntime } from '@master/css-runtime'
const css = initCSSRuntime()

Equivalent to:

import { RuntimeCSS } from '@master/css-runtime'
const runtimeCSS = new RuntimeCSS().observe()
API Reference
@master/css-extractor

Master CSS static extractor for various raw text extraction.

API Reference
theme-service

Standard CSS theme switching and service for Master CSS.

© Aoyue Design LLC.