smoosic 2.0.3 → 2.0.5

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 (260) hide show
  1. package/build/smoosic.js +408 -69
  2. package/changes.md +95 -0
  3. package/package.json +19 -1
  4. package/release/smoosic.js +408 -69
  5. package/specs/032-split-multimeasure-rests/checklists/requirements.md +40 -0
  6. package/specs/032-split-multimeasure-rests/contracts/grouping-contract.md +53 -0
  7. package/specs/032-split-multimeasure-rests/data-model.md +70 -0
  8. package/specs/032-split-multimeasure-rests/plan.md +81 -0
  9. package/specs/032-split-multimeasure-rests/quickstart.md +46 -0
  10. package/specs/032-split-multimeasure-rests/research.md +63 -0
  11. package/specs/032-split-multimeasure-rests/spec.md +127 -0
  12. package/specs/032-split-multimeasure-rests/tasks.md +174 -0
  13. package/specs/033-key-distance-transposition/checklists/requirements.md +35 -0
  14. package/specs/033-key-distance-transposition/contracts/spelling-api.md +36 -0
  15. package/specs/033-key-distance-transposition/data-model.md +49 -0
  16. package/specs/033-key-distance-transposition/plan.md +87 -0
  17. package/specs/033-key-distance-transposition/quickstart.md +40 -0
  18. package/specs/033-key-distance-transposition/research.md +82 -0
  19. package/specs/033-key-distance-transposition/spec.md +132 -0
  20. package/specs/033-key-distance-transposition/tasks.md +139 -0
  21. package/specs/034-smz-compressed-scores/checklists/requirements.md +35 -0
  22. package/specs/034-smz-compressed-scores/contracts/archive-api.md +30 -0
  23. package/specs/034-smz-compressed-scores/data-model.md +48 -0
  24. package/specs/034-smz-compressed-scores/plan.md +89 -0
  25. package/specs/034-smz-compressed-scores/quickstart.md +44 -0
  26. package/specs/034-smz-compressed-scores/research.md +86 -0
  27. package/specs/034-smz-compressed-scores/spec.md +137 -0
  28. package/specs/034-smz-compressed-scores/tasks.md +148 -0
  29. package/specs/035-paste-special/checklists/requirements.md +35 -0
  30. package/specs/035-paste-special/contracts/paste-special-api.md +50 -0
  31. package/specs/035-paste-special/data-model.md +47 -0
  32. package/specs/035-paste-special/plan.md +83 -0
  33. package/specs/035-paste-special/quickstart.md +51 -0
  34. package/specs/035-paste-special/research.md +97 -0
  35. package/specs/035-paste-special/spec.md +170 -0
  36. package/specs/035-paste-special/tasks.md +149 -0
  37. package/specs/036-autosave-recovery/checklists/requirements.md +36 -0
  38. package/specs/036-autosave-recovery/contracts/autosave-api.md +111 -0
  39. package/specs/036-autosave-recovery/data-model.md +70 -0
  40. package/specs/036-autosave-recovery/plan.md +87 -0
  41. package/specs/036-autosave-recovery/quickstart.md +65 -0
  42. package/specs/036-autosave-recovery/research.md +105 -0
  43. package/specs/036-autosave-recovery/spec.md +143 -0
  44. package/specs/036-autosave-recovery/tasks.md +165 -0
  45. package/specs/037-fix-new-part-dialog/checklists/requirements.md +38 -0
  46. package/specs/037-fix-new-part-dialog/contracts/create-part-api.md +84 -0
  47. package/specs/037-fix-new-part-dialog/data-model.md +68 -0
  48. package/specs/037-fix-new-part-dialog/plan.md +83 -0
  49. package/specs/037-fix-new-part-dialog/quickstart.md +58 -0
  50. package/specs/037-fix-new-part-dialog/research.md +86 -0
  51. package/specs/037-fix-new-part-dialog/spec.md +144 -0
  52. package/specs/037-fix-new-part-dialog/tasks.md +174 -0
  53. package/specs/038-per-measure-beam-groups/checklists/requirements.md +36 -0
  54. package/specs/038-per-measure-beam-groups/contracts/beam-groups-api.md +74 -0
  55. package/specs/038-per-measure-beam-groups/data-model.md +75 -0
  56. package/specs/038-per-measure-beam-groups/plan.md +84 -0
  57. package/specs/038-per-measure-beam-groups/quickstart.md +53 -0
  58. package/specs/038-per-measure-beam-groups/research.md +72 -0
  59. package/specs/038-per-measure-beam-groups/spec.md +146 -0
  60. package/specs/038-per-measure-beam-groups/tasks.md +132 -0
  61. package/specs/039-measure-fill-submenu/checklists/requirements.md +35 -0
  62. package/specs/039-measure-fill-submenu/contracts/measure-fill-api.md +56 -0
  63. package/specs/039-measure-fill-submenu/data-model.md +79 -0
  64. package/specs/039-measure-fill-submenu/plan.md +81 -0
  65. package/specs/039-measure-fill-submenu/quickstart.md +62 -0
  66. package/specs/039-measure-fill-submenu/research.md +68 -0
  67. package/specs/039-measure-fill-submenu/spec.md +153 -0
  68. package/specs/039-measure-fill-submenu/tasks.md +121 -0
  69. package/specs/040-dynamics-dialog-cleanup/checklists/requirements.md +36 -0
  70. package/specs/040-dynamics-dialog-cleanup/contracts/dynamics-dialog.md +52 -0
  71. package/specs/040-dynamics-dialog-cleanup/data-model.md +48 -0
  72. package/specs/040-dynamics-dialog-cleanup/plan.md +89 -0
  73. package/specs/040-dynamics-dialog-cleanup/quickstart.md +69 -0
  74. package/specs/040-dynamics-dialog-cleanup/research.md +80 -0
  75. package/specs/040-dynamics-dialog-cleanup/spec.md +120 -0
  76. package/specs/040-dynamics-dialog-cleanup/tasks.md +114 -0
  77. package/specs/041-delete-special/checklists/requirements.md +35 -0
  78. package/specs/041-delete-special/contracts/delete-special-api.md +41 -0
  79. package/specs/041-delete-special/data-model.md +40 -0
  80. package/specs/041-delete-special/plan.md +93 -0
  81. package/specs/041-delete-special/quickstart.md +41 -0
  82. package/specs/041-delete-special/research.md +75 -0
  83. package/specs/041-delete-special/spec.md +136 -0
  84. package/specs/041-delete-special/tasks.md +106 -0
  85. package/specs/042-preserve-music-time-signature/checklists/requirements.md +35 -0
  86. package/specs/042-preserve-music-time-signature/contracts/rebar-api.md +66 -0
  87. package/specs/042-preserve-music-time-signature/data-model.md +73 -0
  88. package/specs/042-preserve-music-time-signature/plan.md +93 -0
  89. package/specs/042-preserve-music-time-signature/quickstart.md +37 -0
  90. package/specs/042-preserve-music-time-signature/research.md +102 -0
  91. package/specs/042-preserve-music-time-signature/spec.md +153 -0
  92. package/specs/042-preserve-music-time-signature/tasks.md +104 -0
  93. package/src/application/application.ts +13 -2
  94. package/src/application/exports.ts +402 -395
  95. package/src/application/generateVexTests.ts +2 -2
  96. package/src/render/sui/NoteEntryCaret.ts +117 -16
  97. package/src/render/sui/autosave.ts +265 -0
  98. package/src/render/sui/formatter.ts +12 -2
  99. package/src/render/sui/renderState.ts +4 -4
  100. package/src/render/sui/scoreChangeState.ts +8 -3
  101. package/src/render/sui/scoreView.ts +47 -2
  102. package/src/render/sui/scoreViewOperations.ts +2761 -2555
  103. package/src/render/sui/staffLineGeometry.ts +82 -0
  104. package/src/render/sui/tracker.ts +18 -23
  105. package/src/render/vex/vxMeasure.ts +22 -8
  106. package/src/render/vex/vxNote.ts +2 -4
  107. package/src/smo/data/measure.ts +58 -1
  108. package/src/smo/data/measureModifiers.ts +81 -1
  109. package/src/smo/data/music.ts +169 -359
  110. package/src/smo/data/note.ts +1 -1
  111. package/src/smo/data/noteModifiers.ts +12 -0
  112. package/src/smo/data/score.ts +179 -7
  113. package/src/smo/data/scoreModifiers.ts +46 -1
  114. package/src/smo/data/systemStaff.ts +43 -0
  115. package/src/smo/xform/beamers.ts +80 -6
  116. package/src/smo/xform/copypaste.ts +207 -47
  117. package/src/smo/xform/measureFill.ts +89 -0
  118. package/src/smo/xform/operations.ts +452 -61
  119. package/src/smo/xform/rebar.ts +490 -0
  120. package/src/smo/xform/selections.ts +73 -0
  121. package/src/ui/components/dialogs/beamGroups.vue +106 -0
  122. package/src/ui/components/dialogs/deleteSpecial.vue +38 -0
  123. package/src/ui/components/dialogs/dynamics.vue +16 -3
  124. package/src/ui/components/dialogs/fileUpload.vue +2 -2
  125. package/src/ui/components/dialogs/hairpin.vue +3 -3
  126. package/src/ui/components/dialogs/newPart.vue +148 -184
  127. package/src/ui/components/dialogs/pasteSpecial.vue +49 -0
  128. package/src/ui/components/dialogs/recovery.vue +66 -0
  129. package/src/ui/components/dialogs/save.vue +11 -4
  130. package/src/ui/components/dialogs/scorePreferences.vue +23 -1
  131. package/src/ui/components/dialogs/slur.vue +6 -6
  132. package/src/ui/components/dialogs/tempo.vue +11 -3
  133. package/src/ui/components/dialogs/timeSignature.vue +18 -3
  134. package/src/ui/components/dialogs/volta.vue +3 -3
  135. package/src/ui/dialogs/annotationVue.ts +1 -1
  136. package/src/ui/dialogs/beamGroupsVue.ts +69 -0
  137. package/src/ui/dialogs/createPartHelpers.ts +68 -0
  138. package/src/ui/dialogs/deleteSpecial.ts +57 -0
  139. package/src/ui/dialogs/dynamicsVue.ts +87 -60
  140. package/src/ui/dialogs/factory.ts +0 -2
  141. package/src/ui/dialogs/fileDialogs.ts +63 -22
  142. package/src/ui/dialogs/instrument.ts +37 -30
  143. package/src/ui/dialogs/pasteSpecial.ts +59 -0
  144. package/src/ui/dialogs/preferences.ts +41 -40
  145. package/src/ui/dialogs/recovery.ts +49 -0
  146. package/src/ui/dialogs/timeSignature.ts +27 -39
  147. package/src/ui/fileio/fileInput.ts +12 -3
  148. package/src/ui/fileio/scoreArchive.ts +151 -0
  149. package/src/ui/fileio/xhrLoader.ts +26 -0
  150. package/src/ui/i18n/language.ts +1 -1
  151. package/src/ui/menus/beams.ts +181 -112
  152. package/src/ui/menus/edit.ts +44 -6
  153. package/src/ui/menus/file.ts +21 -1
  154. package/src/ui/menus/measure.ts +40 -1
  155. package/tests/autosave.ts +332 -0
  156. package/tests/beamDotted.ts +56 -0
  157. package/tests/beamGroups.ts +338 -0
  158. package/tests/createPart.ts +292 -0
  159. package/tests/deleteSpecial.ts +350 -0
  160. package/tests/dynamicsFontSize.ts +132 -0
  161. package/tests/keyDistanceTransposition.ts +351 -0
  162. package/tests/measureFill.ts +295 -0
  163. package/tests/movePart.ts +94 -0
  164. package/tests/multimeasureRest.ts +338 -0
  165. package/tests/pasteIntoMeasure.ts +103 -0
  166. package/tests/pasteSpecial.ts +541 -0
  167. package/tests/quickBeam.ts +126 -0
  168. package/tests/rebarMeasures.ts +492 -0
  169. package/tests/scoreArchive.ts +218 -0
  170. package/tests/scoreChangeState.ts +2 -0
  171. package/tests/staffLineGeometry.ts +179 -0
  172. package/tests/timeRangeSelect.ts +111 -0
  173. package/tests/timeSignatureDisplay.ts +58 -0
  174. package/tools/smoosic-schema.json +37 -0
  175. package/typedoc.ts +2 -1
  176. package/types/src/application/exports.d.ts +454 -447
  177. package/types/src/common/promiseHelpers.d.ts +30 -30
  178. package/types/src/common/vex.d.ts +224 -224
  179. package/types/src/render/sui/NoteEntryCaret.d.ts +107 -107
  180. package/types/src/render/sui/autosave.d.ts +99 -0
  181. package/types/src/render/sui/scoreView.d.ts +23 -0
  182. package/types/src/render/sui/scoreViewOperations.d.ts +776 -639
  183. package/types/src/render/sui/svgHelpers.d.ts +88 -88
  184. package/types/src/render/sui/svgPageMap.d.ts +344 -344
  185. package/types/src/render/sui/textEdit.d.ts +96 -96
  186. package/types/src/render/sui/textRender.d.ts +199 -199
  187. package/types/src/render/vex/smoAdapter.d.ts +47 -47
  188. package/types/src/render/vex/vxMeasure.d.ts +97 -97
  189. package/types/src/render/vex/vxNote.d.ts +56 -56
  190. package/types/src/render/vex/vxSystem.d.ts +71 -71
  191. package/types/src/smo/data/measure.d.ts +30 -0
  192. package/types/src/smo/data/measureModifiers.d.ts +568 -513
  193. package/types/src/smo/data/music.d.ts +74 -32
  194. package/types/src/smo/data/note.d.ts +498 -498
  195. package/types/src/smo/data/noteModifiers.d.ts +615 -606
  196. package/types/src/smo/data/score.d.ts +479 -421
  197. package/types/src/smo/data/scoreModifiers.d.ts +30 -0
  198. package/types/src/smo/data/scoreText.d.ts +334 -334
  199. package/types/src/smo/data/systemStaff.d.ts +14 -0
  200. package/types/src/smo/xform/beamers.d.ts +23 -1
  201. package/types/src/smo/xform/copypaste.d.ts +138 -2
  202. package/types/src/smo/xform/measureFill.d.ts +21 -0
  203. package/types/src/smo/xform/operations.d.ts +269 -129
  204. package/types/src/smo/xform/rebar.d.ts +53 -0
  205. package/types/src/smo/xform/selections.d.ts +168 -154
  206. package/types/src/smo/xform/undo.d.ts +142 -142
  207. package/types/src/ui/buttons/button.d.ts +100 -100
  208. package/types/src/ui/buttons/ribbon.d.ts +70 -70
  209. package/types/src/ui/common.d.ts +76 -76
  210. package/types/src/ui/components/dialogs/chordText.d.ts +28 -28
  211. package/types/src/ui/components/dialogs/textBlockAtomNode.d.ts +20 -20
  212. package/types/src/ui/components/dialogs/textGroupHtml.d.ts +29 -29
  213. package/types/src/ui/composable/draggable.d.ts +15 -15
  214. package/types/src/ui/dialogs/adapter.d.ts +120 -120
  215. package/types/src/ui/dialogs/annotationVue.d.ts +9 -9
  216. package/types/src/ui/dialogs/audioSettings.d.ts +32 -32
  217. package/types/src/ui/dialogs/beamGroupsVue.d.ts +20 -0
  218. package/types/src/ui/dialogs/chordChangeVue.d.ts +8 -8
  219. package/types/src/ui/dialogs/createPartHelpers.d.ts +29 -0
  220. package/types/src/ui/dialogs/customTupletsVue.d.ts +9 -9
  221. package/types/src/ui/dialogs/deleteSpecial.d.ts +8 -0
  222. package/types/src/ui/dialogs/dialog.d.ts +203 -203
  223. package/types/src/ui/dialogs/dynamicsVue.d.ts +10 -10
  224. package/types/src/ui/dialogs/factory.d.ts +15 -15
  225. package/types/src/ui/dialogs/fileDialogs.d.ts +4 -4
  226. package/types/src/ui/dialogs/hairpin.d.ts +35 -35
  227. package/types/src/ui/dialogs/hairpinVue.d.ts +7 -7
  228. package/types/src/ui/dialogs/instrument.d.ts +3 -3
  229. package/types/src/ui/dialogs/keySignatureVue.d.ts +7 -7
  230. package/types/src/ui/dialogs/libraryVue.d.ts +15 -15
  231. package/types/src/ui/dialogs/lyricVue.d.ts +8 -8
  232. package/types/src/ui/dialogs/pasteSpecial.d.ts +8 -0
  233. package/types/src/ui/dialogs/pedalMarkingVue.d.ts +7 -7
  234. package/types/src/ui/dialogs/recovery.d.ts +8 -0
  235. package/types/src/ui/dialogs/rehearsalMark.d.ts +25 -25
  236. package/types/src/ui/dialogs/rehearsalMarkVue.d.ts +7 -7
  237. package/types/src/ui/dialogs/slur.d.ts +57 -57
  238. package/types/src/ui/dialogs/slurVue.d.ts +7 -7
  239. package/types/src/ui/dialogs/tempo.d.ts +50 -50
  240. package/types/src/ui/dialogs/tempoVue.d.ts +10 -10
  241. package/types/src/ui/dialogs/textBlockVue.d.ts +8 -8
  242. package/types/src/ui/dialogs/textBracket.d.ts +35 -35
  243. package/types/src/ui/dialogs/textBracketVue.d.ts +7 -7
  244. package/types/src/ui/dialogs/tie.d.ts +41 -41
  245. package/types/src/ui/dialogs/volta.d.ts +40 -40
  246. package/types/src/ui/dialogs/voltaVue.d.ts +7 -7
  247. package/types/src/ui/fileio/fileInput.d.ts +7 -1
  248. package/types/src/ui/fileio/library.d.ts +40 -40
  249. package/types/src/ui/fileio/scoreArchive.d.ts +55 -0
  250. package/types/src/ui/fileio/xhrLoader.d.ts +7 -0
  251. package/types/src/ui/menus/file.d.ts +8 -8
  252. package/types/src/ui/menus/language.d.ts +7 -7
  253. package/types/src/ui/menus/manager.d.ts +58 -58
  254. package/types/src/ui/menus/menu.d.ts +159 -159
  255. package/types/src/ui/menus/partSelection.d.ts +14 -14
  256. package/types/src/ui/menus/score.d.ts +8 -8
  257. package/types/src/ui/menus/staffModifier.d.ts +17 -17
  258. package/types/typedoc.d.ts +148 -147
  259. package/src/ui/dialogs/dynamics.ts +0 -141
  260. package/types/src/ui/dialogs/dynamics.d.ts +0 -37
@@ -1,129 +1,269 @@
1
- import { Pitch } from '../data/common';
2
- import { SmoNote } from '../data/note';
3
- import { SmoScore } from '../data/score';
4
- import { SmoSystemStaff, SmoSystemStaffParams } from '../data/systemStaff';
5
- import { SmoGraceNote, SmoDynamicText, SmoTabNote } from '../data/noteModifiers';
6
- import { SmoRehearsalMark, SmoMeasureText, SmoVolta, SmoMeasureFormat, SmoTempo, SmoBarline, SmoTimeSignature, SmoRepeatSymbol } from '../data/measureModifiers';
7
- import { SmoStaffHairpin, SmoSlur, SmoTie, StaffModifierBase, SmoInstrument, SmoSlurParams, SmoStaffTextBracket, SmoTabStave } from '../data/staffModifiers';
8
- import { SmoSystemGroup } from '../data/scoreModifiers';
9
- import { SmoTextGroup } from '../data/scoreText';
10
- import { SmoSelection, SmoSelector, ModifierTab } from './selections';
11
- /**
12
- * supported operations for {@link SmoOperation.batchSelectionOperation} to change a note's duration
13
- */
14
- export type BatchSelectionOperation = 'dotDuration' | 'undotDuration' | 'doubleDuration' | 'halveDuration' | 'doubleGraceNoteDuration' | 'halveGraceNoteDuration';
15
- export interface MakeTupletOperation {
16
- numNotes: number;
17
- notesOccupied: number;
18
- ratioed: boolean;
19
- bracketed: boolean;
20
- }
21
- export type createStaffModifierType<T> = (fromSelection: SmoSelection, toSelection: SmoSelection) => T;
22
- /**
23
- * SmoOperation is a collection of static methods that operate on/change/transform the music. Most methods
24
- * take the score, a selection or selection array, and the parameters of the operation.
25
- * @category SmoTransform
26
- */
27
- export declare class SmoOperation {
28
- static setMeasureFormat(score: SmoScore, selection: SmoSelection, value: SmoMeasureFormat): void;
29
- static addKeySignature(score: SmoScore, selection: SmoSelection, keySignature: string): void;
30
- static addConnectorDown(score: SmoScore, selections: SmoSelection[], parameters: SmoSystemGroup): void;
31
- static setActiveVoice(score: SmoScore, voiceIx: number): void;
32
- /**
33
- * Move a single stave up or down one. If last down, move to first.
34
- * If first up, move to last
35
- * @param score
36
- * @param selection
37
- * @param index
38
- */
39
- static moveStaffUpDown(score: SmoScore, selection: SmoSelection, index: number): void;
40
- static depopulateVoice(selection: SmoSelection, voiceIx: number): void;
41
- static populateVoice(selection: SmoSelection, voiceIx: number): void;
42
- static swapVoice(selections: SmoSelection[], voice1: number, voice2: number): void;
43
- static setTabStave(score: SmoScore, tabStave: SmoTabStave): void;
44
- static removeTabStave(score: SmoScore, tabStaves: SmoTabStave[]): void;
45
- static setTimeSignature(score: SmoScore, selections: SmoSelection[], timeSignature: SmoTimeSignature): void;
46
- static batchSelectionOperation(score: SmoScore, selections: SmoSelection[], operation: BatchSelectionOperation): void;
47
- static doubleDuration(selection: SmoSelection): boolean;
48
- static halveDuration(selection: SmoSelection): boolean;
49
- static makeTuplet(selection: SmoSelection, params: MakeTupletOperation): void;
50
- static addStaffModifier(selection: SmoSelection, modifier: StaffModifierBase): void;
51
- static toggleRest(selection: SmoSelection): void;
52
- static toggleSlash(selection: SmoSelection): void;
53
- static makeRest(selection: SmoSelection): void;
54
- static makeNote(selection: SmoSelection): void;
55
- static setNoteHead(selections: SmoSelection[], noteHead: string): void;
56
- static addGraceNote(selection: SmoSelection, g: SmoGraceNote, offset: number): void;
57
- static removeGraceNote(selection: SmoSelection, offset: number): void;
58
- static doubleGraceNoteDuration(selection: SmoSelection, modifiers: SmoGraceNote[]): void;
59
- static halveGraceNoteDuration(selection: SmoSelection, modifiers: SmoGraceNote[]): void;
60
- static toggleGraceNoteCourtesy(selection: any, modifiers: SmoGraceNote[]): void;
61
- static toggleGraceNoteEnharmonic(selection: SmoSelection, modifiers: SmoGraceNote[]): void;
62
- static transposeGraceNotes(selection: SmoSelection, modifiers: SmoGraceNote[], offset: number): void;
63
- static slashGraceNotes(selections: ModifierTab[] | ModifierTab): void;
64
- static unmakeTuplet(selection: SmoSelection): void;
65
- static dotDuration(selection: SmoSelection): void;
66
- static undotDuration(selection: SmoSelection): void;
67
- static transposeScore(score: SmoScore, offset: number): void;
68
- static updateTabNote(selections: SmoSelection[], tabNote: SmoTabNote): void;
69
- static removeTabNote(selections: SmoSelection[]): void;
70
- static transpose(selection: SmoSelection, offset: number): boolean;
71
- static setPitch(selection: SmoSelection, pitches: Pitch[]): void;
72
- static toggleCourtesyAccidental(selection: SmoSelection): void;
73
- static courtesyAccidental(pitchSelection: SmoSelection, toBe: boolean): void;
74
- static toggleEnharmonic(pitchSelection: SmoSelection): void;
75
- static addDynamic(selection: SmoSelection, dynamic: SmoDynamicText): void;
76
- static removeDynamic(selection: SmoSelection, dynamic: SmoDynamicText): void;
77
- static unbeamSelections(noteSelection: SmoSelection): void;
78
- static beamSelections(score: SmoScore, selections: SmoSelection[]): void;
79
- static clearAllBeamGroups(score: SmoScore): void;
80
- static clearBeamGroups(score: SmoScore, selections: SmoSelection[]): void;
81
- static toggleBeamDirection(selections: SmoSelection[]): void;
82
- static addEnding(score: SmoScore, parameters: SmoVolta): void;
83
- static removeEnding(score: SmoScore, ending: SmoVolta): void;
84
- static addTextGroup(score: SmoScore, textGroup: SmoTextGroup): void;
85
- static removeTextGroup(score: SmoScore, textGroup: SmoTextGroup): void;
86
- static addMeasureText(score: SmoScore, selection: SmoSelection, measureText: SmoMeasureText): void;
87
- static removeMeasureText(score: SmoScore, selection: SmoSelection, mt: SmoMeasureText): void;
88
- static removeRehearsalMark(score: SmoScore, selection: SmoSelection): void;
89
- static addRehearsalMark(score: SmoScore, selection: SmoSelection, rehearsalMark: SmoRehearsalMark): void;
90
- static addTempo(score: SmoScore, selection: SmoSelection, tempo: SmoTempo): void;
91
- static setMeasureBarline(score: SmoScore, selection: SmoSelection, barline: SmoBarline): void;
92
- static setRepeatSymbol(score: SmoScore, selection: SmoSelection, sym: SmoRepeatSymbol): void;
93
- static interval(selection: SmoSelection, interval: number): boolean;
94
- static addOrReplaceBracket(modifier: SmoStaffTextBracket, fromSelection: SmoSelection, toSelection: SmoSelection): void;
95
- static createTextBracket(fromSelection: SmoSelection, toSelection: SmoSelection, text: string): SmoStaffTextBracket;
96
- static createTextBracketGeneric(fromSelection: SmoSelection, toSelection: SmoSelection): SmoStaffTextBracket;
97
- static createRitardBracket(fromSelection: SmoSelection, toSelection: SmoSelection): SmoStaffTextBracket;
98
- static createAccelerandoBracket(fromSelection: SmoSelection, toSelection: SmoSelection): SmoStaffTextBracket;
99
- static createCrescendoBracket(fromSelection: SmoSelection, toSelection: SmoSelection): SmoStaffTextBracket;
100
- static createDimenuendoBracket(fromSelection: SmoSelection, toSelection: SmoSelection): SmoStaffTextBracket;
101
- static createCrescendo(fromSelection: SmoSelection, toSelection: SmoSelection): SmoStaffHairpin;
102
- static createDecrescendo(fromSelection: SmoSelection, toSelection: SmoSelection): SmoStaffHairpin;
103
- static createTie(fromSelection: SmoSelection, toSelection: SmoSelection): SmoTie;
104
- static getSlurDefaultParameters(selections: SmoSelection[]): void;
105
- /**
106
- * Heuristically determine how a slur should be formatted based on the notes. Determine control points,
107
- * offset, and alignment
108
- *
109
- * ## Note: Vexflow slurs consider `top` to mean the furthest point from the note head, which could be the top
110
- * or the bottom of the note. It also considers yoffset to be negative if inverted is set. Head means close to the
111
- * note head.
112
- * @param score
113
- * @param fromSelection
114
- * @param toSelection
115
- * @returns
116
- */
117
- static getDefaultSlurDirection(score: SmoScore, fromSelector: SmoSelector, toSelector: SmoSelector): SmoSlurParams;
118
- static createSlur(score: SmoScore, fromSelection: SmoSelection, toSelection: SmoSelection): SmoSlur;
119
- static addStaff(score: SmoScore, parameters: SmoSystemStaffParams): SmoSystemStaff;
120
- static removeStaff(score: SmoScore, index: number): void;
121
- static transposeChords(smoNote: SmoNote, offset: number, key: string): void;
122
- /**
123
- * Compute new map based on current instrument selections, adjusting existing instruments as required
124
- * @param instrument
125
- * @param selections
126
- */
127
- static changeInstrument(instrument: SmoInstrument, score: SmoScore, selections: SmoSelection[]): void;
128
- static computeMultipartRest(score: SmoScore): void;
129
- }
1
+ import { Pitch } from '../data/common';
2
+ import { SmoNote } from '../data/note';
3
+ import { SmoScore } from '../data/score';
4
+ import { SmoSystemStaff, SmoSystemStaffParams } from '../data/systemStaff';
5
+ import { SmoGraceNote, SmoDynamicText, SmoTabNote } from '../data/noteModifiers';
6
+ import { SmoRehearsalMark, SmoMeasureText, SmoVolta, SmoMeasureFormat, SmoTempo, SmoBarline, SmoTimeSignature, SmoRepeatSymbol } from '../data/measureModifiers';
7
+ import { SmoStaffHairpin, SmoSlur, SmoTie, StaffModifierBase, SmoInstrument, SmoSlurParams, SmoStaffTextBracket, SmoTabStave } from '../data/staffModifiers';
8
+ import { SmoSystemGroup } from '../data/scoreModifiers';
9
+ import { SmoTextGroup } from '../data/scoreText';
10
+ import { SmoSelection, SmoSelector, ModifierTab } from './selections';
11
+ import { MeasureFillType } from './measureFill';
12
+ import { RebarResult } from './rebar';
13
+ /**
14
+ * supported operations for {@link SmoOperation.batchSelectionOperation} to change a note's duration
15
+ */
16
+ export type BatchSelectionOperation = 'dotDuration' | 'undotDuration' | 'doubleDuration' | 'halveDuration' | 'doubleGraceNoteDuration' | 'halveGraceNoteDuration';
17
+ export interface MakeTupletOperation {
18
+ numNotes: number;
19
+ notesOccupied: number;
20
+ ratioed: boolean;
21
+ bracketed: boolean;
22
+ }
23
+ export type createStaffModifierType<T> = (fromSelection: SmoSelection, toSelection: SmoSelection) => T;
24
+ /**
25
+ * SmoOperation is a collection of static methods that operate on/change/transform the music. Most methods
26
+ * take the score, a selection or selection array, and the parameters of the operation.
27
+ * @category SmoTransform
28
+ */
29
+ /**
30
+ * What is needed to create a part: where it goes, its instrument, and what it is called.
31
+ * @category SmoOperation
32
+ */
33
+ export interface AddPartParams {
34
+ /** where the new part goes, counting from 1; N + 1 is after the last of N staves */
35
+ location: number;
36
+ /** the sound, clef, staff lines and transposition of the (first) staff */
37
+ instrument: SmoInstrument;
38
+ /** add a second staff to the part, with the opposite clef */
39
+ twoStaves: boolean;
40
+ /** the name as typed. If it is blank, instrumentLabel is the name */
41
+ name: string;
42
+ /** the display name of the instrument, e.g. 'Bb Trumpet' */
43
+ instrumentLabel: string;
44
+ /** the abbreviation as typed; blank for none */
45
+ abbreviation: string;
46
+ }
47
+ /**
48
+ * The kinds of marking attached to notes that Delete Special can remove on their own
49
+ * @category SmoTransform
50
+ */
51
+ export type DeleteAttributeKind = 'dynamics' | 'lyrics' | 'annotations' | 'chords' | 'articulations' | 'ornaments' | 'graceNotes' | 'arpeggios' | 'microtones';
52
+ export declare class SmoOperation {
53
+ /** All the kinds Delete Special can remove, in the order of its dialog */
54
+ static readonly deleteAttributeKinds: DeleteAttributeKind[];
55
+ /**
56
+ * How many markings of the given kinds are on the notes of the selections. Reads only. Selections with
57
+ * no note are skipped, and kinds that are not known are ignored.
58
+ * @param selections the selected notes
59
+ * @param kinds the kinds of marking to count
60
+ */
61
+ static countNoteAttributes(selections: SmoSelection[], kinds: DeleteAttributeKind[]): number;
62
+ /**
63
+ * Remove every marking of the given kinds from the notes of the selections. Pitches, durations, ties and
64
+ * the kinds not listed are not changed. Kinds that are not known are ignored.
65
+ * @param selections the selected notes
66
+ * @param kinds the kinds of marking to remove
67
+ */
68
+ static deleteNoteAttributes(selections: SmoSelection[], kinds: DeleteAttributeKind[]): void;
69
+ private static deleteHandlersFor;
70
+ static setMeasureFormat(score: SmoScore, selection: SmoSelection, value: SmoMeasureFormat): void;
71
+ static addKeySignature(score: SmoScore, selection: SmoSelection, keySignature: string): void;
72
+ static addConnectorDown(score: SmoScore, selections: SmoSelection[], parameters: SmoSystemGroup): void;
73
+ static setActiveVoice(score: SmoScore, voiceIx: number): void;
74
+ /**
75
+ * The staves that make up the part containing the given staff. A multi-staff part is
76
+ * kept together.
77
+ * @returns the index of the first staff of the part, and the number of staves in it
78
+ */
79
+ static getPartBlock(score: SmoScore, staffIndex: number): {
80
+ start: number;
81
+ length: number;
82
+ };
83
+ /**
84
+ * Swap the part starting at `start` with the part just before it, keeping the staves
85
+ * of each part together and in order.
86
+ */
87
+ private static swapPartWithPrevious;
88
+ /**
89
+ * Move a part up or down one. A part with 2 staves moves as a unit, so a single-staff part
90
+ * that it passes moves by 2. If last down, move to first. If first up, move to last
91
+ * @param score
92
+ * @param selection
93
+ * @param index direction to move, -1 for up and 1 for down
94
+ */
95
+ static moveStaffUpDown(score: SmoScore, selection: SmoSelection, index: number): void;
96
+ static depopulateVoice(selection: SmoSelection, voiceIx: number): void;
97
+ static populateVoice(selection: SmoSelection, voiceIx: number): void;
98
+ static swapVoice(selections: SmoSelection[], voice1: number, voice2: number): void;
99
+ static setTabStave(score: SmoScore, tabStave: SmoTabStave): void;
100
+ static removeTabStave(score: SmoScore, tabStaves: SmoTabStave[]): void;
101
+ /**
102
+ * Re-bar the music of measures firstMeasure to lastMeasure (all staves) into a new time signature, adding
103
+ * measures if the new one holds less time. See {@link rebarMeasures}. Unlike {@link setTimeSignature}, no
104
+ * music is lost.
105
+ * @param score the score to change
106
+ * @param firstMeasure the first measure of the range
107
+ * @param lastMeasure the last measure of the range
108
+ * @param timeSignature the new time signature
109
+ */
110
+ static rebarMeasures(score: SmoScore, firstMeasure: number, lastMeasure: number, timeSignature: SmoTimeSignature): RebarResult;
111
+ /**
112
+ * Would setting this time signature on measures firstMeasure to lastMeasure change anything? True if any
113
+ * of those measures, in any staff, has a time signature that is not equal to this one, display options included.
114
+ * Reads only.
115
+ */
116
+ static timeSignatureChanges(score: SmoScore, firstMeasure: number, lastMeasure: number, timeSignature: SmoTimeSignature): boolean;
117
+ /**
118
+ * Is every measure in the range, in every staff, already as long as the new time signature would make it?
119
+ * (2/2 for 4/4, or only a display option changed). If so the music does not need to move. The measure
120
+ * k places after the first has part k of a time signature that has several parts. Reads only.
121
+ */
122
+ static timeSignatureKeepsLength(score: SmoScore, firstMeasure: number, lastMeasure: number, timeSignature: SmoTimeSignature): boolean;
123
+ private static rangeMeasures;
124
+ static setTimeSignature(score: SmoScore, selections: SmoSelection[], timeSignature: SmoTimeSignature): void;
125
+ static batchSelectionOperation(score: SmoScore, selections: SmoSelection[], operation: BatchSelectionOperation): void;
126
+ static doubleDuration(selection: SmoSelection): boolean;
127
+ static halveDuration(selection: SmoSelection): boolean;
128
+ static makeTuplet(selection: SmoSelection, params: MakeTupletOperation): void;
129
+ static addStaffModifier(selection: SmoSelection, modifier: StaffModifierBase): void;
130
+ static toggleRest(selection: SmoSelection): void;
131
+ static toggleSlash(selection: SmoSelection): void;
132
+ static makeRest(selection: SmoSelection): void;
133
+ static makeNote(selection: SmoSelection): void;
134
+ static setNoteHead(selections: SmoSelection[], noteHead: string): void;
135
+ static addGraceNote(selection: SmoSelection, g: SmoGraceNote, offset: number): void;
136
+ static removeGraceNote(selection: SmoSelection, offset: number): void;
137
+ static doubleGraceNoteDuration(selection: SmoSelection, modifiers: SmoGraceNote[]): void;
138
+ static halveGraceNoteDuration(selection: SmoSelection, modifiers: SmoGraceNote[]): void;
139
+ static toggleGraceNoteCourtesy(selection: any, modifiers: SmoGraceNote[]): void;
140
+ static toggleGraceNoteEnharmonic(selection: SmoSelection, modifiers: SmoGraceNote[]): void;
141
+ static transposeGraceNotes(selection: SmoSelection, modifiers: SmoGraceNote[], offset: number): void;
142
+ static slashGraceNotes(selections: ModifierTab[] | ModifierTab): void;
143
+ static unmakeTuplet(selection: SmoSelection): void;
144
+ static dotDuration(selection: SmoSelection): void;
145
+ static undotDuration(selection: SmoSelection): void;
146
+ /**
147
+ * Transpose the whole score by a number of half steps. The destination key of each measure is
148
+ * computed from its current key, and each pitch is spelled so that its distance from the new key
149
+ * matches its distance from the old key (e.g. e natural in Eb becomes g# in G).
150
+ * @param score
151
+ * @param offset half steps, may be negative
152
+ */
153
+ static transposeScore(score: SmoScore, offset: number): void;
154
+ static updateTabNote(selections: SmoSelection[], tabNote: SmoTabNote): void;
155
+ static removeTabNote(selections: SmoSelection[]): void;
156
+ static transpose(selection: SmoSelection, offset: number): boolean;
157
+ static setPitch(selection: SmoSelection, pitches: Pitch[]): void;
158
+ static toggleCourtesyAccidental(selection: SmoSelection): void;
159
+ static courtesyAccidental(pitchSelection: SmoSelection, toBe: boolean): void;
160
+ static toggleEnharmonic(pitchSelection: SmoSelection): void;
161
+ static addDynamic(selection: SmoSelection, dynamic: SmoDynamicText): void;
162
+ static removeDynamic(selection: SmoSelection, dynamic: SmoDynamicText): void;
163
+ static unbeamSelections(noteSelection: SmoSelection): void;
164
+ static beamSelections(score: SmoScore, selections: SmoSelection[]): void;
165
+ /**
166
+ * Set the beam grouping of the measures in the selections, or clear it with an empty list.
167
+ * Only the staves and measures in the selections change.
168
+ * @param score the score the selections belong to
169
+ * @param selections the notes or measures to change; every measure they touch is changed
170
+ * @param groups the longest beam group for each group in turn, whole numbers from 1 to 4
171
+ */
172
+ static setBeamGroups(score: SmoScore, selections: SmoSelection[], groups: number[]): void;
173
+ /**
174
+ * Set the beam grouping of every measure in every staff of the score, or clear it with
175
+ * an empty list.
176
+ */
177
+ static setAllBeamGroups(score: SmoScore, groups: number[]): void;
178
+ /**
179
+ * Fill the measures in the selections with rests, removing all the notes and voices in them. See
180
+ * {@link fillRestDurations} for which rests. Everything attached to the removed notes goes with them:
181
+ * staff modifiers that start or end in the measure (slurs, ties, hairpins) and text attached to its notes.
182
+ * Only the staves and measures in the selections change.
183
+ * @param score the score the selections belong to
184
+ * @param selections the notes or measures; every measure they touch is filled
185
+ * @param fill which rests
186
+ */
187
+ static fillMeasures(score: SmoScore, selections: SmoSelection[], fill: MeasureFillType): void;
188
+ static clearAllBeamGroups(score: SmoScore): void;
189
+ static clearBeamGroups(score: SmoScore, selections: SmoSelection[]): void;
190
+ /**
191
+ * Put the selected notes back to automatic beaming: no hand-placed beam break or join, and the
192
+ * beam length for the meter from the score preferences. In a measure with its own beam grouping,
193
+ * that grouping applies.
194
+ */
195
+ static autoBeamSelections(score: SmoScore, selections: SmoSelection[]): void;
196
+ /**
197
+ * Set the stem direction of the selected notes
198
+ * @param flagState one of {@link SmoNote.flagStates}: auto, up or down
199
+ */
200
+ static setStemDirection(selections: SmoSelection[], flagState: number): void;
201
+ static toggleBeamDirection(selections: SmoSelection[]): void;
202
+ static addEnding(score: SmoScore, parameters: SmoVolta): void;
203
+ static removeEnding(score: SmoScore, ending: SmoVolta): void;
204
+ static addTextGroup(score: SmoScore, textGroup: SmoTextGroup): void;
205
+ static removeTextGroup(score: SmoScore, textGroup: SmoTextGroup): void;
206
+ static addMeasureText(score: SmoScore, selection: SmoSelection, measureText: SmoMeasureText): void;
207
+ static removeMeasureText(score: SmoScore, selection: SmoSelection, mt: SmoMeasureText): void;
208
+ static removeRehearsalMark(score: SmoScore, selection: SmoSelection): void;
209
+ static addRehearsalMark(score: SmoScore, selection: SmoSelection, rehearsalMark: SmoRehearsalMark): void;
210
+ static addTempo(score: SmoScore, selection: SmoSelection, tempo: SmoTempo): void;
211
+ static setMeasureBarline(score: SmoScore, selection: SmoSelection, barline: SmoBarline): void;
212
+ static setRepeatSymbol(score: SmoScore, selection: SmoSelection, sym: SmoRepeatSymbol): void;
213
+ static interval(selection: SmoSelection, interval: number): boolean;
214
+ static addOrReplaceBracket(modifier: SmoStaffTextBracket, fromSelection: SmoSelection, toSelection: SmoSelection): void;
215
+ static createTextBracket(fromSelection: SmoSelection, toSelection: SmoSelection, text: string): SmoStaffTextBracket;
216
+ static createTextBracketGeneric(fromSelection: SmoSelection, toSelection: SmoSelection): SmoStaffTextBracket;
217
+ static createRitardBracket(fromSelection: SmoSelection, toSelection: SmoSelection): SmoStaffTextBracket;
218
+ static createAccelerandoBracket(fromSelection: SmoSelection, toSelection: SmoSelection): SmoStaffTextBracket;
219
+ static createCrescendoBracket(fromSelection: SmoSelection, toSelection: SmoSelection): SmoStaffTextBracket;
220
+ static createDimenuendoBracket(fromSelection: SmoSelection, toSelection: SmoSelection): SmoStaffTextBracket;
221
+ static createCrescendo(fromSelection: SmoSelection, toSelection: SmoSelection): SmoStaffHairpin;
222
+ static createDecrescendo(fromSelection: SmoSelection, toSelection: SmoSelection): SmoStaffHairpin;
223
+ static createTie(fromSelection: SmoSelection, toSelection: SmoSelection): SmoTie;
224
+ static getSlurDefaultParameters(selections: SmoSelection[]): void;
225
+ /**
226
+ * Heuristically determine how a slur should be formatted based on the notes. Determine control points,
227
+ * offset, and alignment
228
+ *
229
+ * ## Note: Vexflow slurs consider `top` to mean the furthest point from the note head, which could be the top
230
+ * or the bottom of the note. It also considers yoffset to be negative if inverted is set. Head means close to the
231
+ * note head.
232
+ * @param score
233
+ * @param fromSelection
234
+ * @param toSelection
235
+ * @returns
236
+ */
237
+ static getDefaultSlurDirection(score: SmoScore, fromSelector: SmoSelector, toSelector: SmoSelector): SmoSlurParams;
238
+ static createSlur(score: SmoScore, fromSelection: SmoSelection, toSelection: SmoSelection): SmoSlur;
239
+ static addStaff(score: SmoScore, parameters: SmoSystemStaffParams): SmoSystemStaff;
240
+ /**
241
+ * Create a part with one or two staves. The part goes at the requested location, but never
242
+ * inside an existing part with more than one staff. Staves below it move down, and anything
243
+ * that refers to them moves too. The new part keeps its text groups (preserveTextGroups), which
244
+ * is not the default for a part.
245
+ * @param score the full score
246
+ * @param params where to put the part and what it is called
247
+ * @returns the index of the first new staff
248
+ */
249
+ static addPart(score: SmoScore, params: AddPartParams): number;
250
+ static removeStaff(score: SmoScore, index: number): void;
251
+ static transposeChords(smoNote: SmoNote, offset: number, key: string): void;
252
+ /**
253
+ * Compute new map based on current instrument selections, adjusting existing instruments as required
254
+ * @param instrument
255
+ * @param selections
256
+ */
257
+ static changeInstrument(instrument: SmoInstrument, score: SmoScore, selections: SmoSelection[]): void;
258
+ /**
259
+ * Group runs of empty measures into multimeasure rests, for parts that show them. A landmark splits a run:
260
+ * a start landmark (rehearsal mark, key, time or tempo change, Segno, Coda, instrument change, repeat
261
+ * or double barline at the start of the measure) ends the rest before its measure and that measure
262
+ * starts the next rest; an end landmark (D.S., D.C., To Coda, Fine, repeat or double barline at the end of
263
+ * the measure) ends the rest after its measure. Measures under a volta ending are never grouped.
264
+ * The result is recorded in each measure's svg record: the first measure of a rest has its length, end
265
+ * barline and end symbol, the others are hidden; every other measure is reset.
266
+ * @param score the score being displayed
267
+ */
268
+ static computeMultipartRest(score: SmoScore): void;
269
+ }
@@ -0,0 +1,53 @@
1
+ import { SmoScore } from '../data/score';
2
+ import { SmoTimeSignature } from '../data/measureModifiers';
3
+ /**
4
+ * What {@link rebarMeasures} did
5
+ * @category SmoTransform
6
+ */
7
+ export interface RebarResult {
8
+ /** the first re-barred measure */
9
+ firstMeasure: number;
10
+ /** how many measures are now in the range: the ones it had, plus those that were added */
11
+ measureCount: number;
12
+ /** how many measures were added after the old last measure of the range */
13
+ added: number;
14
+ }
15
+ /**
16
+ * Which measures a time signature change applies to: only the selected ones, from the first selected one to the
17
+ * end of the score, or the whole score.
18
+ * @category SmoTransform
19
+ */
20
+ export type TimeSignatureApplyTo = 'Selected' | 'Remaining' | 'Score';
21
+ /**
22
+ * The range of measures a time signature change applies to.
23
+ * @param applyTo which measures
24
+ * @param selectedMeasures the measure index of each selected note or measure, in any staff, in any order
25
+ * @param measureCount the number of measures in the score
26
+ * @returns the first and last measure, or null if there is no selection (and the choice is not the whole score) or no measures
27
+ */
28
+ export declare const timeSignatureRange: (applyTo: TimeSignatureApplyTo, selectedMeasures: number[], measureCount: number) => {
29
+ firstMeasure: number;
30
+ lastMeasure: number;
31
+ } | null;
32
+ /**
33
+ * The length in ticks of the measure k places after the first of a range that gets a time signature. A time
34
+ * signature with several parts (3/4+2/4) alternates its parts from measure to measure.
35
+ * @param timeSignature the new time signature
36
+ * @param k how many measures after the first re-barred measure
37
+ * @param startIndex which part the first re-barred measure has
38
+ */
39
+ export declare const rebarMeasureTicks: (timeSignature: SmoTimeSignature, k: number, startIndex: number) => number;
40
+ /**
41
+ * Re-bar the music of a range of measures into a new time signature, in every staff. The notes keep their order
42
+ * and their lengths. Where the new measures are not long enough, measures are added after the range (in every
43
+ * staff) so that all of the music fits; measures are never removed. A note that crosses a new bar line is split and
44
+ * tied. A tuplet is kept whole, starting the next measure if it does not fit. Things attached to a note stay with
45
+ * it; if the note is split they stay with the first part. Slurs, ties, hairpins and other things between notes
46
+ * follow their notes. Hand-placed beaming in the range is reset to automatic.
47
+ * @param score the score to change
48
+ * @param firstMeasure the first measure of the range
49
+ * @param lastMeasure the last measure of the range
50
+ * @param timeSignature the new time signature
51
+ * @returns what was done. Nothing is changed, and `added` is 0, if the range is not in the score.
52
+ */
53
+ export declare const rebarMeasures: (score: SmoScore, firstMeasure: number, lastMeasure: number, timeSignature: SmoTimeSignature) => RebarResult;