smoosic 2.0.2 → 2.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/smoosic.js +167 -74
- package/package.json +82 -77
- package/release/smoosic.js +171 -78
- package/release/styles/menus.css +26 -0
- package/specs/022-text-reposition-on-resize/spec.md +1 -0
- package/specs/027-fix-bottom-modifier-lookup/checklists/requirements.md +38 -0
- package/specs/027-fix-bottom-modifier-lookup/contracts/division-lookup-contract.md +51 -0
- package/specs/027-fix-bottom-modifier-lookup/data-model.md +43 -0
- package/specs/027-fix-bottom-modifier-lookup/plan.md +77 -0
- package/specs/027-fix-bottom-modifier-lookup/quickstart.md +36 -0
- package/specs/027-fix-bottom-modifier-lookup/research.md +58 -0
- package/specs/027-fix-bottom-modifier-lookup/spec.md +105 -0
- package/specs/027-fix-bottom-modifier-lookup/tasks.md +167 -0
- package/specs/028-unsaved-changes-indicator/checklists/requirements.md +39 -0
- package/specs/028-unsaved-changes-indicator/contracts/score-change-contract.md +44 -0
- package/specs/028-unsaved-changes-indicator/data-model.md +64 -0
- package/specs/028-unsaved-changes-indicator/plan.md +96 -0
- package/specs/028-unsaved-changes-indicator/quickstart.md +54 -0
- package/specs/028-unsaved-changes-indicator/research.md +68 -0
- package/specs/028-unsaved-changes-indicator/spec.md +135 -0
- package/specs/028-unsaved-changes-indicator/tasks.md +173 -0
- package/specs/029-remove-promise-helpers/checklists/requirements.md +39 -0
- package/specs/029-remove-promise-helpers/contracts/public-api-contract.md +32 -0
- package/specs/029-remove-promise-helpers/data-model.md +45 -0
- package/specs/029-remove-promise-helpers/plan.md +86 -0
- package/specs/029-remove-promise-helpers/quickstart.md +53 -0
- package/specs/029-remove-promise-helpers/research.md +71 -0
- package/specs/029-remove-promise-helpers/spec.md +107 -0
- package/specs/029-remove-promise-helpers/tasks.md +164 -0
- package/specs/030-copy-paste-voices/checklists/requirements.md +39 -0
- package/specs/030-copy-paste-voices/contracts/voice-copy-paste-contract.md +47 -0
- package/specs/030-copy-paste-voices/data-model.md +63 -0
- package/specs/030-copy-paste-voices/plan.md +80 -0
- package/specs/030-copy-paste-voices/quickstart.md +50 -0
- package/specs/030-copy-paste-voices/research.md +80 -0
- package/specs/030-copy-paste-voices/spec.md +124 -0
- package/specs/030-copy-paste-voices/tasks.md +183 -0
- package/specs/031-select-voice/checklists/requirements.md +39 -0
- package/specs/031-select-voice/contracts/select-voice-contract.md +43 -0
- package/specs/031-select-voice/data-model.md +47 -0
- package/specs/031-select-voice/plan.md +79 -0
- package/specs/031-select-voice/quickstart.md +43 -0
- package/specs/031-select-voice/research.md +55 -0
- package/specs/031-select-voice/spec.md +113 -0
- package/specs/031-select-voice/tasks.md +171 -0
- package/src/application/application.ts +464 -459
- package/src/common/promiseHelpers.ts +2 -2
- package/src/render/audio/samples.ts +117 -118
- package/src/render/sui/pageDivisions.ts +58 -0
- package/src/render/sui/renderState.ts +469 -464
- package/src/render/sui/scoreChangeState.ts +62 -0
- package/src/render/sui/scoreView.ts +30 -0
- package/src/render/sui/scoreViewOperations.ts +2555 -2380
- package/src/render/sui/svgPageMap.ts +16 -17
- package/src/render/sui/textEdit.ts +310 -311
- package/src/render/sui/tracker.ts +40 -0
- package/src/render/vex/vxNote.ts +3 -1
- package/src/smo/xform/copypaste.ts +304 -4
- package/src/smo/xform/selections.ts +68 -0
- package/src/smo/xform/undo.ts +9 -0
- package/src/styles/menus.css +26 -0
- package/src/ui/buttons/ribbon.ts +3 -1
- package/src/ui/components/buttons/sidebar.vue +15 -6
- package/src/ui/components/dialogs/library.vue +3 -1
- package/src/ui/components/dialogs/unsavedChanges.vue +44 -0
- package/src/ui/dialogs/adapter.ts +181 -183
- package/src/ui/dialogs/addMeasure.ts +97 -97
- package/src/ui/dialogs/annotationVue.ts +56 -56
- package/src/ui/dialogs/audioSettings.ts +121 -123
- package/src/ui/dialogs/chordChangeVue.ts +46 -46
- package/src/ui/dialogs/clefChange.ts +53 -53
- package/src/ui/dialogs/customTuplets.ts +95 -96
- package/src/ui/dialogs/customTupletsVue.ts +47 -47
- package/src/ui/dialogs/dialog.ts +627 -620
- package/src/ui/dialogs/durations.ts +34 -34
- package/src/ui/dialogs/dynamics.ts +140 -142
- package/src/ui/dialogs/factory.ts +198 -198
- package/src/ui/dialogs/fileDialogs.ts +245 -179
- package/src/ui/dialogs/fonts.ts +93 -93
- package/src/ui/dialogs/globalLayout.ts +40 -40
- package/src/ui/dialogs/gracenote.ts +31 -31
- package/src/ui/dialogs/hairpin.ts +108 -110
- package/src/ui/dialogs/hairpinVue.ts +51 -51
- package/src/ui/dialogs/instrument.ts +111 -111
- package/src/ui/dialogs/keySignature.ts +175 -176
- package/src/ui/dialogs/keySignatureVue.ts +47 -47
- package/src/ui/dialogs/library.ts +207 -207
- package/src/ui/dialogs/libraryVue.ts +62 -48
- package/src/ui/dialogs/lyricVue.ts +46 -46
- package/src/ui/dialogs/measureFormat.ts +78 -78
- package/src/ui/dialogs/microtones.ts +147 -147
- package/src/ui/dialogs/noteHead.ts +319 -319
- package/src/ui/dialogs/pageLayout.ts +61 -61
- package/src/ui/dialogs/partInfo.ts +60 -60
- package/src/ui/dialogs/pedalMarking.ts +117 -117
- package/src/ui/dialogs/pedalMarkingVue.ts +73 -73
- package/src/ui/dialogs/pitch.ts +352 -352
- package/src/ui/dialogs/preferences.ts +40 -40
- package/src/ui/dialogs/rehearsalMark.ts +64 -64
- package/src/ui/dialogs/rehearsalMarkVue.ts +57 -57
- package/src/ui/dialogs/scoreId.ts +35 -36
- package/src/ui/dialogs/scoreView.ts +42 -42
- package/src/ui/dialogs/slur.ts +308 -310
- package/src/ui/dialogs/slurVue.ts +91 -91
- package/src/ui/dialogs/staffGroup.ts +112 -112
- package/src/ui/dialogs/tabNote.ts +84 -84
- package/src/ui/dialogs/tabStave.ts +182 -182
- package/src/ui/dialogs/tempo.ts +261 -263
- package/src/ui/dialogs/tempoVue.ts +73 -73
- package/src/ui/dialogs/textBlockVue.ts +127 -127
- package/src/ui/dialogs/textBracket.ts +114 -116
- package/src/ui/dialogs/textBracketVue.ts +56 -56
- package/src/ui/dialogs/tie.ts +140 -142
- package/src/ui/dialogs/timeSignature.ts +65 -66
- package/src/ui/dialogs/transposeScore.ts +39 -39
- package/src/ui/dialogs/unsavedChanges.ts +43 -0
- package/src/ui/dialogs/volta.ts +120 -122
- package/src/ui/dialogs/voltaVue.ts +51 -51
- package/src/ui/fileio/library.ts +110 -111
- package/src/ui/menus/edit.ts +100 -1
- package/src/ui/menus/file.ts +19 -3
- package/tests/pageDivisions.ts +156 -0
- package/tests/promiseHelpersUsage.ts +142 -0
- package/tests/scoreChangeState.ts +102 -0
- package/tests/selectVoice.ts +189 -0
- package/tests/voiceCopyPaste.ts +417 -0
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
# Feature Specification: Select Voice
|
|
2
|
+
|
|
3
|
+
**Feature Branch**: `031-select-voice`
|
|
4
|
+
|
|
5
|
+
**Created**: 2026-10-20
|
|
6
|
+
|
|
7
|
+
**Status**: Draft
|
|
8
|
+
|
|
9
|
+
**Input**: User description: "In the edit menu, create a 'Select Voice' submenu. It allows you to select a specific notes from a specific voice, based on the currently selected measures. If there is only a single voice in all selected measures, there would be no sub menu choices, and if the user selects a voice and there are no notes in the set of selected measures, the selection should not change. All notes in the measures that currently have a selection should be selected, since different voices can have different numbers of notes that might overlap in different ways. This allows us to do things like changing the pitch or duration of many notes, but only in a specific voice."
|
|
10
|
+
|
|
11
|
+
## User Scenarios & Testing *(mandatory)*
|
|
12
|
+
|
|
13
|
+
### User Story 1 - Select every note of one voice in the chosen measures (Priority: P1)
|
|
14
|
+
|
|
15
|
+
A composer has a passage with two or more voices in the same staff, for example a melody in voice 1 and a bass line in voice 2. They select the measures they want to work on, open Edit > Select Voice and choose Voice 2. Every note in voice 2 of those measures is now selected, and the notes of the other voices are not. They can then change the pitch, duration or any other property of just those notes in one step.
|
|
16
|
+
|
|
17
|
+
**Why this priority**: This is the whole point of the feature. Today a selection in a multi-voice passage picks up the notes of whichever voice happens to be on top, so changing "all the notes in the bass line" means selecting them one at a time or accepting changes to the other voices as well.
|
|
18
|
+
|
|
19
|
+
**Independent Test**: Make four measures with two voices. Select the four measures, choose Edit > Select Voice > Voice 2, then transpose the selection up an octave. Only the voice 2 notes change; voice 1 stays as it was.
|
|
20
|
+
|
|
21
|
+
**Acceptance Scenarios**:
|
|
22
|
+
|
|
23
|
+
1. **Given** a selection that touches several measures that each have voices 1 and 2, **When** the user chooses Select Voice > Voice 2, **Then** every note of voice 2 in all of those measures is selected, and no note of any other voice is.
|
|
24
|
+
2. **Given** a selection of only part of a measure (for example, a single note), **When** the user chooses Select Voice > Voice 2, **Then** all the notes of voice 2 in that whole measure are selected, not only the ones that line up with the original selection.
|
|
25
|
+
3. **Given** voices that have different numbers of notes in a measure (for example, four quarter notes in voice 1 and one whole note in voice 2), **When** the user selects either voice, **Then** all of that voice's notes in the measure are selected, whatever their positions relative to the other voice.
|
|
26
|
+
4. **Given** a selection spanning more than one staff, **When** the user chooses Select Voice > Voice 1, **Then** the voice 1 notes of the selected measures in each of those staves are selected.
|
|
27
|
+
5. **Given** the new selection, **When** the user applies an edit that works on selected notes (change pitch, duration, accidental, articulation, and so on), **Then** the edit applies to the selected voice's notes only.
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
### User Story 2 - The menu only offers choices that make sense (Priority: P1)
|
|
32
|
+
|
|
33
|
+
The Select Voice choices depend on the selection. Only voices that actually exist in the selected measures are listed. If the selected measures all have only a single voice, there is nothing to choose between, so Select Voice offers no choices (it doesn't appear). If the user picks a voice that turns out to have no notes in the selected measures, nothing happens and the current selection is left exactly as it was.
|
|
34
|
+
|
|
35
|
+
**Why this priority**: Without this, the menu would offer actions that do nothing, or that quietly destroy the user's current selection. A small rule, but it decides whether the feature feels trustworthy.
|
|
36
|
+
|
|
37
|
+
**Independent Test**: Select a measure with one voice and open the Edit menu: no Select Voice entry (or an empty one). Select a measure with voices 1 and 2: choices are Voice 1 and Voice 2. Select measures 1 to 4 where only measure 4 has voice 3: Voice 3 is offered, and choosing it selects voice 3 of measure 4 only.
|
|
38
|
+
|
|
39
|
+
**Acceptance Scenarios**:
|
|
40
|
+
|
|
41
|
+
1. **Given** every selected measure has exactly one voice, **When** the user opens the Edit menu, **Then** Select Voice offers no choices.
|
|
42
|
+
2. **Given** the selected measures contain voices 1 and 2, **When** the user opens Select Voice, **Then** it lists Voice 1 and Voice 2 only.
|
|
43
|
+
3. **Given** voice 3 exists in only some of the selected measures, **When** the user opens Select Voice and chooses Voice 3, **Then** the voice 3 notes in the measures that have them are selected, and the measures without voice 3 contribute nothing.
|
|
44
|
+
4. **Given** the user chooses a voice that has no notes in any of the selected measures, **When** the choice is made, **Then** the selection does not change at all.
|
|
45
|
+
5. **Given** nothing is selected, **When** the user opens the Edit menu, **Then** Select Voice offers no choices.
|
|
46
|
+
|
|
47
|
+
---
|
|
48
|
+
|
|
49
|
+
### User Story 3 - Selecting a voice never changes the music (Priority: P2)
|
|
50
|
+
|
|
51
|
+
Select Voice only changes which notes are selected. It never adds, removes, moves or edits a note, never creates a voice, and does not add an entry to the undo history. This separates it from the existing Voices menu, which makes a voice the one the user is entering notes into and can create a new voice.
|
|
52
|
+
|
|
53
|
+
**Why this priority**: It keeps the action safe to use freely and keeps Undo meaning "undo my last edit", not "undo my last selection". It is lower priority only because it is a property of the feature rather than a step of the user's workflow.
|
|
54
|
+
|
|
55
|
+
**Independent Test**: Select two measures, choose Select Voice > Voice 2 several times and alternate with Voice 1. The score is unchanged, and Undo does not step through the selections.
|
|
56
|
+
|
|
57
|
+
**Acceptance Scenarios**:
|
|
58
|
+
|
|
59
|
+
1. **Given** any selection, **When** the user chooses a voice from Select Voice, **Then** no note, measure or voice in the score is added, removed or modified.
|
|
60
|
+
2. **Given** the user has just used Select Voice, **When** the user chooses Undo, **Then** the undo applies to the last edit made before it, not to the selection.
|
|
61
|
+
3. **Given** a measure that has no voice 2, **When** the user looks at the Select Voice choices, **Then** there is no choice that would create a voice 2.
|
|
62
|
+
|
|
63
|
+
---
|
|
64
|
+
|
|
65
|
+
### Edge Cases
|
|
66
|
+
|
|
67
|
+
- What happens when the selected measures contain different numbers of voices (one has two, another has four)? The choices are the voices that exist in at least one selected measure; a chosen voice selects its notes only in the measures that have it.
|
|
68
|
+
- What happens when the chosen voice contains only rests in the selected measures? Rests count as notes of the voice and are selected, since they are part of the voice and can be edited like any other.
|
|
69
|
+
- What happens when the selection is a range of measures that includes measures from several staves? Each staff's selected measures are handled the same way; the chosen voice is selected in each.
|
|
70
|
+
- What happens when the voice contains a tuplet or a note that crosses a beam? All notes of the voice in the measure are selected, including every note of a tuplet.
|
|
71
|
+
- What happens when the user selects a voice while a part is being displayed? Only the voices of the displayed measures are offered and selected.
|
|
72
|
+
- What happens right after the voice is selected and the user presses an arrow key? Navigation continues from the new selection, as after any selection.
|
|
73
|
+
- What happens when the user chooses a voice that is already the only one selected? The selection is rebuilt to be all of that voice's notes in the selected measures (which may select more notes than before) and otherwise remains the same.
|
|
74
|
+
|
|
75
|
+
## Requirements *(mandatory)*
|
|
76
|
+
|
|
77
|
+
### Functional Requirements
|
|
78
|
+
|
|
79
|
+
- **FR-001**: The Edit menu MUST contain a Select Voice submenu.
|
|
80
|
+
- **FR-002**: The Select Voice submenu MUST offer one choice for each voice (1 to 4) that exists in at least one measure that currently has a selected note, and no other choices.
|
|
81
|
+
- **FR-003**: When every measure that currently has a selected note has only a single voice, or when nothing is selected, Select Voice MUST offer no choices.
|
|
82
|
+
- **FR-004**: Choosing a voice MUST replace the current selection with all the notes (including rests) of that voice in all of the measures that currently have a selection, on every staff that has a selection.
|
|
83
|
+
- **FR-005**: The new selection MUST include every note of the chosen voice in each of those measures, regardless of which notes were selected before, and regardless of how the voice's notes line up with the other voices' notes.
|
|
84
|
+
- **FR-006**: The new selection MUST NOT include any note of a voice other than the chosen one.
|
|
85
|
+
- **FR-007**: A measure that does not have the chosen voice MUST contribute no notes and MUST NOT have the voice created.
|
|
86
|
+
- **FR-008**: If the chosen voice has no notes in any of the selected measures, the selection MUST NOT change.
|
|
87
|
+
- **FR-009**: Choosing a voice MUST NOT modify the score in any way and MUST NOT create an undo entry.
|
|
88
|
+
- **FR-010**: After a voice is selected, selection-based edits (pitch, duration, accidentals and so on) MUST affect only the notes of that voice, and the selection MUST be shown on screen as for any other selection.
|
|
89
|
+
- **FR-011**: The existing Voices menu MUST be unchanged.
|
|
90
|
+
|
|
91
|
+
### Key Entities
|
|
92
|
+
|
|
93
|
+
- **Voice**: One of up to four independent lines of notes within the same staff, in each measure, numbered 1 to 4.
|
|
94
|
+
- **Selected measures**: The measures that contain at least one currently selected note, on each staff that has a selection. The new selection is built from the whole of these measures.
|
|
95
|
+
|
|
96
|
+
## Success Criteria *(mandatory)*
|
|
97
|
+
|
|
98
|
+
### Measurable Outcomes
|
|
99
|
+
|
|
100
|
+
- **SC-001**: After choosing Select Voice > Voice N, 100% of the notes of voice N in the selected measures are selected and 0% of the notes of other voices are.
|
|
101
|
+
- **SC-002**: A user can change the pitch of every note in one voice across a passage in two actions after selecting the measures (choose Select Voice > Voice N, then apply the pitch change), without touching the other voices.
|
|
102
|
+
- **SC-003**: Choosing a voice with no notes in the selected measures leaves the selection identical in 100% of cases.
|
|
103
|
+
- **SC-004**: Using Select Voice any number of times leaves the score and the undo history unchanged, verified by comparing the score before and after.
|
|
104
|
+
- **SC-005**: The Select Voice choices never include a voice that does not exist in any selected measure, and never appear when only a single voice is present.
|
|
105
|
+
|
|
106
|
+
## Assumptions
|
|
107
|
+
|
|
108
|
+
- "Currently selected measures" means the measures that contain at least one selected note, as the existing measure-level actions (such as swapping voices) define it; the whole of each such measure takes part.
|
|
109
|
+
- Rests are notes of a voice for this purpose, so a voice made of rests can be selected.
|
|
110
|
+
- Select Voice only selects; the existing Voices menu remains the way to make a voice the active one for entering notes and to create new voices. After a voice is selected, the application treats that voice as the one being worked on in the same way it does whenever the user selects notes of that voice by other means.
|
|
111
|
+
- The choices are labelled "Voice 1" to "Voice 4", matching the existing Voices menu.
|
|
112
|
+
- Existing keyboard shortcuts are unchanged and none is added here.
|
|
113
|
+
- The selection result is a normal selection, so highlighting, playback of the selection, and scrolling behave as for any other selection.
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
---
|
|
2
|
+
|
|
3
|
+
description: "Task list for Select Voice"
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Tasks: Select Voice
|
|
7
|
+
|
|
8
|
+
**Input**: Design documents from `/specs/031-select-voice/`
|
|
9
|
+
|
|
10
|
+
**Prerequisites**: [plan.md](./plan.md), [spec.md](./spec.md), [research.md](./research.md), [data-model.md](./data-model.md), [contracts/select-voice-contract.md](./contracts/select-voice-contract.md), [quickstart.md](./quickstart.md)
|
|
11
|
+
|
|
12
|
+
**Tests**: Included. The plan commits to a headless `tests/selectVoice.ts` (cases S1 to S16) for the pure selection logic. The tracker mapping, highlighting and menu need the renderer and are checked manually (M1 to M10).
|
|
13
|
+
|
|
14
|
+
**Organization**: Tasks are grouped by user story. The pure functions, tracker method and view methods are shared by all stories, so they are the foundation; each story then adds its tests and the part of the menu behavior it covers.
|
|
15
|
+
|
|
16
|
+
## Format: `[ID] [P?] [Story] Description`
|
|
17
|
+
|
|
18
|
+
- **[P]**: Can run in parallel (different files, no dependencies on incomplete tasks)
|
|
19
|
+
- **[Story]**: Which user story this task belongs to (US1, US2, US3)
|
|
20
|
+
|
|
21
|
+
## Path Conventions
|
|
22
|
+
|
|
23
|
+
Single project: `src/`, `tests/`, repo-root `package.json`.
|
|
24
|
+
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
## Phase 1: Setup
|
|
28
|
+
|
|
29
|
+
- [X] T001 Add the script `"test:select-voice": "ts-node -P tests/tsconfig.json tests/selectVoice.ts"` to `package.json`, next to the existing `test:voice-copy-paste` entry.
|
|
30
|
+
- [X] T002 Create `tests/selectVoice.ts` with the scaffold and the shared test score builder: header comment pointing at `specs/031-select-voice/contracts/select-voice-contract.md`; the dynamic-ctor-init calls and imports used by `tests/voiceCopyPaste.ts`; the `failures` counter and `check()` helper; the final summary block; `buildScore()` making the two-staff, six-measure 4/4 score described in the contract (staff 0: voice 0 four quarter notes in every measure, except measure 3 where they are rests; voice 1 on measures 0 to 2 as a whole note, two half notes and four quarter notes; voice 2 on measure 2 only. Staff 1: voice 0 in every measure, voice 1 on measure 1 only), using `SmoScore.getDefaultScore`, `addStaff`, `addMeasure`, `SmoMeasure.populateVoice` and setting `note.ticks` as in `tests/voiceCopyPaste.ts`; and helpers `sel(score, staff, measure, voice, tick)` returning a `SmoSelection` via `SmoSelection.noteSelection`, and `tickRange(score, staff, measure, voice, first, last)` returning a list of selections.
|
|
31
|
+
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
## Phase 2: Foundational (Blocking Prerequisites)
|
|
35
|
+
|
|
36
|
+
**Purpose**: The logic and plumbing every story uses.
|
|
37
|
+
|
|
38
|
+
**CRITICAL**: No user story work can begin until this phase is complete.
|
|
39
|
+
|
|
40
|
+
- [X] T003 In `src/smo/xform/selections.ts`, add to `SmoSelection` the two static functions from [data-model.md](./data-model.md): `voiceChoices(score, selections): number[]` (unique selected `(staff, measure)` pairs, largest `voices.length` capped at 4, `[]` below 2, else `0..max-1`) and `getVoiceSelectors(score, selections, voice): SmoSelector[]` (for each unique pair in staff then measure order, one selector per note of the voice with `pitches: []`; nothing for a measure that lacks the voice; empty for a voice outside 0 to 3 or an empty selection). Skip pairs whose measure cannot be found in the score.
|
|
41
|
+
- [X] T004 In `src/render/sui/tracker.ts`, add `selectVoice(voice: number): boolean` to `SuiTracker`: call `SmoSelection.getVoiceSelectors(this.score, this.selections, voice)`, map each selector to `this.measureNoteMap[SmoSelector.getNoteKey(selector)]` (skip any that are missing; do not use `_getClosestTick`), return false without changing anything if none are mapped, otherwise set `this.selections` to the mapped list, set `this.pitchIndex = -1`, call `setActiveVoice(voice)` on the measure of each selection, call `this.score.setActiveStaff(...)` with the first selected staff, then `_createLocalModifiersList()` and `deferHighlight()`, and return true. Document that it makes no score change and no undo entry.
|
|
42
|
+
- [X] T005 In `src/render/sui/scoreViewOperations.ts`, add `getSelectVoiceChoices(): number[]` returning `SmoSelection.voiceChoices(this.score, this.tracker.selections)` and `async selectVoice(voice: number): Promise<void>` calling `this.tracker.selectVoice(voice)` and doing nothing else (no `_undo*` call, no `populateVoice`).
|
|
43
|
+
- [X] T006 Run `npx tsc --noEmit -p tsconfig.json` and fix any errors.
|
|
44
|
+
|
|
45
|
+
**Checkpoint**: The logic and plumbing exist; nothing in the menu uses them yet.
|
|
46
|
+
|
|
47
|
+
---
|
|
48
|
+
|
|
49
|
+
## Phase 3: User Story 1 - Select every note of one voice in the chosen measures (Priority: P1) MVP
|
|
50
|
+
|
|
51
|
+
**Goal**: Edit > Select Voice > Voice N selects the whole voice in the selected measures.
|
|
52
|
+
|
|
53
|
+
**Independent Test**: quickstart.md section 3, steps 2 to 4 and 7.
|
|
54
|
+
|
|
55
|
+
### Tests for User Story 1
|
|
56
|
+
|
|
57
|
+
- [X] T007 [P] [US1] In `tests/selectVoice.ts`, add cases S6 to S9 and S11 to S13 from the contract (whole-measure selection from a single note, uneven voices, multi-measure counts and order, a voice present in only some measures, two staves, rests).
|
|
58
|
+
- [X] T008 [US1] Run `npm run test:select-voice` and fix `selections.ts` until S6 to S9 and S11 to S13 pass.
|
|
59
|
+
|
|
60
|
+
### Implementation for User Story 1
|
|
61
|
+
|
|
62
|
+
- [X] T009 [US1] In `src/ui/menus/edit.ts`, add a `selectVoiceChoice(voice: number)` factory returning a `SuiConfiguredMenuOption` (handler `await menu.view.selectVoice(voice)`, text `Voice ${voice + 1}`, value `selectVoice${voice}`, empty icon, `display` true when `menu.view.getSelectVoiceChoices()` includes `voice`) and a `selectVoiceMenuOption` with `subMenu` of the four choices, text `Select Voice`, value `selectVoiceAction`, a no-op handler (unreachable), and `display` true when the choices list is non-empty. Add it to `SuiEditMenuOptions` after `pasteVoiceMenuOption`.
|
|
63
|
+
- [X] T010 [US1] Run `npx tsc --noEmit -p tsconfig.json` and fix any errors.
|
|
64
|
+
- [ ] T011 [US1] Manual validation: quickstart.md section 3, steps 2 to 4 and 7 (M2, M3, M4, M7).
|
|
65
|
+
|
|
66
|
+
**Checkpoint**: Users can select one voice's notes across their selected measures.
|
|
67
|
+
|
|
68
|
+
---
|
|
69
|
+
|
|
70
|
+
## Phase 4: User Story 2 - The menu only offers choices that make sense (Priority: P1)
|
|
71
|
+
|
|
72
|
+
**Goal**: Choices reflect the voices that exist; a single voice offers nothing; an empty result leaves the selection alone.
|
|
73
|
+
|
|
74
|
+
**Independent Test**: quickstart.md section 3, steps 1 and 5; cases S1 to S5, S10, S15, S16.
|
|
75
|
+
|
|
76
|
+
### Tests for User Story 2
|
|
77
|
+
|
|
78
|
+
- [X] T012 [P] [US2] In `tests/selectVoice.ts`, add cases S1 to S5, S10, S15 and S16 (single-voice and empty selections offer nothing, the voices listed, a voice with no notes in the selected measures returns no selectors, out-of-range voices, selector shape).
|
|
79
|
+
- [X] T013 [US2] Run `npm run test:select-voice` and fix `selections.ts` until S1 to S5, S10, S15 and S16 pass.
|
|
80
|
+
|
|
81
|
+
### Implementation for User Story 2
|
|
82
|
+
|
|
83
|
+
- [X] T014 [US2] In `src/render/sui/tracker.ts` `selectVoice`, confirm by reading the code that the no-notes and nothing-mapped paths return false before any change to `selections`, `pitchIndex`, active voices, or the highlight, and that a measure missing the voice is skipped without calling `populateVoice`. Fix any path that changes state early.
|
|
84
|
+
- [ ] T015 [US2] Manual validation: quickstart.md section 3, steps 1 and 5 (M1, M5).
|
|
85
|
+
|
|
86
|
+
**Checkpoint**: The menu is accurate and a no-op choice is harmless.
|
|
87
|
+
|
|
88
|
+
---
|
|
89
|
+
|
|
90
|
+
## Phase 5: User Story 3 - Selecting a voice never changes the music (Priority: P2)
|
|
91
|
+
|
|
92
|
+
**Goal**: No edit and no undo entry.
|
|
93
|
+
|
|
94
|
+
**Independent Test**: S14 passes; quickstart.md section 3, step 6.
|
|
95
|
+
|
|
96
|
+
### Tests for User Story 3
|
|
97
|
+
|
|
98
|
+
- [X] T016 [P] [US3] In `tests/selectVoice.ts`, add case S14: serialize the score before and after calling `voiceChoices` and `getVoiceSelectors` for every voice and compare, and check each measure's voice count is unchanged.
|
|
99
|
+
- [X] T017 [US3] Run `npm run test:select-voice` and confirm all cases S1 to S16 pass.
|
|
100
|
+
|
|
101
|
+
### Implementation for User Story 3
|
|
102
|
+
|
|
103
|
+
- [X] T018 [US3] Confirm by search that `selectVoice` in `scoreViewOperations.ts` and `tracker.ts` calls none of `_undoScore`, `_undoSelection`, `undoMeasureRange`, `storeUndo.addBuffer`, `populateVoice` or any `SmoOperation` method, and that the existing Voices menu file `src/ui/menus/voices.ts` is unchanged.
|
|
104
|
+
- [ ] T019 [US3] Manual validation: quickstart.md section 3, steps 6, 8 and 9 (M6, M9, M10).
|
|
105
|
+
|
|
106
|
+
**Checkpoint**: Select Voice is selection-only.
|
|
107
|
+
|
|
108
|
+
---
|
|
109
|
+
|
|
110
|
+
## Phase 6: Polish & Cross-Cutting Concerns
|
|
111
|
+
|
|
112
|
+
- [X] T020 Run `npm run test:select-voice` and all eight existing test scripts; confirm all pass.
|
|
113
|
+
- [X] T021 Run `npx tsc --noEmit -p tsconfig.json` and `npm run build`; confirm both succeed with no new warnings.
|
|
114
|
+
- [ ] T022 Run through all of quickstart.md (sections 1 to 3), including step 10 in part view, and note the result.
|
|
115
|
+
|
|
116
|
+
---
|
|
117
|
+
|
|
118
|
+
## Dependencies & Execution Order
|
|
119
|
+
|
|
120
|
+
### Phase Dependencies
|
|
121
|
+
|
|
122
|
+
- **Setup (Phase 1)**: none.
|
|
123
|
+
- **Foundational (Phase 2)**: depends on Setup. T003, T004 and T005 edit three different files but T004 and T005 call T003's functions, so do T003 first.
|
|
124
|
+
- **US1 (Phase 3)**: depends on Phase 2.
|
|
125
|
+
- **US2 (Phase 4)**: depends on Phase 2; T014 reviews T004 and is best done after US1's manual check.
|
|
126
|
+
- **US3 (Phase 5)**: depends on Phase 2.
|
|
127
|
+
- **Polish (Phase 6)**: depends on all stories.
|
|
128
|
+
|
|
129
|
+
### Within Each Story
|
|
130
|
+
|
|
131
|
+
- `tests/selectVoice.ts` is edited by T002, T007, T012 and T016: add cases in separate blocks, in order.
|
|
132
|
+
- `edit.ts` is edited only by T009.
|
|
133
|
+
|
|
134
|
+
### Parallel Opportunities
|
|
135
|
+
|
|
136
|
+
- T007, T012 and T016 are separate test blocks in one file, so write them one after another; each can proceed while code in other files is edited (T004, T005, T009).
|
|
137
|
+
- T004 and T005 can be edited in parallel once T003 exists.
|
|
138
|
+
|
|
139
|
+
---
|
|
140
|
+
|
|
141
|
+
## Parallel Example: Foundational phase
|
|
142
|
+
|
|
143
|
+
```text
|
|
144
|
+
Task: "SmoSelection.voiceChoices / getVoiceSelectors in src/smo/xform/selections.ts" (T003)
|
|
145
|
+
Task: "SuiTracker.selectVoice in src/render/sui/tracker.ts" (T004, after T003)
|
|
146
|
+
Task: "selectVoice / getSelectVoiceChoices in src/render/sui/scoreViewOperations.ts" (T005, after T003)
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
---
|
|
150
|
+
|
|
151
|
+
## Implementation Strategy
|
|
152
|
+
|
|
153
|
+
### MVP First (User Story 1)
|
|
154
|
+
|
|
155
|
+
1. Phases 1 and 2 (pure logic, tracker method, view methods compile).
|
|
156
|
+
2. Phase 3: tests prove the selection logic; the menu exposes it.
|
|
157
|
+
3. Stop and validate in the app: select a voice across several measures and change its pitch.
|
|
158
|
+
|
|
159
|
+
### Incremental Delivery
|
|
160
|
+
|
|
161
|
+
1. US1 delivers the feature.
|
|
162
|
+
2. US2 locks in the choice and no-op rules with tests.
|
|
163
|
+
3. US3 proves it is selection-only.
|
|
164
|
+
|
|
165
|
+
---
|
|
166
|
+
|
|
167
|
+
## Notes
|
|
168
|
+
|
|
169
|
+
- The tracker method needs a renderer and is not covered by the headless test; keep it small so that the logic lives in the tested functions.
|
|
170
|
+
- No keyboard shortcut is added (spec assumption).
|
|
171
|
+
- Commit after each phase.
|