Mixins / foldkit-mixins
Slots: the public contract
A slot is metadata, not a DOM node:
ts
Slot.make({
capability: Capability.TextInput,
events: [Event.Input],
attributes: [Attr.AriaInvalid],
hidden: false,
protected: { events: [Event.Click], attributes: [Attr.Role], style: ['position'] },
})- Capability describes structural compatibility. The built-in hierarchy is
Base → Interactive → { Container, Focusable → TextInput, Draggable }, plusBase → Collection. A behavior that requiresInteractivemay attach to aTextInput. Extend it withCapability.make(name, { extends }). - Event and Attr are branded metadata tokens.
Event.makeandAttr.makeadd custom ones; declaring them does not install handlers. - Requirement tokens name platform needs such as
Keyboard,PointerandClipboardfor tooling to inspect. hiddenreserves an internal extension point: public Style and Behavior specs do not even offer that key.protectedkeeps structural events, attributes or style properties from being replaced by an attachment.
Names come from the keys passed to Slots.define; they are never repeated inside each slot.