aihu CSS engine — Tailwind v4 hard fork with WC-native scoped output.
anchorFallbackfunction anchorFallback( anchor: Element, floating: HTMLElement, opts: PositionOptions = {}, ): () => voidFallback for the `anchor:` feature: position `floating` against `anchor` with JS when native CSS anchor positioning is unsupported.
cnfunction cn(...inputs: ClassValue[]): stringMerge class values, resolving last-wins conflicts per property group.
compilefunction compile(classes: string[]): stringcompileSfcfunction compileSfc(source: string, id?: string, lightScopeId?: string): stringCompile a `.aihu` SFC source string to scoped, shadow-DOM-embedded CSS.
defineStylePackfunction defineStylePack(input: StylePackInput): StylePackDefine a style pack from a token map.
isUsableExecutablefunction isUsableExecutable(candidate: string): booleanWhether `candidate` is a usable `aihu-css-compile` executable — NOT merely a present file.
popoverFallbackfunction popoverFallback( anchor: Element, panel: HTMLElement, opts: PositionOptions = {}, ): () => voidFallback for the `popover:` feature: emulate the Popover API's top layer by portaling `panel` out of the normal flow and positioning it against `anchor` with the SHARED positioning shim (`position`, also used by `anchorFallback`).
portalfunction portal(el: HTMLElement): () => voidPortal `el` to a top-layer-emulating container appended to `<body>` with a high z-index.
positionfunction position( anchor: Element, floating: HTMLElement, opts: PositionOptions = {}, ): PlacementPosition `floating` against `anchor` and apply `position: fixed; left/top`.
aihuDefaultconst aihuDefault: StylePack`aihu-default` — the aihu brand palette (warm paper + ink, accent `#c8543a`), derived from `aihu-logo.html` / `aihu-wordmark.svg`.
aihuGraphiteconst aihuGraphite: StylePack`aihu-graphite` — a neutral monochrome ramp expressed in `oklch()` (chroma ≈ 0).
builtinPacksconst builtinPacks: Record<string, StylePack>All built-in packs, keyed by name — handy for registry/iteration.
DARK_SELECTORconst DARK_SELECTORThe selector the dark overrides are emitted under.
PositionOptionsinterface PositionOptions {
/** Preferred side. Default `'bottom'`. */
placement?: Placement
/** Gap between anchor and floating element, in px. Default `4`. */
offset?: number
/** Flip to the opposite side if it would overflow the viewport. Default `true`. */
flip?: boolean
}StylePackinterface StylePack {
readonly name: string
readonly tokens: TokenMap
readonly dark: TokenMap
/** Named themes, keyed by theme name. Empty when the pack declares none. */
readonly themes: Record<string, TokenMap>
/** The named themes this pack offers, in declaration order. */
readonly themeNames: readonly string[]
/**
* Serialize the pack to a `:root { … }` (+ dark, + named-theme) CSS string —
* the same shape as the shipped `styles/*.css` bundles.
*/
toCss(): string
}A registered, validated style-pack descriptor.
StylePackInputinterface StylePackInput {
/** Pack name, e.g. `'acme'` (used for registration / debugging). */
name: string
/** Light-theme tokens (the `:root` block). Names without the `--` prefix. */
tokens: TokenMap
/**
* Optional dark-theme overrides. Emitted under {@link DARK_SELECTOR} — i.e.
* both `.dark` and `[data-theme="dark"]`.
*/
dark?: TokenMap
/**
* Optional named themes, each emitted as its own `[data-theme="<name>"]`
* block. This is the dimension a swappable theme catalog (daisyUI's `light`/
* `cupcake`/`dracula`/… set) transcribes into.
*
* Each entry is an OVERRIDE layer over `tokens`, not a standalone theme: only
* the names that differ from the base need listing, exactly as `dark` works
* today. A theme is selected by putting `data-theme="<name>"` on an ancestor
* (per Founder-decision #3, `<html>`).
*
* `'dark'` is reserved — use the `dark` field, which is dual-keyed.
*/
themes?: Record<string, TokenMap>
}ClassValuetype ClassValue = string | number | null | undefined | false | ClassValue[]A class value: string, falsy (dropped), or a nested array of the same.
Placementtype Placement = 'top' | 'bottom' | 'left' | 'right'Where to place the floating element relative to its anchor.
TokenMaptype TokenMap = Record<string, string>A design-token map: `name` → CSS value.