feat(voice): render the voice control from a presenter

createVoiceControl now returns a presenter instead of building the
control with innerHTML: the session, cost, input, card and panel owners
write its state by part and listen for interactions, and VoiceControl.vue
renders it in the command dock, between the location bar and the visual
presets as before. Focus moves wait for the render; the waveform's bars
publish apart from the control and only when they change; the minutes
field keeps a draft until its owner writes it. Owner tests use a real
presenter on their own store, and view tests render the control.
This commit is contained in:
Sameh Khamis committed 2026-10-31 19:22:03 -07:00
1 parent 2ffd7a4afd
commit 1de4f635ca
47 files changed
+1691 -1645

No files matched your search

+39
View File
@@ -0,0 +1,39 @@
import { defineStore } from 'pinia';
import { markRaw, shallowRef } from 'vue';
/**
* The voice control as the command dock renders it. The voice control
* presenter (src/voice/control.js) holds the control's state for the session
* owners and publishes it here; the view sends clicks, keys and form changes
* back to the connected presenter.
*/
export const useVoiceStore = defineStore('gev-voice', () => {
/** The presented control; null while no voice session owns one. */
const view = shallowRef(null);
/** @param {?object} next A fresh presentation; every publish re-renders. */
function publish(next) {
view.value = next && markRaw(next);
}
/** The presenter the view calls, or null while none is wired. */
const controls = shallowRef(null);
/** @param {?object} next The presenter, or null to disconnect. */
function connect(next) {
controls.value = next && markRaw(next);
}
/**
* The waveform's bars, apart from the view: they change every animation
* frame while voice is live, and only the visualizer renders them.
*/
const bars = shallowRef(null);
/** @param {?Array<{level: string, opacity: string}>} next */
function publishBars(next) {
bars.value = next && markRaw(next);
}
return { view, publish, controls, connect, bars, publishBars };
});