refactor: functional style in exporter.js and subobject-kinds.js

This commit is contained in:
c0dev0id
2026-07-06 21:20:32 +02:00
parent d3a55cb663
commit bf35441b77
2 changed files with 66 additions and 83 deletions

View File

@@ -1,9 +1,3 @@
// Group a node's sub-objects by KIND (the SLOT side of SLOT.SUBTYPE in the AST).
// Per the editor design: items sharing a kind share one pane; different kinds
// produce separate panes whose handles render in the AppShell bottom bar.
// Each group is { kind, items: [{ kind, node, label, hasChildren, readOnly? }] }.
// The returned order is the display order for the handle bar.
export const KIND_LABEL = {
tuning: 'TU',
stage: 'ST',
@@ -30,10 +24,10 @@ export function getKindGroups(node) {
]});
}
const stage = [];
if (node.stageCone) stage.push({ kind: 'stage', node: node.stageCone, label: 'cone (orchestra)', hasChildren: false });
for (const sv of (node.stageVoices ?? []))
stage.push({ kind: 'stage', node: sv, label: sv.name, hasChildren: false });
const stage = [
...(node.stageCone ? [{ kind: 'stage', node: node.stageCone, label: 'cone (orchestra)', hasChildren: false }] : []),
...(node.stageVoices ?? []).map(sv => ({ kind: 'stage', node: sv, label: sv.name, hasChildren: false })),
];
if (stage.length) groups.push({ kind: 'stage', items: stage });
if (node.instruments.length) {