Flicker.Components.Search (Flicker v0.1.0)

Copy Markdown View Source

The internal Phoenix.LiveComponent behind Flicker.search/1 (Spec 003).

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

Unlike Flicker.Components.Select, this component has no selection semantics and never lists/fetches records itself: it owns only the typed text, classifies the cursor position on every keystroke via Flicker.CursorContext, and drives a suggestion dropdown off Flicker.FacetSuggest — facet-key suggestions, an enum facet's value picklist, or a relationship facet's nested actor-scoped record search. Every keystroke re-parses the full text (Flicker.Query.parse/2) and sends {on_change, query, filter} to the host — the host owns what it does with the composed query (drive a Cinder table, a stream, its own list).

The .FlickerSearchNav colocated hook reports the input's real selectionStart on every keyup/click/select (Spec 003's cursor-tracking follow-up, now closed) — the cursor assign carries it (nil before the hook's first event, or after this component sets the text itself, falling back to end-of-text per Flicker.FacetSuggest.classify/3), so a cursor moved back into an already-typed token classifies right there, not "at the end".