mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 08:12:24 +00:00
initKeySetup keeps the setup requests, the ChatGPT OAuth flow, the pasted field values and the dialog's keyboard, and publishes the POWER UP chip, the dialog, its key rows and the status line to the gev-provider-settings store. ProviderSettingsView renders them and sends clicks and typing to the connected owner; in Cyber the chip is teleported into the top toolbar. A successful save renders the rows afresh so no field keeps a key, and the status line announces a repeated message again. The voice action opens and closes the dialog through the same controls.
32 lines
1.0 KiB
JavaScript
32 lines
1.0 KiB
JavaScript
import { defineStore } from 'pinia';
|
|
import { markRaw, shallowRef } from 'vue';
|
|
|
|
/**
|
|
* Provider Settings (the dev-only key setup) as its view renders it. The
|
|
* setup owner (src/keySetup.js) presents the POWER UP chip, the dialog, its
|
|
* key rows, the field values and the status line, and publishes them here;
|
|
* the view sends clicks and typing to the connected owner.
|
|
*/
|
|
export const useProviderSettingsStore = defineStore(
|
|
'gev-provider-settings',
|
|
() => {
|
|
/** The presented setup; null until the owner first publishes. */
|
|
const view = shallowRef(null);
|
|
|
|
/** @param {?object} next A fresh presentation; every publish re-renders. */
|
|
function publish(next) {
|
|
view.value = next && markRaw(next);
|
|
}
|
|
|
|
/** The setup owner the controls call, or null while none is wired. */
|
|
const controls = shallowRef(null);
|
|
|
|
/** @param {?object} next The owner, or null to disconnect. */
|
|
function connect(next) {
|
|
controls.value = next && markRaw(next);
|
|
}
|
|
|
|
return { view, publish, controls, connect };
|
|
},
|
|
);
|