Mixins / foldkit-mixins-ui

CarouselSlots

const · packages/mixins-ui/src/carousel.ts:35

const CarouselSlots: Slots.Contract<{ readonly root: Slot.UnnamedSlot<Capability.Capability<"Container", readonly [Capability.Capability<"Interactive", readonly [Capability.Capability<"Base", readonly []>]>]>, readonly [Event.EventToken<"hover">, Event.EventToken<"focus">], readonly [Attr.AttrToken<"role">, Attr.AttrToken<"aria-label">], readonly Slot.RequirementName[], boolean>; readonly rotation: Slot.UnnamedSlot<Capability.Capability<"Interactive", readonly [Capability.Capability<"Base", readonly []>]>, readonly [Event.EventToken<"click">], readonly [Attr.AttrToken<"aria-label">], readonly Slot.RequirementName[], boolean>; readonly track: 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 slide: Slot.UnnamedSlot<Capability.Capability<"Container", readonly [Capability.Capability<"Interactive", readonly [Capability.Capability<"Base", readonly []>]>]>, readonly Slot.EventName[], readonly [Attr.AttrToken<"role">, Attr.AttrToken<"aria-label">], readonly Slot.RequirementName[], boolean>; readonly controls: 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 previous: Slot.Unna …;

A carousel, the APG's: a group with aria-roledescription="carousel" named by its label, each slide a group with aria-roledescription="slide" named "2 of 5", previous and next buttons, and a picker of a dot (or a thumbnail) per place the track can rest. The track is a CSS scroll-snap scroller, so a swipe or a trackpad moves it natively, and ScrollSettle reports where it came to rest.

button, dot, swipe, timer -> Message -> update -> index -> ShowSlide -> track

The current slide, and whether it rotates, are this Model, which the application keeps and folds with update({ count }). Started with autoplay, it moves on every delay: a pointer over it pauses it, focus arriving by the keys stops it (the APG's rule), and the rotation button, first in the tab order, stops and starts it. The current dot fills as the delay runs. A polite status says the slide shown once it changes, and is quiet while the carousel rotates.