mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 16:22:20 +00:00
LocationControls presents whether the search field is open and whether a lookup runs, and the dock renders its expanded and searching classes and calls toggleSearch(). The lookup, the navigation's settle, Escape and the location tray's collapse reach the field through the controls (setSearching, settleSearch, closeSearch) instead of writing its classes. LocationControls no longer takes searchToggle, LocationSearch takes setSearching and NavigationController takes settleSearch in place of searchInput.
30 lines
1.0 KiB
JavaScript
30 lines
1.0 KiB
JavaScript
import { defineStore } from 'pinia';
|
|
import { markRaw, shallowRef } from 'vue';
|
|
|
|
/**
|
|
* The dock's location tray as its view renders it. LocationControls
|
|
* presents the city pills, the landmark row, the mini status, the search
|
|
* error, the search field's open and searching state and the ORBIT indicator
|
|
* and publishes them here; it keeps the search field's key, input and blur
|
|
* listeners.
|
|
*/
|
|
export const useLocationStore = defineStore('gev-location', () => {
|
|
/** The presented tray; null until the controls first render. */
|
|
const view = shallowRef(null);
|
|
|
|
/** @param {?object} next A fresh presentation; every publish re-renders. */
|
|
function publish(next) {
|
|
view.value = next && markRaw(next);
|
|
}
|
|
|
|
/** The controls whose `chooseCity(id)` and `choosePoi(index)` pills call. */
|
|
const controls = shallowRef(null);
|
|
|
|
/** @param {?object} next The location controls, or null to disconnect. */
|
|
function connect(next) {
|
|
controls.value = next && markRaw(next);
|
|
}
|
|
|
|
return { view, publish, controls, connect };
|
|
});
|