Plugins

A plugin is a module that exports the members of a scope() from cssints/plugin: scope("name", table).build(impl).export(). The table says what the plugin has (syntax names, kernels, a runtime, conflicts, token sets, other scopes, and its members); the members are typed from the table, with no second file of types. User code imports the plugin with the attribute, like cssints itself: import { ring } from "./ring.ts" with { type: "cssints" }. There is no registration in vite.config and no type augmentation; the engine finds the sites by the attribute, and learns kernels, runtimes and conflicts from the style each member returns. In user code a member returns a class string, so it goes into cn(), cx() and the conditions like any css.* value.

import { const cn: (...styles: Style[]) => Stylecn, const p: Prop<"padding">
`<'padding-top'>{1,4}`. Chrome 1, Edge 12, Firefox 1, Safari 1, iOS 1, Android 18. [MDN](https://developer.mozilla.org/docs/Web/CSS/padding)
p
} from "cssints" with { type: "cssints" };
import { function scope<const N extends string, const T extends Table>(name: N, table: T & Valid<N, T>): [CallKeys<T>] extends [never] ? Scope<N, T> : Pending<N, T>
A plugin is a scope: `scope("name", table)`. The table holds, by shape: syntax aliases (a string), typed properties (a `-vendor-prop` key with a grammar), kernels, static globals, layers, runtimes, conflicts, token sets and embedded scopes, and the members (`chain`, `args` + `build`, `args` + `value`). A key starting `#` is private. Everything it declares is namespaced by `name`, which is unique in the process (`cssints` and `derived` are reserved).
scope
} from "cssints/plugin";
export const {
const ring: () => Chain<"ring", {
    readonly width: {
        readonly args: "<width>";
        readonly spacing: true;
        readonly emit: (v: string) => [string, string][];
    };
    readonly color: {
        readonly args: "<color>";
        readonly emit: (v: string) => [string, string][];
    };
}, Own<{
    readonly width: "<length [0,∞]> | thin | thick";
    readonly "#core": {
        readonly css: "& { outline: var(--_w) solid var(--_c); outline-offset: 2px }";
        readonly atProperty: "@property --_w { syntax: \"<length>\"; inherits: false; initial-value: 2px; }";
        readonly requires: ["css.at-rules.property"];
    };
    readonly "#noOutline": {
        readonly props: [...];
        readonly message: "ring() sets the outline: use its methods";
    };
    readonly ring: {
        ...;
    };
    readonly "-webkit-font-smoothing": "auto | none | antialiased | subpixel-antialiased";
    readonly dot: {
        ...;
    };
}>>
ring
, const dot: <const P extends readonly Part[]>(...parts: CheckIn<"dot", "small | large", false, P>) => Styledot, const webkitFontSmoothing: <const P extends readonly Part[]>(...parts: CheckIn<"-webkit-font-smoothing", "auto | none | antialiased | subpixel-antialiased", false, P>) => StylewebkitFontSmoothing } =
scope<"ring", {
    readonly width: "<length [0,∞]> | thin | thick";
    readonly "#core": {
        readonly css: "& { outline: var(--_w) solid var(--_c); outline-offset: 2px }";
        readonly atProperty: "@property --_w { syntax: \"<length>\"; inherits: false; initial-value: 2px; }";
        readonly requires: ["css.at-rules.property"];
    };
    readonly "#noOutline": {
        readonly props: ["outline", RegExp];
        readonly message: "ring() sets the outline: use its methods";
    };
    readonly ring: {
        readonly uses: readonly ["core", "noOutline"];
        readonly chain: {
            readonly width: {
                readonly args: "<width>";
                readonly spacing: true;
                readonly emit: (v: string) => [...][];
            };
            readonly color: {
                ...;
            };
        };
    };
    readonly "-webkit-font-smoothing": "auto | none | antialiased | subpixel-antialiased";
    readonly dot: {
        ...;
    };
}>(name: "ring", table: {
    readonly width: "<length [0,∞]> | thin | thick";
    readonly "#core": {
        readonly css: "& { outline: var(--_w) solid var(--_c); outline-offset: 2px }";
        readonly atProperty: "@property --_w { syntax: \"<length>\"; inherits: false; initial-value: 2px; }";
        readonly requires: ["css.at-rules.property"];
    };
    readonly "#noOutline": {
        readonly props: ["outline", RegExp];
        readonly message: "ring() sets the outline: use its methods";
    };
    readonly ring: {
        readonly uses: readonly ["core", "noOutline"];
        readonly chain: {
            readonly width: {
                readonly args: "<width>";
                readonly spacing: true;
                readonly emit: (v: string) => [...][];
            };
            readonly color: {
                ...;
            };
        };
    };
    readonly "-webkit-font-smoothing": "auto | none | antialiased | subpixel-antialiased";
    readonly dot: {
        ...;
    };
} & Valid<...>): Pending<...>
A plugin is a scope: `scope("name", table)`. The table holds, by shape: syntax aliases (a string), typed properties (a `-vendor-prop` key with a grammar), kernels, static globals, layers, runtimes, conflicts, token sets and embedded scopes, and the members (`chain`, `args` + `build`, `args` + `value`). A key starting `#` is private. Everything it declares is namespaced by `name`, which is unique in the process (`cssints` and `derived` are reserved).
scope
("ring", {
// a local syntax name: `<width>` in a grammar of this scope (it does not leak into mdn's names) width: "<length [0,∞]> | thin | thick"width: "<length [0,∞]> | thin | thick", // a kernel: global CSS, once. `&` is the class the engine mints for it, `--_w` is the custom property `--ring-w` "#core": { css: "& { outline: var(--_w) solid var(--_c); outline-offset: 2px }"css: "& { outline: var(--_w) solid var(--_c); outline-offset: 2px }", atProperty: "@property --_w { syntax: \"<length>\"; inherits: false; initial-value: 2px; }"atProperty: '@property --_w { syntax: "<length>"; inherits: false; initial-value: 2px; }', requires: ["css.at-rules.property"]requires: ["css.at-rules.property"], }, "#noOutline": { props: ["outline", RegExp]props: ["outline", /^outline-/], message: "ring() sets the outline: use its methods"message: "ring() sets the outline: use its methods" }, // a chain member, like flex(): a call gives the marker and the kernel, each method emits custom properties
ring: {
    readonly uses: readonly ["core", "noOutline"];
    readonly chain: {
        readonly width: {
            readonly args: "<width>";
            readonly spacing: true;
            readonly emit: (v: string) => [string, string][];
        };
        readonly color: {
            readonly args: "<color>";
            readonly emit: (v: string) => [string, string][];
        };
    };
}
ring
: {
uses: readonly ["core", "noOutline"]uses: ["core", "noOutline"],
chain: {
    readonly width: {
        readonly args: "<width>";
        readonly spacing: true;
        readonly emit: (v: string) => [string, string][];
    };
    readonly color: {
        readonly args: "<color>";
        readonly emit: (v: string) => [string, string][];
    };
}
chain
: {
width: {
    readonly args: "<width>";
    readonly spacing: true;
    readonly emit: (v: string) => [string, string][];
}
width
: { args: "<width>"args: "<width>", spacing: truespacing: true, emit: (v: string) => [string, string][]emit: (v: stringv) => [["--_w", v: stringv]] },
color: {
    readonly args: "<color>";
    readonly emit: (v: string) => [string, string][];
}
color
: { args: "<color>"args: "<color>", emit: (v: string) => [string, string][]emit: (v: stringv) => [["--_c", v: stringv]] },
}, }, // a property of your own, typed by its grammar (it is not in mdn-data); the key starts with `-` "-webkit-font-smoothing": "auto | none | antialiased | subpixel-antialiased", // a call member: its function is the entry of the same name in build()
dot: {
    readonly args: "small | large";
}
dot
: { args: "small | large"args: "small | large" },
}) .
Pending<"ring", { readonly width: "<length [0,∞]> | thin | thick"; readonly "#core": { readonly css: "& { outline: var(--_w) solid var(--_c); outline-offset: 2px }"; readonly atProperty: "@property --_w { syntax: \"<length>\"; inherits: false; initial-value: 2px; }"; readonly requires: [...]; }; readonly "#noOutline": { ...; }; readonly ring: { ...; }; readonly "-webkit-font-smoothing": "auto | none | antialiased | subpixel-antialiased"; readonly dot: { ...; }; }>.build(impl: Impl<{
    readonly width: "<length [0,∞]> | thin | thick";
    readonly "#core": {
        readonly css: "& { outline: var(--_w) solid var(--_c); outline-offset: 2px }";
        readonly atProperty: "@property --_w { syntax: \"<length>\"; inherits: false; initial-value: 2px; }";
        readonly requires: ["css.at-rules.property"];
    };
    readonly "#noOutline": {
        readonly props: ["outline", RegExp];
        readonly message: "ring() sets the outline: use its methods";
    };
    readonly ring: {
        readonly uses: readonly ["core", "noOutline"];
        readonly chain: {
            readonly width: {
                readonly args: "<width>";
                readonly spacing: true;
                readonly emit: (v: string) => [...][];
            };
            readonly color: {
                ...;
            };
        };
    };
    readonly "-webkit-font-smoothing": "auto | none | antialiased | subpixel-antialiased";
    readonly dot: {
        ...;
    };
}>): Scope<...>
build
({ dot: (value: string) => Madedot: (size: stringsize) => ({ Made.decls?: Decl[] | undefineddecls: [["--_size", size: stringsize === "small" ? "4px" : "8px"]] }) })
.
Scope<"ring", { readonly width: "<length [0,∞]> | thin | thick"; readonly "#core": { readonly css: "& { outline: var(--_w) solid var(--_c); outline-offset: 2px }"; readonly atProperty: "@property --_w { syntax: \"<length>\"; inherits: false; initial-value: 2px; }"; readonly requires: [...]; }; readonly "#noOutline": { ...; }; readonly ring: { ...; }; readonly "-webkit-font-smoothing": "auto | none | antialiased | subpixel-antialiased"; readonly dot: { ...; }; }>.export(): Members<{
    readonly width: "<length [0,∞]> | thin | thick";
    readonly "#core": {
        readonly css: "& { outline: var(--_w) solid var(--_c); outline-offset: 2px }";
        readonly atProperty: "@property --_w { syntax: \"<length>\"; inherits: false; initial-value: 2px; }";
        readonly requires: ["css.at-rules.property"];
    };
    readonly "#noOutline": {
        readonly props: ["outline", RegExp];
        readonly message: "ring() sets the outline: use its methods";
    };
    readonly ring: {
        readonly uses: readonly ["core", "noOutline"];
        readonly chain: {
            readonly width: {
                readonly args: "<width>";
                readonly spacing: true;
                readonly emit: (v: string) => [...][];
            };
            readonly color: {
                ...;
            };
        };
    };
    readonly "-webkit-font-smoothing": "auto | none | antialiased | subpixel-antialiased";
    readonly dot: {
        ...;
    };
}>
The typed members of the table: `export const { ring } = scope("ring", { ... }).export()`.
export
();
export const const card: Stylecard = function cn(...styles: Style[]): Stylecn(p<readonly [2]>(parts_0: 2): Style
`<'padding-top'>{1,4}`. Chrome 1, Edge 12, Firefox 1, Safari 1, iOS 1, Android 18. [MDN](https://developer.mozilla.org/docs/Web/CSS/padding)
p
(2),
const ring: () => Chain<"ring", {
    readonly width: {
        readonly args: "<width>";
        readonly spacing: true;
        readonly emit: (v: string) => [...][];
    };
    readonly color: {
        ...;
    };
}, Own<...>>
ring
().
width: <readonly ["thin"]>(parts_0: "thin") => Chain<"ring", Omit<{
    readonly width: {
        readonly args: "<width>";
        readonly spacing: true;
        readonly emit: (v: string) => [string, string][];
    };
    readonly color: {
        readonly args: "<color>";
        readonly emit: (v: string) => [string, string][];
    };
}, "width">, Own<{
    readonly width: "<length [0,∞]> | thin | thick";
    readonly "#core": {
        readonly css: "& { outline: var(--_w) solid var(--_c); outline-offset: 2px }";
        readonly atProperty: "@property --_w { syntax: \"<length>\"; inherits: false; initial-value: 2px; }";
        readonly requires: ["css.at-rules.property"];
    };
    readonly "#noOutline": {
        ...;
    };
    readonly ring: {
        ...;
    };
    readonly "-webkit-font-smoothing": "auto | none | antialiased | subpixel-antialiased";
    readonly dot: {
        ...;
    };
}>>
width
("thin").
color: <readonly ["red"]>(parts_0: "red") => Chain<"ring", Omit<Omit<{
    readonly width: {
        readonly args: "<width>";
        readonly spacing: true;
        readonly emit: (v: string) => [string, string][];
    };
    readonly color: {
        readonly args: "<color>";
        readonly emit: (v: string) => [string, string][];
    };
}, "width">, "color">, Own<{
    readonly width: "<length [0,∞]> | thin | thick";
    readonly "#core": {
        readonly css: "& { outline: var(--_w) solid var(--_c); outline-offset: 2px }";
        readonly atProperty: "@property --_w { syntax: \"<length>\"; inherits: false; initial-value: 2px; }";
        readonly requires: [...];
    };
    readonly "#noOutline": {
        ...;
    };
    readonly ring: {
        ...;
    };
    readonly "-webkit-font-smoothing": "auto | none | antialiased | subpixel-antialiased";
    readonly dot: {
        ...;
    };
}>>
color
("red"), const webkitFontSmoothing: <readonly ["antialiased"]>(parts_0: "antialiased") => StylewebkitFontSmoothing("antialiased"), const dot: <readonly ["small"]>(parts_0: "small") => Styledot("small"));
export const const twice: anytwice =
const ring: () => Chain<"ring", {
    readonly width: {
        readonly args: "<width>";
        readonly spacing: true;
        readonly emit: (v: string) => [...][];
    };
    readonly color: {
        ...;
    };
}, Own<...>>
ring
().
width: <readonly ["1px"]>(parts_0: "1px") => Chain<"ring", Omit<{
    readonly width: {
        readonly args: "<width>";
        readonly spacing: true;
        readonly emit: (v: string) => [string, string][];
    };
    readonly color: {
        readonly args: "<color>";
        readonly emit: (v: string) => [string, string][];
    };
}, "width">, Own<{
    readonly width: "<length [0,∞]> | thin | thick";
    readonly "#core": {
        readonly css: "& { outline: var(--_w) solid var(--_c); outline-offset: 2px }";
        readonly atProperty: "@property --_w { syntax: \"<length>\"; inherits: false; initial-value: 2px; }";
        readonly requires: ["css.at-rules.property"];
    };
    readonly "#noOutline": {
        ...;
    };
    readonly ring: {
        ...;
    };
    readonly "-webkit-font-smoothing": "auto | none | antialiased | subpixel-antialiased";
    readonly dot: {
        ...;
    };
}>>
width
("1px").width("2px"); // error: a method is used once
Property 'width' does not exist on type 'Chain<"ring", Omit<{ readonly width: { readonly args: "<width>"; readonly spacing: true; readonly emit: (v: string) => [string, string][]; }; readonly color: { readonly args: "<color>"; readonly emit: (v: string) => [...][]; }; }, "width">, Own<...>>'.
export const
const wrong: Chain<"ring", Omit<{
    readonly width: {
        readonly args: "<width>";
        readonly spacing: true;
        readonly emit: (v: string) => [string, string][];
    };
    readonly color: {
        readonly args: "<color>";
        readonly emit: (v: string) => [string, string][];
    };
}, "width">, Own<{
    readonly width: "<length [0,∞]> | thin | thick";
    readonly "#core": {
        readonly css: "& { outline: var(--_w) solid var(--_c); outline-offset: 2px }";
        readonly atProperty: "@property --_w { syntax: \"<length>\"; inherits: false; initial-value: 2px; }";
        readonly requires: ["css.at-rules.property"];
    };
    readonly "#noOutline": {
        readonly props: [...];
        readonly message: "ring() sets the outline: use its methods";
    };
    readonly ring: {
        ...;
    };
    readonly "-webkit-font-smoothing": "auto | none | antialiased | subpixel-antialiased";
    readonly dot: {
        ...;
    };
}>>
wrong
=
const ring: () => Chain<"ring", {
    readonly width: {
        readonly args: "<width>";
        readonly spacing: true;
        readonly emit: (v: string) => [...][];
    };
    readonly color: {
        ...;
    };
}, Own<...>>
ring
().
width: <readonly ["red"]>(parts_0: "ring.width: unexpected \"red\" in \"red\", grammar [ <length [0,∞]> | thin | thick ]") => Chain<"ring", Omit<{
    readonly width: {
        readonly args: "<width>";
        readonly spacing: true;
        readonly emit: (v: string) => [string, string][];
    };
    readonly color: {
        readonly args: "<color>";
        readonly emit: (v: string) => [string, string][];
    };
}, "width">, Own<{
    readonly width: "<length [0,∞]> | thin | thick";
    readonly "#core": {
        readonly css: "& { outline: var(--_w) solid var(--_c); outline-offset: 2px }";
        readonly atProperty: "@property --_w { syntax: \"<length>\"; inherits: false; initial-value: 2px; }";
        readonly requires: [...];
    };
    readonly "#noOutline": {
        ...;
    };
    readonly ring: {
        ...;
    };
    readonly "-webkit-font-smoothing": "auto | none | antialiased | subpixel-antialiased";
    readonly dot: {
        ...;
    };
}>>
width
("red"); // error: not a width
Argument of type '"red"' is not assignable to parameter of type '"ring.width: unexpected \"red\" in \"red\", grammar [ <length [0,∞]> | thin | thick ]"'.
export const const bad: Stylebad = const webkitFontSmoothing: <readonly ["bold"]>(parts_0: "-webkit-font-smoothing: unexpected \"bold\" in \"bold\", grammar auto | none | antialiased | subpixel-antialiased") => StylewebkitFontSmoothing("bold"); // error: not in the grammar
Argument of type '"bold"' is not assignable to parameter of type '"-webkit-font-smoothing: unexpected \"bold\" in \"bold\", grammar auto | none | antialiased | subpixel-antialiased"'.
export const const no: Styleno = const dot: <readonly ["medium"]>(parts_0: "dot: unexpected \"medium\" in \"medium\", grammar small | large") => Styledot("medium"); // error: not in the grammar
Argument of type '"medium"' is not assignable to parameter of type '"dot: unexpected \"medium\" in \"medium\", grammar small | large"'.
export const const hidden: anyhidden =
const ring: () => Chain<"ring", {
    readonly width: {
        readonly args: "<width>";
        readonly spacing: true;
        readonly emit: (v: string) => [...][];
    };
    readonly color: {
        ...;
    };
}, Own<...>>
ring
().core; // error: no such method
Property 'core' does not exist on type 'Chain<"ring", { readonly width: { readonly args: "<width>"; readonly spacing: true; readonly emit: (v: string) => [string, string][]; }; readonly color: { readonly args: "<color>"; readonly emit: (v: string) => [...][]; }; }, Own<...>>'.
import { function scope<const N extends string, const T extends Table>(name: N, table: T & Valid<N, T>): [CallKeys<T>] extends [never] ? Scope<N, T> : Pending<N, T>
A plugin is a scope: `scope("name", table)`. The table holds, by shape: syntax aliases (a string), typed properties (a `-vendor-prop` key with a grammar), kernels, static globals, layers, runtimes, conflicts, token sets and embedded scopes, and the members (`chain`, `args` + `build`, `args` + `value`). A key starting `#` is private. Everything it declares is namespaced by `name`, which is unique in the process (`cssints` and `derived` are reserved).
scope
} from "cssints/plugin";
// A member that sets tokens in a look: `mode(t, "dark", { color: { bg: "#000" } })` is `[data-mode="dark"] { --color-bg: #000 }` in @layer viewer export const {
const mode: <const P extends readonly [unknown, unknown, unknown]>(...args: P & CheckAll<"mode", Own<{
    readonly layers: {
        readonly layers: readonly ["app", "viewer"];
    };
    readonly mode: {
        readonly args: readonly ["$tokens", "<custom-ident>", "$overrides"];
        readonly uses: readonly ["layers"];
    };
}>, readonly ["$tokens", "<custom-ident>", "$overrides"], P>) => Style
mode
} =
scope<"mode", {
    readonly layers: {
        readonly layers: readonly ["app", "viewer"];
    };
    readonly mode: {
        readonly args: readonly ["$tokens", "<custom-ident>", "$overrides"];
        readonly uses: readonly ["layers"];
    };
}>(name: "mode", table: {
    readonly layers: {
        readonly layers: readonly ["app", "viewer"];
    };
    readonly mode: {
        readonly args: readonly ["$tokens", "<custom-ident>", "$overrides"];
        readonly uses: readonly ["layers"];
    };
} & Valid<"mode", {
    readonly layers: {
        readonly layers: readonly ["app", "viewer"];
    };
    readonly mode: {
        readonly args: readonly ["$tokens", "<custom-ident>", "$overrides"];
        readonly uses: readonly ["layers"];
    };
}>): Pending<...>
A plugin is a scope: `scope("name", table)`. The table holds, by shape: syntax aliases (a string), typed properties (a `-vendor-prop` key with a grammar), kernels, static globals, layers, runtimes, conflicts, token sets and embedded scopes, and the members (`chain`, `args` + `build`, `args` + `value`). A key starting `#` is private. Everything it declares is namespaced by `name`, which is unique in the process (`cssints` and `derived` are reserved).
scope
("mode", {
layers: {
    readonly layers: readonly ["app", "viewer"];
}
layers
: { layers: readonly ["app", "viewer"]layers: ["app", "viewer"] },
mode: {
    readonly args: readonly ["$tokens", "<custom-ident>", "$overrides"];
    readonly uses: readonly ["layers"];
}
mode
: { args: readonly ["$tokens", "<custom-ident>", "$overrides"]args: ["$tokens", "<custom-ident>", "$overrides"], uses: readonly ["layers"]uses: ["layers"] },
}) .
Pending<"mode", { readonly layers: { readonly layers: readonly ["app", "viewer"]; }; readonly mode: { readonly args: readonly ["$tokens", "<custom-ident>", "$overrides"]; readonly uses: readonly ["layers"]; }; }>.build(impl: Impl<{
    readonly layers: {
        readonly layers: readonly ["app", "viewer"];
    };
    readonly mode: {
        readonly args: readonly ["$tokens", "<custom-ident>", "$overrides"];
        readonly uses: readonly ["layers"];
    };
}>): Scope<"mode", {
    readonly layers: {
        readonly layers: readonly ["app", "viewer"];
    };
    readonly mode: {
        readonly args: readonly ["$tokens", "<custom-ident>", "$overrides"];
        readonly uses: readonly ["layers"];
    };
}>
build
({
mode: (args_0: object, args_1: string, args_2: {
    readonly [group: string]: unknown;
}) => Made
mode
: (tokens: objecttokens, name: stringname,
overrides: {
    readonly [group: string]: unknown;
}
overrides
) => ({
Made.themes?: {
    tokens: object;
    overrides: object;
    selector: string;
    layer?: string;
    scope?: string;
}[] | undefined
As `createGlobalTheme(tokens, selector, overrides, { layer, scope })`: registered like any theme.
themes
: [{ tokens: objecttokens, overrides: objectoverrides, selector: stringselector: `[data-mode="${name: stringname}"]`, layer?: string | undefinedlayer: "viewer" }],
}), }) .
Scope<"mode", { readonly layers: { readonly layers: readonly ["app", "viewer"]; }; readonly mode: { readonly args: readonly ["$tokens", "<custom-ident>", "$overrides"]; readonly uses: readonly ["layers"]; }; }>.export(): Members<{
    readonly layers: {
        readonly layers: readonly ["app", "viewer"];
    };
    readonly mode: {
        readonly args: readonly ["$tokens", "<custom-ident>", "$overrides"];
        readonly uses: readonly ["layers"];
    };
}>
The typed members of the table: `export const { ring } = scope("ring", { ... }).export()`.
export
();
import { const cn: (...styles: Style[]) => Stylecn, const paddingLeft: Prop<"padding-left">
`<length-percentage [0,∞]>`. Chrome 1, Edge 12, Firefox 1, Safari 1, iOS 1, Android 18. [MDN](https://developer.mozilla.org/docs/Web/CSS/padding-left)
paddingLeft
} from "cssints" with { type: "cssints" };
import { function scope<const N extends string, const T extends Table>(name: N, table: T & Valid<N, T>): [CallKeys<T>] extends [never] ? Scope<N, T> : Pending<N, T>
A plugin is a scope: `scope("name", table)`. The table holds, by shape: syntax aliases (a string), typed properties (a `-vendor-prop` key with a grammar), kernels, static globals, layers, runtimes, conflicts, token sets and embedded scopes, and the members (`chain`, `args` + `build`, `args` + `value`). A key starting `#` is private. Everything it declares is namespaced by `name`, which is unique in the process (`cssints` and `derived` are reserved).
scope
} from "cssints/plugin";
export const {
const chip: () => Chain<"chip", {
    readonly padding: {
        readonly args: "<length>";
        readonly emit: (v: string) => [string, string][];
    };
}, Own<{
    readonly core: {
        readonly css: (css: Css) => Style[];
    };
    readonly chip: {
        readonly uses: readonly ["core"];
        readonly chain: {
            readonly padding: {
                readonly args: "<length>";
                readonly emit: (v: string) => [string, string][];
            };
        };
    };
}>>
chip
} =
scope<"chip", {
    readonly core: {
        readonly css: (css: Css) => Style[];
    };
    readonly chip: {
        readonly uses: readonly ["core"];
        readonly chain: {
            readonly padding: {
                readonly args: "<length>";
                readonly emit: (v: string) => [string, string][];
            };
        };
    };
}>(name: "chip", table: {
    readonly core: {
        readonly css: (css: Css) => Style[];
    };
    readonly chip: {
        readonly uses: readonly ["core"];
        readonly chain: {
            readonly padding: {
                readonly args: "<length>";
                readonly emit: (v: string) => [string, string][];
            };
        };
    };
} & Valid<"chip", {
    readonly core: {
        readonly css: (css: Css) => Style[];
    };
    readonly chip: {
        readonly uses: readonly ["core"];
        readonly chain: {
            readonly padding: {
                readonly args: "<length>";
                readonly emit: (v: string) => [string, string][];
            };
        };
    };
}>): Scope<...>
A plugin is a scope: `scope("name", table)`. The table holds, by shape: syntax aliases (a string), typed properties (a `-vendor-prop` key with a grammar), kernels, static globals, layers, runtimes, conflicts, token sets and embedded scopes, and the members (`chain`, `args` + `build`, `args` + `value`). A key starting `#` is private. Everything it declares is namespaced by `name`, which is unique in the process (`cssints` and `derived` are reserved).
scope
("chip", {
core: {
    readonly css: (css: Css) => Style[];
}
core
: {
css: (css: Css) => Style[]css: (css: Csscss) => [ css: Csscss.const padding: <readonly ["var(--_p)"]>(parts_0: "var(--_p)") => Style
`<'padding-top'>{1,4}`. Chrome 1, Edge 12, Firefox 1, Safari 1, iOS 1, Android 18. [MDN](https://developer.mozilla.org/docs/Web/CSS/padding)
padding
("var(--_p)"),
css: Csscss.const border: <readonly ["1px solid"]>(parts_0: "1px solid") => Style
`<line-width> || <line-style> || <color>`. Chrome 1, Edge 12, Firefox 1, Safari 1, iOS 1, Android 18. [MDN](https://developer.mozilla.org/docs/Web/CSS/border)
border
("1px solid"),
css: Csscss.const hover: (...styles: Style[]) => Style
Chrome 1, Edge 12, Firefox 1, Safari 2, iOS 1, Android 18. [MDN](https://developer.mozilla.org/docs/Web/CSS/:hover)
hover
(css: Csscss.const opacity: <readonly [0.8]>(parts_0: 0.8) => Style
`<opacity-value>`. Chrome 1, Edge 12, Firefox 1, Safari 2, iOS 1, Android 18. [MDN](https://developer.mozilla.org/docs/Web/CSS/opacity)
opacity
(0.8)),
css: Csscss.
const media: Condition
<"(width >= 40rem)">(query: "(width >= 40rem)") => QueryWrap (+2 overloads)
media
("(width >= 40rem)")(css: Csscss.const padding: <readonly ["1rem"]>(parts_0: "1rem") => Style
`<'padding-top'>{1,4}`. Chrome 1, Edge 12, Firefox 1, Safari 1, iOS 1, Android 18. [MDN](https://developer.mozilla.org/docs/Web/CSS/padding)
padding
("1rem")),
], },
chip: {
    readonly uses: readonly ["core"];
    readonly chain: {
        readonly padding: {
            readonly args: "<length>";
            readonly emit: (v: string) => [string, string][];
        };
    };
}
chip
: { uses: readonly ["core"]uses: ["core"],
chain: {
    readonly padding: {
        readonly args: "<length>";
        readonly emit: (v: string) => [string, string][];
    };
}
chain
: {
padding: {
    readonly args: "<length>";
    readonly emit: (v: string) => [string, string][];
}
padding
: { args: "<length>"args: "<length>", emit: (v: string) => [string, string][]emit: (v: stringv) => [["--_p", v: stringv]] } } },
}).
Scope<"chip", { readonly core: { readonly css: (css: Css) => Style[]; }; readonly chip: { readonly uses: readonly ["core"]; readonly chain: { readonly padding: { readonly args: "<length>"; readonly emit: (v: string) => [string, string][]; }; }; }; }>.export(): Members<{
    readonly core: {
        readonly css: (css: Css) => Style[];
    };
    readonly chip: {
        readonly uses: readonly ["core"];
        readonly chain: {
            readonly padding: {
                readonly args: "<length>";
                readonly emit: (v: string) => [string, string][];
            };
        };
    };
}>
The typed members of the table: `export const { ring } = scope("ring", { ... }).export()`.
export
();
// layer _.k: ._chip-core{border:1px solid;padding:var(--chip-p)} ._chip-core:hover{opacity:0.8} @media (width >= 40rem){._chip-core{padding:1rem}} export const
const a: Chain<"chip", Omit<{
    readonly padding: {
        readonly args: "<length>";
        readonly emit: (v: string) => [string, string][];
    };
}, "padding">, Own<{
    readonly core: {
        readonly css: (css: Css) => Style[];
    };
    readonly chip: {
        readonly uses: readonly ["core"];
        readonly chain: {
            readonly padding: {
                readonly args: "<length>";
                readonly emit: (v: string) => [string, string][];
            };
        };
    };
}>>
a
=
const chip: () => Chain<"chip", {
    readonly padding: {
        readonly args: "<length>";
        readonly emit: (v: string) => [string, string][];
    };
}, Own<{
    readonly core: {
        readonly css: (css: Css) => Style[];
    };
    readonly chip: {
        readonly uses: readonly ["core"];
        readonly chain: {
            readonly padding: {
                readonly args: "<length>";
                readonly emit: (v: string) => [string, string][];
            };
        };
    };
}>>
chip
().
padding: <readonly ["4px"]>(parts_0: "4px") => Chain<"chip", Omit<{
    readonly padding: {
        readonly args: "<length>";
        readonly emit: (v: string) => [string, string][];
    };
}, "padding">, Own<{
    readonly core: {
        readonly css: (css: Css) => Style[];
    };
    readonly chip: {
        readonly uses: readonly ["core"];
        readonly chain: {
            readonly padding: {
                readonly args: "<length>";
                readonly emit: (v: string) => [string, string][];
            };
        };
    };
}>>
padding
("4px");
// build error: cssints: chip: kernel core sets padding, border, opacity (this style also sets padding-left) export const const b: Styleb = function cn(...styles: Style[]): Stylecn(
const chip: () => Chain<"chip", {
    readonly padding: {
        readonly args: "<length>";
        readonly emit: (v: string) => [string, string][];
    };
}, Own<{
    readonly core: {
        readonly css: (css: Css) => Style[];
    };
    readonly chip: {
        readonly uses: readonly ["core"];
        readonly chain: {
            readonly padding: {
                readonly args: "<length>";
                readonly emit: (v: string) => [string, string][];
            };
        };
    };
}>>
chip
(), paddingLeft<readonly ["1px"]>(parts_0: "1px"): Style
`<length-percentage [0,∞]>`. Chrome 1, Edge 12, Firefox 1, Safari 1, iOS 1, Android 18. [MDN](https://developer.mozilla.org/docs/Web/CSS/padding-left)
paddingLeft
("1px"));
import { const cn: (...styles: Style[]) => Stylecn, const flexGrow: Prop<"flex-grow">
`<number [0,∞]>`. Chrome 29, Edge 12, Firefox 20, Safari 9, iOS 9, Android 29. [MDN](https://developer.mozilla.org/docs/Web/CSS/flex-grow)
flexGrow
, const keyframes: (steps: Steps) => Keyframes
`keyframes({ from: opacity(0), to: opacity(1) })`: a `@keyframes` rule named by a hash of its content, in the sheet of the modules that use the name. Each step is checked like a class; no conditions.
keyframes
, const margin: Prop<"margin">
`<'margin-top'>{1,4}`. Chrome 1, Edge 12, Firefox 1, Safari 1, iOS 1, Android 18. [MDN](https://developer.mozilla.org/docs/Web/CSS/margin)
margin
, const opacity: Prop<"opacity">
`<opacity-value>`. Chrome 1, Edge 12, Firefox 1, Safari 2, iOS 1, Android 18. [MDN](https://developer.mozilla.org/docs/Web/CSS/opacity)
opacity
} from "cssints" with { type: "cssints" };
import { function scope<const N extends string, const T extends Table>(name: N, table: T & Valid<N, T>): [CallKeys<T>] extends [never] ? Scope<N, T> : Pending<N, T>
A plugin is a scope: `scope("name", table)`. The table holds, by shape: syntax aliases (a string), typed properties (a `-vendor-prop` key with a grammar), kernels, static globals, layers, runtimes, conflicts, token sets and embedded scopes, and the members (`chain`, `args` + `build`, `args` + `value`). A key starting `#` is private. Everything it declares is namespaced by `name`, which is unique in the process (`cssints` and `derived` are reserved).
scope
} from "cssints/plugin";
const const fade: Keyframesfade = function keyframes(steps: Steps): Keyframes
`keyframes({ from: opacity(0), to: opacity(1) })`: a `@keyframes` rule named by a hash of its content, in the sheet of the modules that use the name. Each step is checked like a class; no conditions.
keyframes
({ Steps.from?: Style | undefinedfrom: opacity<readonly [0]>(parts_0: 0): Style
`<opacity-value>`. Chrome 1, Edge 12, Firefox 1, Safari 2, iOS 1, Android 18. [MDN](https://developer.mozilla.org/docs/Web/CSS/opacity)
opacity
(0) });
export const {
const row: () => Chain<"row", {
    readonly gap: {
        readonly args: "<length>";
        readonly emit: (v: string) => [string, string][];
    };
}, Own<{
    readonly core: {
        readonly css: (css: Css) => Style[];
    };
    readonly row: {
        readonly uses: readonly ["core"];
        readonly chain: {
            readonly gap: {
                readonly args: "<length>";
                readonly emit: (v: string) => [string, string][];
            };
        };
    };
}>>
row
} =
scope<"row", {
    readonly core: {
        readonly css: (css: Css) => Style[];
    };
    readonly row: {
        readonly uses: readonly ["core"];
        readonly chain: {
            readonly gap: {
                readonly args: "<length>";
                readonly emit: (v: string) => [string, string][];
            };
        };
    };
}>(name: "row", table: {
    readonly core: {
        readonly css: (css: Css) => Style[];
    };
    readonly row: {
        readonly uses: readonly ["core"];
        readonly chain: {
            readonly gap: {
                readonly args: "<length>";
                readonly emit: (v: string) => [string, string][];
            };
        };
    };
} & Valid<"row", {
    readonly core: {
        readonly css: (css: Css) => Style[];
    };
    readonly row: {
        readonly uses: readonly ["core"];
        readonly chain: {
            readonly gap: {
                readonly args: "<length>";
                readonly emit: (v: string) => [string, string][];
            };
        };
    };
}>): Scope<...>
A plugin is a scope: `scope("name", table)`. The table holds, by shape: syntax aliases (a string), typed properties (a `-vendor-prop` key with a grammar), kernels, static globals, layers, runtimes, conflicts, token sets and embedded scopes, and the members (`chain`, `args` + `build`, `args` + `value`). A key starting `#` is private. Everything it declares is namespaced by `name`, which is unique in the process (`cssints` and `derived` are reserved).
scope
("row", {
core: {
    readonly css: (css: Css) => Style[];
}
core
: {
css: (css: Css) => Style[]css: (css: Csscss) => [ css: Csscss.
KernelCss.vars: (set: {
    readonly [name: `--${string}`]: string | number | CSSStyleValue;
}) => Style
`vars({ "--_gap": "1rem" })`: custom properties on the element (`--_x` is `--<scope>-x`), values not checked. A `keyframes()` or `positionTry()` name is a value too: its rule goes with the kernel. Not part of derived conflicts.
vars
({ "--_gap": "1rem", "--_fade": const fade: Keyframesfade }),
css: Csscss.const display: <readonly ["flex"]>(parts_0: "flex") => Style
`[ <display-outside> || <display-inside> ] | <display-listitem> | <display-internal> | <display-box> | <display-legacy> | grid-lanes | inline-grid-lanes | <display-outside> || [ <display-inside> | math ]`. Chrome 1, Edge 12, Firefox 1, Safari 1, iOS 1, Android 18. [MDN](https://developer.mozilla.org/docs/Web/CSS/display)
display
("flex"),
css: Csscss.const animation: <readonly ["var(--_fade) 200ms"]>(parts_0: "var(--_fade) 200ms") => Style
`<single-animation>#`. Chrome 43, Edge 12, Firefox 16, Safari 9, iOS 9, Android 43. [MDN](https://developer.mozilla.org/docs/Web/CSS/animation)
animation
("var(--_fade) 200ms"),
css: Csscss.KernelCss.nest: <"& > * + *">(selector: "& > * + *") => Wrap
`nest("& > *")(flexGrow(1))`: styles under a selector around the kernel's class (`._k > *`, `:root:has(._k)`). A condition inside applies to its subject (`& > *:hover`), one around it to the element (`._k:hover > *`, `:root:has(._k:hover)`). One condition. When the subject is another element (`&` not in the last compound), what it sets is not the element's, so a member's derived conflicts leave it out; `.x &` is the element's.
nest
("& > * + *")(css: Csscss.const marginInlineStart: <readonly ["var(--_gap)"]>(parts_0: "var(--_gap)") => Style
`<'margin-top'>`. Chrome 69, Edge 79, Firefox 41, Safari 12.1, iOS 12.2, Android 69. [MDN](https://developer.mozilla.org/docs/Web/CSS/margin-inline-start)
marginInlineStart
("var(--_gap)")),
], },
row: {
    readonly uses: readonly ["core"];
    readonly chain: {
        readonly gap: {
            readonly args: "<length>";
            readonly emit: (v: string) => [string, string][];
        };
    };
}
row
: { uses: readonly ["core"]uses: ["core"],
chain: {
    readonly gap: {
        readonly args: "<length>";
        readonly emit: (v: string) => [string, string][];
    };
}
chain
: {
gap: {
    readonly args: "<length>";
    readonly emit: (v: string) => [string, string][];
}
gap
: { args: "<length>"args: "<length>", emit: (v: string) => [string, string][]emit: (v: stringv) => [["--_gap", v: stringv]] } } },
}).
Scope<"row", { readonly core: { readonly css: (css: Css) => Style[]; }; readonly row: { readonly uses: readonly ["core"]; readonly chain: { readonly gap: { readonly args: "<length>"; readonly emit: (v: string) => [string, string][]; }; }; }; }>.export(): Members<{
    readonly core: {
        readonly css: (css: Css) => Style[];
    };
    readonly row: {
        readonly uses: readonly ["core"];
        readonly chain: {
            readonly gap: {
                readonly args: "<length>";
                readonly emit: (v: string) => [string, string][];
            };
        };
    };
}>
The typed members of the table: `export const { ring } = scope("ring", { ... }).export()`.
export
();
// layer _.k: @keyframes kf-…{from{opacity:0}} ._row-core{animation:var(--row-fade) 200ms;--row-gap:1rem;--row-fade:kf-…;display:flex} ._row-core > * + *{margin-inline-start:var(--row-gap)} export const const a: Stylea = function cn(...styles: Style[]): Stylecn(
const row: () => Chain<"row", {
    readonly gap: {
        readonly args: "<length>";
        readonly emit: (v: string) => [string, string][];
    };
}, Own<{
    readonly core: {
        readonly css: (css: Css) => Style[];
    };
    readonly row: {
        readonly uses: readonly ["core"];
        readonly chain: {
            readonly gap: {
                readonly args: "<length>";
                readonly emit: (v: string) => [string, string][];
            };
        };
    };
}>>
row
().
gap: <readonly ["2rem"]>(parts_0: "2rem") => Chain<"row", Omit<{
    readonly gap: {
        readonly args: "<length>";
        readonly emit: (v: string) => [string, string][];
    };
}, "gap">, Own<{
    readonly core: {
        readonly css: (css: Css) => Style[];
    };
    readonly row: {
        readonly uses: readonly ["core"];
        readonly chain: {
            readonly gap: {
                readonly args: "<length>";
                readonly emit: (v: string) => [string, string][];
            };
        };
    };
}>>
gap
("2rem"), margin<readonly [0]>(parts_0: 0): Style
`<'margin-top'>{1,4}`. Chrome 1, Edge 12, Firefox 1, Safari 1, iOS 1, Android 18. [MDN](https://developer.mozilla.org/docs/Web/CSS/margin)
margin
(0), flexGrow<readonly [1]>(parts_0: 1): Style
`<number [0,∞]>`. Chrome 29, Edge 12, Firefox 20, Safari 9, iOS 9, Android 29. [MDN](https://developer.mozilla.org/docs/Web/CSS/flex-grow)
flexGrow
(1)); // fine: the margin is the children's
import { 
const attr: {
    <const N extends string>(name: Name<N>): StateWrap;
    <const N extends string>(name: Name<N>, value: string, op?: AttrOp): StateWrap;
}
`attr("aria-current", "page")(color(...))` is `._x[aria-current="page"]`; no value is `[disabled]`. The value is quoted for you. `op` is how the value is compared: `=` (default), `~=` (a word), `|=`, `^=`, `$=`, `*=`. One condition.
attr
, const cn: (...styles: Style[]) => Stylecn, const color: Prop<"color">
`<color>`. Chrome 1, Edge 12, Firefox 1, Safari 1, iOS 1, Android 18. [MDN](https://developer.mozilla.org/docs/Web/CSS/color)
color
, const container: Condition<"container", QueryWrap>container, type
type Style = string & {
    readonly __cssints: "style";
}
What every member returns: a class string. It is a string (`className`, `cx`), but only members make one.
Style
, const within: <const N extends string = never>(state: StateWrap, name?: Name<N>) => Wrap
`within(hover)(color("red"))` is the style while a marked ancestor is hovered: `:where(._g:hover) ._x`, one class of specificity, one condition. `within(hover, "row")` reads the `group("row")` ancestor.
within
} from "cssints" with { type: "cssints" };
import { const lacking: (...keys: BcdKey[]) => string[]
The build's targets that lack one of the BCD keys, as browserslist names them (`["firefox 140"]`), by the rules of the support warnings (`partial_implementation` lacks); empty when every target has them all. Build time, like `scope()`.
lacking
} from "cssints/plugin";
const const old: booleanold = function lacking(...keys: BcdKey[]): string[]
The build's targets that lack one of the BCD keys, as browserslist names them (`["firefox 140"]`), by the rules of the support warnings (`partial_implementation` lacks); empty when every target has them all. Build time, like `scope()`.
lacking
("css.at-rules.container.scroll-state_queries").Array<string>.length: number
Gets or sets the length of the array. This is a number one higher than the highest index in the array.
length
> 0; // ["firefox 140"] or []
export const const stuck: (...styles: Style[]) => Stylestuck = (...styles: Style[]styles:
type Style = string & {
    readonly __cssints: "style";
}
What every member returns: a class string. It is a string (`className`, `cx`), but only members make one.
Style
[]) =>
function cn(...styles: Style[]): Stylecn( container<"scroll-state(stuck: top)">(query: "scroll-state(stuck: top)"): QueryWrap (+2 overloads)container("scroll-state(stuck: top)")(...styles: Style[]styles), ...(const old: booleanold ? [within<"stuck">(state: StateWrap, name?: "stuck" | undefined): Wrap
`within(hover)(color("red"))` is the style while a marked ancestor is hovered: `:where(._g:hover) ._x`, one class of specificity, one condition. `within(hover, "row")` reads the `group("row")` ancestor.
within
(attr<"data-stuck">(name: "data-stuck", value: string, op?: AttrOp): StateWrap (+1 overload)
`attr("aria-current", "page")(color(...))` is `._x[aria-current="page"]`; no value is `[disabled]`. The value is quoted for you. `op` is how the value is compared: `=` (default), `~=` (a word), `|=`, `^=`, `$=`, `*=`. One condition.
attr
("data-stuck", "top", "~="), "stuck")(...styles: Style[]styles)] : []),
); export const const title: Styletitle = const stuck: (...styles: Style[]) => Stylestuck(color<readonly ["red"]>(parts_0: "red"): Style
`<color>`. Chrome 1, Edge 12, Firefox 1, Safari 1, iOS 1, Android 18. [MDN](https://developer.mozilla.org/docs/Web/CSS/color)
color
("red"));
import { 
function readFileSync(path: PathOrFileDescriptor, options?: {
    encoding?: null | undefined;
    flag?: string | undefined;
} | null): NonSharedBuffer (+2 overloads)
Returns the contents of the `path`. For detailed information, see the documentation of the asynchronous version of this API: {@link readFile } . If the `encoding` option is specified then this function returns a string. Otherwise it returns a buffer. Similar to {@link readFile } , when the path is a directory, the behavior of `fs.readFileSync()` is platform-specific. ```js import { readFileSync } from 'node:fs'; // macOS, Linux, and Windows readFileSync('<directory>'); // => [Error: EISDIR: illegal operation on a directory, read <directory>] // FreeBSD readFileSync('<directory>'); // => <data> ```
@sincev0.1.8@parampath filename or file descriptor
readFileSync
} from "node:fs";
import { const color: Prop<"color">
`<color>`. Chrome 1, Edge 12, Firefox 1, Safari 1, iOS 1, Android 18. [MDN](https://developer.mozilla.org/docs/Web/CSS/color)
color
} from "cssints" with { type: "cssints" };
import { const dependsOn: (path: string) => void
Tells the engine that the module being evaluated read the file at `path` (relative to the working directory): in dev, an edit of the file runs that module again, as an edit of a module it imports does; in `vite build --watch`, it is a watched file. Build time, like `scope()`: in a member's functions or in the plugin's own.
dependsOn
} from "cssints/plugin";
export const const swatch: (file: string) => Styleswatch = (file: stringfile: string) => { function dependsOn(path: string): void
Tells the engine that the module being evaluated read the file at `path` (relative to the working directory): in dev, an edit of the file runs that module again, as an edit of a module it imports does; in `vite build --watch`, it is a watched file. Build time, like `scope()`: in a member's functions or in the plugin's own.
dependsOn
(file: stringfile);
return color<readonly [string]>(parts_0: string): Style
`<color>`. Chrome 1, Edge 12, Firefox 1, Safari 1, iOS 1, Android 18. [MDN](https://developer.mozilla.org/docs/Web/CSS/color)
color
(
function readFileSync(path: PathOrFileDescriptor, options: {
    encoding: BufferEncoding;
    flag?: string | undefined;
} | BufferEncoding): string (+2 overloads)
Synchronously reads the entire contents of a file.
@parampath A path to a file. If a URL is provided, it must use the `file:` protocol. If a file descriptor is provided, the underlying file will _not_ be closed automatically.@paramoptions Either the encoding for the result, or an object that contains the encoding and an optional flag. If a flag is not provided, it defaults to `'r'`.
readFileSync
(file: stringfile, "utf8").String.trim(): string
Removes the leading and trailing white space and line terminator characters from a string.
trim
());
};

A dependency is a file, not a directory: a file added to a directory is not seen. Vite's watcher skips node_modules, so a file there (a collection of @iconify-json, @fontsource) is not watched. An evaluation that fails records nothing: after a build error, edit the module or reload.