mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-19 01:32:19 +00:00
Wire Context into the shell
The shell connects the layer store that Context and the omnibar share, installs the click-to-Context bridge and removes both on dispose. Voice sessions hand their command runner to the same store, and the stylesheet imports the Context styles. Co-authored-by: Sameh Khamis <[email protected]>
This commit is contained in:
1 parent
0fe6fd2bb8
commit
c351e66af9
4 files changed
+64
No files matched your search
@@ -0,0 +1,33 @@
|
||||
import { defineStore } from 'pinia';
|
||||
import { markRaw, shallowRef } from 'vue';
|
||||
|
||||
/**
|
||||
* The top-bar omnibar's link to the shell. The shell connects the actions
|
||||
* the omnibar offers: `layers()` lists the data layers as `{id, name,
|
||||
* enabled}`, and `setLayer(id, enabled)` turns one on or off as a user click
|
||||
* would. Place search runs through the location controls and Ask GEV through
|
||||
* the voice controls, so neither is repeated here.
|
||||
*/
|
||||
export const useOmnibarStore = defineStore('gev-omnibar', () => {
|
||||
/** `{layers(), setLayer(id, enabled)}`, or null while disconnected. */
|
||||
const controls = shallowRef(null);
|
||||
|
||||
/** @param {?object} next The shell's omnibar actions, or null. */
|
||||
function connect(next) {
|
||||
controls.value = next && markRaw(next);
|
||||
}
|
||||
|
||||
/**
|
||||
* The voice action runner, `(name, args) → Promise<result>`: the same
|
||||
* actions voice and chat call, run directly without a model. Null while no
|
||||
* voice runtime is up.
|
||||
*/
|
||||
const runner = shallowRef(null);
|
||||
|
||||
/** @param {?Function} next The runner, or null to disconnect. */
|
||||
function connectRunner(next) {
|
||||
runner.value = next ? markRaw(next) : null;
|
||||
}
|
||||
|
||||
return { controls, connect, runner, connectRunner };
|
||||
});
|
||||
Reference in new issue
Block a user