mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 08:12:24 +00:00
feat(ui): render the language picker as a Vue component
LocalePicker renders the existing picker model with the same markup and listbox behaviour; ProviderSettingsView shows it while the shell publishes the active language and its choice handler to the gev-locale store. A host passing localePicker: false publishes nothing. A choice reaches the shell after the list is closed on screen, and every opening keeps the active option in view.
This commit is contained in:
1 parent
5bf797ef71
commit
6cb01ff975
9 files changed
+627
-335
No files matched your search
@@ -0,0 +1,19 @@
|
||||
import { defineStore } from 'pinia';
|
||||
import { markRaw, shallowRef } from 'vue';
|
||||
|
||||
/**
|
||||
* The interface language picker as its view renders it. The shell publishes
|
||||
* the active language and what a choice does once it decides to show the
|
||||
* picker; a host that does not initialize Core's locale never does.
|
||||
*/
|
||||
export const useLocaleStore = defineStore('gev-locale', () => {
|
||||
/** `{current, onSelect}`, or null while no picker is shown. */
|
||||
const picker = shallowRef(null);
|
||||
|
||||
/** @param {?{current: string, onSelect: (locale: string) => void}} next */
|
||||
function publishPicker(next) {
|
||||
picker.value = next && markRaw(next);
|
||||
}
|
||||
|
||||
return { picker, publishPicker };
|
||||
});
|
||||
Reference in new issue
Block a user