6.2 KiB
6.2 KiB
phase, plan, subsystem, tags, requires, provides, affects, tech-stack, key-files, decisions, metrics
| phase | plan | subsystem | tags | requires | provides | affects | tech-stack | key-files | decisions | metrics | |||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 02.1 | 06 | ui-search |
|
|
|
|
|
|
|
|
Phase 02.1 Plan 06: Search Foundation Summary
Per-tab Search ViewModels (Recipes + Pantry) with locked SearchState shape and SearchPill composable rendering a 44dp inline GlassSurface pill — search affordance functional before catalog data exists (UI-10).
What Was Built
SearchState(isOpen, query)data class +SearchSourceplaceholder interface inui.screens.recipes.RecipesSearchViewModelandPantrySearchViewModel: identical 4-action API (open,close,onQueryChange,clear).close()clears query (D-08);clear()preservesisOpen(D-07). Both accept nullablesearchSource: SearchSource? = nullfor Phase 5/8 dependency injection without VM refactor.SearchPill: 44dp-height pill onGlassSurface(cornerRadius = 22.dp), leading search icon +BasicTextFieldquery input + conditional clear button (visible only whenquery.isNotEmpty()) + always-visible close button. A11y descriptions resolved fromsearch_clear_a11y/search_close_a11y.- Replaced
@Ignorestubs inRecipesSearchViewModelTest(5 cases — V-05 + V-06 + edge cases) andPantrySearchViewModelTest(3 cases — V-07 parity).
Output Spec Answers
- Compose Unstyled TextField vs BasicTextField: Used
BasicTextFieldfromcompose-foundation. It is renderless, already on the classpath, and provides the IME/a11y plumbing the pill needs. Compose UnstyledTextFieldwould have added a dependency surface for no gain in this phase. - Resource keys:
search_clear_a11yandsearch_close_a11ywere both present incomposeResources/values/strings.xmlfrom plan 02.1-04 before SearchPill compilation (verified viagrep -creturning 2). - SearchSource placement: Declared in
ui.screens.recipesas planned. PantrySearchViewModel imports it (alongsideSearchState) to keep a single canonical shape. - AppShell handoff (02.1-05): AppShell from plan 02.1-05 was already shipped before this plan; on inspection it stubs the search affordance internally. AppShell will be rewired to consume this plan's
SearchPill+ per-tab Search ViewModels in plan 02.1-08 (ShellModule wiring) — that's the natural integration point because Koin registration of the new VMs happens there. No regression: SearchPill + VMs are pure additions; nothing in AppShell breaks.
Verification
./gradlew :composeApp:compileKotlinIosSimulatorArm64 -q→ exit 0../gradlew :composeApp:iosSimulatorArm64Test --tests "...RecipesSearchViewModelTest" --tests "...PantrySearchViewModelTest" -q→ exit 0; all 8 cases pass.- Material 3 boundary: 0
androidx.compose.material3imports across the 3 new commonMain files. - Liquid / Haze imports: 0 across the new search package and search VMs.
Deviations from Plan
None substantive. Two minor cosmetic deviations:
- The plan's example code referenced an internal helper named
BasicTextWithStyledefined to callBasicText. Renamed toPlaceholderTextand importedBasicTextdirectly at top-level for cleaner reading — semantics unchanged. - The plan's import list included
KeyboardOptions,KeyboardCapitalization, andImeAction, but the spec'd implementation does not actually use them (nokeyboardOptions = ...argument is set onBasicTextField). Omitted to keep the import list honest. If future work configures the keyboard explicitly, those imports come back.
Self-Check: PASSED
Verified files and commits exist:
- composeApp/src/commonMain/kotlin/dev/ulfrx/recipe/ui/screens/recipes/RecipesSearchViewModel.kt — FOUND
- composeApp/src/commonMain/kotlin/dev/ulfrx/recipe/ui/screens/pantry/PantrySearchViewModel.kt — FOUND
- composeApp/src/commonMain/kotlin/dev/ulfrx/recipe/ui/components/search/SearchPill.kt — FOUND
- composeApp/src/commonTest/kotlin/dev/ulfrx/recipe/ui/screens/recipes/RecipesSearchViewModelTest.kt — FOUND (no @Ignore)
- composeApp/src/commonTest/kotlin/dev/ulfrx/recipe/ui/screens/pantry/PantrySearchViewModelTest.kt — FOUND (no @Ignore)
Commits:
- d40aeef feat(02.1-06): add per-tab search ViewModels
- 9c193d7 feat(02.1-06): add SearchPill inline search input
- b8100cb test(02.1-06): assert search VM state-machine semantics