Mixins / foldkit-mixins-ui

TreeViewSlots

const · packages/mixins-ui/src/treeView.ts:28

const TreeViewSlots: Slots.Contract<{ readonly root: Slot.UnnamedSlot<Capability.Capability<"Container", readonly [Capability.Capability<"Interactive", readonly [Capability.Capability<"Base", readonly []>]>]>, readonly [Event.EventToken<"keydown">], readonly [Attr.AttrToken<"role">, Attr.AttrToken<"aria-label">], readonly Slot.RequirementName[], boolean>; readonly item: Slot.UnnamedSlot<Capability.Capability<"Focusable", readonly [Capability.Capability<"Interactive", readonly [Capability.Capability<"Base", readonly []>]>]>, readonly [Event.EventToken<"focus">], readonly [Attr.AttrToken<"role">, Attr.AttrToken<"aria-expanded">, Attr.AttrToken<"aria-selected">, Attr.AttrToken<"aria-disabled">], readonly Slot.RequirementName[], boolean>; readonly row: Slot.UnnamedSlot<Capability.Capability<"Interactive", readonly [Capability.Capability<"Base", readonly []>]>, readonly [Event.EventToken<"click">], readonly Slot.AttributeName[], readonly Slot.RequirementName[], boolean>; readonly chevron: Slot.UnnamedSlot<Capability.Capability<"Container", readonly [Capability.Capability<"Interactive", readonly [Capability.Capability<"Base", readonly []>]>]>, readonly Slot.EventName[], readonly Slot.AttributeName[], readonly Slot.RequirementName[], boolean>; readonly label: Slot.UnnamedSlot<Capability.Capability<"Container", readonly [Capability.Capability<"Interactive", readonly [Capability.Capability<"Base", readonly []>]>]>, readonly Slot.EventName[], readonly Slot.AttributeName[], readonly Slot.RequirementName[],  …;

A tree view, the APG's and Zag's: nested rows that open and shut, one tab stop, Up and Down through the rows showing, Right to open a row or step into it, Left to shut it or step out, Home and End, Enter and Space to choose a row (and open or shut it, if it holds rows), and a printed character to the next showing row that starts with it. The keys are TreeNavigation's, decided in update against this Model, so keys faster than a frame still move on. The current, open and chosen rows are this Model, which the application keeps and folds with update(nodes).

Each row is an item (the treeitem, which takes focus) holding a row (the line drawn and clicked) and, when it holds rows, a group. The item carries its depth as --fk-tree-level and data-state open or closed; a shut group stays drawn, inert, so it can animate shut.