Files
gods-eye-view/src/ui/stores/bhoteKoshiPanel.js
T
Sameh Khamis fd0d51c450 feat(bhote-koshi): render the reconstruction panel from a store
The Bhote Koshi layer keeps its panel controls as plain records and
presents them to a store; the context rail renders the panel as its last
child and marks itself while it is on. Controls are bound to the enable
that published them, and an unchanged frame is not sent again.
2026-10-31 21:12:08 -07:00

36 lines
1.2 KiB
JavaScript

import { defineStore } from 'pinia';
import { markRaw, shallowRef } from 'vue';
/**
* The Bhote Koshi event's reconstruction panel as its view renders it. The
* event layer (src/data/bhoteKoshiEvent.js) presents each control's state
* and the field reports; the view sends clicks and slider moves back to the
* connected controls.
*/
export const useBhoteKoshiPanelStore = defineStore(
'gev-bhote-koshi-panel',
() => {
/**
* `{owner, sceneBeat, refs, beforeDate, afterDate, reports}`, or null while
* the event layer is off. Each entry of `refs` holds one control's
* `textContent`, `hidden`, `disabled`, `value` and `attributes`.
*/
const panel = shallowRef(null);
/** @param {?object} next A fresh presentation; every publish re-renders. */
function publish(next) {
panel.value = next && markRaw(next);
}
/** The controls the panel's buttons, sliders and reports call. */
const controls = shallowRef(null);
/** @param {?object} next The controls, or null to disconnect. */
function connect(next) {
controls.value = next && markRaw(next);
}
return { panel, publish, controls, connect };
},
);