smoosic 2.0.2 → 2.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/smoosic.js +546 -125
- package/changes.md +85 -0
- package/package.json +23 -2
- package/release/smoosic.js +549 -128
- package/release/styles/menus.css +26 -0
- package/specs/022-text-reposition-on-resize/spec.md +1 -0
- package/specs/027-fix-bottom-modifier-lookup/checklists/requirements.md +38 -0
- package/specs/027-fix-bottom-modifier-lookup/contracts/division-lookup-contract.md +51 -0
- package/specs/027-fix-bottom-modifier-lookup/data-model.md +43 -0
- package/specs/027-fix-bottom-modifier-lookup/plan.md +77 -0
- package/specs/027-fix-bottom-modifier-lookup/quickstart.md +36 -0
- package/specs/027-fix-bottom-modifier-lookup/research.md +58 -0
- package/specs/027-fix-bottom-modifier-lookup/spec.md +105 -0
- package/specs/027-fix-bottom-modifier-lookup/tasks.md +167 -0
- package/specs/028-unsaved-changes-indicator/checklists/requirements.md +39 -0
- package/specs/028-unsaved-changes-indicator/contracts/score-change-contract.md +44 -0
- package/specs/028-unsaved-changes-indicator/data-model.md +64 -0
- package/specs/028-unsaved-changes-indicator/plan.md +96 -0
- package/specs/028-unsaved-changes-indicator/quickstart.md +54 -0
- package/specs/028-unsaved-changes-indicator/research.md +68 -0
- package/specs/028-unsaved-changes-indicator/spec.md +135 -0
- package/specs/028-unsaved-changes-indicator/tasks.md +173 -0
- package/specs/029-remove-promise-helpers/checklists/requirements.md +39 -0
- package/specs/029-remove-promise-helpers/contracts/public-api-contract.md +32 -0
- package/specs/029-remove-promise-helpers/data-model.md +45 -0
- package/specs/029-remove-promise-helpers/plan.md +86 -0
- package/specs/029-remove-promise-helpers/quickstart.md +53 -0
- package/specs/029-remove-promise-helpers/research.md +71 -0
- package/specs/029-remove-promise-helpers/spec.md +107 -0
- package/specs/029-remove-promise-helpers/tasks.md +164 -0
- package/specs/030-copy-paste-voices/checklists/requirements.md +39 -0
- package/specs/030-copy-paste-voices/contracts/voice-copy-paste-contract.md +47 -0
- package/specs/030-copy-paste-voices/data-model.md +63 -0
- package/specs/030-copy-paste-voices/plan.md +80 -0
- package/specs/030-copy-paste-voices/quickstart.md +50 -0
- package/specs/030-copy-paste-voices/research.md +80 -0
- package/specs/030-copy-paste-voices/spec.md +124 -0
- package/specs/030-copy-paste-voices/tasks.md +183 -0
- package/specs/031-select-voice/checklists/requirements.md +39 -0
- package/specs/031-select-voice/contracts/select-voice-contract.md +43 -0
- package/specs/031-select-voice/data-model.md +47 -0
- package/specs/031-select-voice/plan.md +79 -0
- package/specs/031-select-voice/quickstart.md +43 -0
- package/specs/031-select-voice/research.md +55 -0
- package/specs/031-select-voice/spec.md +113 -0
- package/specs/031-select-voice/tasks.md +171 -0
- package/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/src/application/application.ts +475 -459
- package/src/application/exports.ts +401 -395
- package/src/application/generateVexTests.ts +2 -2
- package/src/common/promiseHelpers.ts +2 -2
- package/src/render/audio/samples.ts +117 -118
- 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/pageDivisions.ts +58 -0
- package/src/render/sui/renderState.ts +469 -464
- package/src/render/sui/scoreChangeState.ts +67 -0
- package/src/render/sui/scoreView.ts +77 -2
- package/src/render/sui/scoreViewOperations.ts +363 -37
- package/src/render/sui/staffLineGeometry.ts +82 -0
- package/src/render/sui/svgPageMap.ts +16 -17
- package/src/render/sui/textEdit.ts +310 -311
- package/src/render/sui/tracker.ts +40 -0
- package/src/render/vex/vxMeasure.ts +22 -8
- package/src/render/vex/vxNote.ts +5 -5
- 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 +167 -2
- 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 +511 -51
- package/src/smo/xform/measureFill.ts +89 -0
- package/src/smo/xform/operations.ts +403 -61
- package/src/smo/xform/selections.ts +75 -0
- package/src/smo/xform/undo.ts +9 -0
- package/src/styles/menus.css +26 -0
- package/src/ui/buttons/ribbon.ts +3 -1
- package/src/ui/components/buttons/sidebar.vue +15 -6
- package/src/ui/components/dialogs/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/library.vue +3 -1
- 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 +5 -0
- package/src/ui/components/dialogs/unsavedChanges.vue +44 -0
- package/src/ui/components/dialogs/volta.vue +3 -3
- package/src/ui/dialogs/adapter.ts +181 -183
- package/src/ui/dialogs/addMeasure.ts +97 -97
- package/src/ui/dialogs/annotationVue.ts +56 -56
- package/src/ui/dialogs/audioSettings.ts +121 -123
- package/src/ui/dialogs/beamGroupsVue.ts +69 -0
- package/src/ui/dialogs/chordChangeVue.ts +46 -46
- package/src/ui/dialogs/clefChange.ts +53 -53
- package/src/ui/dialogs/createPartHelpers.ts +68 -0
- package/src/ui/dialogs/customTuplets.ts +95 -96
- package/src/ui/dialogs/customTupletsVue.ts +47 -47
- package/src/ui/dialogs/deleteSpecial.ts +57 -0
- package/src/ui/dialogs/dialog.ts +627 -620
- package/src/ui/dialogs/durations.ts +34 -34
- package/src/ui/dialogs/dynamicsVue.ts +87 -60
- package/src/ui/dialogs/factory.ts +196 -198
- package/src/ui/dialogs/fileDialogs.ts +286 -179
- package/src/ui/dialogs/fonts.ts +93 -93
- package/src/ui/dialogs/globalLayout.ts +40 -40
- package/src/ui/dialogs/gracenote.ts +31 -31
- package/src/ui/dialogs/hairpin.ts +108 -110
- package/src/ui/dialogs/hairpinVue.ts +51 -51
- package/src/ui/dialogs/instrument.ts +119 -112
- package/src/ui/dialogs/keySignature.ts +175 -176
- package/src/ui/dialogs/keySignatureVue.ts +47 -47
- package/src/ui/dialogs/library.ts +207 -207
- package/src/ui/dialogs/libraryVue.ts +62 -48
- package/src/ui/dialogs/lyricVue.ts +46 -46
- package/src/ui/dialogs/measureFormat.ts +78 -78
- package/src/ui/dialogs/microtones.ts +147 -147
- package/src/ui/dialogs/noteHead.ts +319 -319
- package/src/ui/dialogs/pageLayout.ts +61 -61
- package/src/ui/dialogs/partInfo.ts +60 -60
- package/src/ui/dialogs/pasteSpecial.ts +59 -0
- package/src/ui/dialogs/pedalMarking.ts +117 -117
- package/src/ui/dialogs/pedalMarkingVue.ts +73 -73
- package/src/ui/dialogs/pitch.ts +352 -352
- package/src/ui/dialogs/preferences.ts +1 -0
- package/src/ui/dialogs/recovery.ts +49 -0
- package/src/ui/dialogs/rehearsalMark.ts +64 -64
- package/src/ui/dialogs/rehearsalMarkVue.ts +57 -57
- package/src/ui/dialogs/scoreId.ts +35 -36
- package/src/ui/dialogs/scoreView.ts +42 -42
- package/src/ui/dialogs/slur.ts +308 -310
- package/src/ui/dialogs/slurVue.ts +91 -91
- package/src/ui/dialogs/staffGroup.ts +112 -112
- package/src/ui/dialogs/tabNote.ts +84 -84
- package/src/ui/dialogs/tabStave.ts +182 -182
- package/src/ui/dialogs/tempo.ts +261 -263
- package/src/ui/dialogs/tempoVue.ts +73 -73
- package/src/ui/dialogs/textBlockVue.ts +127 -127
- package/src/ui/dialogs/textBracket.ts +114 -116
- package/src/ui/dialogs/textBracketVue.ts +56 -56
- package/src/ui/dialogs/tie.ts +140 -142
- package/src/ui/dialogs/timeSignature.ts +65 -66
- package/src/ui/dialogs/transposeScore.ts +39 -39
- package/src/ui/dialogs/unsavedChanges.ts +43 -0
- package/src/ui/dialogs/volta.ts +120 -122
- package/src/ui/dialogs/voltaVue.ts +51 -51
- package/src/ui/fileio/fileInput.ts +12 -3
- package/src/ui/fileio/library.ts +110 -111
- 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 +143 -6
- package/src/ui/menus/file.ts +40 -4
- 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/pageDivisions.ts +156 -0
- package/tests/pasteIntoMeasure.ts +103 -0
- package/tests/pasteSpecial.ts +541 -0
- package/tests/promiseHelpersUsage.ts +142 -0
- package/tests/quickBeam.ts +126 -0
- package/tests/scoreArchive.ts +218 -0
- package/tests/scoreChangeState.ts +104 -0
- package/tests/selectVoice.ts +189 -0
- package/tests/staffLineGeometry.ts +179 -0
- package/tests/timeSignatureDisplay.ts +58 -0
- package/tests/voiceCopyPaste.ts +417 -0
- package/tools/smoosic-schema.json +37 -0
- package/typedoc.ts +1 -1
- package/types/src/application/exports.d.ts +453 -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 +759 -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 +476 -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 +245 -129
- package/types/src/smo/xform/selections.d.ts +154 -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 +147 -147
- package/src/ui/dialogs/dynamics.ts +0 -143
- package/types/src/ui/dialogs/dynamics.d.ts +0 -37
|
@@ -1,185 +1,149 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import {
|
|
3
|
-
import { IsClef } from '../../../smo/data/common';
|
|
4
|
-
import { SmoInstrument, SmoInstrumentNumParamType, SmoInstrumentStringParamType } from '../../../smo/data/staffModifiers';
|
|
5
|
-
import selectComp from './select.vue';
|
|
6
|
-
import dialogContainer from './dialogContainer.vue';
|
|
7
|
-
import numberInputApp from './numberInput.vue';
|
|
8
|
-
import toggle from './toggle.vue';
|
|
9
|
-
import { computed, ref, Ref, reactive, watch } from 'vue';
|
|
10
|
-
interface Props {
|
|
11
|
-
domId: string,
|
|
12
|
-
label: string,
|
|
13
|
-
staffLength: number,
|
|
14
|
-
getInstrument: () => SmoInstrument,
|
|
15
|
-
addStaveCb: () => Promise<void>,
|
|
16
|
-
setStaffId: (staffId: number) => void,
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
value: '
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
value
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
<
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
<div class="
|
|
143
|
-
<div class="
|
|
144
|
-
<
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
<selectComp :domId="getId('instrument-select')" :label="'Sound'" :selections="instrumentChoices"
|
|
150
|
-
:initialValue="instrument.instrument" :changeCb="updateInstrumentCb" />
|
|
151
|
-
</div>
|
|
152
|
-
</div>
|
|
153
|
-
<div class="row mb-2 ms-2 align-items-center">
|
|
154
|
-
<div class="col col-12 mb-2">
|
|
155
|
-
<selectComp :domId="getId('clef-select')" :label="'Clef'" :selections="clefOptions"
|
|
156
|
-
:initialValue="instrument.clef" :changeCb="updateClefCb" />
|
|
157
|
-
</div>
|
|
158
|
-
</div>
|
|
159
|
-
<div class="row mb-2" :class="{ hide: !showPercussionSymbols }">
|
|
160
|
-
<div class="col col-12">
|
|
161
|
-
<toggle :domId="getId('font-weight')" :label="'Use Percussion Symbols'" :initialValue="usePercussionSymbols"
|
|
162
|
-
:changeCb="(value: boolean) => { usePercussionSymbols = value }" />
|
|
163
|
-
</div>
|
|
164
|
-
</div>
|
|
165
|
-
<div class="group">
|
|
166
|
-
<numberInputApp :domId="getId('staffId')" :initialValue="props.staffLength - 1" :precision="0"
|
|
167
|
-
:maxValue="props.staffLength" :minValue="1" label="Staff Location"
|
|
168
|
-
:changeCb="updateInsertLocation"></numberInputApp>
|
|
169
|
-
</div>
|
|
170
|
-
<div class="group">
|
|
171
|
-
<numberInputApp :domId="getId('stafflines')" :initialValue="instrument.lines" :precision="0"
|
|
172
|
-
:changeCb="updateNumberCb('lines')" label="Staff Lines"></numberInputApp>
|
|
173
|
-
</div>
|
|
174
|
-
<div class="group">
|
|
175
|
-
<numberInputApp :domId="getId('keyOffset')" :initialValue="instrument.keyOffset" :precision="0"
|
|
176
|
-
:changeCb="updateNumberCb('keyOffset')" label="Transpose 1/2 Steps"></numberInputApp>
|
|
177
|
-
</div>
|
|
178
|
-
<div class="row mb-2 mt-2">
|
|
179
|
-
<div class="col col-4">
|
|
180
|
-
<toggle :domId="getId('toggleStems')" :label="'2-Stave part'" :initialValue="addStave"
|
|
181
|
-
:changeCb="(value: boolean) => { addStave = value; addStaveCb(); }" />
|
|
182
|
-
</div>
|
|
183
|
-
</div>
|
|
184
|
-
</dialogContainer>
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { instrumentChoices, instrumentLabelFor } from '../../dialogs/createPartHelpers';
|
|
3
|
+
import { IsClef } from '../../../smo/data/common';
|
|
4
|
+
import { SmoInstrument, SmoInstrumentNumParamType, SmoInstrumentStringParamType } from '../../../smo/data/staffModifiers';
|
|
5
|
+
import selectComp from './select.vue';
|
|
6
|
+
import dialogContainer from './dialogContainer.vue';
|
|
7
|
+
import numberInputApp from './numberInput.vue';
|
|
8
|
+
import toggle from './toggle.vue';
|
|
9
|
+
import { computed, ref, Ref, reactive, watch } from 'vue';
|
|
10
|
+
interface Props {
|
|
11
|
+
domId: string,
|
|
12
|
+
label: string,
|
|
13
|
+
staffLength: number,
|
|
14
|
+
getInstrument: () => SmoInstrument,
|
|
15
|
+
addStaveCb: () => Promise<void>,
|
|
16
|
+
setStaffId: (staffId: number) => void,
|
|
17
|
+
setName: (value: string) => void,
|
|
18
|
+
setAbbreviation: (value: string) => void,
|
|
19
|
+
commitCb: () => Promise<void>,
|
|
20
|
+
cancelCb: () => Promise<void>
|
|
21
|
+
};
|
|
22
|
+
const props = defineProps<Props>();
|
|
23
|
+
|
|
24
|
+
const { domId, getInstrument } = { ...props };
|
|
25
|
+
|
|
26
|
+
const updateInsertLocation = async (loc: number) => {
|
|
27
|
+
props.setStaffId(loc);
|
|
28
|
+
}
|
|
29
|
+
const clefOptions = [{
|
|
30
|
+
value: 'treble',
|
|
31
|
+
label: 'Treble'
|
|
32
|
+
}, {
|
|
33
|
+
value: 'bass',
|
|
34
|
+
label: 'Bass'
|
|
35
|
+
}, {
|
|
36
|
+
value: 'tenor',
|
|
37
|
+
label: 'Tenor'
|
|
38
|
+
}, {
|
|
39
|
+
value: 'alto',
|
|
40
|
+
label: 'Alto'
|
|
41
|
+
}, {
|
|
42
|
+
label: 'Percussion',
|
|
43
|
+
value: 'percussion'
|
|
44
|
+
}]
|
|
45
|
+
const instrument: SmoInstrument = getInstrument();
|
|
46
|
+
type numberParams = 'lines' | 'keyOffset';
|
|
47
|
+
const updateNumberCb = (param: numberParams) => {
|
|
48
|
+
const cb = async (value: number) => {
|
|
49
|
+
(instrument as any)[param] = value;
|
|
50
|
+
}
|
|
51
|
+
return cb;
|
|
52
|
+
}
|
|
53
|
+
const addStave: Ref<boolean> = ref(false);
|
|
54
|
+
const usePercussionSymbols = ref(instrument.usePercussionNoteheads ?? false);
|
|
55
|
+
watch(usePercussionSymbols, (newVal) => {
|
|
56
|
+
instrument.usePercussionNoteheads = newVal;
|
|
57
|
+
});
|
|
58
|
+
// The instrument is not reactive, so keep the chosen one here for the Name placeholder.
|
|
59
|
+
const currentInstrument: Ref<string> = ref(instrument.instrument);
|
|
60
|
+
const namePlaceholder = computed(() => instrumentLabelFor(currentInstrument.value));
|
|
61
|
+
const partName: Ref<string> = ref('');
|
|
62
|
+
const partAbbreviation: Ref<string> = ref('');
|
|
63
|
+
watch(partName, (newVal) => {
|
|
64
|
+
props.setName(newVal);
|
|
65
|
+
});
|
|
66
|
+
watch(partAbbreviation, (newVal) => {
|
|
67
|
+
props.setAbbreviation(newVal);
|
|
68
|
+
});
|
|
69
|
+
const updateInstrumentCb = async (value: string) => {
|
|
70
|
+
instrument.instrument = value;
|
|
71
|
+
currentInstrument.value = value;
|
|
72
|
+
if (typeof (SmoInstrument.instrumentKeyOffset[value]) === 'number') {
|
|
73
|
+
instrument.keyOffset = SmoInstrument.instrumentKeyOffset[value];
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
const showPercussionSymbols = computed(() => {
|
|
77
|
+
return instrument.instrument === 'percussion';
|
|
78
|
+
});
|
|
79
|
+
const updateClefCb = async (value: string) => {
|
|
80
|
+
if (IsClef(value)) {
|
|
81
|
+
instrument.clef = value;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
const getId = (str: string) => {
|
|
85
|
+
return `${domId}-${str}`;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
</script>
|
|
89
|
+
<template>
|
|
90
|
+
<dialogContainer :domId="domId" :label="label" :commitCb="props.commitCb" :cancelCb="props.cancelCb">
|
|
91
|
+
<div class="row mb-2">
|
|
92
|
+
<div class="col col-12 fs-5 text-center">
|
|
93
|
+
<div class="text-center">Initial Instrument </div>
|
|
94
|
+
<div class="text-center fs-6">(can be changed later)</div>
|
|
95
|
+
</div>
|
|
96
|
+
</div>
|
|
97
|
+
<div class="row mb-2 ms-2 align-items-center">
|
|
98
|
+
<div class="col col-12 mb-2">
|
|
99
|
+
<selectComp :domId="getId('instrument-select')" :label="'Sound'" :selections="instrumentChoices"
|
|
100
|
+
:initialValue="instrument.instrument" :changeCb="updateInstrumentCb" />
|
|
101
|
+
</div>
|
|
102
|
+
</div>
|
|
103
|
+
<div class="row mb-2 ms-2 align-items-center">
|
|
104
|
+
<div class="col col-12 mb-2">
|
|
105
|
+
<selectComp :domId="getId('clef-select')" :label="'Clef'" :selections="clefOptions"
|
|
106
|
+
:initialValue="instrument.clef" :changeCb="updateClefCb" />
|
|
107
|
+
</div>
|
|
108
|
+
</div>
|
|
109
|
+
<div class="row mb-2" :class="{ hide: !showPercussionSymbols }">
|
|
110
|
+
<div class="col col-12">
|
|
111
|
+
<toggle :domId="getId('font-weight')" :label="'Use Percussion Symbols'" :initialValue="usePercussionSymbols"
|
|
112
|
+
:changeCb="(value: boolean) => { usePercussionSymbols = value }" />
|
|
113
|
+
</div>
|
|
114
|
+
</div>
|
|
115
|
+
<div class="row mb-2 ms-2 align-items-center">
|
|
116
|
+
<div class="col col-3 text-start"><label :for="getId('part-name')">Name</label></div>
|
|
117
|
+
<div class="col col-9">
|
|
118
|
+
<input type="text" class="form-control" :id="getId('part-name')" v-model="partName"
|
|
119
|
+
:placeholder="namePlaceholder" />
|
|
120
|
+
</div>
|
|
121
|
+
</div>
|
|
122
|
+
<div class="row mb-2 ms-2 align-items-center">
|
|
123
|
+
<div class="col col-3 text-start"><label :for="getId('part-abbreviation')">Abbreviation</label></div>
|
|
124
|
+
<div class="col col-9">
|
|
125
|
+
<input type="text" class="form-control" :id="getId('part-abbreviation')" v-model="partAbbreviation" />
|
|
126
|
+
</div>
|
|
127
|
+
</div>
|
|
128
|
+
<!-- counted from 1; one more than the number of staves is after the last staff -->
|
|
129
|
+
<div class="group">
|
|
130
|
+
<numberInputApp :domId="getId('staffId')" :initialValue="props.staffLength + 1" :precision="0"
|
|
131
|
+
:maxValue="props.staffLength + 1" :minValue="1" label="Staff Location"
|
|
132
|
+
:changeCb="updateInsertLocation"></numberInputApp>
|
|
133
|
+
</div>
|
|
134
|
+
<div class="group">
|
|
135
|
+
<numberInputApp :domId="getId('stafflines')" :initialValue="instrument.lines" :precision="0"
|
|
136
|
+
:changeCb="updateNumberCb('lines')" label="Staff Lines"></numberInputApp>
|
|
137
|
+
</div>
|
|
138
|
+
<div class="group">
|
|
139
|
+
<numberInputApp :domId="getId('keyOffset')" :initialValue="instrument.keyOffset" :precision="0"
|
|
140
|
+
:changeCb="updateNumberCb('keyOffset')" label="Transpose 1/2 Steps"></numberInputApp>
|
|
141
|
+
</div>
|
|
142
|
+
<div class="row mb-2 mt-2">
|
|
143
|
+
<div class="col col-4">
|
|
144
|
+
<toggle :domId="getId('toggleStems')" :label="'2-Stave part'" :initialValue="addStave"
|
|
145
|
+
:changeCb="(value: boolean) => { addStave = value; addStaveCb(); }" />
|
|
146
|
+
</div>
|
|
147
|
+
</div>
|
|
148
|
+
</dialogContainer>
|
|
185
149
|
</template>
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import dialogContainer from './dialogContainer.vue';
|
|
3
|
+
import toggle from './toggle.vue';
|
|
4
|
+
import { computed, Ref } from 'vue';
|
|
5
|
+
interface PasteKindRow {
|
|
6
|
+
id: string,
|
|
7
|
+
label: string
|
|
8
|
+
};
|
|
9
|
+
interface Props {
|
|
10
|
+
domId: string,
|
|
11
|
+
label: string,
|
|
12
|
+
// the kinds of marking that can be pasted
|
|
13
|
+
kinds: PasteKindRow[],
|
|
14
|
+
// which kinds are turned on, by id. A reactive object owned by the dialog.
|
|
15
|
+
selected: Record<string, boolean>,
|
|
16
|
+
getReplace: () => Ref<boolean>,
|
|
17
|
+
commitCb: () => Promise<void>,
|
|
18
|
+
cancelCb: () => Promise<void>
|
|
19
|
+
};
|
|
20
|
+
const props = defineProps<Props>();
|
|
21
|
+
|
|
22
|
+
const { domId, selected } = { ...props };
|
|
23
|
+
const replace: Ref<boolean> = props.getReplace();
|
|
24
|
+
const setReplace = (value: boolean) => {
|
|
25
|
+
replace.value = value;
|
|
26
|
+
}
|
|
27
|
+
// Paste is only allowed once something has been chosen
|
|
28
|
+
const canPaste = computed(() => props.kinds.some((kind) => selected[kind.id] === true));
|
|
29
|
+
const getId = (str: string) => {
|
|
30
|
+
return `${domId}-${str}`;
|
|
31
|
+
}
|
|
32
|
+
</script>
|
|
33
|
+
<template>
|
|
34
|
+
<dialogContainer :domId="domId" :label="label" :commitCb="props.commitCb" :cancelCb="props.cancelCb"
|
|
35
|
+
:enable="canPaste">
|
|
36
|
+
<div class="row mb-2" v-for="kind in kinds" :key="kind.id">
|
|
37
|
+
<div class="col col-8 pe-0 me-n2">
|
|
38
|
+
<toggle :domId="getId(kind.id + '-toggle')" :label="kind.label" :initialValue="false"
|
|
39
|
+
:changeCb="(value: boolean) => { selected[kind.id] = value }" />
|
|
40
|
+
</div>
|
|
41
|
+
</div>
|
|
42
|
+
<div class="row mb-2">
|
|
43
|
+
<div class="col col-10 pe-0 me-n2">
|
|
44
|
+
<toggle :domId="getId('replace-toggle')" :label="'Replace existing (off adds to them)'" :initialValue="true"
|
|
45
|
+
:changeCb="setReplace" />
|
|
46
|
+
</div>
|
|
47
|
+
</div>
|
|
48
|
+
</dialogContainer>
|
|
49
|
+
</template>
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { ref, Ref, computed } from 'vue';
|
|
3
|
+
import dialogContainer from './dialogContainer.vue';
|
|
4
|
+
|
|
5
|
+
interface RecoveryRow {
|
|
6
|
+
id: number,
|
|
7
|
+
time: number,
|
|
8
|
+
title: string,
|
|
9
|
+
available: boolean
|
|
10
|
+
}
|
|
11
|
+
interface Props {
|
|
12
|
+
domId: string,
|
|
13
|
+
label: string,
|
|
14
|
+
/** newest first */
|
|
15
|
+
entries: RecoveryRow[],
|
|
16
|
+
storageAvailable: boolean,
|
|
17
|
+
/** called with the id of the chosen snapshot when the user presses OK */
|
|
18
|
+
selectedCb: (id: number) => void,
|
|
19
|
+
commitCb: () => Promise<void>,
|
|
20
|
+
cancelCb: () => Promise<void>
|
|
21
|
+
}
|
|
22
|
+
const props = defineProps<Props>();
|
|
23
|
+
const selectedId: Ref<number | null> = ref(null);
|
|
24
|
+
const canRecover = computed<boolean>(() => selectedId.value !== null);
|
|
25
|
+
const getId = (str: string) => {
|
|
26
|
+
return `${props.domId}-${str}`;
|
|
27
|
+
}
|
|
28
|
+
const rowTitle = (row: RecoveryRow): string => {
|
|
29
|
+
const title = (row.title ?? '').trim();
|
|
30
|
+
return title.length > 0 ? title : 'Untitled';
|
|
31
|
+
}
|
|
32
|
+
const rowTime = (row: RecoveryRow): string => {
|
|
33
|
+
return new Date(row.time).toLocaleString();
|
|
34
|
+
}
|
|
35
|
+
const choose = (row: RecoveryRow) => {
|
|
36
|
+
if (row.available) {
|
|
37
|
+
selectedId.value = row.id;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
const handleCommit = async () => {
|
|
41
|
+
if (selectedId.value !== null) {
|
|
42
|
+
props.selectedCb(selectedId.value);
|
|
43
|
+
}
|
|
44
|
+
await props.commitCb();
|
|
45
|
+
}
|
|
46
|
+
</script>
|
|
47
|
+
<template>
|
|
48
|
+
<dialogContainer :domId="domId" :label="label" :commitCb="handleCommit" :cancelCb="cancelCb" :enable="canRecover">
|
|
49
|
+
<div class="row mb-2" v-if="entries.length === 0" :id="getId('empty')">
|
|
50
|
+
<div class="col text-start">
|
|
51
|
+
<p>No autosaved scores are available.</p>
|
|
52
|
+
<p v-if="!storageAvailable">Browser storage is not available.</p>
|
|
53
|
+
</div>
|
|
54
|
+
</div>
|
|
55
|
+
<div class="list-group text-start mb-2" v-else :id="getId('list')">
|
|
56
|
+
<button v-for="row in entries" :key="row.id" type="button"
|
|
57
|
+
class="list-group-item list-group-item-action"
|
|
58
|
+
:class="{ active: row.id === selectedId, disabled: !row.available }"
|
|
59
|
+
:disabled="!row.available" :id="getId('entry-' + row.id)" @click.prevent="choose(row)">
|
|
60
|
+
<span class="fw-bold">{{ rowTitle(row) }}</span>
|
|
61
|
+
<span class="ms-2">{{ rowTime(row) }}</span>
|
|
62
|
+
<span class="ms-2" v-if="!row.available">(unavailable)</span>
|
|
63
|
+
</button>
|
|
64
|
+
</div>
|
|
65
|
+
</dialogContainer>
|
|
66
|
+
</template>
|
|
@@ -4,12 +4,12 @@ import dialogContainer from './dialogContainer.vue';
|
|
|
4
4
|
|
|
5
5
|
interface Props {
|
|
6
6
|
domId: string,
|
|
7
|
-
contents: Ref<string>,
|
|
7
|
+
contents: Ref<string | Uint8Array>,
|
|
8
8
|
suggestedName: string,
|
|
9
9
|
extension: Ref<string>,
|
|
10
10
|
commitCb: () => Promise<void>,
|
|
11
11
|
cancelCb: () => Promise<void>,
|
|
12
|
-
changeExtensionCb: (value: string) => void
|
|
12
|
+
changeExtensionCb: (value: string) => void | Promise<void>
|
|
13
13
|
}
|
|
14
14
|
const props = defineProps < Props > ();
|
|
15
15
|
const { domId, commitCb, contents, cancelCb, extension, suggestedName } = { ...props };
|
|
@@ -20,7 +20,7 @@ const getId = (str: string) => {
|
|
|
20
20
|
}
|
|
21
21
|
const selectedExtension = ref(extension.value);
|
|
22
22
|
const extensions = [
|
|
23
|
-
{ text: 'Smoosic', value: '.
|
|
23
|
+
{ text: 'Smoosic (compressed)', value: '.smz' },
|
|
24
24
|
{ text: 'MusicXML', value: '.xml' },
|
|
25
25
|
{ text: 'midi', value: '.mid' },
|
|
26
26
|
{ text: 'vex', value: '.js' },
|
|
@@ -32,7 +32,14 @@ if (!filename.value.endsWith(extension.value)) {
|
|
|
32
32
|
}
|
|
33
33
|
const mimeType = 'application/octet-stream'
|
|
34
34
|
const saveLink = useTemplateRef('saveLink');
|
|
35
|
+
// The contents of some formats are computed asynchronously. Remember the latest request so saving
|
|
36
|
+
// never uses the contents of a format that was just replaced.
|
|
37
|
+
let pendingContents: Promise<void> | void = undefined;
|
|
38
|
+
const formatChanged = () => {
|
|
39
|
+
pendingContents = props.changeExtensionCb(selectedExtension.value);
|
|
40
|
+
};
|
|
35
41
|
const saveFileCb = async () => {
|
|
42
|
+
await pendingContents;
|
|
36
43
|
if (!filename.value.endsWith(extension.value)) {
|
|
37
44
|
filename.value = filename.value + extension.value;
|
|
38
45
|
}
|
|
@@ -75,7 +82,7 @@ onMounted(() => {
|
|
|
75
82
|
<label class="input-group-text" :for="getId('format-select')">File Format:</label>
|
|
76
83
|
<div class="col-md-6">
|
|
77
84
|
<select :id="getId('format-select')" v-model="selectedExtension"
|
|
78
|
-
@change="
|
|
85
|
+
@change="formatChanged" class="form-control">
|
|
79
86
|
<option v-for="option in extensions" :key="option.value" :value="option.value">
|
|
80
87
|
{{ option.text }}
|
|
81
88
|
</option>
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import { ref, Ref } from 'vue';
|
|
3
|
-
import { SmoScorePreferences } from '../../../smo/data/scoreModifiers';
|
|
3
|
+
import { SmoScorePreferences, autosaveLimits, clampAutosaveInterval, clampAutosaveCount } from '../../../smo/data/scoreModifiers';
|
|
4
4
|
import { SelectOption } from '../../common';
|
|
5
5
|
import selectComp from './select.vue';
|
|
6
6
|
import dialogContainer from './dialogContainer.vue';
|
|
7
7
|
import toggle from './toggle.vue';
|
|
8
|
+
import numberInput from './numberInput.vue';
|
|
8
9
|
|
|
9
10
|
interface Props {
|
|
10
11
|
domId: string,
|
|
@@ -27,6 +28,12 @@ const defaultTripleDurations: SelectOption[] = [
|
|
|
27
28
|
{ label: '1/8', value: '2048' }
|
|
28
29
|
];
|
|
29
30
|
|
|
31
|
+
const updateAutosaveInterval = async (value: number) => {
|
|
32
|
+
preferences.autosaveInterval = clampAutosaveInterval(value);
|
|
33
|
+
}
|
|
34
|
+
const updateAutosaveCount = async (value: number) => {
|
|
35
|
+
preferences.autosaveCount = clampAutosaveCount(value);
|
|
36
|
+
}
|
|
30
37
|
const getDomId = () => {
|
|
31
38
|
return `attr-modal-dialog-${domId}`;
|
|
32
39
|
}
|
|
@@ -91,5 +98,20 @@ const updateNumber = (type: numberTypes) => {
|
|
|
91
98
|
:changeCb="updateNumber('defaultTripleDuration')" />
|
|
92
99
|
</div>
|
|
93
100
|
</div>
|
|
101
|
+
<div class="row mt-3">
|
|
102
|
+
<div class="col text-start fw-bold">Autosave</div>
|
|
103
|
+
</div>
|
|
104
|
+
<div class="row align-items-baseline" :id="getId('autosave-row')">
|
|
105
|
+
<div class="col col-6 text-start">
|
|
106
|
+
<numberInput :domId="getId('autosave-interval')" label="Minutes between autosaves" :precision="0"
|
|
107
|
+
:minValue="autosaveLimits.minInterval" :maxValue="autosaveLimits.maxInterval"
|
|
108
|
+
:initialValue="preferences.autosaveInterval" :changeCb="updateAutosaveInterval" />
|
|
109
|
+
</div>
|
|
110
|
+
<div class="col col-6 text-start">
|
|
111
|
+
<numberInput :domId="getId('autosave-count')" label="Autosaves to keep" :precision="0"
|
|
112
|
+
:minValue="autosaveLimits.minCount" :maxValue="autosaveLimits.maxCount"
|
|
113
|
+
:initialValue="preferences.autosaveCount" :changeCb="updateAutosaveCount" />
|
|
114
|
+
</div>
|
|
115
|
+
</div>
|
|
94
116
|
</dialogContainer>
|
|
95
117
|
</template>
|
|
@@ -62,9 +62,9 @@ const orientationOptions: SelectOption[] = [
|
|
|
62
62
|
</div>
|
|
63
63
|
<div class="group">
|
|
64
64
|
<div class="grow-row">
|
|
65
|
-
<numberInputApp :domId="getId('x-offset')" :initialValue="xOffset" :precision="0" label="X Offset"
|
|
65
|
+
<numberInputApp :domId="getId('x-offset')" :initialValue="xOffset" :precision="0" :minValue="-1000" :maxValue="1000" label="X Offset"
|
|
66
66
|
:changeCb="(value: number) => updateNumberCb('xOffset', value)" :inline="true" />
|
|
67
|
-
<numberInputApp :domId="getId('y-offset')" :initialValue="yOffset" :precision="0" label="Y Offset"
|
|
67
|
+
<numberInputApp :domId="getId('y-offset')" :initialValue="yOffset" :precision="0" :minValue="-1000" :maxValue="1000" label="Y Offset"
|
|
68
68
|
:changeCb="(value: number) => updateNumberCb('yOffset', value)" :inline="true" />
|
|
69
69
|
</div>
|
|
70
70
|
</div>
|
|
@@ -96,17 +96,17 @@ const orientationOptions: SelectOption[] = [
|
|
|
96
96
|
</div>
|
|
97
97
|
<div class="group">
|
|
98
98
|
<div class="grow-row">
|
|
99
|
-
<numberInputApp :domId="getId('cp1x')" :initialValue="cp1x" :precision="0" label="Control Point 1 X"
|
|
99
|
+
<numberInputApp :domId="getId('cp1x')" :initialValue="cp1x" :precision="0" :minValue="-1000" :maxValue="1000" label="Control Point 1 X"
|
|
100
100
|
:changeCb="(value: number) => updateNumberCb('cp1x', value)" :inline="true" />
|
|
101
|
-
<numberInputApp :domId="getId('cp1y')" :initialValue="cp1y" :precision="0" label="Control Point 1 Y"
|
|
101
|
+
<numberInputApp :domId="getId('cp1y')" :initialValue="cp1y" :precision="0" :minValue="-1000" :maxValue="1000" label="Control Point 1 Y"
|
|
102
102
|
:changeCb="(value: number) => updateNumberCb('cp1y', value)" :inline="true" />
|
|
103
103
|
</div>
|
|
104
104
|
</div>
|
|
105
105
|
<div class="group">
|
|
106
106
|
<div class="grow-row">
|
|
107
|
-
<numberInputApp :domId="getId('cp2x')" :initialValue="cp2x" :precision="0" label="Control Point 2 X"
|
|
107
|
+
<numberInputApp :domId="getId('cp2x')" :initialValue="cp2x" :precision="0" :minValue="-1000" :maxValue="1000" label="Control Point 2 X"
|
|
108
108
|
:changeCb="(value: number) => updateNumberCb('cp2x', value)" :inline="true" />
|
|
109
|
-
<numberInputApp :domId="getId('cp2y')" :initialValue="cp2y" :precision="0" label="Control Point 2 Y"
|
|
109
|
+
<numberInputApp :domId="getId('cp2y')" :initialValue="cp2y" :precision="0" :minValue="-1000" :maxValue="1000" label="Control Point 2 Y"
|
|
110
110
|
:changeCb="(value: number) => updateNumberCb('cp2y', value)" :inline="true" />
|
|
111
111
|
</div>
|
|
112
112
|
</div>
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
+
import { ref, Ref } from 'vue';
|
|
2
3
|
import numberInputApp from './numberInput.vue';
|
|
3
4
|
import selectComp from './select.vue';
|
|
4
5
|
import toggle from './toggle.vue';
|
|
@@ -30,6 +31,13 @@ const { domId, label, commitCb, cancelCb } = { ...props };
|
|
|
30
31
|
const getId = (str: string) => {
|
|
31
32
|
return `${domId}-${str}`;
|
|
32
33
|
}
|
|
34
|
+
// The dialog is mounted with the values as they were when it opened, and the props don't change
|
|
35
|
+
// as the user edits. Keep the mode locally so the custom text field appears as soon as it is chosen.
|
|
36
|
+
const currentMode: Ref<string> = ref(props.tempoMode);
|
|
37
|
+
const changeMode = (value: string) => {
|
|
38
|
+
currentMode.value = value;
|
|
39
|
+
props.updateSelectCb('tempoMode', value);
|
|
40
|
+
}
|
|
33
41
|
const tempoModeOptions: SelectOption[] = [
|
|
34
42
|
{ value: 'duration', label: 'Duration (Beats/Minute)' },
|
|
35
43
|
{ value: 'text', label: 'Tempo Text' },
|
|
@@ -66,10 +74,10 @@ const tempoTextOptions: SelectOption[] = [
|
|
|
66
74
|
<div class="row mb-2">
|
|
67
75
|
<div class="col col-12">
|
|
68
76
|
<selectComp :domId="getId('tempo-mode')" :label="'Tempo Mode'" :selections="tempoModeOptions"
|
|
69
|
-
:initialValue="
|
|
77
|
+
:initialValue="currentMode" :changeCb="changeMode" />
|
|
70
78
|
</div>
|
|
71
79
|
</div>
|
|
72
|
-
<div v-if="
|
|
80
|
+
<div v-if="currentMode === 'custom'" class="row mb-2">
|
|
73
81
|
<div class="col col-9">
|
|
74
82
|
<input type="text" class="form-control" :id="getId('custom-text')" :value="customText"
|
|
75
83
|
@change="($event) => updateTextCb(($event.target as HTMLInputElement).value)">
|
|
@@ -112,7 +120,7 @@ const tempoTextOptions: SelectOption[] = [
|
|
|
112
120
|
</div>
|
|
113
121
|
<div class="group">
|
|
114
122
|
<div class="grow-row">
|
|
115
|
-
<numberInputApp :domId="getId('y-offset')" :initialValue="yOffset" :precision="0" label="Y Offset"
|
|
123
|
+
<numberInputApp :domId="getId('y-offset')" :initialValue="yOffset" :precision="0" :minValue="-1000" :maxValue="1000" label="Y Offset"
|
|
116
124
|
:changeCb="(value: number) => updateNumberCb('yOffset', value)" :inline="true" />
|
|
117
125
|
</div>
|
|
118
126
|
</div>
|
|
@@ -78,6 +78,11 @@ watch(displayString, async (newValue: string, oldValue: string) => {
|
|
|
78
78
|
if (newValue === oldValue) {
|
|
79
79
|
return;
|
|
80
80
|
}
|
|
81
|
+
// The string is changed one key at a time. Wait until it is a valid time signature (or empty,
|
|
82
|
+
// to remove it) before updating the score.
|
|
83
|
+
if (newValue.length > 0 && !SmoTimeSignature.isValidDisplayString(newValue)) {
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
81
86
|
const ts = new SmoTimeSignature(timeSignature.value);
|
|
82
87
|
ts.displayString = newValue;
|
|
83
88
|
await props.updateTimeSignatureCb(ts);
|