UNPKG

@master/css-runtime

Version:

Run Master CSS right in the browser

85 lines (84 loc) 3.52 kB
import { MasterCSS } from '@master/css'; import { type Config } from '@master/css'; import { HydrateResult } from './types'; import RuntimeLayer from './layer'; export default class CSSRuntime extends MasterCSS { root: Document | ShadowRoot; customConfig: Config; static instances: WeakMap<Document | ShadowRoot, CSSRuntime>; readonly host: Element; readonly container: HTMLElement | ShadowRoot; readonly baseLayer: { rules: import("@master/css").SyntaxRule[]; insert(syntaxRule: import("@master/css").SyntaxRule): number | undefined; delete(key: string): import("@master/css").SyntaxRule | undefined; insertVariables(syntaxRule: import("@master/css").SyntaxRule): void; insertAnimations(syntaxRule: import("@master/css").SyntaxRule): void; readonly tokenCounts: Map<string, number>; name: string; css: MasterCSS; attach(): void; detach(): void; reset(): void; readonly text: string; } & RuntimeLayer; readonly themeLayer: RuntimeLayer; readonly presetLayer: { rules: import("@master/css").SyntaxRule[]; insert(syntaxRule: import("@master/css").SyntaxRule): number | undefined; delete(key: string): import("@master/css").SyntaxRule | undefined; insertVariables(syntaxRule: import("@master/css").SyntaxRule): void; insertAnimations(syntaxRule: import("@master/css").SyntaxRule): void; readonly tokenCounts: Map<string, number>; name: string; css: MasterCSS; attach(): void; detach(): void; reset(): void; readonly text: string; } & RuntimeLayer; readonly componentsLayer: { rules: import("@master/css").SyntaxRule[]; insert(syntaxRule: import("@master/css").SyntaxRule): number | undefined; delete(key: string): import("@master/css").SyntaxRule | undefined; insertVariables(syntaxRule: import("@master/css").SyntaxRule): void; insertAnimations(syntaxRule: import("@master/css").SyntaxRule): void; readonly tokenCounts: Map<string, number>; name: string; css: MasterCSS; attach(): void; detach(): void; reset(): void; readonly text: string; } & RuntimeLayer; readonly generalLayer: { rules: import("@master/css").SyntaxRule[]; insert(syntaxRule: import("@master/css").SyntaxRule): number | undefined; delete(key: string): import("@master/css").SyntaxRule | undefined; insertVariables(syntaxRule: import("@master/css").SyntaxRule): void; insertAnimations(syntaxRule: import("@master/css").SyntaxRule): void; readonly tokenCounts: Map<string, number>; name: string; css: MasterCSS; attach(): void; detach(): void; reset(): void; readonly text: string; } & RuntimeLayer; readonly classCounts: Map<string, number>; observer?: MutationObserver; progressive: boolean; observing: boolean; constructor(root?: Document | ShadowRoot, customConfig?: Config); /** * Observe the DOM for changes and update the running stylesheet. (browser only) * @param options mutation observer options * @returns this */ observe(): this; hydrate(nativeLayerRules: CSSRuleList): HydrateResult; getSelectorText(cssRule: CSSRule): string | undefined; disconnect(): this | undefined; refresh(customConfig?: Config): this; destroy(): this; }