import { GUI_BOUNDARIES, GUI_FAMILIES, panelsForFamily, type GuiFamily } from "./gui-domain"; export type GuiFamilyDescriptor = { family: GuiFamily; panels: readonly string[]; source_kind: "desktop-equivalent" | "web-component" | "threejs"; capabilities: readonly string[]; boundaries: readonly string[]; }; const FAMILY_CAPABILITIES: Record = { axis: ["program", "mdi", "jog", "home", "override", "spindle", "tool", "alarm"], gmoccapy: ["touch", "program", "mdi", "jog", "tool", "alarm"], touchy: ["touch", "jog", "mdi", "program", "alarm"], gscreen: ["program", "mdi", "jog", "hal", "alarm"], qtvcp: ["vcp_pins", "python_callbacks", "program", "hal", "tool"], qtdragon: ["vcp_pins", "python_callbacks", "program", "tool", "alarm"], pyvcp: ["vcp_pins", "hal", "python_callbacks"], gladevcp: ["vcp_pins", "hal", "python_callbacks"], vismach: ["threejs_model", "pose", "joints", "toolpath"], ngcgui: ["subroutine_forms", "program", "mdi"], qtplasmac: ["material_table", "torch", "program", "python_callbacks"], plasma: ["material_table", "torch", "program", "python_callbacks"], }; export function descriptorForFamily(family: GuiFamily): GuiFamilyDescriptor { const source_kind = family === "vismach" ? "threejs" : ["qtvcp", "qtdragon", "pyvcp", "gladevcp"].includes(family) ? "web-component" : "desktop-equivalent"; return { family, panels: panelsForFamily(family), source_kind, capabilities: FAMILY_CAPABILITIES[family], boundaries: [GUI_BOUNDARIES.desktop_window, ...(FAMILY_CAPABILITIES[family].includes("python_callbacks") ? [GUI_BOUNDARIES.python_callbacks] : []), ...(source_kind === "threejs" ? [GUI_BOUNDARIES.virtual_devices] : [])] }; } export const GUI_FAMILY_DESCRIPTORS = Object.freeze(Object.fromEntries(GUI_FAMILIES.map((family) => [family, descriptorForFamily(family)])) as Record); export function descriptorForDisplay(display: string | null | undefined): GuiFamilyDescriptor { const lower = String(display ?? "axis").toLowerCase(); const family = GUI_FAMILIES.find((candidate) => lower.includes(candidate)) ?? "axis"; return GUI_FAMILY_DESCRIPTORS[family]; }