smoosic 2.0.2 → 2.0.4

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.
Files changed (352) hide show
  1. package/build/smoosic.js +546 -125
  2. package/changes.md +85 -0
  3. package/package.json +23 -2
  4. package/release/smoosic.js +549 -128
  5. package/release/styles/menus.css +26 -0
  6. package/specs/022-text-reposition-on-resize/spec.md +1 -0
  7. package/specs/027-fix-bottom-modifier-lookup/checklists/requirements.md +38 -0
  8. package/specs/027-fix-bottom-modifier-lookup/contracts/division-lookup-contract.md +51 -0
  9. package/specs/027-fix-bottom-modifier-lookup/data-model.md +43 -0
  10. package/specs/027-fix-bottom-modifier-lookup/plan.md +77 -0
  11. package/specs/027-fix-bottom-modifier-lookup/quickstart.md +36 -0
  12. package/specs/027-fix-bottom-modifier-lookup/research.md +58 -0
  13. package/specs/027-fix-bottom-modifier-lookup/spec.md +105 -0
  14. package/specs/027-fix-bottom-modifier-lookup/tasks.md +167 -0
  15. package/specs/028-unsaved-changes-indicator/checklists/requirements.md +39 -0
  16. package/specs/028-unsaved-changes-indicator/contracts/score-change-contract.md +44 -0
  17. package/specs/028-unsaved-changes-indicator/data-model.md +64 -0
  18. package/specs/028-unsaved-changes-indicator/plan.md +96 -0
  19. package/specs/028-unsaved-changes-indicator/quickstart.md +54 -0
  20. package/specs/028-unsaved-changes-indicator/research.md +68 -0
  21. package/specs/028-unsaved-changes-indicator/spec.md +135 -0
  22. package/specs/028-unsaved-changes-indicator/tasks.md +173 -0
  23. package/specs/029-remove-promise-helpers/checklists/requirements.md +39 -0
  24. package/specs/029-remove-promise-helpers/contracts/public-api-contract.md +32 -0
  25. package/specs/029-remove-promise-helpers/data-model.md +45 -0
  26. package/specs/029-remove-promise-helpers/plan.md +86 -0
  27. package/specs/029-remove-promise-helpers/quickstart.md +53 -0
  28. package/specs/029-remove-promise-helpers/research.md +71 -0
  29. package/specs/029-remove-promise-helpers/spec.md +107 -0
  30. package/specs/029-remove-promise-helpers/tasks.md +164 -0
  31. package/specs/030-copy-paste-voices/checklists/requirements.md +39 -0
  32. package/specs/030-copy-paste-voices/contracts/voice-copy-paste-contract.md +47 -0
  33. package/specs/030-copy-paste-voices/data-model.md +63 -0
  34. package/specs/030-copy-paste-voices/plan.md +80 -0
  35. package/specs/030-copy-paste-voices/quickstart.md +50 -0
  36. package/specs/030-copy-paste-voices/research.md +80 -0
  37. package/specs/030-copy-paste-voices/spec.md +124 -0
  38. package/specs/030-copy-paste-voices/tasks.md +183 -0
  39. package/specs/031-select-voice/checklists/requirements.md +39 -0
  40. package/specs/031-select-voice/contracts/select-voice-contract.md +43 -0
  41. package/specs/031-select-voice/data-model.md +47 -0
  42. package/specs/031-select-voice/plan.md +79 -0
  43. package/specs/031-select-voice/quickstart.md +43 -0
  44. package/specs/031-select-voice/research.md +55 -0
  45. package/specs/031-select-voice/spec.md +113 -0
  46. package/specs/031-select-voice/tasks.md +171 -0
  47. package/specs/032-split-multimeasure-rests/checklists/requirements.md +40 -0
  48. package/specs/032-split-multimeasure-rests/contracts/grouping-contract.md +53 -0
  49. package/specs/032-split-multimeasure-rests/data-model.md +70 -0
  50. package/specs/032-split-multimeasure-rests/plan.md +81 -0
  51. package/specs/032-split-multimeasure-rests/quickstart.md +46 -0
  52. package/specs/032-split-multimeasure-rests/research.md +63 -0
  53. package/specs/032-split-multimeasure-rests/spec.md +127 -0
  54. package/specs/032-split-multimeasure-rests/tasks.md +174 -0
  55. package/specs/033-key-distance-transposition/checklists/requirements.md +35 -0
  56. package/specs/033-key-distance-transposition/contracts/spelling-api.md +36 -0
  57. package/specs/033-key-distance-transposition/data-model.md +49 -0
  58. package/specs/033-key-distance-transposition/plan.md +87 -0
  59. package/specs/033-key-distance-transposition/quickstart.md +40 -0
  60. package/specs/033-key-distance-transposition/research.md +82 -0
  61. package/specs/033-key-distance-transposition/spec.md +132 -0
  62. package/specs/033-key-distance-transposition/tasks.md +139 -0
  63. package/specs/034-smz-compressed-scores/checklists/requirements.md +35 -0
  64. package/specs/034-smz-compressed-scores/contracts/archive-api.md +30 -0
  65. package/specs/034-smz-compressed-scores/data-model.md +48 -0
  66. package/specs/034-smz-compressed-scores/plan.md +89 -0
  67. package/specs/034-smz-compressed-scores/quickstart.md +44 -0
  68. package/specs/034-smz-compressed-scores/research.md +86 -0
  69. package/specs/034-smz-compressed-scores/spec.md +137 -0
  70. package/specs/034-smz-compressed-scores/tasks.md +148 -0
  71. package/specs/035-paste-special/checklists/requirements.md +35 -0
  72. package/specs/035-paste-special/contracts/paste-special-api.md +50 -0
  73. package/specs/035-paste-special/data-model.md +47 -0
  74. package/specs/035-paste-special/plan.md +83 -0
  75. package/specs/035-paste-special/quickstart.md +51 -0
  76. package/specs/035-paste-special/research.md +97 -0
  77. package/specs/035-paste-special/spec.md +170 -0
  78. package/specs/035-paste-special/tasks.md +149 -0
  79. package/specs/036-autosave-recovery/checklists/requirements.md +36 -0
  80. package/specs/036-autosave-recovery/contracts/autosave-api.md +111 -0
  81. package/specs/036-autosave-recovery/data-model.md +70 -0
  82. package/specs/036-autosave-recovery/plan.md +87 -0
  83. package/specs/036-autosave-recovery/quickstart.md +65 -0
  84. package/specs/036-autosave-recovery/research.md +105 -0
  85. package/specs/036-autosave-recovery/spec.md +143 -0
  86. package/specs/036-autosave-recovery/tasks.md +165 -0
  87. package/specs/037-fix-new-part-dialog/checklists/requirements.md +38 -0
  88. package/specs/037-fix-new-part-dialog/contracts/create-part-api.md +84 -0
  89. package/specs/037-fix-new-part-dialog/data-model.md +68 -0
  90. package/specs/037-fix-new-part-dialog/plan.md +83 -0
  91. package/specs/037-fix-new-part-dialog/quickstart.md +58 -0
  92. package/specs/037-fix-new-part-dialog/research.md +86 -0
  93. package/specs/037-fix-new-part-dialog/spec.md +144 -0
  94. package/specs/037-fix-new-part-dialog/tasks.md +174 -0
  95. package/specs/038-per-measure-beam-groups/checklists/requirements.md +36 -0
  96. package/specs/038-per-measure-beam-groups/contracts/beam-groups-api.md +74 -0
  97. package/specs/038-per-measure-beam-groups/data-model.md +75 -0
  98. package/specs/038-per-measure-beam-groups/plan.md +84 -0
  99. package/specs/038-per-measure-beam-groups/quickstart.md +53 -0
  100. package/specs/038-per-measure-beam-groups/research.md +72 -0
  101. package/specs/038-per-measure-beam-groups/spec.md +146 -0
  102. package/specs/038-per-measure-beam-groups/tasks.md +132 -0
  103. package/specs/039-measure-fill-submenu/checklists/requirements.md +35 -0
  104. package/specs/039-measure-fill-submenu/contracts/measure-fill-api.md +56 -0
  105. package/specs/039-measure-fill-submenu/data-model.md +79 -0
  106. package/specs/039-measure-fill-submenu/plan.md +81 -0
  107. package/specs/039-measure-fill-submenu/quickstart.md +62 -0
  108. package/specs/039-measure-fill-submenu/research.md +68 -0
  109. package/specs/039-measure-fill-submenu/spec.md +153 -0
  110. package/specs/039-measure-fill-submenu/tasks.md +121 -0
  111. package/specs/040-dynamics-dialog-cleanup/checklists/requirements.md +36 -0
  112. package/specs/040-dynamics-dialog-cleanup/contracts/dynamics-dialog.md +52 -0
  113. package/specs/040-dynamics-dialog-cleanup/data-model.md +48 -0
  114. package/specs/040-dynamics-dialog-cleanup/plan.md +89 -0
  115. package/specs/040-dynamics-dialog-cleanup/quickstart.md +69 -0
  116. package/specs/040-dynamics-dialog-cleanup/research.md +80 -0
  117. package/specs/040-dynamics-dialog-cleanup/spec.md +120 -0
  118. package/specs/040-dynamics-dialog-cleanup/tasks.md +114 -0
  119. package/specs/041-delete-special/checklists/requirements.md +35 -0
  120. package/specs/041-delete-special/contracts/delete-special-api.md +41 -0
  121. package/specs/041-delete-special/data-model.md +40 -0
  122. package/specs/041-delete-special/plan.md +93 -0
  123. package/specs/041-delete-special/quickstart.md +41 -0
  124. package/specs/041-delete-special/research.md +75 -0
  125. package/specs/041-delete-special/spec.md +136 -0
  126. package/specs/041-delete-special/tasks.md +106 -0
  127. package/src/application/application.ts +475 -459
  128. package/src/application/exports.ts +401 -395
  129. package/src/application/generateVexTests.ts +2 -2
  130. package/src/common/promiseHelpers.ts +2 -2
  131. package/src/render/audio/samples.ts +117 -118
  132. package/src/render/sui/NoteEntryCaret.ts +117 -16
  133. package/src/render/sui/autosave.ts +265 -0
  134. package/src/render/sui/formatter.ts +12 -2
  135. package/src/render/sui/pageDivisions.ts +58 -0
  136. package/src/render/sui/renderState.ts +469 -464
  137. package/src/render/sui/scoreChangeState.ts +67 -0
  138. package/src/render/sui/scoreView.ts +77 -2
  139. package/src/render/sui/scoreViewOperations.ts +363 -37
  140. package/src/render/sui/staffLineGeometry.ts +82 -0
  141. package/src/render/sui/svgPageMap.ts +16 -17
  142. package/src/render/sui/textEdit.ts +310 -311
  143. package/src/render/sui/tracker.ts +40 -0
  144. package/src/render/vex/vxMeasure.ts +22 -8
  145. package/src/render/vex/vxNote.ts +5 -5
  146. package/src/smo/data/measure.ts +58 -1
  147. package/src/smo/data/measureModifiers.ts +81 -1
  148. package/src/smo/data/music.ts +169 -359
  149. package/src/smo/data/note.ts +1 -1
  150. package/src/smo/data/noteModifiers.ts +12 -0
  151. package/src/smo/data/score.ts +167 -2
  152. package/src/smo/data/scoreModifiers.ts +46 -1
  153. package/src/smo/data/systemStaff.ts +43 -0
  154. package/src/smo/xform/beamers.ts +80 -6
  155. package/src/smo/xform/copypaste.ts +511 -51
  156. package/src/smo/xform/measureFill.ts +89 -0
  157. package/src/smo/xform/operations.ts +403 -61
  158. package/src/smo/xform/selections.ts +75 -0
  159. package/src/smo/xform/undo.ts +9 -0
  160. package/src/styles/menus.css +26 -0
  161. package/src/ui/buttons/ribbon.ts +3 -1
  162. package/src/ui/components/buttons/sidebar.vue +15 -6
  163. package/src/ui/components/dialogs/beamGroups.vue +106 -0
  164. package/src/ui/components/dialogs/deleteSpecial.vue +38 -0
  165. package/src/ui/components/dialogs/dynamics.vue +16 -3
  166. package/src/ui/components/dialogs/fileUpload.vue +2 -2
  167. package/src/ui/components/dialogs/hairpin.vue +3 -3
  168. package/src/ui/components/dialogs/library.vue +3 -1
  169. package/src/ui/components/dialogs/newPart.vue +148 -184
  170. package/src/ui/components/dialogs/pasteSpecial.vue +49 -0
  171. package/src/ui/components/dialogs/recovery.vue +66 -0
  172. package/src/ui/components/dialogs/save.vue +11 -4
  173. package/src/ui/components/dialogs/scorePreferences.vue +23 -1
  174. package/src/ui/components/dialogs/slur.vue +6 -6
  175. package/src/ui/components/dialogs/tempo.vue +11 -3
  176. package/src/ui/components/dialogs/timeSignature.vue +5 -0
  177. package/src/ui/components/dialogs/unsavedChanges.vue +44 -0
  178. package/src/ui/components/dialogs/volta.vue +3 -3
  179. package/src/ui/dialogs/adapter.ts +181 -183
  180. package/src/ui/dialogs/addMeasure.ts +97 -97
  181. package/src/ui/dialogs/annotationVue.ts +56 -56
  182. package/src/ui/dialogs/audioSettings.ts +121 -123
  183. package/src/ui/dialogs/beamGroupsVue.ts +69 -0
  184. package/src/ui/dialogs/chordChangeVue.ts +46 -46
  185. package/src/ui/dialogs/clefChange.ts +53 -53
  186. package/src/ui/dialogs/createPartHelpers.ts +68 -0
  187. package/src/ui/dialogs/customTuplets.ts +95 -96
  188. package/src/ui/dialogs/customTupletsVue.ts +47 -47
  189. package/src/ui/dialogs/deleteSpecial.ts +57 -0
  190. package/src/ui/dialogs/dialog.ts +627 -620
  191. package/src/ui/dialogs/durations.ts +34 -34
  192. package/src/ui/dialogs/dynamicsVue.ts +87 -60
  193. package/src/ui/dialogs/factory.ts +196 -198
  194. package/src/ui/dialogs/fileDialogs.ts +286 -179
  195. package/src/ui/dialogs/fonts.ts +93 -93
  196. package/src/ui/dialogs/globalLayout.ts +40 -40
  197. package/src/ui/dialogs/gracenote.ts +31 -31
  198. package/src/ui/dialogs/hairpin.ts +108 -110
  199. package/src/ui/dialogs/hairpinVue.ts +51 -51
  200. package/src/ui/dialogs/instrument.ts +119 -112
  201. package/src/ui/dialogs/keySignature.ts +175 -176
  202. package/src/ui/dialogs/keySignatureVue.ts +47 -47
  203. package/src/ui/dialogs/library.ts +207 -207
  204. package/src/ui/dialogs/libraryVue.ts +62 -48
  205. package/src/ui/dialogs/lyricVue.ts +46 -46
  206. package/src/ui/dialogs/measureFormat.ts +78 -78
  207. package/src/ui/dialogs/microtones.ts +147 -147
  208. package/src/ui/dialogs/noteHead.ts +319 -319
  209. package/src/ui/dialogs/pageLayout.ts +61 -61
  210. package/src/ui/dialogs/partInfo.ts +60 -60
  211. package/src/ui/dialogs/pasteSpecial.ts +59 -0
  212. package/src/ui/dialogs/pedalMarking.ts +117 -117
  213. package/src/ui/dialogs/pedalMarkingVue.ts +73 -73
  214. package/src/ui/dialogs/pitch.ts +352 -352
  215. package/src/ui/dialogs/preferences.ts +1 -0
  216. package/src/ui/dialogs/recovery.ts +49 -0
  217. package/src/ui/dialogs/rehearsalMark.ts +64 -64
  218. package/src/ui/dialogs/rehearsalMarkVue.ts +57 -57
  219. package/src/ui/dialogs/scoreId.ts +35 -36
  220. package/src/ui/dialogs/scoreView.ts +42 -42
  221. package/src/ui/dialogs/slur.ts +308 -310
  222. package/src/ui/dialogs/slurVue.ts +91 -91
  223. package/src/ui/dialogs/staffGroup.ts +112 -112
  224. package/src/ui/dialogs/tabNote.ts +84 -84
  225. package/src/ui/dialogs/tabStave.ts +182 -182
  226. package/src/ui/dialogs/tempo.ts +261 -263
  227. package/src/ui/dialogs/tempoVue.ts +73 -73
  228. package/src/ui/dialogs/textBlockVue.ts +127 -127
  229. package/src/ui/dialogs/textBracket.ts +114 -116
  230. package/src/ui/dialogs/textBracketVue.ts +56 -56
  231. package/src/ui/dialogs/tie.ts +140 -142
  232. package/src/ui/dialogs/timeSignature.ts +65 -66
  233. package/src/ui/dialogs/transposeScore.ts +39 -39
  234. package/src/ui/dialogs/unsavedChanges.ts +43 -0
  235. package/src/ui/dialogs/volta.ts +120 -122
  236. package/src/ui/dialogs/voltaVue.ts +51 -51
  237. package/src/ui/fileio/fileInput.ts +12 -3
  238. package/src/ui/fileio/library.ts +110 -111
  239. package/src/ui/fileio/scoreArchive.ts +151 -0
  240. package/src/ui/fileio/xhrLoader.ts +26 -0
  241. package/src/ui/i18n/language.ts +1 -1
  242. package/src/ui/menus/beams.ts +181 -112
  243. package/src/ui/menus/edit.ts +143 -6
  244. package/src/ui/menus/file.ts +40 -4
  245. package/src/ui/menus/measure.ts +40 -1
  246. package/tests/autosave.ts +332 -0
  247. package/tests/beamDotted.ts +56 -0
  248. package/tests/beamGroups.ts +338 -0
  249. package/tests/createPart.ts +292 -0
  250. package/tests/deleteSpecial.ts +350 -0
  251. package/tests/dynamicsFontSize.ts +132 -0
  252. package/tests/keyDistanceTransposition.ts +351 -0
  253. package/tests/measureFill.ts +295 -0
  254. package/tests/movePart.ts +94 -0
  255. package/tests/multimeasureRest.ts +338 -0
  256. package/tests/pageDivisions.ts +156 -0
  257. package/tests/pasteIntoMeasure.ts +103 -0
  258. package/tests/pasteSpecial.ts +541 -0
  259. package/tests/promiseHelpersUsage.ts +142 -0
  260. package/tests/quickBeam.ts +126 -0
  261. package/tests/scoreArchive.ts +218 -0
  262. package/tests/scoreChangeState.ts +104 -0
  263. package/tests/selectVoice.ts +189 -0
  264. package/tests/staffLineGeometry.ts +179 -0
  265. package/tests/timeSignatureDisplay.ts +58 -0
  266. package/tests/voiceCopyPaste.ts +417 -0
  267. package/tools/smoosic-schema.json +37 -0
  268. package/typedoc.ts +1 -1
  269. package/types/src/application/exports.d.ts +453 -447
  270. package/types/src/common/promiseHelpers.d.ts +30 -30
  271. package/types/src/common/vex.d.ts +224 -224
  272. package/types/src/render/sui/NoteEntryCaret.d.ts +107 -107
  273. package/types/src/render/sui/autosave.d.ts +99 -0
  274. package/types/src/render/sui/scoreView.d.ts +23 -0
  275. package/types/src/render/sui/scoreViewOperations.d.ts +759 -639
  276. package/types/src/render/sui/svgHelpers.d.ts +88 -88
  277. package/types/src/render/sui/svgPageMap.d.ts +344 -344
  278. package/types/src/render/sui/textEdit.d.ts +96 -96
  279. package/types/src/render/sui/textRender.d.ts +199 -199
  280. package/types/src/render/vex/smoAdapter.d.ts +47 -47
  281. package/types/src/render/vex/vxMeasure.d.ts +97 -97
  282. package/types/src/render/vex/vxNote.d.ts +56 -56
  283. package/types/src/render/vex/vxSystem.d.ts +71 -71
  284. package/types/src/smo/data/measure.d.ts +30 -0
  285. package/types/src/smo/data/measureModifiers.d.ts +568 -513
  286. package/types/src/smo/data/music.d.ts +74 -32
  287. package/types/src/smo/data/note.d.ts +498 -498
  288. package/types/src/smo/data/noteModifiers.d.ts +615 -606
  289. package/types/src/smo/data/score.d.ts +476 -421
  290. package/types/src/smo/data/scoreModifiers.d.ts +30 -0
  291. package/types/src/smo/data/scoreText.d.ts +334 -334
  292. package/types/src/smo/data/systemStaff.d.ts +14 -0
  293. package/types/src/smo/xform/beamers.d.ts +23 -1
  294. package/types/src/smo/xform/copypaste.d.ts +138 -2
  295. package/types/src/smo/xform/measureFill.d.ts +21 -0
  296. package/types/src/smo/xform/operations.d.ts +245 -129
  297. package/types/src/smo/xform/selections.d.ts +154 -154
  298. package/types/src/smo/xform/undo.d.ts +142 -142
  299. package/types/src/ui/buttons/button.d.ts +100 -100
  300. package/types/src/ui/buttons/ribbon.d.ts +70 -70
  301. package/types/src/ui/common.d.ts +76 -76
  302. package/types/src/ui/components/dialogs/chordText.d.ts +28 -28
  303. package/types/src/ui/components/dialogs/textBlockAtomNode.d.ts +20 -20
  304. package/types/src/ui/components/dialogs/textGroupHtml.d.ts +29 -29
  305. package/types/src/ui/composable/draggable.d.ts +15 -15
  306. package/types/src/ui/dialogs/adapter.d.ts +120 -120
  307. package/types/src/ui/dialogs/annotationVue.d.ts +9 -9
  308. package/types/src/ui/dialogs/audioSettings.d.ts +32 -32
  309. package/types/src/ui/dialogs/beamGroupsVue.d.ts +20 -0
  310. package/types/src/ui/dialogs/chordChangeVue.d.ts +8 -8
  311. package/types/src/ui/dialogs/createPartHelpers.d.ts +29 -0
  312. package/types/src/ui/dialogs/customTupletsVue.d.ts +9 -9
  313. package/types/src/ui/dialogs/deleteSpecial.d.ts +8 -0
  314. package/types/src/ui/dialogs/dialog.d.ts +203 -203
  315. package/types/src/ui/dialogs/dynamicsVue.d.ts +10 -10
  316. package/types/src/ui/dialogs/factory.d.ts +15 -15
  317. package/types/src/ui/dialogs/fileDialogs.d.ts +4 -4
  318. package/types/src/ui/dialogs/hairpin.d.ts +35 -35
  319. package/types/src/ui/dialogs/hairpinVue.d.ts +7 -7
  320. package/types/src/ui/dialogs/instrument.d.ts +3 -3
  321. package/types/src/ui/dialogs/keySignatureVue.d.ts +7 -7
  322. package/types/src/ui/dialogs/libraryVue.d.ts +15 -15
  323. package/types/src/ui/dialogs/lyricVue.d.ts +8 -8
  324. package/types/src/ui/dialogs/pasteSpecial.d.ts +8 -0
  325. package/types/src/ui/dialogs/pedalMarkingVue.d.ts +7 -7
  326. package/types/src/ui/dialogs/recovery.d.ts +8 -0
  327. package/types/src/ui/dialogs/rehearsalMark.d.ts +25 -25
  328. package/types/src/ui/dialogs/rehearsalMarkVue.d.ts +7 -7
  329. package/types/src/ui/dialogs/slur.d.ts +57 -57
  330. package/types/src/ui/dialogs/slurVue.d.ts +7 -7
  331. package/types/src/ui/dialogs/tempo.d.ts +50 -50
  332. package/types/src/ui/dialogs/tempoVue.d.ts +10 -10
  333. package/types/src/ui/dialogs/textBlockVue.d.ts +8 -8
  334. package/types/src/ui/dialogs/textBracket.d.ts +35 -35
  335. package/types/src/ui/dialogs/textBracketVue.d.ts +7 -7
  336. package/types/src/ui/dialogs/tie.d.ts +41 -41
  337. package/types/src/ui/dialogs/volta.d.ts +40 -40
  338. package/types/src/ui/dialogs/voltaVue.d.ts +7 -7
  339. package/types/src/ui/fileio/fileInput.d.ts +7 -1
  340. package/types/src/ui/fileio/library.d.ts +40 -40
  341. package/types/src/ui/fileio/scoreArchive.d.ts +55 -0
  342. package/types/src/ui/fileio/xhrLoader.d.ts +7 -0
  343. package/types/src/ui/menus/file.d.ts +8 -8
  344. package/types/src/ui/menus/language.d.ts +7 -7
  345. package/types/src/ui/menus/manager.d.ts +58 -58
  346. package/types/src/ui/menus/menu.d.ts +159 -159
  347. package/types/src/ui/menus/partSelection.d.ts +14 -14
  348. package/types/src/ui/menus/score.d.ts +8 -8
  349. package/types/src/ui/menus/staffModifier.d.ts +17 -17
  350. package/types/typedoc.d.ts +147 -147
  351. package/src/ui/dialogs/dynamics.ts +0 -143
  352. package/types/src/ui/dialogs/dynamics.d.ts +0 -37
@@ -0,0 +1,63 @@
1
+ # Research: Split Multimeasure Rests at Landmarks
2
+
3
+ Findings from reading the code. No NEEDS CLARIFICATION items remained after the spec and the user's clarifications.
4
+
5
+ ## 1. Where the lone rest bar comes from
6
+
7
+ **Finding**: `computeMultipartRest` (operations.ts) walks the measures: if `isMultimeasureRest(i, true, forceRest)` it extends `j` while `isMultimeasureRest(j, false, forceRest)` and no `restBreak`, and records a block only when `j - i >= 2`; otherwise it advances by one and clears `hideMultimeasure`. `SmoScore.isMultimeasureRest` returns false, for both the "start" and "continue" calls, if any staff has a volta on the measure, a repeat symbol (`isRepeatSymbol`), a rehearsal mark, or (staff index above 0) an instrument entry on the measure. Only the key and time signature checks, and the previous-measure repeat check, are skipped for a start. So a rehearsal mark on measure 6 of a run of rests ends the block at measure 5 (6 fails to continue), then 6 fails the *start* test too, so it is stepped over as an ordinary rest bar, and a new block starts at 7: the lone bar between two multimeasure rests.
8
+
9
+ **Decision**: Separate "can this measure be in a block at all" (volta, forced) from "does this measure break the run before it" (start landmarks) and "does this measure close the run after it" (end landmarks), and rewrite the loop around those.
10
+
11
+ ## 2. Which landmarks are already handled
12
+
13
+ **Finding**: Key and time signature differences are only tested when continuing (`!start`), so a key or time change already ends one block and starts the next with no lone bar. The reported problem for those two is therefore in the drawing (does the second block show the new signature?) rather than in the grouping, or it is a different path; the manual check in quickstart.md covers it. A tempo change is not tested at all today, so a tempo change inside a run of rests does not split it.
14
+
15
+ **Decision**: Keep the key/time rule, add tempo (a change from the previous measure's tempo, counted only if the new tempo is displayed, since otherwise there is nothing for the player to see). Verify the signature drawing by hand, and fix it in the drawing code only if it fails.
16
+
17
+ ## 3. Start versus end landmarks
18
+
19
+ **Finding**: `SmoRepeatSymbol.symbols` are Coda, Segno, ToCoda, DcAlCoda, DcAlFine, DsAlCoda, DsAlFine, Fine. `SmoBarline` start and end barlines are per measure (`getStartBarline`, `getEndBarline`); today `SmoSystemStaff.isRepeat(index)` mixes them: it is true if the *next* measure's start barline is special, or this measure's end barline is special, or this measure has a repeat symbol, and the loop uses it as "measure i-1 closes a run" (`!start && isRepeat(measureIndex - 1)`).
20
+
21
+ **Decision**:
22
+
23
+ - Start landmark at measure m (any staff): rehearsal mark; repeat symbol Segno or Coda; tempo change (displayed); key signature change; time signature change; start barline that is not a single bar or no bar; an instrument map entry at m > 0.
24
+ - End landmark at measure m (any staff): repeat symbol ToCoda, DC/DS al Coda/Fine, or Fine; end barline that is not a single bar or no bar.
25
+ - Blocked (never in a block, as today): a volta ending covering the measure on any staff; and the quirk below.
26
+ - A block is a start measure followed by every following rest measure that is not blocked, has no `restBreak`, and has no start landmark, stopping after the first measure that has an end landmark. A start measure that is itself an end measure closes at once (a single bar).
27
+ - Key and time comparisons stay against the previous measure on staff 0, as today. Tempo likewise compares staff 0.
28
+
29
+ ## 4. A legacy quirk kept on purpose
30
+
31
+ **Finding**: The instrument test is `measureInstrumentMap[measureIndex] && i > 0`: for any staff after the first, an instrument entry on the measure counts. Every staff has an entry at measure 0, so in a multi-staff part measure 0 can never start a block today (it is shown as an ordinary bar and a block starts at measure 1). That looks accidental but changes the look of every multi-staff part's first bar.
32
+
33
+ **Decision**: Do not change it here (SC-004 says scores without landmarks inside rests look as before). Measure 0 of a multi-staff part stays "blocked" from starting a block. An instrument entry at m > 0 on any staff, including the first, becomes a start landmark. Flag the quirk to the maintainer as a separate question.
34
+
35
+ ## 5. Why an end symbol vanishes
36
+
37
+ **Finding**: `SuiRenderState`/`vxSystem.renderMeasure` returns immediately for any measure with `svg.hideMultimeasure`, and `vxMeasure.createMeasureModifiers` draws the repeat symbol (`VF.Repetition`) from the measure's own `getRepeatSymbol()` only when `firstInColumn`. In a block, every measure after the first is hidden. A D.S. on the last measure of a block is on a hidden measure, so it is never drawn. The start measure's `svg` also carries `multimeasureEndBarline`, copied from the last measure's end barline, which is how an end repeat bar is already shown at the end of a block.
38
+
39
+ **Decision**: Record the last measure's end-type symbol on the block's first measure as a runtime field `svg.multimeasureEndSymbol`, and draw it in `createMeasureModifiers` over the multimeasure rest (position from the symbol's own x/y offset, as for any symbol). Do the same for the VexFlow export path (`toVex.ts`) only if it draws repeat symbols; check during implementation.
40
+
41
+ ## 6. Stale flags
42
+
43
+ **Finding**: For a measure that is not a block start, the current code resets only `hideMultimeasure`; `multimeasureLength`, `multimeasureEndBarline` can keep values from an earlier grouping.
44
+
45
+ **Decision**: For every measure on every staff that is not a block start, set `multimeasureLength = 0`, reset `multimeasureEndBarline` to a single bar, and clear `multimeasureEndSymbol`. For a block start, set all three from the block.
46
+
47
+ ## 7. When the grouping is computed
48
+
49
+ **Finding**: `computeMultipartRest` is called only from `SuiScoreView.setView` (when a part is exposed) and `updatePartInfo`. Landmark edits in an exposed part therefore do not regroup until the part is re-exposed or its info is updated. The grouping only applies to parts (`expandMultimeasureRests` is set true for new full scores, and the loop is skipped when it is).
50
+
51
+ **Decision**: Also call `SmoOperation.computeMultipartRest(this.score)` at the start of `SuiLayoutFormatter.layout()` when `score.isPartExposed()`. Every full layout then reflects the current landmarks and rest content. Edits that only re-render single columns without a full layout (an existing limitation, for example typing a note into an already grouped measure) are out of scope; the manual check lists which landmark edits do a full layout.
52
+
53
+ ## 8. The public `isMultimeasureRest`
54
+
55
+ **Finding**: `SmoScore.isMultimeasureRest(measureIndex, start, forceRest)` is public and exported with the library, though the only caller in `src/` is `computeMultipartRest`.
56
+
57
+ **Decision**: Leave it unchanged (same behavior for outside callers), mark it as superseded in its doc comment, and implement the new rule with new helpers. The same approach was used for `PromiseHelpers` in spec 029.
58
+
59
+ ## 9. Barline between blocks
60
+
61
+ **Finding**: A block's end barline comes from the last measure (`multimeasureEndBarline`) and its start barline from its first measure; hidden measures contribute neither, so a barline between two blocks is drawn once at the end of the first and once at the start of the second only if the user set both, exactly as for adjacent ordinary measures.
62
+
63
+ **Decision**: No special handling beyond the grouping rules. FR-007a is met by construction; confirm by hand.
@@ -0,0 +1,127 @@
1
+ # Feature Specification: Split Multimeasure Rests at Landmarks
2
+
3
+ **Feature Branch**: `032-split-multimeasure-rests`
4
+
5
+ **Created**: 2026-10-22
6
+
7
+ **Status**: Draft
8
+
9
+ **Input**: User description: "operations.ts computeMultipartRest and the logic in vxSystem, vxMeasure is not handling the case where a multimeasure rest is broken up because of a key signature, rehearsal mark, or other landmark. The score should display the landmark but it should not render a measure of rest between 2 multimeasure rests."
10
+
11
+ ## Clarifications
12
+
13
+ ### Session 2026-10-22
14
+
15
+ - Q: Where do landmarks that mark the end of a section (D.S., D.C., To Coda, Fine, an end-repeat or double barline) break the rest, and where are they shown? → A: The rest is broken after the measure that carries them, and they are shown on the first block (the symbol over that block's rest, the barline at its end).
16
+ - Q: Where do landmarks that mark the start of a section (Segno, Coda, a start-repeat or double barline, rehearsal mark) break the rest, and where are they shown? → A: The rest is broken before the measure that carries them, and they are shown at the beginning of the next block, after the separating barline.
17
+ - Q: Are tempo, key signature and time signature changes landmarks? → A: Yes, all three. Each is a start landmark: the rest is broken before the measure with the change and the change is shown at the start of the next block. (This replaces the earlier assumption that a tempo change does not split a rest.)
18
+
19
+ ## User Scenarios & Testing *(mandatory)*
20
+
21
+ ### User Story 1 - A rehearsal mark inside a long rest starts the next multimeasure rest (Priority: P1)
22
+
23
+ A composer or arranger has a part with many empty measures in a row. Normally these are shown as one multimeasure rest (a thick bar with a count, such as "10"). They put a rehearsal mark (for example "B") on measure 6, in the middle of the rest. The part should now show a multimeasure rest for measures 1 to 5, then a second multimeasure rest for measures 6 to 10 that carries the rehearsal mark "B". Today the rest is broken in the wrong way: the measure with the rehearsal mark is drawn as a separate, ordinary measure of rest in between, so the player sees a rest of 5, a single rest bar, and then a rest of 4.
24
+
25
+ **Why this priority**: Rehearsal marks are the most common reason to break a long rest, and every part with a rest of more than a few bars and rehearsal letters is affected. The extra single bar is a visible engraving error and misleads the player about the count.
26
+
27
+ **Independent Test**: Make 10 empty measures, put a rehearsal mark on measure 6, and view the score. You should see exactly two multimeasure rests: one for measures 1 to 5 and one for measures 6 to 10, with the rehearsal mark shown above the second. No ordinary rest measure appears between them.
28
+
29
+ **Acceptance Scenarios**:
30
+
31
+ 1. **Given** a run of empty measures with a rehearsal mark on a measure in the middle, **When** the score is displayed, **Then** the measures before the mark form one multimeasure rest and the mark's measure and the measures after it (up to the next break) form the next one, with the mark displayed.
32
+ 2. **Given** a rehearsal mark on the very first measure of a run of rests, **When** the score is displayed, **Then** the whole run is one multimeasure rest that starts with the mark.
33
+ 3. **Given** a rehearsal mark on a measure that is followed by music (not rests), **When** the score is displayed, **Then** that measure is shown as an ordinary measure of rest with its mark, because a single bar is not a multimeasure rest.
34
+ 4. **Given** two rehearsal marks in a run of rests, **When** the score is displayed, **Then** each mark begins its own multimeasure rest and no single-bar rest appears between them.
35
+
36
+ ---
37
+
38
+ ### User Story 2 - Key, time signature and tempo changes inside a long rest (Priority: P1)
39
+
40
+ The same rule applies when the key signature, time signature or tempo changes during a run of empty measures. The measures before the change form one multimeasure rest; the measure with the change starts the next multimeasure rest, and the new signature or tempo is shown at its start. There is never a lone ordinary rest measure between them.
41
+
42
+ **Why this priority**: Key and time changes during a rest are normal in orchestral parts (a movement may change key while a part is tacet), and the player must see the new signature before they play again.
43
+
44
+ **Independent Test**: Make 8 empty measures, change the key signature at measure 5, and view the score. Expect a multimeasure rest for measures 1 to 4, then a multimeasure rest for measures 5 to 8 that begins with the new key signature, with no single rest bar between them. Repeat for a time signature change.
45
+
46
+ **Acceptance Scenarios**:
47
+
48
+ 1. **Given** a run of empty measures with a key signature change at one measure, **When** the score is displayed, **Then** the rest is split into two multimeasure rests at that measure, and the new key signature is displayed at the start of the second.
49
+ 2. **Given** a time signature change inside a run of empty measures, **When** the score is displayed, **Then** the same split occurs and the new time signature is displayed at the start of the second.
50
+ 3. **Given** a run of empty measures with a tempo change at one measure, **When** the score is displayed, **Then** the same split occurs and the new tempo is displayed at the start of the second.
51
+ 4. **Given** a run of empty measures with both a key signature change and a rehearsal mark on the same measure, **When** the score is displayed, **Then** one split is made there, and both are displayed.
52
+
53
+ ---
54
+
55
+ ### User Story 3 - Landmarks that end a section break the rest after their measure (Priority: P1)
56
+
57
+ Some markings belong to the end of a measure, not its start: D.S. and D.C. (al Coda, al Fine), To Coda, Fine, and an end-repeat or double barline. When one of these is on an empty measure inside a run of rests, the rest is broken after that measure: the measure with the marking is the last bar of its block, the marking is shown over that block's rest (or, for a barline, at the end of the block), and the next block begins on the following measure. Markings that belong to the start of a measure (Segno, Coda, a start-repeat or double barline) are handled as in User Story 1: the rest is broken before that measure, and the marking is shown at the beginning of the next block, after the separating barline.
58
+
59
+ **Why this priority**: Without this rule, a "D.S. al Coda" in the middle of a long rest would either be lost or would force a lone rest bar. Players rely on seeing the instruction where the music ends, and on a Segno or Coda sign where the music resumes.
60
+
61
+ **Independent Test**: Make 12 empty measures. Put a D.S. al Coda on measure 4 and a Coda sign on measure 9. View the score. Expect a multimeasure rest for measures 1 to 4 with the D.S. al Coda shown over it, a multimeasure rest for measures 5 to 8, and a multimeasure rest for measures 9 to 12 with the Coda sign shown at its start, after the barline. No ordinary rest bar appears between them.
62
+
63
+ **Acceptance Scenarios**:
64
+
65
+ 1. **Given** a D.S., D.C., To Coda or Fine marking on an empty measure inside a run of rests, **When** the score is displayed, **Then** the rest is broken after that measure and the marking is displayed over the multimeasure rest that ends with it.
66
+ 2. **Given** a Segno or Coda sign on an empty measure inside a run of rests, **When** the score is displayed, **Then** the rest is broken before that measure and the sign is displayed at the beginning of the multimeasure rest that starts with it, after the barline that separates the blocks.
67
+ 3. **Given** an end-repeat barline or a double barline at the end of an empty measure inside a run of rests, **When** the score is displayed, **Then** the rest is broken after that measure and the barline is drawn at the end of the block that ends with it.
68
+ 4. **Given** a start-repeat barline or a double barline at the start of an empty measure inside a run of rests, **When** the score is displayed, **Then** the rest is broken before that measure and the barline is drawn at the start of the block that begins with it.
69
+ 5. **Given** a rest that is broken at a barline, **When** the score is displayed, **Then** the barline appears once, between the two blocks, and not both at the end of the first block and again at the start of the second.
70
+
71
+ ---
72
+
73
+ ### Edge Cases
74
+
75
+ - What happens when a start landmark sits on the last measure of the run of rests, so only one measure would follow it? That measure is a single bar and is shown as an ordinary measure of rest, as today, because there is nothing to merge it with.
76
+ - What happens when an end landmark (such as D.S.) is on the first measure of a run of rests? That measure is a single bar, shown as an ordinary measure of rest with the marking, and the rest continues after it.
77
+ - What happens when one measure carries both a start landmark and an end landmark (for example a rehearsal mark and a D.S.)? That measure is a block of its own, shown as an ordinary measure of rest with both markings, between the blocks before and after it. This is unavoidable, and is the only case where a single rest bar appears between multimeasure rests.
78
+ - What happens when the measure after a split is followed by notes? The measure carrying the landmark is an ordinary rest bar, and the music follows.
79
+ - What happens when the run of rests has start landmarks on consecutive measures (for example marks on 5 and 6)? Measure 5 is a single bar with its mark; measure 6 starts the next multimeasure rest, if the rest continues.
80
+ - What happens when a part with more than one staff is displayed (for example a piano part)? A landmark on any staff splits the rest on all staves, since all staves must have the same measure groupings, and each staff shows the landmark it has.
81
+ - What happens when a part is displayed with "expand multimeasure rests" turned on? Every rest measure is shown individually, as today, and nothing changes.
82
+ - What happens when the user adds or removes a landmark? The grouping updates at the next display, with no leftover single-bar rest.
83
+ - What happens when a measure that is part of a repeat ending (volta bracket) is empty? These keep the behavior they have today: measures under an ending bracket are shown individually. This feature does not change how endings are shown.
84
+ - What happens when the score is printed or exported to an image? The same grouping is used.
85
+
86
+ ## Requirements *(mandatory)*
87
+
88
+ ### Functional Requirements
89
+
90
+ - **FR-001**: A run of consecutive empty measures MUST be shown as a multimeasure rest, unless multimeasure rests are turned off for the score or part.
91
+ - **FR-002**: A landmark that belongs to the start of a measure (a start landmark) MUST end the multimeasure rest that precedes that measure: the measures before it are one multimeasure rest and the landmark's measure is not part of that rest.
92
+ - **FR-003**: The measure carrying a start landmark MUST start a new multimeasure rest that includes it and the empty measures that follow it, up to the next break. The landmark MUST be displayed at the beginning of that rest, after the barline that separates the blocks.
93
+ - **FR-004**: The start landmarks are: a rehearsal mark, a key signature change, a time signature change, a tempo change, a Segno or Coda sign, a start-repeat barline or a double barline at the start of a measure, and a change of instrument.
94
+ - **FR-005**: A landmark that belongs to the end of a measure (an end landmark) MUST end the multimeasure rest at that measure: the measure carrying it is the last bar of its block, and the next block begins on the following measure. The landmark MUST be displayed on the block that ends with it: a D.S., D.C., To Coda or Fine marking over the rest, and an end-repeat or double barline at the end of the block.
95
+ - **FR-005a**: The end landmarks are: a D.S. or D.C. marking (al Coda or al Fine), To Coda, Fine, and an end-repeat barline or a double barline at the end of a measure.
96
+ - **FR-006**: The system MUST NOT draw an ordinary measure of rest between two multimeasure rests merely because the second begins at a start landmark or the first ends at an end landmark.
97
+ - **FR-007**: A measure that is the only empty measure in its block (for example, a start landmark followed by music, an end landmark right after another break, or a measure carrying both kinds) MUST be shown as an ordinary measure of rest with its landmarks.
98
+ - **FR-007a**: A barline that falls between two blocks MUST be drawn once, between them, as the end of the first block or the start of the second as appropriate, and MUST NOT be repeated at both.
99
+ - **FR-008**: The grouping MUST be the same on every staff of the displayed score, and a landmark on any staff MUST split the rest on all of them.
100
+ - **FR-009**: The count shown on each multimeasure rest MUST be the number of measures it spans, and the sum of the counts of adjacent rests plus any single bars between them MUST equal the number of empty measures.
101
+ - **FR-010**: Turning on "expand multimeasure rests" for a part MUST continue to show every measure individually, and measures under a repeat ending MUST keep their current behavior.
102
+ - **FR-011**: The grouping MUST be recomputed whenever the displayed measures change (editing, adding or removing a landmark, changing the part), so that no stale single-bar rest or hidden measure remains.
103
+
104
+ ### Key Entities
105
+
106
+ - **Multimeasure rest**: A group of two or more consecutive empty measures drawn as one measure with a count.
107
+ - **Start landmark**: A marking that belongs to the beginning of a measure: rehearsal mark, key, time or tempo change, Segno, Coda, start-repeat or double barline, instrument change.
108
+ - **End landmark**: A marking that belongs to the end of a measure: D.S., D.C., To Coda, Fine, end-repeat or double barline.
109
+ - **Break**: The point between two measures at which one multimeasure rest ends and the next begins: just before a measure with a start landmark, or just after a measure with an end landmark.
110
+
111
+ ## Success Criteria *(mandatory)*
112
+
113
+ ### Measurable Outcomes
114
+
115
+ - **SC-001**: In a run of N empty measures with B breaks (each start landmark not on the first measure and each end landmark not on the last measure adds one), the score shows B + 1 blocks, a block of two or more measures is one multimeasure rest, no block of two or more measures is drawn as separate rests, and the measures shown add up to N.
116
+ - **SC-002**: Each start landmark is visible at the beginning of the block it starts, and each end landmark on the block it ends, in 100% of cases.
117
+ - **SC-003**: With "expand multimeasure rests" on, the score shows N separate measures, as before, in 100% of cases.
118
+ - **SC-004**: Scores with no landmarks inside their runs of empty measures display exactly as they did before this change.
119
+ - **SC-005**: After adding or removing a landmark, the displayed grouping matches a fresh display of the same score in 100% of cases.
120
+
121
+ ## Assumptions
122
+
123
+ - "Empty measure" means a measure that contains only rests, as the application already defines it for multimeasure rests.
124
+ - Which measures count as a landmark is the set in FR-004 and FR-005a. Text annotations are not landmarks and do not split a rest. Measures covered by a repeat ending bracket keep today's behavior and are out of scope.
125
+ - Multi-staff scores always keep the same grouping on all staves, since the staves share their measures' positions.
126
+ - The rule applies equally when a part is displayed, since a part is just a score showing selected staves.
127
+ - The count shown on a multimeasure rest and its end barline follow the existing rules; only where a rest starts and ends changes.
@@ -0,0 +1,174 @@
1
+ ---
2
+
3
+ description: "Task list for Split Multimeasure Rests at Landmarks"
4
+ ---
5
+
6
+ # Tasks: Split Multimeasure Rests at Landmarks
7
+
8
+ **Input**: Design documents from `/specs/032-split-multimeasure-rests/`
9
+
10
+ **Prerequisites**: [plan.md](./plan.md), [spec.md](./spec.md), [research.md](./research.md), [data-model.md](./data-model.md), [contracts/grouping-contract.md](./contracts/grouping-contract.md), [quickstart.md](./quickstart.md)
11
+
12
+ **Tests**: Included. The plan commits to a headless `tests/multimeasureRest.ts` (cases G1 to G24) for the grouping logic. Drawing is checked manually (M1 to M10).
13
+
14
+ **Organization**: Tasks are grouped by user story. The landmark classification and the rewritten grouping loop are shared by all three stories, so they are the foundation; each story then adds its tests and the drawing or layout work it needs.
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:multimeasure-rest": "ts-node -P tests/tsconfig.json tests/multimeasureRest.ts"` to `package.json`, next to the existing `test:select-voice` entry.
30
+ - [X] T002 Create `tests/multimeasureRest.ts` with the scaffold and builders: header comment pointing at `specs/032-split-multimeasure-rests/contracts/grouping-contract.md`; the dynamic-ctor-init calls and imports used by `tests/selectVoice.ts`; the `failures` counter and `check()` helper; the final summary block; `buildScore(staffCount = 1)` returning a score of 12 measures in 4/4 where every measure contains only rests (the default measures are rests), exposed as a part by leaving `partInfo.expandMultimeasureRests` false on `staves[0]`; and helpers `blocks(score)` returning the list of `start:length` strings for measures with `svg.multimeasureLength > 0` (1-based start), `hidden(score)` returning the 1-based indexes with `svg.hideMultimeasure`, and `accounted(score)` returning true when the block lengths plus the measures that are neither a block start nor hidden add up to the measure count. Add landmark helpers: `addRehearsal(score, m)` (via `measure.addRehearsalMark`), `setRepeatSymbol(score, m, symbolName)` (set `measure.repeatSymbol = true` and the symbol on `getRepeatSymbol()`), `setStartBarline(score, m, barline)`, `setEndBarline(score, m, barline)`, `setKey(score, m, key)` and `setTime(score, m, beats, duration)` (applied to the measure and all later measures, as a real change carries forward), `setTempo(score, m, display)` (a tempo with a different `bpm`, applied to measure m and later), and `setInstrument(score, m)` (an entry in `staves[0].measureInstrumentMap`).
31
+
32
+ ---
33
+
34
+ ## Phase 2: Foundational (Blocking Prerequisites)
35
+
36
+ **Purpose**: The classification and grouping that every story relies on.
37
+
38
+ **CRITICAL**: No user story work can begin until this phase is complete.
39
+
40
+ - [X] T003 [P] In `src/smo/data/measure.ts`, add `multimeasureEndSymbol: SmoRepeatSymbol | null` to the `svg` runtime interface (next to `multimeasureEndBarline`) and to its default (`null`), importing `SmoRepeatSymbol` if needed. It is not serialized.
41
+ - [X] T004 In `src/smo/data/score.ts`, add the three helpers from [data-model.md](./data-model.md): `isMultimeasureBlocked(measureIndex)`, `isMultimeasureStartLandmark(measureIndex)` and `isMultimeasureEndLandmark(measureIndex)`, implemented exactly as specified there (volta on any staff, plus the legacy measure-0-of-a-multi-staff-part block; start landmarks: rehearsal mark, repeat symbol Segno or Coda, instrument map entry at measure above 0, non-plain start barline, and for staff 0 a key signature, time signature or displayed-tempo difference from the previous measure; end landmarks: repeat symbol ToCoda, DcAlCoda, DcAlFine, DsAlCoda, DsAlFine or Fine, and a non-plain end barline). Use `SmoBarline.barlines.singleBar` and `.noBar`, `SmoRepeatSymbol.symbols`, `SmoTimeSignature.equal` and `SmoTempo.eq`. Leave `isMultimeasureRest` unchanged and add a doc comment that it is superseded by the new helpers but kept for outside users.
42
+ - [X] T005 In `src/smo/xform/operations.ts`, rewrite `computeMultipartRest` as specified in [data-model.md](./data-model.md): keep the early return for `expandMultimeasureRests`; walk the measures with the new block rule (start measure may carry start landmarks; an end landmark on a measure closes the block after it; join only rest, unblocked measures with no `restBreak` and no start landmark; `forceRest` as before); for every block set length, end barline from the last measure, `multimeasureEndSymbol` from the last measure's end-type symbol (null if none) and `hideMultimeasure` on every staff; and for every measure that is not a block start or a hidden block member, reset `multimeasureLength` to 0, `multimeasureEndBarline` to the single bar, `multimeasureEndSymbol` to null and `hideMultimeasure` to false, on every staff.
43
+ - [X] T006 Run `npx tsc --noEmit -p tsconfig.json` and fix any errors.
44
+
45
+ **Checkpoint**: The grouping follows the new rules; nothing yet exercises them.
46
+
47
+ ---
48
+
49
+ ## Phase 3: User Story 1 - A rehearsal mark inside a long rest starts the next multimeasure rest (Priority: P1) MVP
50
+
51
+ **Goal**: A rehearsal mark splits a run of rests without a lone bar between the blocks, and edits take effect on the next layout.
52
+
53
+ **Independent Test**: quickstart.md section 3, steps 1 to 4.
54
+
55
+ ### Tests for User Story 1
56
+
57
+ - [X] T007 [P] [US1] In `tests/multimeasureRest.ts`, add cases G1 to G5 (no landmarks, rehearsal mark in the middle, on the first measure, on the last measure, two marks) and G21 and G22 (expand multimeasure rests on, and a volta ending), each also checking `accounted(score)`.
58
+ - [X] T008 [US1] Run `npm run test:multimeasure-rest` and fix `score.ts` / `operations.ts` until G1 to G5, G21 and G22 pass.
59
+
60
+ ### Implementation for User Story 1
61
+
62
+ - [X] T009 [US1] In `src/render/sui/formatter.ts` `SuiLayoutFormatter.layout()`, call `SmoOperation.computeMultipartRest(this.score)` at the start when `this.score.isPartExposed()` is true, importing `SmoOperation`; first confirm there is no circular import problem with `operations.ts` (if there is, call it from the code that invokes `layout()` instead, for example in `scoreRender.ts`).
63
+ - [X] T010 [US1] Run `npx tsc --noEmit -p tsconfig.json` and `npm run build`; fix any errors.
64
+ - [ ] T011 [US1] Manual validation: quickstart.md section 3, steps 1 to 4 and 12 (M1, M7).
65
+
66
+ **Checkpoint**: Rehearsal marks split a long rest correctly.
67
+
68
+ ---
69
+
70
+ ## Phase 4: User Story 2 - Key, time signature and tempo changes inside a long rest (Priority: P1)
71
+
72
+ **Goal**: Key, time and tempo changes split the rest and the change is shown at the start of the second block.
73
+
74
+ **Independent Test**: quickstart.md section 3, step 5.
75
+
76
+ ### Tests for User Story 2
77
+
78
+ - [X] T012 [P] [US2] In `tests/multimeasureRest.ts`, add cases G6 to G10 (key change, time change, displayed tempo change, undisplayed tempo change, key change together with a rehearsal mark).
79
+ - [X] T013 [US2] Run `npm run test:multimeasure-rest` and fix until G6 to G10 pass.
80
+
81
+ ### Implementation for User Story 2
82
+
83
+ - [ ] T014 [US2] Manual validation: quickstart.md section 3, step 5 (M2, M3, M4): confirm the new key signature, time signature and tempo are drawn at the start of the second rest. If one is not drawn, read `calculateBeginningSymbols` and the hidden-measure carry-over in `src/render/sui/formatter.ts` (around lines 780 to 795 and 833 to 866) and `createMeasureModifiers` in `src/render/vex/vxMeasure.ts`, and fix the cause in the drawing code (the force flags are computed against the measure to the left, which may be a hidden measure); record what was found.
84
+
85
+ **Checkpoint**: Signature and tempo changes split the rest and are visible.
86
+
87
+ ---
88
+
89
+ ## Phase 5: User Story 3 - Landmarks that end a section break the rest after their measure (Priority: P1)
90
+
91
+ **Goal**: D.S., D.C., To Coda, Fine and end barlines end a block and are shown on it; Segno, Coda and start barlines begin the next block.
92
+
93
+ **Independent Test**: quickstart.md section 3, steps 6 to 9.
94
+
95
+ ### Tests for User Story 3
96
+
97
+ - [X] T015 [P] [US3] In `tests/multimeasureRest.ts`, add cases G11 to G20 and G23 (Segno and Coda, D.S. al Coda, To Coda, D.C. al Fine on the first measure, end-repeat and start-repeat barlines, double bar both ways, instrument change, a rehearsal mark together with a D.S., two staves). Include in G13, G14 and G15 checks that `svg.multimeasureEndSymbol` is set on the block's first measure with the right symbol (and null elsewhere), and in G16 that `svg.multimeasureEndBarline` of the first block's first measure equals the end-repeat barline.
98
+ - [X] T016 [US3] Run `npm run test:multimeasure-rest` and fix until G11 to G20 and G23 pass.
99
+
100
+ ### Implementation for User Story 3
101
+
102
+ - [X] T017 [US3] In `src/render/vex/vxMeasure.ts` `createMeasureModifiers`, after the existing own-symbol block, add: if `this.smoMeasure.svg.multimeasureEndSymbol` is set and `this.smoMeasure.svg.multimeasureLength > 0` and `this.firstInColumn`, create a `VF.Repetition` from that symbol (using `toVexSymbol`, `symbol.xOffset + this.smoMeasure.staffX`, and `symbol.yOffset`, moved up 30 as the existing code does when the measure has a rehearsal mark) and push it onto the stave modifiers, so the symbol shows over the multimeasure rest.
103
+ - [X] T018 [US3] Check `src/render/vex/toVex.ts` (around lines 128 to 142 and where it handles repeat symbols): if the Vex export draws repeat symbols for measures, mirror T017 for `multimeasureEndSymbol`; if it does not draw them at all, record that and make no change.
104
+ - [X] T019 [US3] Run `npx tsc --noEmit -p tsconfig.json` and `npm run build`; fix any errors.
105
+ - [ ] T020 [US3] Manual validation: quickstart.md section 3, steps 6 to 9 (M5, M6, M8): the D.S. over the first rest, the Coda sign at the start of the last rest after the barline, repeat barlines drawn once.
106
+
107
+ **Checkpoint**: All landmark kinds split rests as specified.
108
+
109
+ ---
110
+
111
+ ## Phase 6: Polish & Cross-Cutting Concerns
112
+
113
+ - [X] T021 [P] In `tests/multimeasureRest.ts`, add case G24 (group with a rehearsal mark, remove it, regroup; assert one block `1:12` and that no measure keeps a stale `multimeasureLength`, `hideMultimeasure` or `multimeasureEndSymbol`; repeat with a D.S. added then removed).
114
+ - [X] T022 Run `npm run test:multimeasure-rest` and all nine existing test scripts; confirm all pass.
115
+ - [X] T023 Run `npx tsc --noEmit -p tsconfig.json` and `npm run build`; confirm both succeed with no new warnings.
116
+ - [ ] T024 Run through all of quickstart.md (sections 1 to 3), including steps 9 to 11, and note the result, including which edits regroup immediately.
117
+
118
+ ---
119
+
120
+ ## Dependencies & Execution Order
121
+
122
+ ### Phase Dependencies
123
+
124
+ - **Setup (Phase 1)**: none.
125
+ - **Foundational (Phase 2)**: depends on Setup. T003 (measure.ts) is independent; T004 (score.ts) must precede T005 (operations.ts), which uses its helpers and T003's field.
126
+ - **US1, US2, US3 (Phases 3 to 5)**: depend on Phase 2; their test blocks are in one file, so add them in order. US3's drawing task T017 depends on T003 and T005.
127
+ - **Polish (Phase 6)**: depends on all stories.
128
+
129
+ ### Within Each Story
130
+
131
+ - `tests/multimeasureRest.ts` is edited by T002, T007, T012, T015 and T021: add cases in separate blocks, in order.
132
+ - `vxMeasure.ts` is edited by T017 (and possibly T014).
133
+ - `formatter.ts` is edited by T009 (and possibly T014).
134
+
135
+ ### Parallel Opportunities
136
+
137
+ - T003 can be done while T001 and T002 are written.
138
+ - T007, T012 and T015 are separate blocks of the same file; write them while the code tasks proceed.
139
+ - T017 (drawing) can be written in parallel with T015/T016 once T003 and T005 exist.
140
+
141
+ ---
142
+
143
+ ## Parallel Example: Foundational phase
144
+
145
+ ```text
146
+ Task: "Add multimeasureEndSymbol to the svg record in src/smo/data/measure.ts" (T003)
147
+ Task: "Landmark helpers in src/smo/data/score.ts" (T004)
148
+ Task: "Rewrite computeMultipartRest in src/smo/xform/operations.ts" (T005, after T003, T004)
149
+ ```
150
+
151
+ ---
152
+
153
+ ## Implementation Strategy
154
+
155
+ ### MVP First (User Story 1)
156
+
157
+ 1. Phases 1 and 2 (classification and algorithm in place and compiling).
158
+ 2. Phase 3: tests prove rehearsal-mark splitting and regression behavior; the layout hook makes it take effect.
159
+ 3. Stop and validate in the app: a rehearsal mark in the middle of a part's long rest.
160
+
161
+ ### Incremental Delivery
162
+
163
+ 1. US1 fixes the most common case.
164
+ 2. US2 locks in key, time and tempo changes and verifies their drawing.
165
+ 3. US3 adds end landmarks and the drawing of end symbols.
166
+
167
+ ---
168
+
169
+ ## Notes
170
+
171
+ - The legacy rule that blocks measure 0 from starting a block in a multi-staff part is kept on purpose (research.md section 4) so that existing parts look the same; raise it separately if it should change.
172
+ - `SmoScore.isMultimeasureRest` is left unchanged for outside users.
173
+ - Edits that only re-render single columns without a full layout are an existing limitation and out of scope (research.md section 7).
174
+ - Commit after each phase.
@@ -0,0 +1,35 @@
1
+ # Specification Quality Checklist: Key-Distance Enharmonic Spelling for Transposition
2
+
3
+ **Purpose**: Validate specification completeness and quality before proceeding to planning
4
+ **Created**: 2026-10-27
5
+ **Feature**: [spec.md](../spec.md)
6
+
7
+ ## Content Quality
8
+
9
+ - [x] No implementation details (languages, frameworks, APIs)
10
+ - [x] Focused on user value and business needs
11
+ - [x] Written for non-technical stakeholders
12
+ - [x] All mandatory sections completed
13
+
14
+ ## Requirement Completeness
15
+
16
+ - [x] No [NEEDS CLARIFICATION] markers remain
17
+ - [x] Requirements are testable and unambiguous
18
+ - [x] Success criteria are measurable
19
+ - [x] Success criteria are technology-agnostic (no implementation details)
20
+ - [x] All acceptance scenarios are defined
21
+ - [x] Edge cases are identified
22
+ - [x] Scope is clearly bounded
23
+ - [x] Dependencies and assumptions identified
24
+
25
+ ## Feature Readiness
26
+
27
+ - [x] All functional requirements have clear acceptance criteria
28
+ - [x] User scenarios cover primary flows
29
+ - [x] Feature meets measurable outcomes defined in Success Criteria
30
+ - [x] No implementation details leak into specification
31
+
32
+ ## Notes
33
+
34
+ - FR-011 names the existing table being removed, because the request explicitly asks for its replacement; this is scope, not design.
35
+ - Distance is defined as steps around the circle of fifths to the nearest key containing the pitch (Bb = 1 flat from C, A# = 5 sharps from C), confirmed by the user on 2026-10-27.
@@ -0,0 +1,36 @@
1
+ # Contract: Spelling API (`SmoMusic`, `SmoOperation`)
2
+
3
+ Internal library contract; `SmoMusic` is part of the exported library surface (see `types/`), so names below are public. All keys are lowercase VexFlow strings as stored on `SmoMeasure.keySignature`.
4
+
5
+ ## Added (SmoMusic)
6
+
7
+ | Method | Signature | Behavior |
8
+ |--------|-----------|----------|
9
+ | `keyFifths` | `(keySignature: string) => number` | Sharps (+) / flats (-) of the major key, -7..+7. Throws or returns 0 for an unknown key (match `getSharpsInKeySignature` behavior: unknown returns 0). |
10
+ | `pitchFifths` | `(pitch: Pitch) => number` | Line-of-fifths position. |
11
+ | `fifthsToPitch` | `(f: number, octave: number) => Pitch` | Inverse of `pitchFifths`; octave is taken as given. |
12
+ | `distanceFromKey` | `(pitch: Pitch, keySignature: string) => number` | Signed distance; 0 in key, positive sharp side, negative flat side. |
13
+ | `keyForOffset` | `(keySignature: string, offset: number) => string` | Destination key for a half-step offset; fewest accidentals, tie to flats; offset 0 returns the input key. |
14
+
15
+ ## Changed (SmoMusic)
16
+
17
+ | Method | New behavior | Unchanged |
18
+ |--------|--------------|-----------|
19
+ | `getScaleTonesForKey(key)` | Computed from `keyFifths`. | Return shape `{ [letter]: 'f#' / 'bb' / 'cn' }`. |
20
+ | `getEnharmonicInKey(pitch, key)` | Smallest distance spelling, ties to flat. | Signature; octave adjusted so sounding pitch is identical; mutates `pitch.octave = 1` default when undefined, as today. |
21
+ | `transposePitchForKey(pitch, originalKey, destinationKey, offset)` | Position shift `s` (research R4). | Signature; returns a new `Pitch`. |
22
+
23
+ ## Removed
24
+
25
+ `enharmonicRoles`, `findRoleOfPitch`, `findPitchForRole`, interface `KeySignatureRole`. No in-repo callers outside `music.ts`.
26
+
27
+ ## Changed (SmoOperation)
28
+
29
+ `transposeScore(score, offset)`: for each measure, `kd = keyForOffset(measure.keySignature, offset)`; notes (including grace notes) are transposed with `transposePitchForKey(pitch, ks, kd, offset)`; then `measure.keySignature = kd`. Zero offset is a no-op.
30
+
31
+ ## Invariants (asserted by tests)
32
+
33
+ 1. `smoPitchToInt(result) === smoPitchToInt(input) + offset` for every transposition.
34
+ 2. `abs(distanceFromKey(result, kd)) === abs(distanceFromKey(input, ks))` and the sign is equal, for all non-extreme cases.
35
+ 3. `transpose(n)` then `transpose(-n)` restores letter, accidental, octave and key (non-extreme cases).
36
+ 4. Tie between sharp and flat spelling resolves to flat.
@@ -0,0 +1,49 @@
1
+ # Data Model: Key-Distance Enharmonic Spelling
2
+
3
+ No persisted data changes. These are the in-memory concepts the logic computes with; none is serialized.
4
+
5
+ ## Pitch (existing)
6
+
7
+ `{ letter: 'a'..'g', accidental: 'n' | '#' | 'b' | '##' | 'bb' (empty string tolerated), octave: number }`
8
+
9
+ ## Fifths position (derived, integer)
10
+
11
+ | Field | Meaning |
12
+ |-------|---------|
13
+ | `f` | `base(letter) + 7 * acc`, with base F=-1, C=0, G=1, D=2, A=3, E=4, B=5 and `acc` = +1 per sharp / -1 per flat |
14
+
15
+ Rules:
16
+ - Valid range with at most double accidentals: -15 (Fbb) .. 19 (B##).
17
+ - Pitch class is `(7 * f) mod 12`. Two positions are enharmonic iff they differ by a multiple of 12.
18
+ - Converting back: `letter` from `((f + 1) mod 7)` indexed over F,C,G,D,A,E,B; `acc` is `floor((f + 1) / 7)`.
19
+
20
+ ## Key index (derived, integer)
21
+
22
+ | Field | Meaning |
23
+ |-------|---------|
24
+ | `k` | Sharps (positive) or flats (negative) in the major key signature, -7 .. +7 |
25
+
26
+ Rules:
27
+ - Source of truth is the key signature string on the measure (`'c'`, `'g'`, `'db'`, ...). `k` is read from it via the existing sharp/flat counts.
28
+ - Scale tones of key `k` are positions `k-1 .. k+5`.
29
+ - Accidental for letter with base `b` in key `k` is `floor((k + 5 - b) / 7)`.
30
+
31
+ ## Distance (derived, signed integer)
32
+
33
+ `distance(f, k) = 0` if `k-1 <= f <= k+5`; `f - (k+5)` if above (sharp side, positive); `f - (k-1)` if below (flat side, negative).
34
+
35
+ | Example | f | k | Distance |
36
+ |---------|---|---|----------|
37
+ | A# in C | 10 | 0 | +5 |
38
+ | Bb in C | -2 | 0 | -1 |
39
+ | C# in C | 7 | 0 | +2 |
40
+ | E natural in Eb | 4 | -3 | +2 |
41
+ | G# in G | 8 | 1 | +2 |
42
+
43
+ Note on the Eb row: the window for Eb is positions -4..2 (Ab, Eb, Bb, F, C, G, D); E natural (4) is 2 above the top, so +2; G# in G (window 0..6) is 8, also +2. Equal distance, same direction, which is the preservation the spec requires.
44
+
45
+ ## Key shift (derived, integer)
46
+
47
+ `s = kd - ks`, adjusted by a multiple of 12 only if needed so that `7 * s ≡ offset (mod 12)`.
48
+
49
+ State transitions: none. All values are recomputed per operation; transposing by `+n` then `-n` returns each original `f` and `k` exactly, except for pitches that needed a ±12 respell to stay within double accidentals.
@@ -0,0 +1,87 @@
1
+ # Implementation Plan: Key-Distance Enharmonic Spelling for Transposition
2
+
3
+ **Branch**: `033-key-distance-transposition` (work is on `main`; no feature branch was created) | **Date**: 2026-10-27 | **Spec**: [spec.md](spec.md)
4
+
5
+ **Input**: Feature specification from `/specs/033-key-distance-transposition/spec.md`
6
+
7
+ ## Summary
8
+
9
+ Replace the `SmoMusic.enharmonicRoles` table in [music.ts](../../src/smo/data/music.ts) and the role lookups built on it with arithmetic on the circle of fifths. Every spelling gets a single integer position on the "line of fifths" (F=-1, C=0, G=1 ... B=5, plus 7 per sharp, minus 7 per flat) and every major key signature gets an index in -7..+7. From those two numbers:
10
+
11
+ - a key's seven scale tones are the positions `k-1 .. k+5`;
12
+ - a spelling's signed *distance* from a key is how far it lies outside that window (A# in C: 5 sharps; Bb in C: 1 flat);
13
+ - the default spelling of a pitch class is the candidate with the smallest distance, ties going to the flat side;
14
+ - transposing from key `ks` to key `kd` shifts every position by `kd - ks`, which preserves scale degree, alteration and therefore distance exactly.
15
+
16
+ The whole-score transpose operation computes the destination key from the interval and applies that shift. No serialization changes.
17
+
18
+ ## Technical Context
19
+
20
+ **Language/Version**: TypeScript (see `tsconfig.json`), run in tests with `ts-node`
21
+
22
+ **Primary Dependencies**: None new. VexFlow is not involved in the spelling logic; `SmoMusic` helpers (`smoPitchToInt`, `smoIntToPitch`, `noteValues`) are reused.
23
+
24
+ **Storage**: N/A. Pitches serialize as `{letter, accidental, octave}` and key signatures as lowercase VexFlow strings (`'c'`, `'db'`, `'f#'`); both are unchanged.
25
+
26
+ **Testing**: Headless `ts-node` scripts under `tests/`, one npm script each (see `test:voice-copy-paste`). New: `tests/keyDistanceTransposition.ts` with script `test:key-distance-transposition`.
27
+
28
+ **Target Platform**: Browser application and library (`src/smo` has no UI dependencies).
29
+
30
+ **Project Type**: Single project (TypeScript library plus Vue UI).
31
+
32
+ **Performance Goals**: Spelling is O(1) per pitch (a few integer operations); the table lookup it replaces was a linear scan. No rendering impact.
33
+
34
+ **Constraints**: Sounding pitch must never change when respelling (FR-010). Output must stay within double sharps/flats, which the existing `noteValues` table supports.
35
+
36
+ **Scale/Scope**: One module (`music.ts`), three callers' behavior (`SmoNote.transpose`, chord-symbol transposition, `SmoOperation.transpose`/`transposeScore`), one new test file.
37
+
38
+ ## Constitution Check
39
+
40
+ *GATE: Must pass before Phase 0 research. Re-check after Phase 1 design.*
41
+
42
+ | Principle | Assessment |
43
+ |-----------|------------|
44
+ | #1 Serialization | Pass. No new persisted fields. Existing scores keep their stored spellings; only operations that choose a spelling are affected. |
45
+ | #2 Editing/transformation logic is regression tested | Pass, and driving the design: `tests/keyDistanceTransposition.ts` covers every worked example and edge case from the spec. |
46
+ | #3 Rendering performance | Pass. No render-path change. |
47
+ | #4 Logical dependencies | Pass. All new code is in `src/smo/data/music.ts` and `src/smo/xform/operations.ts`; no UI or renderer imports. |
48
+
49
+ Re-check after Phase 1 design: still passes. No complexity violations.
50
+
51
+ ## Project Structure
52
+
53
+ ### Documentation (this feature)
54
+
55
+ ```text
56
+ specs/033-key-distance-transposition/
57
+ ├── plan.md # This file
58
+ ├── research.md # Phase 0 output
59
+ ├── data-model.md # Phase 1 output
60
+ ├── quickstart.md # Phase 1 output
61
+ ├── contracts/
62
+ │ └── spelling-api.md # Phase 1 output (internal API contract)
63
+ ├── checklists/
64
+ │ └── requirements.md
65
+ └── tasks.md # Phase 2 output (/speckit-tasks - NOT created by /speckit-plan)
66
+ ```
67
+
68
+ ### Source Code (repository root)
69
+
70
+ ```text
71
+ src/smo/data/music.ts # remove enharmonicRoles, KeySignatureRole, findRoleOfPitch, findPitchForRole;
72
+ # add line-of-fifths helpers; rewrite getScaleTonesForKey, getEnharmonicInKey,
73
+ # transposePitchForKey; fix 'Gg' typo in keySignatureLength
74
+ src/smo/xform/operations.ts # transposeScore: compute destination key, update measure key signatures,
75
+ # transpose with distance preserved
76
+ src/smo/data/note.ts # no change expected (SmoNote.transpose already calls transposePitchForKey)
77
+ src/smo/data/noteModifiers.ts # no change expected (chord-symbol transposition already calls it)
78
+ types/src/smo/data/music.d.ts # regenerated by `npm run types`
79
+ tests/keyDistanceTransposition.ts # new
80
+ package.json # add test:key-distance-transposition script
81
+ ```
82
+
83
+ **Structure Decision**: Single-project layout as it exists. The logic stays in `SmoMusic` as static methods, matching the surrounding code. A separate module would be unwarranted for roughly 80 lines.
84
+
85
+ ## Complexity Tracking
86
+
87
+ No constitution violations to justify.
@@ -0,0 +1,40 @@
1
+ # Quickstart: Validating Key-Distance Spelling
2
+
3
+ ## Prerequisites
4
+
5
+ - `npm install` done at the repository root.
6
+ - Types regenerated if you changed `music.ts` public signatures: `npm run types`.
7
+
8
+ ## Automated check
9
+
10
+ ```bash
11
+ npm run test:key-distance-transposition
12
+ ```
13
+
14
+ Expected: every line prints `PASS`, exit code 0. The script covers the cases below (see [contracts/spelling-api.md](contracts/spelling-api.md) for the invariants and [data-model.md](data-model.md) for the arithmetic).
15
+
16
+ | # | Scenario | Expected |
17
+ |---|----------|----------|
18
+ | 1 | C# in C → D, +2 | D# |
19
+ | 2 | A# in C → D, +2 | B# |
20
+ | 3 | E natural in Eb → G, +4 | G# |
21
+ | 4 | Default spelling, pitch class 10 in C | Bb |
22
+ | 5 | Default spelling with sharp/flat tie (pitch class 8 in C) | Ab |
23
+ | 6 | In-key note in destination key (F in C → G, +7) | C (4th degree maps to 4th degree) |
24
+ | 7 | Same key, offset 0 | Spelling unchanged |
25
+ | 8 | Octave handling across B/C (Cb4 in Gb → G, +1) | C4; sounding pitch rises exactly one half step |
26
+ | 9 | Round trip for all 12 chromatic notes, all 15 major keys, offsets -12..12 | Original spelling restored |
27
+ | 10 | Extreme destination (offset giving more than 7 accidentals) | Equivalent key with fewer accidentals |
28
+ | 11 | Chord symbol `C#` in C → D | `D#` |
29
+ | 12 | `SmoOperation.transposeScore` on a 2-measure Eb score with E natural, +4 | Measures in `g`, E natural is G# |
30
+
31
+ ## Manual check in the application
32
+
33
+ 1. Start the app, enter a measure in C major containing C#.
34
+ 2. Select **Transpose Score** and enter +2. The key signature becomes D major (2 sharps) and the C# shows as D#, not Eb.
35
+ 3. Press Cancel in the dialog. The score returns to C major with C#.
36
+ 4. Copy an A# from C major, paste into a D major measure: B#.
37
+
38
+ ## Regression
39
+
40
+ Run the other test scripts in `package.json` (`test:voice-copy-paste`, `test:multimeasure-rest`, ...) to confirm nothing else changed.