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): 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.
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
/**
* Serialize the pack to a `:root { … }` (+ `.dark { … }`) 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 (the `.dark` block). */
dark?: 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.