Overview of Lightbox Component Architecture
mainThe Lightbox component is a modular media viewer composed of several specialized sub-components. It supports View Transitions (VT), keyboard navigation, and a dialog-based modal structure.
Core File Inventory:
lightbox.ts: Public API surface (barrel export).index.ts: Re-exports the components under theLightboxnamespace.lightbox-root.tsx: The state provider that orchestrates opening/closing and View Transition morph logic.lightbox-content.tsx: Renders the native<dialog>modal, handles keyboard navigation, and backdrop clicks.lightbox-item.tsx: Represents individual media items with lazy rendering and caption support.lightbox-item-group.tsx: Container for items that manages the preload window and direction tracking.lightbox-trigger.tsx: The button used to open the lightbox for a specific index.lightbox-close.tsx,lightbox-previous.tsx,lightbox-next.tsx: Navigation and dismissal controls.lightbox-counter.tsx: Displays the current position (e.g., "1 / 12") usingaria-live.lightbox-caption.tsx: Displays the caption for the currently active item.lightbox-thumbnail-group.tsx: A tablist container for thumbnail navigation using roving tabindex.