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.
- package/build/smoosic.js +408 -69
- package/changes.md +95 -0
- package/package.json +19 -1
- package/release/smoosic.js +408 -69
- package/specs/032-split-multimeasure-rests/checklists/requirements.md +40 -0
- package/specs/032-split-multimeasure-rests/contracts/grouping-contract.md +53 -0
- package/specs/032-split-multimeasure-rests/data-model.md +70 -0
- package/specs/032-split-multimeasure-rests/plan.md +81 -0
- package/specs/032-split-multimeasure-rests/quickstart.md +46 -0
- package/specs/032-split-multimeasure-rests/research.md +63 -0
- package/specs/032-split-multimeasure-rests/spec.md +127 -0
- package/specs/032-split-multimeasure-rests/tasks.md +174 -0
- package/specs/033-key-distance-transposition/checklists/requirements.md +35 -0
- package/specs/033-key-distance-transposition/contracts/spelling-api.md +36 -0
- package/specs/033-key-distance-transposition/data-model.md +49 -0
- package/specs/033-key-distance-transposition/plan.md +87 -0
- package/specs/033-key-distance-transposition/quickstart.md +40 -0
- package/specs/033-key-distance-transposition/research.md +82 -0
- package/specs/033-key-distance-transposition/spec.md +132 -0
- package/specs/033-key-distance-transposition/tasks.md +139 -0
- package/specs/034-smz-compressed-scores/checklists/requirements.md +35 -0
- package/specs/034-smz-compressed-scores/contracts/archive-api.md +30 -0
- package/specs/034-smz-compressed-scores/data-model.md +48 -0
- package/specs/034-smz-compressed-scores/plan.md +89 -0
- package/specs/034-smz-compressed-scores/quickstart.md +44 -0
- package/specs/034-smz-compressed-scores/research.md +86 -0
- package/specs/034-smz-compressed-scores/spec.md +137 -0
- package/specs/034-smz-compressed-scores/tasks.md +148 -0
- package/specs/035-paste-special/checklists/requirements.md +35 -0
- package/specs/035-paste-special/contracts/paste-special-api.md +50 -0
- package/specs/035-paste-special/data-model.md +47 -0
- package/specs/035-paste-special/plan.md +83 -0
- package/specs/035-paste-special/quickstart.md +51 -0
- package/specs/035-paste-special/research.md +97 -0
- package/specs/035-paste-special/spec.md +170 -0
- package/specs/035-paste-special/tasks.md +149 -0
- package/specs/036-autosave-recovery/checklists/requirements.md +36 -0
- package/specs/036-autosave-recovery/contracts/autosave-api.md +111 -0
- package/specs/036-autosave-recovery/data-model.md +70 -0
- package/specs/036-autosave-recovery/plan.md +87 -0
- package/specs/036-autosave-recovery/quickstart.md +65 -0
- package/specs/036-autosave-recovery/research.md +105 -0
- package/specs/036-autosave-recovery/spec.md +143 -0
- package/specs/036-autosave-recovery/tasks.md +165 -0
- package/specs/037-fix-new-part-dialog/checklists/requirements.md +38 -0
- package/specs/037-fix-new-part-dialog/contracts/create-part-api.md +84 -0
- package/specs/037-fix-new-part-dialog/data-model.md +68 -0
- package/specs/037-fix-new-part-dialog/plan.md +83 -0
- package/specs/037-fix-new-part-dialog/quickstart.md +58 -0
- package/specs/037-fix-new-part-dialog/research.md +86 -0
- package/specs/037-fix-new-part-dialog/spec.md +144 -0
- package/specs/037-fix-new-part-dialog/tasks.md +174 -0
- package/specs/038-per-measure-beam-groups/checklists/requirements.md +36 -0
- package/specs/038-per-measure-beam-groups/contracts/beam-groups-api.md +74 -0
- package/specs/038-per-measure-beam-groups/data-model.md +75 -0
- package/specs/038-per-measure-beam-groups/plan.md +84 -0
- package/specs/038-per-measure-beam-groups/quickstart.md +53 -0
- package/specs/038-per-measure-beam-groups/research.md +72 -0
- package/specs/038-per-measure-beam-groups/spec.md +146 -0
- package/specs/038-per-measure-beam-groups/tasks.md +132 -0
- package/specs/039-measure-fill-submenu/checklists/requirements.md +35 -0
- package/specs/039-measure-fill-submenu/contracts/measure-fill-api.md +56 -0
- package/specs/039-measure-fill-submenu/data-model.md +79 -0
- package/specs/039-measure-fill-submenu/plan.md +81 -0
- package/specs/039-measure-fill-submenu/quickstart.md +62 -0
- package/specs/039-measure-fill-submenu/research.md +68 -0
- package/specs/039-measure-fill-submenu/spec.md +153 -0
- package/specs/039-measure-fill-submenu/tasks.md +121 -0
- package/specs/040-dynamics-dialog-cleanup/checklists/requirements.md +36 -0
- package/specs/040-dynamics-dialog-cleanup/contracts/dynamics-dialog.md +52 -0
- package/specs/040-dynamics-dialog-cleanup/data-model.md +48 -0
- package/specs/040-dynamics-dialog-cleanup/plan.md +89 -0
- package/specs/040-dynamics-dialog-cleanup/quickstart.md +69 -0
- package/specs/040-dynamics-dialog-cleanup/research.md +80 -0
- package/specs/040-dynamics-dialog-cleanup/spec.md +120 -0
- package/specs/040-dynamics-dialog-cleanup/tasks.md +114 -0
- package/specs/041-delete-special/checklists/requirements.md +35 -0
- package/specs/041-delete-special/contracts/delete-special-api.md +41 -0
- package/specs/041-delete-special/data-model.md +40 -0
- package/specs/041-delete-special/plan.md +93 -0
- package/specs/041-delete-special/quickstart.md +41 -0
- package/specs/041-delete-special/research.md +75 -0
- package/specs/041-delete-special/spec.md +136 -0
- package/specs/041-delete-special/tasks.md +106 -0
- package/specs/042-preserve-music-time-signature/checklists/requirements.md +35 -0
- package/specs/042-preserve-music-time-signature/contracts/rebar-api.md +66 -0
- package/specs/042-preserve-music-time-signature/data-model.md +73 -0
- package/specs/042-preserve-music-time-signature/plan.md +93 -0
- package/specs/042-preserve-music-time-signature/quickstart.md +37 -0
- package/specs/042-preserve-music-time-signature/research.md +102 -0
- package/specs/042-preserve-music-time-signature/spec.md +153 -0
- package/specs/042-preserve-music-time-signature/tasks.md +104 -0
- package/src/application/application.ts +13 -2
- package/src/application/exports.ts +402 -395
- package/src/application/generateVexTests.ts +2 -2
- package/src/render/sui/NoteEntryCaret.ts +117 -16
- package/src/render/sui/autosave.ts +265 -0
- package/src/render/sui/formatter.ts +12 -2
- package/src/render/sui/renderState.ts +4 -4
- package/src/render/sui/scoreChangeState.ts +8 -3
- package/src/render/sui/scoreView.ts +47 -2
- package/src/render/sui/scoreViewOperations.ts +2761 -2555
- package/src/render/sui/staffLineGeometry.ts +82 -0
- package/src/render/sui/tracker.ts +18 -23
- package/src/render/vex/vxMeasure.ts +22 -8
- package/src/render/vex/vxNote.ts +2 -4
- package/src/smo/data/measure.ts +58 -1
- package/src/smo/data/measureModifiers.ts +81 -1
- package/src/smo/data/music.ts +169 -359
- package/src/smo/data/note.ts +1 -1
- package/src/smo/data/noteModifiers.ts +12 -0
- package/src/smo/data/score.ts +179 -7
- package/src/smo/data/scoreModifiers.ts +46 -1
- package/src/smo/data/systemStaff.ts +43 -0
- package/src/smo/xform/beamers.ts +80 -6
- package/src/smo/xform/copypaste.ts +207 -47
- package/src/smo/xform/measureFill.ts +89 -0
- package/src/smo/xform/operations.ts +452 -61
- package/src/smo/xform/rebar.ts +490 -0
- package/src/smo/xform/selections.ts +73 -0
- package/src/ui/components/dialogs/beamGroups.vue +106 -0
- package/src/ui/components/dialogs/deleteSpecial.vue +38 -0
- package/src/ui/components/dialogs/dynamics.vue +16 -3
- package/src/ui/components/dialogs/fileUpload.vue +2 -2
- package/src/ui/components/dialogs/hairpin.vue +3 -3
- package/src/ui/components/dialogs/newPart.vue +148 -184
- package/src/ui/components/dialogs/pasteSpecial.vue +49 -0
- package/src/ui/components/dialogs/recovery.vue +66 -0
- package/src/ui/components/dialogs/save.vue +11 -4
- package/src/ui/components/dialogs/scorePreferences.vue +23 -1
- package/src/ui/components/dialogs/slur.vue +6 -6
- package/src/ui/components/dialogs/tempo.vue +11 -3
- package/src/ui/components/dialogs/timeSignature.vue +18 -3
- package/src/ui/components/dialogs/volta.vue +3 -3
- package/src/ui/dialogs/annotationVue.ts +1 -1
- package/src/ui/dialogs/beamGroupsVue.ts +69 -0
- package/src/ui/dialogs/createPartHelpers.ts +68 -0
- package/src/ui/dialogs/deleteSpecial.ts +57 -0
- package/src/ui/dialogs/dynamicsVue.ts +87 -60
- package/src/ui/dialogs/factory.ts +0 -2
- package/src/ui/dialogs/fileDialogs.ts +63 -22
- package/src/ui/dialogs/instrument.ts +37 -30
- package/src/ui/dialogs/pasteSpecial.ts +59 -0
- package/src/ui/dialogs/preferences.ts +41 -40
- package/src/ui/dialogs/recovery.ts +49 -0
- package/src/ui/dialogs/timeSignature.ts +27 -39
- package/src/ui/fileio/fileInput.ts +12 -3
- package/src/ui/fileio/scoreArchive.ts +151 -0
- package/src/ui/fileio/xhrLoader.ts +26 -0
- package/src/ui/i18n/language.ts +1 -1
- package/src/ui/menus/beams.ts +181 -112
- package/src/ui/menus/edit.ts +44 -6
- package/src/ui/menus/file.ts +21 -1
- package/src/ui/menus/measure.ts +40 -1
- package/tests/autosave.ts +332 -0
- package/tests/beamDotted.ts +56 -0
- package/tests/beamGroups.ts +338 -0
- package/tests/createPart.ts +292 -0
- package/tests/deleteSpecial.ts +350 -0
- package/tests/dynamicsFontSize.ts +132 -0
- package/tests/keyDistanceTransposition.ts +351 -0
- package/tests/measureFill.ts +295 -0
- package/tests/movePart.ts +94 -0
- package/tests/multimeasureRest.ts +338 -0
- package/tests/pasteIntoMeasure.ts +103 -0
- package/tests/pasteSpecial.ts +541 -0
- package/tests/quickBeam.ts +126 -0
- package/tests/rebarMeasures.ts +492 -0
- package/tests/scoreArchive.ts +218 -0
- package/tests/scoreChangeState.ts +2 -0
- package/tests/staffLineGeometry.ts +179 -0
- package/tests/timeRangeSelect.ts +111 -0
- package/tests/timeSignatureDisplay.ts +58 -0
- package/tools/smoosic-schema.json +37 -0
- package/typedoc.ts +2 -1
- package/types/src/application/exports.d.ts +454 -447
- package/types/src/common/promiseHelpers.d.ts +30 -30
- package/types/src/common/vex.d.ts +224 -224
- package/types/src/render/sui/NoteEntryCaret.d.ts +107 -107
- package/types/src/render/sui/autosave.d.ts +99 -0
- package/types/src/render/sui/scoreView.d.ts +23 -0
- package/types/src/render/sui/scoreViewOperations.d.ts +776 -639
- package/types/src/render/sui/svgHelpers.d.ts +88 -88
- package/types/src/render/sui/svgPageMap.d.ts +344 -344
- package/types/src/render/sui/textEdit.d.ts +96 -96
- package/types/src/render/sui/textRender.d.ts +199 -199
- package/types/src/render/vex/smoAdapter.d.ts +47 -47
- package/types/src/render/vex/vxMeasure.d.ts +97 -97
- package/types/src/render/vex/vxNote.d.ts +56 -56
- package/types/src/render/vex/vxSystem.d.ts +71 -71
- package/types/src/smo/data/measure.d.ts +30 -0
- package/types/src/smo/data/measureModifiers.d.ts +568 -513
- package/types/src/smo/data/music.d.ts +74 -32
- package/types/src/smo/data/note.d.ts +498 -498
- package/types/src/smo/data/noteModifiers.d.ts +615 -606
- package/types/src/smo/data/score.d.ts +479 -421
- package/types/src/smo/data/scoreModifiers.d.ts +30 -0
- package/types/src/smo/data/scoreText.d.ts +334 -334
- package/types/src/smo/data/systemStaff.d.ts +14 -0
- package/types/src/smo/xform/beamers.d.ts +23 -1
- package/types/src/smo/xform/copypaste.d.ts +138 -2
- package/types/src/smo/xform/measureFill.d.ts +21 -0
- package/types/src/smo/xform/operations.d.ts +269 -129
- package/types/src/smo/xform/rebar.d.ts +53 -0
- package/types/src/smo/xform/selections.d.ts +168 -154
- package/types/src/smo/xform/undo.d.ts +142 -142
- package/types/src/ui/buttons/button.d.ts +100 -100
- package/types/src/ui/buttons/ribbon.d.ts +70 -70
- package/types/src/ui/common.d.ts +76 -76
- package/types/src/ui/components/dialogs/chordText.d.ts +28 -28
- package/types/src/ui/components/dialogs/textBlockAtomNode.d.ts +20 -20
- package/types/src/ui/components/dialogs/textGroupHtml.d.ts +29 -29
- package/types/src/ui/composable/draggable.d.ts +15 -15
- package/types/src/ui/dialogs/adapter.d.ts +120 -120
- package/types/src/ui/dialogs/annotationVue.d.ts +9 -9
- package/types/src/ui/dialogs/audioSettings.d.ts +32 -32
- package/types/src/ui/dialogs/beamGroupsVue.d.ts +20 -0
- package/types/src/ui/dialogs/chordChangeVue.d.ts +8 -8
- package/types/src/ui/dialogs/createPartHelpers.d.ts +29 -0
- package/types/src/ui/dialogs/customTupletsVue.d.ts +9 -9
- package/types/src/ui/dialogs/deleteSpecial.d.ts +8 -0
- package/types/src/ui/dialogs/dialog.d.ts +203 -203
- package/types/src/ui/dialogs/dynamicsVue.d.ts +10 -10
- package/types/src/ui/dialogs/factory.d.ts +15 -15
- package/types/src/ui/dialogs/fileDialogs.d.ts +4 -4
- package/types/src/ui/dialogs/hairpin.d.ts +35 -35
- package/types/src/ui/dialogs/hairpinVue.d.ts +7 -7
- package/types/src/ui/dialogs/instrument.d.ts +3 -3
- package/types/src/ui/dialogs/keySignatureVue.d.ts +7 -7
- package/types/src/ui/dialogs/libraryVue.d.ts +15 -15
- package/types/src/ui/dialogs/lyricVue.d.ts +8 -8
- package/types/src/ui/dialogs/pasteSpecial.d.ts +8 -0
- package/types/src/ui/dialogs/pedalMarkingVue.d.ts +7 -7
- package/types/src/ui/dialogs/recovery.d.ts +8 -0
- package/types/src/ui/dialogs/rehearsalMark.d.ts +25 -25
- package/types/src/ui/dialogs/rehearsalMarkVue.d.ts +7 -7
- package/types/src/ui/dialogs/slur.d.ts +57 -57
- package/types/src/ui/dialogs/slurVue.d.ts +7 -7
- package/types/src/ui/dialogs/tempo.d.ts +50 -50
- package/types/src/ui/dialogs/tempoVue.d.ts +10 -10
- package/types/src/ui/dialogs/textBlockVue.d.ts +8 -8
- package/types/src/ui/dialogs/textBracket.d.ts +35 -35
- package/types/src/ui/dialogs/textBracketVue.d.ts +7 -7
- package/types/src/ui/dialogs/tie.d.ts +41 -41
- package/types/src/ui/dialogs/volta.d.ts +40 -40
- package/types/src/ui/dialogs/voltaVue.d.ts +7 -7
- package/types/src/ui/fileio/fileInput.d.ts +7 -1
- package/types/src/ui/fileio/library.d.ts +40 -40
- package/types/src/ui/fileio/scoreArchive.d.ts +55 -0
- package/types/src/ui/fileio/xhrLoader.d.ts +7 -0
- package/types/src/ui/menus/file.d.ts +8 -8
- package/types/src/ui/menus/language.d.ts +7 -7
- package/types/src/ui/menus/manager.d.ts +58 -58
- package/types/src/ui/menus/menu.d.ts +159 -159
- package/types/src/ui/menus/partSelection.d.ts +14 -14
- package/types/src/ui/menus/score.d.ts +8 -8
- package/types/src/ui/menus/staffModifier.d.ts +17 -17
- package/types/typedoc.d.ts +148 -147
- package/src/ui/dialogs/dynamics.ts +0 -141
- package/types/src/ui/dialogs/dynamics.d.ts +0 -37
|
@@ -1,421 +1,479 @@
|
|
|
1
|
-
import { SvgDimensions } from './common';
|
|
2
|
-
import { SmoMeasure, SmoMeasureParams, ColumnMappedParams } from './measure';
|
|
3
|
-
import { SmoNoteModifierBase } from './noteModifiers';
|
|
4
|
-
import { SmoTempo, SmoMeasureModifierBase, SmoTimeSignature, SmoMeasureFormatParamsSer } from './measureModifiers';
|
|
5
|
-
import { StaffModifierBase, SmoInstrument } from './staffModifiers';
|
|
6
|
-
import { SmoSystemGroup, SmoSystemGroupParamsSer, SmoScoreModifierBase, SmoFormattingManager, SmoAudioPlayerSettings, SmoAudioPlayerParameters, SmoLayoutManagerParamsSer, SmoLayoutManager, FontPurpose, SmoScoreInfo, ScoreMetadataSer, SmoScorePreferences } from './scoreModifiers';
|
|
7
|
-
import { SmoTextGroup, SmoTextGroupParamsSer } from './scoreText';
|
|
8
|
-
import { SmoSystemStaff, SmoSystemStaffParams, SmoSystemStaffParamsSer } from './systemStaff';
|
|
9
|
-
import { SmoSelector, SmoSelection } from '../xform/selections';
|
|
10
|
-
import { FontInfo } from '../../common/vex';
|
|
11
|
-
/**
|
|
12
|
-
* List of engraving fonts available in Smoosic
|
|
13
|
-
*/
|
|
14
|
-
export type engravingFontType = 'Bravura' | 'Gonville' | 'Petaluma' | 'Leland';
|
|
15
|
-
/**
|
|
16
|
-
* Arrary of engraving fonts available in Smoosic
|
|
17
|
-
*/
|
|
18
|
-
export declare const engravingFontTypes: engravingFontType[];
|
|
19
|
-
export declare function isEngravingFont(et: engravingFontType | string): et is engravingFontType;
|
|
20
|
-
/**
|
|
21
|
-
* Constructor parameters. Usually you will call
|
|
22
|
-
* {@link SmoScore.defaults}, and modify the parameters you need to change.
|
|
23
|
-
* A new score with the defaults will create a single, empty measure.
|
|
24
|
-
* @category SmoObject
|
|
25
|
-
*/
|
|
26
|
-
export interface SmoScoreParams {
|
|
27
|
-
/**
|
|
28
|
-
* global font defaults for this score
|
|
29
|
-
*/
|
|
30
|
-
fonts: FontPurpose[];
|
|
31
|
-
/**
|
|
32
|
-
* identifying information about the score
|
|
33
|
-
*/
|
|
34
|
-
scoreInfo: SmoScoreInfo;
|
|
35
|
-
/**
|
|
36
|
-
* customized editor behavior
|
|
37
|
-
*/
|
|
38
|
-
preferences: SmoScorePreferences;
|
|
39
|
-
/**
|
|
40
|
-
* contained {@link SmoSystemStaffParams} objects
|
|
41
|
-
*/
|
|
42
|
-
staves: SmoSystemStaffParams[];
|
|
43
|
-
activeStaff?: number;
|
|
44
|
-
/**
|
|
45
|
-
* score text, not part of specific music
|
|
46
|
-
*/
|
|
47
|
-
textGroups: SmoTextGroup[];
|
|
48
|
-
/**
|
|
49
|
-
* System groups for formatting/justification
|
|
50
|
-
*/
|
|
51
|
-
systemGroups: SmoSystemGroup[];
|
|
52
|
-
/**
|
|
53
|
-
* future: global audio settings
|
|
54
|
-
*/
|
|
55
|
-
audioSettings: SmoAudioPlayerParameters;
|
|
56
|
-
/**
|
|
57
|
-
* layout manager, for svg and div geometry, page sizes, header sizes etc.
|
|
58
|
-
*/
|
|
59
|
-
layoutManager?: SmoLayoutManager;
|
|
60
|
-
/**
|
|
61
|
-
* measure-specific formatting
|
|
62
|
-
*/
|
|
63
|
-
formattingManager?: SmoFormattingManager;
|
|
64
|
-
}
|
|
65
|
-
/**
|
|
66
|
-
* Serialization structure for the entire score. Score is deserialized from this
|
|
67
|
-
* @category serialization
|
|
68
|
-
*/
|
|
69
|
-
export interface SmoScoreParamsSer {
|
|
70
|
-
/**
|
|
71
|
-
* some information about the score, mostly non-musical
|
|
72
|
-
*/
|
|
73
|
-
metadata: ScoreMetadataSer;
|
|
74
|
-
/**
|
|
75
|
-
* contained {@link SmoSystemStaffParams} objects
|
|
76
|
-
*/
|
|
77
|
-
staves: SmoSystemStaffParamsSer[];
|
|
78
|
-
/**
|
|
79
|
-
* score text, not part of specific music
|
|
80
|
-
*/
|
|
81
|
-
textGroups: SmoTextGroupParamsSer[];
|
|
82
|
-
/**
|
|
83
|
-
* System groups for formatting/justification
|
|
84
|
-
*/
|
|
85
|
-
systemGroups: SmoSystemGroupParamsSer[];
|
|
86
|
-
/**
|
|
87
|
-
* future: global audio settings
|
|
88
|
-
*/
|
|
89
|
-
audioSettings: SmoAudioPlayerParameters;
|
|
90
|
-
/**
|
|
91
|
-
* layout manager, for svg and div geometry, page sizes, header sizes etc.
|
|
92
|
-
*/
|
|
93
|
-
layoutManager?: SmoLayoutManagerParamsSer;
|
|
94
|
-
/**
|
|
95
|
-
* map of measure formats to measure
|
|
96
|
-
*/
|
|
97
|
-
measureFormats: SmoMeasureFormatParamsSer[];
|
|
98
|
-
/**
|
|
99
|
-
* tempo, key and other column-mapped parameters
|
|
100
|
-
*/
|
|
101
|
-
columnAttributeMap: ColumnParamsMapType;
|
|
102
|
-
/**
|
|
103
|
-
* dictionary compression for serialization
|
|
104
|
-
*/
|
|
105
|
-
dictionary: Record<string, string>;
|
|
106
|
-
}
|
|
107
|
-
/**
|
|
108
|
-
* @category SmoObject
|
|
109
|
-
*/
|
|
110
|
-
export interface SmoScoreSerializeOptions {
|
|
111
|
-
skipStaves: boolean;
|
|
112
|
-
useDictionary: boolean;
|
|
113
|
-
preserveStaffIds: boolean;
|
|
114
|
-
}
|
|
115
|
-
export declare function isEmptyTextBlock(params: Partial<SmoTextGroupParamsSer>): params is SmoTextGroupParamsSer;
|
|
116
|
-
/**
|
|
117
|
-
* @category SmoObject
|
|
118
|
-
*/
|
|
119
|
-
export interface ColumnParamsMapType {
|
|
120
|
-
keySignature: Record<number, string>;
|
|
121
|
-
tempo: Record<number, SmoTempo>;
|
|
122
|
-
timeSignature: Record<number, SmoTimeSignature>;
|
|
123
|
-
renumberingMap: Record<number, number>;
|
|
124
|
-
}
|
|
125
|
-
export declare function isSmoScoreParemsSer(params: Partial<SmoScoreParamsSer>): params is SmoScoreParamsSer;
|
|
126
|
-
/**
|
|
127
|
-
* Union of modifier types Smo modifier types
|
|
128
|
-
*/
|
|
129
|
-
export type SmoModifier = SmoNoteModifierBase | SmoMeasureModifierBase | StaffModifierBase | SmoScoreModifierBase;
|
|
130
|
-
/**
|
|
131
|
-
* Score is a container of staves, and metadata about the score. Serializing the score serializes the
|
|
132
|
-
* child object. It is the highest-level object in Smoosic.
|
|
133
|
-
* @category SmoObject
|
|
134
|
-
*/
|
|
135
|
-
export declare class SmoScore {
|
|
136
|
-
/**
|
|
137
|
-
* Default fonts in this score, for each type of text (lyrics, etc)
|
|
138
|
-
*
|
|
139
|
-
* @type {FontPurpose[]}
|
|
140
|
-
* @memberof SmoScore
|
|
141
|
-
*/
|
|
142
|
-
fonts: FontPurpose[];
|
|
143
|
-
/**
|
|
144
|
-
* General info about the score, used for export and library
|
|
145
|
-
*
|
|
146
|
-
* @type {SmoScoreInfo}
|
|
147
|
-
* @memberof SmoScore
|
|
148
|
-
*/
|
|
149
|
-
scoreInfo: SmoScoreInfo;
|
|
150
|
-
/**
|
|
151
|
-
* Default behavior for this score. Indicates some global behavior like whether to advance the cursor.
|
|
152
|
-
*
|
|
153
|
-
* @type {SmoScorePreferences}
|
|
154
|
-
* @memberof SmoScore
|
|
155
|
-
*/
|
|
156
|
-
preferences: SmoScorePreferences;
|
|
157
|
-
/**
|
|
158
|
-
* The staves that make up the music of the score
|
|
159
|
-
*
|
|
160
|
-
* @type {SmoSystemStaff[]}
|
|
161
|
-
* @memberof SmoScore
|
|
162
|
-
*/
|
|
163
|
-
staves: SmoSystemStaff[];
|
|
164
|
-
/**
|
|
165
|
-
* The active staff, used for some types of selections. Not serialized.
|
|
166
|
-
*
|
|
167
|
-
* @type {number}
|
|
168
|
-
* @memberof SmoScore
|
|
169
|
-
*/
|
|
170
|
-
activeStaff: number;
|
|
171
|
-
/**
|
|
172
|
-
* Text associated with the score, but not a specific musical element (e.g. lyrics are contains by notes)
|
|
173
|
-
*
|
|
174
|
-
* @type {SmoTextGroup[]}
|
|
175
|
-
* @memberof SmoScore
|
|
176
|
-
*/
|
|
177
|
-
textGroups: SmoTextGroup[];
|
|
178
|
-
/**
|
|
179
|
-
* A logical grouping of staves for justification
|
|
180
|
-
*
|
|
181
|
-
* @type {SmoSystemGroup[]}
|
|
182
|
-
* @memberof SmoScore
|
|
183
|
-
*/
|
|
184
|
-
systemGroups: SmoSystemGroup[];
|
|
185
|
-
/**
|
|
186
|
-
* some audio player defaults
|
|
187
|
-
*
|
|
188
|
-
* @type {SmoAudioPlayerSettings}
|
|
189
|
-
* @memberof SmoScore
|
|
190
|
-
*/
|
|
191
|
-
audioSettings: SmoAudioPlayerSettings;
|
|
192
|
-
/**
|
|
193
|
-
* Preserve a map of measures to their actual measure numbers
|
|
194
|
-
*
|
|
195
|
-
* @type {Record<number, number>}
|
|
196
|
-
* @memberof SmoScore
|
|
197
|
-
*/
|
|
198
|
-
renumberingMap: Record<number, number>;
|
|
199
|
-
/**
|
|
200
|
-
* page and rendering layout of the score, including the ppi and scaling of the pages.
|
|
201
|
-
*
|
|
202
|
-
* @type {SmoLayoutManager}
|
|
203
|
-
* @memberof SmoScore
|
|
204
|
-
*/
|
|
205
|
-
layoutManager?: SmoLayoutManager;
|
|
206
|
-
/**
|
|
207
|
-
* per-measure formatting customizations.
|
|
208
|
-
*
|
|
209
|
-
* @type {SmoFormattingManager}
|
|
210
|
-
* @memberof SmoScore
|
|
211
|
-
*/
|
|
212
|
-
formattingManager?: SmoFormattingManager;
|
|
213
|
-
constructor(params: SmoScoreParams);
|
|
214
|
-
static get engravingFonts(): Record<string, string>;
|
|
215
|
-
static get fontPurposes(): Record<string, number>;
|
|
216
|
-
static get scoreInfoDefaults(): SmoScoreInfo;
|
|
217
|
-
static get scoreMetadataDefaults(): ScoreMetadataSer;
|
|
218
|
-
static get defaults(): SmoScoreParams;
|
|
219
|
-
static get pageSizes(): string[];
|
|
220
|
-
static get pageDimensions(): Record<string, SvgDimensions>;
|
|
221
|
-
static pageSizeFromDimensions(width: number, height: number): string | null;
|
|
222
|
-
static get preferences(): string[];
|
|
223
|
-
/**
|
|
224
|
-
* serialize the keySignature, tempo and time signature, which are mapped
|
|
225
|
-
* to a column at a measure index
|
|
226
|
-
* @returns
|
|
227
|
-
*/
|
|
228
|
-
serializeColumnMapped(func: (measure: SmoMeasure) => ColumnMappedParams): {
|
|
229
|
-
keySignature: Record<number, string>;
|
|
230
|
-
tempo: Record<number, SmoTempo>;
|
|
231
|
-
timeSignature: Record<number, SmoTimeSignature>;
|
|
232
|
-
renumberingMap: Record<number, number>;
|
|
233
|
-
};
|
|
234
|
-
static fixLegacyColumnMappedCtor(scoreObj: any): void;
|
|
235
|
-
/**
|
|
236
|
-
* Column-mapped attributes stay the same in each measure until
|
|
237
|
-
* changed, like key-signatures. We don't store each measure value to
|
|
238
|
-
* make the files smaller
|
|
239
|
-
* @param scoreObj - the json blob that contains the score data
|
|
240
|
-
* @returns
|
|
241
|
-
*/
|
|
242
|
-
static deserializeColumnMapped(scoreObj: any): void;
|
|
243
|
-
/**
|
|
244
|
-
* Serialize the entire score.
|
|
245
|
-
* @returns JSON object
|
|
246
|
-
*/
|
|
247
|
-
serialize(options?: SmoScoreSerializeOptions): SmoScoreParamsSer;
|
|
248
|
-
updateScorePreferences(pref: SmoScorePreferences): void;
|
|
249
|
-
get engravingFont(): engravingFontType;
|
|
250
|
-
set engravingFont(value: engravingFontType);
|
|
251
|
-
static upConvertGlobalLayout(jsonObj: any): void;
|
|
252
|
-
/**
|
|
253
|
-
* Convert legacy score layout to layoutManager object parameters
|
|
254
|
-
* @param jsonObj
|
|
255
|
-
*/
|
|
256
|
-
static upConvertLayout(jsonObj: any): void;
|
|
257
|
-
/**
|
|
258
|
-
* Hack: for the case of a score containing only a single part, use the text from the
|
|
259
|
-
* part.
|
|
260
|
-
* @param jsonObj
|
|
261
|
-
* @returns
|
|
262
|
-
*/
|
|
263
|
-
static fixTextGroupSinglePart(jsonObj: any): void;
|
|
264
|
-
/**
|
|
265
|
-
* Deserialize an entire score
|
|
266
|
-
* @param jsonString
|
|
267
|
-
* @returns SmoScore
|
|
268
|
-
*/
|
|
269
|
-
static deserialize(jsonString: string): SmoScore;
|
|
270
|
-
/**
|
|
271
|
-
* Text groups used to be attachable to a note ({@link SmoTextGroup.attachToSelector}). Notes now carry annotations
|
|
272
|
-
* (a {@link SmoLyric} with the annotation parser) instead, so convert each attached group: one annotation
|
|
273
|
-
* per non-empty text block, on the note the group's selector points at. Attached groups are removed from
|
|
274
|
-
* the result whether or not the note was found. Text groups that are not attached are returned as-is.
|
|
275
|
-
* Each annotation keeps the group's x and y offset (`musicXOffset`, `musicYOffset`) as its own
|
|
276
|
-
* `translateX` and `translateY`; the y offset changes sign because the two use opposite directions.
|
|
277
|
-
*
|
|
278
|
-
* Call it once for the score's text groups (no `ownerStaffIndex`, the selector's staff is used) and once
|
|
279
|
-
* for each staff's `partInfo.textGroups`, passing that staff's index. A part's copy of the text stores a
|
|
280
|
-
* part-relative staff number, so the owning staff is the one that holds the note. Call the score's list first:
|
|
281
|
-
* a part's text group is discarded, unconverted, if its note already has any annotation. The text groups
|
|
282
|
-
* of the score and of a part are never shown together, but the annotations are on the note and show in both,
|
|
283
|
-
* so converting a part's copy of the text would duplicate it.
|
|
284
|
-
*
|
|
285
|
-
* If there are no staves (a score deserialized with `skipStaves`) nothing can be matched, so the groups
|
|
286
|
-
* are returned unchanged.
|
|
287
|
-
* See specs/019-attached-text-to-annotation.
|
|
288
|
-
* @param staves the staves of the score being deserialized
|
|
289
|
-
* @param textGroups the text groups to convert
|
|
290
|
-
* @param ownerStaffIndex the staff that holds the note, for a part's text groups
|
|
291
|
-
* @returns the text groups that remain
|
|
292
|
-
*/
|
|
293
|
-
static attachedTextToAnnotations(staves: SmoSystemStaff[], textGroups: SmoTextGroup[], ownerStaffIndex?: number): SmoTextGroup[];
|
|
294
|
-
/**
|
|
295
|
-
* Convert measure formatting from legacy scores, that had the formatting
|
|
296
|
-
* per measure, to the new way that has a separate formatting object.
|
|
297
|
-
* **/
|
|
298
|
-
static measureFormatFromLegacyScore(score: SmoScore, jsonObj: any): SmoFormattingManager | null;
|
|
299
|
-
/**
|
|
300
|
-
* Return a default score with all default setting and one measure of notes
|
|
301
|
-
* @param scoreDefaults
|
|
302
|
-
* @param measureDefaults
|
|
303
|
-
* @returns
|
|
304
|
-
*/
|
|
305
|
-
static getDefaultScore(scoreDefaults: SmoScoreParams, measureDefaults: SmoMeasureParams | null): SmoScore;
|
|
306
|
-
/**
|
|
307
|
-
* Return an 'empty' score, with one measure of rests
|
|
308
|
-
* @param scoreDefaults
|
|
309
|
-
* @returns
|
|
310
|
-
*/
|
|
311
|
-
static getEmptyScore(scoreDefaults: SmoScoreParams): SmoScore;
|
|
312
|
-
/**
|
|
313
|
-
* We have deleted a measure, update the renumber index to
|
|
314
|
-
* shuffle back.
|
|
315
|
-
* @param indexToDelete
|
|
316
|
-
*/
|
|
317
|
-
updateRenumberForAddDelete(indexToDelete: number, toAdd: boolean): void;
|
|
318
|
-
updateRenumberingMap(measureIndex: number, localIndex: number): void;
|
|
319
|
-
/**
|
|
320
|
-
* Iteratively number the staves, like when adding a measure
|
|
321
|
-
*/
|
|
322
|
-
numberStaves(): void;
|
|
323
|
-
get measureCount(): number;
|
|
324
|
-
/**
|
|
325
|
-
* determine if the measure at this index could be a multi-measure rest
|
|
326
|
-
* @param measureIndex - the measure index we are considering to add
|
|
327
|
-
* @param start - the measure index would be the start of the rest
|
|
328
|
-
* @returns
|
|
329
|
-
*/
|
|
330
|
-
isMultimeasureRest(measureIndex: number, start: boolean, forceRest: boolean): boolean;
|
|
331
|
-
/**
|
|
332
|
-
*
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
*
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
*
|
|
352
|
-
* of
|
|
353
|
-
*
|
|
354
|
-
* @param
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
*
|
|
360
|
-
*
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
/**
|
|
378
|
-
*
|
|
379
|
-
* @param
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
*
|
|
385
|
-
* @param measureIndex
|
|
386
|
-
* @param
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
*
|
|
396
|
-
*
|
|
397
|
-
*/
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
1
|
+
import { SvgDimensions } from './common';
|
|
2
|
+
import { SmoMeasure, SmoMeasureParams, ColumnMappedParams } from './measure';
|
|
3
|
+
import { SmoNoteModifierBase } from './noteModifiers';
|
|
4
|
+
import { SmoTempo, SmoMeasureModifierBase, SmoTimeSignature, SmoMeasureFormatParamsSer } from './measureModifiers';
|
|
5
|
+
import { StaffModifierBase, SmoInstrument } from './staffModifiers';
|
|
6
|
+
import { SmoSystemGroup, SmoSystemGroupParamsSer, SmoScoreModifierBase, SmoFormattingManager, SmoAudioPlayerSettings, SmoAudioPlayerParameters, SmoLayoutManagerParamsSer, SmoLayoutManager, FontPurpose, SmoScoreInfo, ScoreMetadataSer, SmoScorePreferences } from './scoreModifiers';
|
|
7
|
+
import { SmoTextGroup, SmoTextGroupParamsSer } from './scoreText';
|
|
8
|
+
import { SmoSystemStaff, SmoSystemStaffParams, SmoSystemStaffParamsSer } from './systemStaff';
|
|
9
|
+
import { SmoSelector, SmoSelection } from '../xform/selections';
|
|
10
|
+
import { FontInfo } from '../../common/vex';
|
|
11
|
+
/**
|
|
12
|
+
* List of engraving fonts available in Smoosic
|
|
13
|
+
*/
|
|
14
|
+
export type engravingFontType = 'Bravura' | 'Gonville' | 'Petaluma' | 'Leland';
|
|
15
|
+
/**
|
|
16
|
+
* Arrary of engraving fonts available in Smoosic
|
|
17
|
+
*/
|
|
18
|
+
export declare const engravingFontTypes: engravingFontType[];
|
|
19
|
+
export declare function isEngravingFont(et: engravingFontType | string): et is engravingFontType;
|
|
20
|
+
/**
|
|
21
|
+
* Constructor parameters. Usually you will call
|
|
22
|
+
* {@link SmoScore.defaults}, and modify the parameters you need to change.
|
|
23
|
+
* A new score with the defaults will create a single, empty measure.
|
|
24
|
+
* @category SmoObject
|
|
25
|
+
*/
|
|
26
|
+
export interface SmoScoreParams {
|
|
27
|
+
/**
|
|
28
|
+
* global font defaults for this score
|
|
29
|
+
*/
|
|
30
|
+
fonts: FontPurpose[];
|
|
31
|
+
/**
|
|
32
|
+
* identifying information about the score
|
|
33
|
+
*/
|
|
34
|
+
scoreInfo: SmoScoreInfo;
|
|
35
|
+
/**
|
|
36
|
+
* customized editor behavior
|
|
37
|
+
*/
|
|
38
|
+
preferences: SmoScorePreferences;
|
|
39
|
+
/**
|
|
40
|
+
* contained {@link SmoSystemStaffParams} objects
|
|
41
|
+
*/
|
|
42
|
+
staves: SmoSystemStaffParams[];
|
|
43
|
+
activeStaff?: number;
|
|
44
|
+
/**
|
|
45
|
+
* score text, not part of specific music
|
|
46
|
+
*/
|
|
47
|
+
textGroups: SmoTextGroup[];
|
|
48
|
+
/**
|
|
49
|
+
* System groups for formatting/justification
|
|
50
|
+
*/
|
|
51
|
+
systemGroups: SmoSystemGroup[];
|
|
52
|
+
/**
|
|
53
|
+
* future: global audio settings
|
|
54
|
+
*/
|
|
55
|
+
audioSettings: SmoAudioPlayerParameters;
|
|
56
|
+
/**
|
|
57
|
+
* layout manager, for svg and div geometry, page sizes, header sizes etc.
|
|
58
|
+
*/
|
|
59
|
+
layoutManager?: SmoLayoutManager;
|
|
60
|
+
/**
|
|
61
|
+
* measure-specific formatting
|
|
62
|
+
*/
|
|
63
|
+
formattingManager?: SmoFormattingManager;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Serialization structure for the entire score. Score is deserialized from this
|
|
67
|
+
* @category serialization
|
|
68
|
+
*/
|
|
69
|
+
export interface SmoScoreParamsSer {
|
|
70
|
+
/**
|
|
71
|
+
* some information about the score, mostly non-musical
|
|
72
|
+
*/
|
|
73
|
+
metadata: ScoreMetadataSer;
|
|
74
|
+
/**
|
|
75
|
+
* contained {@link SmoSystemStaffParams} objects
|
|
76
|
+
*/
|
|
77
|
+
staves: SmoSystemStaffParamsSer[];
|
|
78
|
+
/**
|
|
79
|
+
* score text, not part of specific music
|
|
80
|
+
*/
|
|
81
|
+
textGroups: SmoTextGroupParamsSer[];
|
|
82
|
+
/**
|
|
83
|
+
* System groups for formatting/justification
|
|
84
|
+
*/
|
|
85
|
+
systemGroups: SmoSystemGroupParamsSer[];
|
|
86
|
+
/**
|
|
87
|
+
* future: global audio settings
|
|
88
|
+
*/
|
|
89
|
+
audioSettings: SmoAudioPlayerParameters;
|
|
90
|
+
/**
|
|
91
|
+
* layout manager, for svg and div geometry, page sizes, header sizes etc.
|
|
92
|
+
*/
|
|
93
|
+
layoutManager?: SmoLayoutManagerParamsSer;
|
|
94
|
+
/**
|
|
95
|
+
* map of measure formats to measure
|
|
96
|
+
*/
|
|
97
|
+
measureFormats: SmoMeasureFormatParamsSer[];
|
|
98
|
+
/**
|
|
99
|
+
* tempo, key and other column-mapped parameters
|
|
100
|
+
*/
|
|
101
|
+
columnAttributeMap: ColumnParamsMapType;
|
|
102
|
+
/**
|
|
103
|
+
* dictionary compression for serialization
|
|
104
|
+
*/
|
|
105
|
+
dictionary: Record<string, string>;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* @category SmoObject
|
|
109
|
+
*/
|
|
110
|
+
export interface SmoScoreSerializeOptions {
|
|
111
|
+
skipStaves: boolean;
|
|
112
|
+
useDictionary: boolean;
|
|
113
|
+
preserveStaffIds: boolean;
|
|
114
|
+
}
|
|
115
|
+
export declare function isEmptyTextBlock(params: Partial<SmoTextGroupParamsSer>): params is SmoTextGroupParamsSer;
|
|
116
|
+
/**
|
|
117
|
+
* @category SmoObject
|
|
118
|
+
*/
|
|
119
|
+
export interface ColumnParamsMapType {
|
|
120
|
+
keySignature: Record<number, string>;
|
|
121
|
+
tempo: Record<number, SmoTempo>;
|
|
122
|
+
timeSignature: Record<number, SmoTimeSignature>;
|
|
123
|
+
renumberingMap: Record<number, number>;
|
|
124
|
+
}
|
|
125
|
+
export declare function isSmoScoreParemsSer(params: Partial<SmoScoreParamsSer>): params is SmoScoreParamsSer;
|
|
126
|
+
/**
|
|
127
|
+
* Union of modifier types Smo modifier types
|
|
128
|
+
*/
|
|
129
|
+
export type SmoModifier = SmoNoteModifierBase | SmoMeasureModifierBase | StaffModifierBase | SmoScoreModifierBase;
|
|
130
|
+
/**
|
|
131
|
+
* Score is a container of staves, and metadata about the score. Serializing the score serializes the
|
|
132
|
+
* child object. It is the highest-level object in Smoosic.
|
|
133
|
+
* @category SmoObject
|
|
134
|
+
*/
|
|
135
|
+
export declare class SmoScore {
|
|
136
|
+
/**
|
|
137
|
+
* Default fonts in this score, for each type of text (lyrics, etc)
|
|
138
|
+
*
|
|
139
|
+
* @type {FontPurpose[]}
|
|
140
|
+
* @memberof SmoScore
|
|
141
|
+
*/
|
|
142
|
+
fonts: FontPurpose[];
|
|
143
|
+
/**
|
|
144
|
+
* General info about the score, used for export and library
|
|
145
|
+
*
|
|
146
|
+
* @type {SmoScoreInfo}
|
|
147
|
+
* @memberof SmoScore
|
|
148
|
+
*/
|
|
149
|
+
scoreInfo: SmoScoreInfo;
|
|
150
|
+
/**
|
|
151
|
+
* Default behavior for this score. Indicates some global behavior like whether to advance the cursor.
|
|
152
|
+
*
|
|
153
|
+
* @type {SmoScorePreferences}
|
|
154
|
+
* @memberof SmoScore
|
|
155
|
+
*/
|
|
156
|
+
preferences: SmoScorePreferences;
|
|
157
|
+
/**
|
|
158
|
+
* The staves that make up the music of the score
|
|
159
|
+
*
|
|
160
|
+
* @type {SmoSystemStaff[]}
|
|
161
|
+
* @memberof SmoScore
|
|
162
|
+
*/
|
|
163
|
+
staves: SmoSystemStaff[];
|
|
164
|
+
/**
|
|
165
|
+
* The active staff, used for some types of selections. Not serialized.
|
|
166
|
+
*
|
|
167
|
+
* @type {number}
|
|
168
|
+
* @memberof SmoScore
|
|
169
|
+
*/
|
|
170
|
+
activeStaff: number;
|
|
171
|
+
/**
|
|
172
|
+
* Text associated with the score, but not a specific musical element (e.g. lyrics are contains by notes)
|
|
173
|
+
*
|
|
174
|
+
* @type {SmoTextGroup[]}
|
|
175
|
+
* @memberof SmoScore
|
|
176
|
+
*/
|
|
177
|
+
textGroups: SmoTextGroup[];
|
|
178
|
+
/**
|
|
179
|
+
* A logical grouping of staves for justification
|
|
180
|
+
*
|
|
181
|
+
* @type {SmoSystemGroup[]}
|
|
182
|
+
* @memberof SmoScore
|
|
183
|
+
*/
|
|
184
|
+
systemGroups: SmoSystemGroup[];
|
|
185
|
+
/**
|
|
186
|
+
* some audio player defaults
|
|
187
|
+
*
|
|
188
|
+
* @type {SmoAudioPlayerSettings}
|
|
189
|
+
* @memberof SmoScore
|
|
190
|
+
*/
|
|
191
|
+
audioSettings: SmoAudioPlayerSettings;
|
|
192
|
+
/**
|
|
193
|
+
* Preserve a map of measures to their actual measure numbers
|
|
194
|
+
*
|
|
195
|
+
* @type {Record<number, number>}
|
|
196
|
+
* @memberof SmoScore
|
|
197
|
+
*/
|
|
198
|
+
renumberingMap: Record<number, number>;
|
|
199
|
+
/**
|
|
200
|
+
* page and rendering layout of the score, including the ppi and scaling of the pages.
|
|
201
|
+
*
|
|
202
|
+
* @type {SmoLayoutManager}
|
|
203
|
+
* @memberof SmoScore
|
|
204
|
+
*/
|
|
205
|
+
layoutManager?: SmoLayoutManager;
|
|
206
|
+
/**
|
|
207
|
+
* per-measure formatting customizations.
|
|
208
|
+
*
|
|
209
|
+
* @type {SmoFormattingManager}
|
|
210
|
+
* @memberof SmoScore
|
|
211
|
+
*/
|
|
212
|
+
formattingManager?: SmoFormattingManager;
|
|
213
|
+
constructor(params: SmoScoreParams);
|
|
214
|
+
static get engravingFonts(): Record<string, string>;
|
|
215
|
+
static get fontPurposes(): Record<string, number>;
|
|
216
|
+
static get scoreInfoDefaults(): SmoScoreInfo;
|
|
217
|
+
static get scoreMetadataDefaults(): ScoreMetadataSer;
|
|
218
|
+
static get defaults(): SmoScoreParams;
|
|
219
|
+
static get pageSizes(): string[];
|
|
220
|
+
static get pageDimensions(): Record<string, SvgDimensions>;
|
|
221
|
+
static pageSizeFromDimensions(width: number, height: number): string | null;
|
|
222
|
+
static get preferences(): string[];
|
|
223
|
+
/**
|
|
224
|
+
* serialize the keySignature, tempo and time signature, which are mapped
|
|
225
|
+
* to a column at a measure index
|
|
226
|
+
* @returns
|
|
227
|
+
*/
|
|
228
|
+
serializeColumnMapped(func: (measure: SmoMeasure) => ColumnMappedParams): {
|
|
229
|
+
keySignature: Record<number, string>;
|
|
230
|
+
tempo: Record<number, SmoTempo>;
|
|
231
|
+
timeSignature: Record<number, SmoTimeSignature>;
|
|
232
|
+
renumberingMap: Record<number, number>;
|
|
233
|
+
};
|
|
234
|
+
static fixLegacyColumnMappedCtor(scoreObj: any): void;
|
|
235
|
+
/**
|
|
236
|
+
* Column-mapped attributes stay the same in each measure until
|
|
237
|
+
* changed, like key-signatures. We don't store each measure value to
|
|
238
|
+
* make the files smaller
|
|
239
|
+
* @param scoreObj - the json blob that contains the score data
|
|
240
|
+
* @returns
|
|
241
|
+
*/
|
|
242
|
+
static deserializeColumnMapped(scoreObj: any): void;
|
|
243
|
+
/**
|
|
244
|
+
* Serialize the entire score.
|
|
245
|
+
* @returns JSON object
|
|
246
|
+
*/
|
|
247
|
+
serialize(options?: SmoScoreSerializeOptions): SmoScoreParamsSer;
|
|
248
|
+
updateScorePreferences(pref: SmoScorePreferences): void;
|
|
249
|
+
get engravingFont(): engravingFontType;
|
|
250
|
+
set engravingFont(value: engravingFontType);
|
|
251
|
+
static upConvertGlobalLayout(jsonObj: any): void;
|
|
252
|
+
/**
|
|
253
|
+
* Convert legacy score layout to layoutManager object parameters
|
|
254
|
+
* @param jsonObj
|
|
255
|
+
*/
|
|
256
|
+
static upConvertLayout(jsonObj: any): void;
|
|
257
|
+
/**
|
|
258
|
+
* Hack: for the case of a score containing only a single part, use the text from the
|
|
259
|
+
* part.
|
|
260
|
+
* @param jsonObj
|
|
261
|
+
* @returns
|
|
262
|
+
*/
|
|
263
|
+
static fixTextGroupSinglePart(jsonObj: any): void;
|
|
264
|
+
/**
|
|
265
|
+
* Deserialize an entire score
|
|
266
|
+
* @param jsonString
|
|
267
|
+
* @returns SmoScore
|
|
268
|
+
*/
|
|
269
|
+
static deserialize(jsonString: string): SmoScore;
|
|
270
|
+
/**
|
|
271
|
+
* Text groups used to be attachable to a note ({@link SmoTextGroup.attachToSelector}). Notes now carry annotations
|
|
272
|
+
* (a {@link SmoLyric} with the annotation parser) instead, so convert each attached group: one annotation
|
|
273
|
+
* per non-empty text block, on the note the group's selector points at. Attached groups are removed from
|
|
274
|
+
* the result whether or not the note was found. Text groups that are not attached are returned as-is.
|
|
275
|
+
* Each annotation keeps the group's x and y offset (`musicXOffset`, `musicYOffset`) as its own
|
|
276
|
+
* `translateX` and `translateY`; the y offset changes sign because the two use opposite directions.
|
|
277
|
+
*
|
|
278
|
+
* Call it once for the score's text groups (no `ownerStaffIndex`, the selector's staff is used) and once
|
|
279
|
+
* for each staff's `partInfo.textGroups`, passing that staff's index. A part's copy of the text stores a
|
|
280
|
+
* part-relative staff number, so the owning staff is the one that holds the note. Call the score's list first:
|
|
281
|
+
* a part's text group is discarded, unconverted, if its note already has any annotation. The text groups
|
|
282
|
+
* of the score and of a part are never shown together, but the annotations are on the note and show in both,
|
|
283
|
+
* so converting a part's copy of the text would duplicate it.
|
|
284
|
+
*
|
|
285
|
+
* If there are no staves (a score deserialized with `skipStaves`) nothing can be matched, so the groups
|
|
286
|
+
* are returned unchanged.
|
|
287
|
+
* See specs/019-attached-text-to-annotation.
|
|
288
|
+
* @param staves the staves of the score being deserialized
|
|
289
|
+
* @param textGroups the text groups to convert
|
|
290
|
+
* @param ownerStaffIndex the staff that holds the note, for a part's text groups
|
|
291
|
+
* @returns the text groups that remain
|
|
292
|
+
*/
|
|
293
|
+
static attachedTextToAnnotations(staves: SmoSystemStaff[], textGroups: SmoTextGroup[], ownerStaffIndex?: number): SmoTextGroup[];
|
|
294
|
+
/**
|
|
295
|
+
* Convert measure formatting from legacy scores, that had the formatting
|
|
296
|
+
* per measure, to the new way that has a separate formatting object.
|
|
297
|
+
* **/
|
|
298
|
+
static measureFormatFromLegacyScore(score: SmoScore, jsonObj: any): SmoFormattingManager | null;
|
|
299
|
+
/**
|
|
300
|
+
* Return a default score with all default setting and one measure of notes
|
|
301
|
+
* @param scoreDefaults
|
|
302
|
+
* @param measureDefaults
|
|
303
|
+
* @returns
|
|
304
|
+
*/
|
|
305
|
+
static getDefaultScore(scoreDefaults: SmoScoreParams, measureDefaults: SmoMeasureParams | null): SmoScore;
|
|
306
|
+
/**
|
|
307
|
+
* Return an 'empty' score, with one measure of rests
|
|
308
|
+
* @param scoreDefaults
|
|
309
|
+
* @returns
|
|
310
|
+
*/
|
|
311
|
+
static getEmptyScore(scoreDefaults: SmoScoreParams): SmoScore;
|
|
312
|
+
/**
|
|
313
|
+
* We have deleted a measure, update the renumber index to
|
|
314
|
+
* shuffle back.
|
|
315
|
+
* @param indexToDelete
|
|
316
|
+
*/
|
|
317
|
+
updateRenumberForAddDelete(indexToDelete: number, toAdd: boolean): void;
|
|
318
|
+
updateRenumberingMap(measureIndex: number, localIndex: number): void;
|
|
319
|
+
/**
|
|
320
|
+
* Iteratively number the staves, like when adding a measure
|
|
321
|
+
*/
|
|
322
|
+
numberStaves(): void;
|
|
323
|
+
get measureCount(): number;
|
|
324
|
+
/**
|
|
325
|
+
* determine if the measure at this index could be a multi-measure rest
|
|
326
|
+
* @param measureIndex - the measure index we are considering to add
|
|
327
|
+
* @param start - the measure index would be the start of the rest
|
|
328
|
+
* @returns
|
|
329
|
+
*/
|
|
330
|
+
isMultimeasureRest(measureIndex: number, start: boolean, forceRest: boolean): boolean;
|
|
331
|
+
/**
|
|
332
|
+
* True for the repeat symbols that belong at the end of a measure: To Coda, D.C. or D.S. (al Coda or
|
|
333
|
+
* al Fine), and Fine. Segno and Coda belong at the start.
|
|
334
|
+
* @param symbol one of SmoRepeatSymbol.symbols
|
|
335
|
+
*/
|
|
336
|
+
static isEndRepeatSymbol(symbol: number): boolean;
|
|
337
|
+
/**
|
|
338
|
+
* True for the repeat symbols that belong at the start of a measure: Segno and Coda
|
|
339
|
+
* @param symbol one of SmoRepeatSymbol.symbols
|
|
340
|
+
*/
|
|
341
|
+
static isStartRepeatSymbol(symbol: number): boolean;
|
|
342
|
+
/**
|
|
343
|
+
* A measure that can never be part of a multimeasure rest: one under a volta ending on any
|
|
344
|
+
* staff, a measure that repeats the previous measure (the measure-repeat sign), or (kept from before)
|
|
345
|
+
* the first measure of a part with more than one staff.
|
|
346
|
+
* @param measureIndex
|
|
347
|
+
*/
|
|
348
|
+
isMultimeasureBlocked(measureIndex: number): boolean;
|
|
349
|
+
/**
|
|
350
|
+
* A landmark that belongs to the start of a measure. A multimeasure rest ends before such a
|
|
351
|
+
* measure, which starts the next one: a rehearsal mark, Segno or Coda, a repeat or double barline at
|
|
352
|
+
* the start of the measure, an instrument change, or (compared with the previous measure) a key
|
|
353
|
+
* signature, time signature or displayed tempo change.
|
|
354
|
+
* @param measureIndex
|
|
355
|
+
*/
|
|
356
|
+
isMultimeasureStartLandmark(measureIndex: number): boolean;
|
|
357
|
+
/**
|
|
358
|
+
* A landmark that belongs to the end of a measure. A multimeasure rest ends after such a measure:
|
|
359
|
+
* To Coda, D.C. or D.S., Fine, or a repeat or double barline at the end of the measure.
|
|
360
|
+
* @param measureIndex
|
|
361
|
+
*/
|
|
362
|
+
isMultimeasureEndLandmark(measureIndex: number): boolean;
|
|
363
|
+
/**
|
|
364
|
+
* Restore measure formats stored when a score is serialized
|
|
365
|
+
*/
|
|
366
|
+
updateMeasureFormats(): void;
|
|
367
|
+
/**
|
|
368
|
+
* Add a measure to the score with the supplied parameters at the supplied index.
|
|
369
|
+
* The defaults per staff may be different depending on the clef, key of the staff.
|
|
370
|
+
*/
|
|
371
|
+
addDefaultMeasureWithNotes(measureIndex: number, parameters: SmoMeasureParams): void;
|
|
372
|
+
getLocalMeasureIndex(measureIndex: number): number;
|
|
373
|
+
/**
|
|
374
|
+
* delete the measure at the supplied index in all the staves
|
|
375
|
+
*/
|
|
376
|
+
deleteMeasure(measureIndex: number): void;
|
|
377
|
+
/**
|
|
378
|
+
* coordinate the ids of the display score with the stored score
|
|
379
|
+
* @param other
|
|
380
|
+
*/
|
|
381
|
+
synchronizeTextGroups(other: SmoTextGroup[]): void;
|
|
382
|
+
/**
|
|
383
|
+
* get a measure 'compatible' with the measure at the given index, in terms
|
|
384
|
+
* of key, time signature etc.
|
|
385
|
+
* @param measureIndex
|
|
386
|
+
* @param staffIndex
|
|
387
|
+
* @param prototypeIndex
|
|
388
|
+
* @returns
|
|
389
|
+
*/
|
|
390
|
+
getPrototypeMeasure(measureIndex: number, staffIndex: number, prototypeIndex?: number): SmoMeasure;
|
|
391
|
+
/**
|
|
392
|
+
* Give a measure prototype, create a new measure and add it to each staff, with the
|
|
393
|
+
* correct settings for current time signature/clef.
|
|
394
|
+
* @param measureIndex
|
|
395
|
+
* @param prototypeIndex the measure the new one copies its settings from. By default, the measure
|
|
396
|
+
* that is at measureIndex now (or the last measure, if there is none).
|
|
397
|
+
*/
|
|
398
|
+
addMeasure(measureIndex: number, prototypeIndex?: number): void;
|
|
399
|
+
/**
|
|
400
|
+
* Replace the measure at the given location. Probably due to an undo operation or paste.
|
|
401
|
+
* @param selector
|
|
402
|
+
* @param measure
|
|
403
|
+
*/
|
|
404
|
+
replaceMeasure(selector: SmoSelector, measure: SmoMeasure): void;
|
|
405
|
+
getSystemGroupForStaff(selection: SmoSelection): SmoSystemGroup | undefined;
|
|
406
|
+
getSystemGroupForStaffId(staffId: number): SmoSystemGroup | undefined;
|
|
407
|
+
getStavesForGroup(group: SmoSystemGroup): SmoSystemStaff[];
|
|
408
|
+
addOrReplaceSystemGroup(newGroup: SmoSystemGroup): void;
|
|
409
|
+
removeSystemGroup(group: SmoSystemGroup): void;
|
|
410
|
+
clearSystemGroups(): void;
|
|
411
|
+
isPartExposed(): boolean;
|
|
412
|
+
/**
|
|
413
|
+
* Probably due to an undo operation, replace the staff at the given index.
|
|
414
|
+
* @param index
|
|
415
|
+
* @param staff
|
|
416
|
+
*/
|
|
417
|
+
replaceStaff(index: number, staff: SmoSystemStaff): void;
|
|
418
|
+
/**
|
|
419
|
+
*
|
|
420
|
+
* @param measureIndex
|
|
421
|
+
* @param key
|
|
422
|
+
*/
|
|
423
|
+
addKeySignature(measureIndex: number, key: string): void;
|
|
424
|
+
/**
|
|
425
|
+
* If the part is a transposing part, remove the transposition from the notes/staff. This logic
|
|
426
|
+
* assumes the measures previously had transposeIndex set up by the instrument map.
|
|
427
|
+
*/
|
|
428
|
+
setTransposing(): void;
|
|
429
|
+
/**
|
|
430
|
+
* If the score is switching from transposing to non-transposing, update the index
|
|
431
|
+
* and pitches. This logic assumes we are changing from transposing to non-transposing.
|
|
432
|
+
*/
|
|
433
|
+
setNonTransposing(): void;
|
|
434
|
+
setNoteInstrumentProperties(): void;
|
|
435
|
+
addStaff(parameters: SmoSystemStaffParams): SmoSystemStaff;
|
|
436
|
+
/**
|
|
437
|
+
* Where a new part goes, given the position the user asked for. The position counts from 1, and
|
|
438
|
+
* one more than the number of staves means after the last staff. A part with more than one staff
|
|
439
|
+
* is never split: if the position is inside one, the new part goes after it.
|
|
440
|
+
* @param location the requested position, counting from 1
|
|
441
|
+
* @returns the index at which to insert the first staff of the new part, 0 to the number of staves
|
|
442
|
+
*/
|
|
443
|
+
resolveNewPartIndex(location: number): number;
|
|
444
|
+
/**
|
|
445
|
+
* A staff was inserted at `fromIndex`, or removed. Staff numbers at or beyond `fromIndex` move by
|
|
446
|
+
* `delta` in everything that refers to a staff: staff modifiers and instruments, system groups, and
|
|
447
|
+
* text attached to notes.
|
|
448
|
+
* @param fromIndex the staff numbers that are this large or larger move
|
|
449
|
+
* @param delta how far they move
|
|
450
|
+
*/
|
|
451
|
+
shiftStaffReferences(fromIndex: number, delta: number): void;
|
|
452
|
+
updateCompoundTimeSignature(): void;
|
|
453
|
+
/**
|
|
454
|
+
* delete any system groups that apply to deleted staves
|
|
455
|
+
*/
|
|
456
|
+
updateSystemGroups(): void;
|
|
457
|
+
removeStaff(index: number): void;
|
|
458
|
+
getStaffInstrument(selector: SmoSelector): SmoInstrument;
|
|
459
|
+
swapStaves(index1: number, index2: number): void;
|
|
460
|
+
updateTextGroup(textGroup: SmoTextGroup, toAdd: boolean): void;
|
|
461
|
+
addTextGroup(textGroup: SmoTextGroup): void;
|
|
462
|
+
getTextGroups(): SmoTextGroup[];
|
|
463
|
+
scaleTextGroups(scale: number): void;
|
|
464
|
+
/**
|
|
465
|
+
* Remove the text that is attached to the notes of a measure, from the score and from the part
|
|
466
|
+
* information of the staff. Used when the notes of the measure are removed.
|
|
467
|
+
* @param staffIndex the staff of the measure
|
|
468
|
+
* @param measureIndex the index of the measure
|
|
469
|
+
*/
|
|
470
|
+
removeTextAttachedToMeasure(staffIndex: number, measureIndex: number): void;
|
|
471
|
+
removeTextGroup(textGroup: SmoTextGroup): void;
|
|
472
|
+
setLyricAdjustWidth(adjustNoteWidth: boolean): void;
|
|
473
|
+
setChordAdjustWidth(adjustNoteWidth: boolean): void;
|
|
474
|
+
setLyricFont(fontInfo: FontInfo): void;
|
|
475
|
+
setChordFont(fontInfo: FontInfo): void;
|
|
476
|
+
get measures(): SmoMeasure[];
|
|
477
|
+
incrementActiveStaff(offset: number): number;
|
|
478
|
+
setActiveStaff(index: number): void;
|
|
479
|
+
}
|