Flicker.Components.Palette (Flicker v0.1.0)

Copy Markdown View Source

The internal Phoenix.LiveComponent behind Flicker.palette/1 (Spec 008).

This module is not part of the public API — hosts never reference it directly. Flicker.palette/1 is the only supported entry point.

This is deliberately thin: overlay chrome (backdrop, panel, footer, focus trap, scroll lock, Escape-to-close, and the mod+k keyboard-activation open/close toggle) plus one nested Flicker.Components.Select — the exact same core Flicker.select/1 runs — in controlled mode with navigate_on_select: true. Nothing here duplicates or forks the search behaviour; the seam is entirely at this wrapper.

Open/close state

open is host-controlled (Flicker.palette/1's open attr) but the component also has to open/close itself on the mod+k chord and on Escape/backdrop-click, with no server round trip to the host in between. It reconciles the two with a simple edge-detected sync: the host's open value is adopted whenever it changes between renders (so a navbar button toggling it always wins), while in between host renders the component is free to flip its own panel_open in response to the chord/Escape/backdrop — and always tells the host about it via on_close so host-side state doesn't drift.