Mixins / Inside-out composition

Structural and rendered accessibility checks

A11y.pattern verifies that a component's Slots satisfy structural accessibility requirements purely from data:

ts
import { A11y } from 'foldkit-mixins'

const DialogPattern = A11y.pattern({
  trigger: { capability: Capability.Interactive, events: [Event.Click] },
  content: { capability: Capability.Container },
})

A11y.validate(DialogPattern, DialogSlots)

Patterns can also declare obligations (A11y.Navigation, A11y.FocusStrategy, A11y.Activation, A11y.State(attr), A11y.Name) satisfied by Behaviors, A11y.base, A11y.native, or A11y.delegated. Adding A11y.conform(pattern) checks at compile time and module load (a11y:unsatisfied-obligation) that every obligation has a supplier.

To verify real DOM behavior—focus movement, keyboard interaction, and Chromium's accessibility tree—run Conformance scenarios (listbox, tree, dialog, tabs, checkbox) from foldkit-mixins/testing. See Obligations and Conformance.

Compiling Style rules as data

Rule-based Style (Style.pseudo, media, supports, container, nest) hashes deterministic rule trees into stable class names, producing identical CSS on server and browser without runtime collectors. Collect and deduplicate all rules into your app stylesheet with Style.stylesheet(...). Dynamic styles choose among static pieces via Style.whenInput so rule graphs stay finite.

Introspecting Slots and Mixins

Slots.describe, Slot.describe, and SlotView.describe(view) export serializable metadata listing every slot, attachment, requirement, and provided obligation—useful for tests, DevTools, and generated documentation—while resolver conflicts emit structured diagnostic codes.

Limits

  • Customization attaches only to published Slots; internal markup stays encapsulated.
  • Behaviors attach DOM attributes and mounts; persistent state belongs in your Model or a foldkit-primitives Bundle.
  • Your application installs the stylesheet generated by Style.stylesheet(...).
  • Components without a render/attribute seam cannot be adapted without adding Slots.
  • A11y.validate and A11y.conform check declared contracts; use Conformance browser tests to verify rendered accessibility behavior (neither constitutes legal WCAG certification).

Next