Simplify: remove dead code and redundancy across vue app
- Delete ObjectBasic (defined, never imported)
- ObjectShort: remove unused node prop
- exporter: export stressorToString; use in patchBarMeta (removes inline duplicate)
- PaneFO: import stressorToString from exporter; extract H4 style constant,
shapeSection() helper, instrOnChange() helper; remove apply param from
makeChangeHandler (was always () => markDirty()); remove unnecessary ?.
on always-initialized arrays (variations, labelSpecs, subvariations)
- PaneSubObjects: explicit hasChildren on all item kinds; bars at score
level get hasChildren based on voices; remove stale kind-list fallback
- ast-parser coerce(): remove unreachable s.trim() check ('' handled above)
- PaneCP: fix post-export synthesisStatus reset to use real field names
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
import { h } from 'vue';
|
||||
import { ObjectShort } from './ObjectShort.js';
|
||||
|
||||
// Shows sub-objects of the currently focused node — variations, bars, voices, etc.
|
||||
export const PaneSubObjects = {
|
||||
props: ['store', 'onFocusFO'],
|
||||
setup(props) {
|
||||
@@ -15,17 +14,17 @@ export const PaneSubObjects = {
|
||||
if (node.type === 'score') {
|
||||
const items = [];
|
||||
if (node.info)
|
||||
items.push({ kind: 'info', node: node.info, label: node.info.title ?? '(no title)', hasChildren: false });
|
||||
items.push({ kind: 'info', node: node.info, label: node.info.title ?? '(no title)', hasChildren: false });
|
||||
if (node.tuning)
|
||||
items.push({ kind: 'tuning', node: node.tuning, label: `base ${node.tuning.base ?? '?'}`, hasChildren: false });
|
||||
items.push({ kind: 'tuning', node: node.tuning, label: `base ${node.tuning.base ?? '?'}`, hasChildren: false });
|
||||
for (const a of (node.articles ?? []))
|
||||
items.push({ kind: 'article', node: a, label: a.name, hasChildren: false });
|
||||
items.push({ kind: 'article', node: a, label: a.name, hasChildren: false });
|
||||
for (const sv of (node.stageVoices ?? []))
|
||||
items.push({ kind: 'stage', node: sv, label: sv.name, hasChildren: false });
|
||||
items.push({ kind: 'stage', node: sv, label: sv.name, hasChildren: false });
|
||||
for (const i of node.instruments)
|
||||
items.push({ kind: 'instrument', node: i, label: i.name, hasChildren: true });
|
||||
items.push({ kind: 'instrument', node: i, label: i.name, hasChildren: true });
|
||||
for (const b of node.bars)
|
||||
items.push({ kind: 'bar', node: b, label: b.id, hasChildren: false });
|
||||
items.push({ kind: 'bar', node: b, label: b.id, hasChildren: Object.keys(b.voices).length > 0 });
|
||||
return items;
|
||||
}
|
||||
if (node.type === 'instrument') {
|
||||
@@ -33,12 +32,13 @@ export const PaneSubObjects = {
|
||||
kind: 'variation',
|
||||
node: v,
|
||||
label: `variation ${idx + 1}${v.dependsOn ? ` (${v.dependsOn})` : ''}`,
|
||||
hasChildren: true,
|
||||
}));
|
||||
}
|
||||
if (node.type === 'variation') {
|
||||
return [
|
||||
...node.labelSpecs.map(ls => ({
|
||||
kind: 'label_spec', node: ls, label: ls.label ?? '(no label)',
|
||||
kind: 'label_spec', node: ls, label: ls.label ?? '(no label)', hasChildren: false,
|
||||
})),
|
||||
...node.subvariations.map((sv, idx) => {
|
||||
const dep = sv.dependsOn;
|
||||
@@ -56,9 +56,7 @@ export const PaneSubObjects = {
|
||||
}
|
||||
if (node.type === 'voice') {
|
||||
return node.offsets.map((o, idx) => ({
|
||||
kind: 'offset', node: o,
|
||||
label: `tick ${o.tick ?? idx}`,
|
||||
hasChildren: false,
|
||||
kind: 'offset', node: o, label: `tick ${o.tick ?? idx}`, hasChildren: false,
|
||||
}));
|
||||
}
|
||||
return [];
|
||||
@@ -69,20 +67,19 @@ export const PaneSubObjects = {
|
||||
const items = subItems(node);
|
||||
if (!items.length) return h('div', null, h('em', null, 'No sub-objects'));
|
||||
|
||||
return h('div', null, [
|
||||
return h('div', null,
|
||||
h('ul', { class: 'se-object-list' }, items.map((item, idx) =>
|
||||
h(ObjectShort, {
|
||||
key: idx,
|
||||
node: item.node,
|
||||
label: item.label,
|
||||
typeTag: item.kind,
|
||||
focused: props.store.focusPath.includes(item.node),
|
||||
hasChildren: item.hasChildren ?? (item.kind !== 'bar' && item.kind !== 'voice'),
|
||||
onFocus: () => { props.store.pushFocus(item.node); props.onFocusFO?.(); },
|
||||
hasChildren: item.hasChildren,
|
||||
onFocus: () => { props.store.pushFocus(item.node); props.onFocusFO?.(); },
|
||||
onDrillDown: () => { props.store.pushFocus(item.node); props.onFocusFO?.(); },
|
||||
})
|
||||
)),
|
||||
]);
|
||||
))
|
||||
);
|
||||
};
|
||||
},
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user