smoosic 2.0.2 → 2.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/smoosic.js +167 -74
- package/package.json +82 -77
- package/release/smoosic.js +171 -78
- package/release/styles/menus.css +26 -0
- package/specs/022-text-reposition-on-resize/spec.md +1 -0
- package/specs/027-fix-bottom-modifier-lookup/checklists/requirements.md +38 -0
- package/specs/027-fix-bottom-modifier-lookup/contracts/division-lookup-contract.md +51 -0
- package/specs/027-fix-bottom-modifier-lookup/data-model.md +43 -0
- package/specs/027-fix-bottom-modifier-lookup/plan.md +77 -0
- package/specs/027-fix-bottom-modifier-lookup/quickstart.md +36 -0
- package/specs/027-fix-bottom-modifier-lookup/research.md +58 -0
- package/specs/027-fix-bottom-modifier-lookup/spec.md +105 -0
- package/specs/027-fix-bottom-modifier-lookup/tasks.md +167 -0
- package/specs/028-unsaved-changes-indicator/checklists/requirements.md +39 -0
- package/specs/028-unsaved-changes-indicator/contracts/score-change-contract.md +44 -0
- package/specs/028-unsaved-changes-indicator/data-model.md +64 -0
- package/specs/028-unsaved-changes-indicator/plan.md +96 -0
- package/specs/028-unsaved-changes-indicator/quickstart.md +54 -0
- package/specs/028-unsaved-changes-indicator/research.md +68 -0
- package/specs/028-unsaved-changes-indicator/spec.md +135 -0
- package/specs/028-unsaved-changes-indicator/tasks.md +173 -0
- package/specs/029-remove-promise-helpers/checklists/requirements.md +39 -0
- package/specs/029-remove-promise-helpers/contracts/public-api-contract.md +32 -0
- package/specs/029-remove-promise-helpers/data-model.md +45 -0
- package/specs/029-remove-promise-helpers/plan.md +86 -0
- package/specs/029-remove-promise-helpers/quickstart.md +53 -0
- package/specs/029-remove-promise-helpers/research.md +71 -0
- package/specs/029-remove-promise-helpers/spec.md +107 -0
- package/specs/029-remove-promise-helpers/tasks.md +164 -0
- package/specs/030-copy-paste-voices/checklists/requirements.md +39 -0
- package/specs/030-copy-paste-voices/contracts/voice-copy-paste-contract.md +47 -0
- package/specs/030-copy-paste-voices/data-model.md +63 -0
- package/specs/030-copy-paste-voices/plan.md +80 -0
- package/specs/030-copy-paste-voices/quickstart.md +50 -0
- package/specs/030-copy-paste-voices/research.md +80 -0
- package/specs/030-copy-paste-voices/spec.md +124 -0
- package/specs/030-copy-paste-voices/tasks.md +183 -0
- package/specs/031-select-voice/checklists/requirements.md +39 -0
- package/specs/031-select-voice/contracts/select-voice-contract.md +43 -0
- package/specs/031-select-voice/data-model.md +47 -0
- package/specs/031-select-voice/plan.md +79 -0
- package/specs/031-select-voice/quickstart.md +43 -0
- package/specs/031-select-voice/research.md +55 -0
- package/specs/031-select-voice/spec.md +113 -0
- package/specs/031-select-voice/tasks.md +171 -0
- package/src/application/application.ts +464 -459
- package/src/common/promiseHelpers.ts +2 -2
- package/src/render/audio/samples.ts +117 -118
- package/src/render/sui/pageDivisions.ts +58 -0
- package/src/render/sui/renderState.ts +469 -464
- package/src/render/sui/scoreChangeState.ts +62 -0
- package/src/render/sui/scoreView.ts +30 -0
- package/src/render/sui/scoreViewOperations.ts +2555 -2380
- package/src/render/sui/svgPageMap.ts +16 -17
- package/src/render/sui/textEdit.ts +310 -311
- package/src/render/sui/tracker.ts +40 -0
- package/src/render/vex/vxNote.ts +3 -1
- package/src/smo/xform/copypaste.ts +304 -4
- package/src/smo/xform/selections.ts +68 -0
- package/src/smo/xform/undo.ts +9 -0
- package/src/styles/menus.css +26 -0
- package/src/ui/buttons/ribbon.ts +3 -1
- package/src/ui/components/buttons/sidebar.vue +15 -6
- package/src/ui/components/dialogs/library.vue +3 -1
- package/src/ui/components/dialogs/unsavedChanges.vue +44 -0
- package/src/ui/dialogs/adapter.ts +181 -183
- package/src/ui/dialogs/addMeasure.ts +97 -97
- package/src/ui/dialogs/annotationVue.ts +56 -56
- package/src/ui/dialogs/audioSettings.ts +121 -123
- package/src/ui/dialogs/chordChangeVue.ts +46 -46
- package/src/ui/dialogs/clefChange.ts +53 -53
- package/src/ui/dialogs/customTuplets.ts +95 -96
- package/src/ui/dialogs/customTupletsVue.ts +47 -47
- package/src/ui/dialogs/dialog.ts +627 -620
- package/src/ui/dialogs/durations.ts +34 -34
- package/src/ui/dialogs/dynamics.ts +140 -142
- package/src/ui/dialogs/factory.ts +198 -198
- package/src/ui/dialogs/fileDialogs.ts +245 -179
- package/src/ui/dialogs/fonts.ts +93 -93
- package/src/ui/dialogs/globalLayout.ts +40 -40
- package/src/ui/dialogs/gracenote.ts +31 -31
- package/src/ui/dialogs/hairpin.ts +108 -110
- package/src/ui/dialogs/hairpinVue.ts +51 -51
- package/src/ui/dialogs/instrument.ts +111 -111
- package/src/ui/dialogs/keySignature.ts +175 -176
- package/src/ui/dialogs/keySignatureVue.ts +47 -47
- package/src/ui/dialogs/library.ts +207 -207
- package/src/ui/dialogs/libraryVue.ts +62 -48
- package/src/ui/dialogs/lyricVue.ts +46 -46
- package/src/ui/dialogs/measureFormat.ts +78 -78
- package/src/ui/dialogs/microtones.ts +147 -147
- package/src/ui/dialogs/noteHead.ts +319 -319
- package/src/ui/dialogs/pageLayout.ts +61 -61
- package/src/ui/dialogs/partInfo.ts +60 -60
- package/src/ui/dialogs/pedalMarking.ts +117 -117
- package/src/ui/dialogs/pedalMarkingVue.ts +73 -73
- package/src/ui/dialogs/pitch.ts +352 -352
- package/src/ui/dialogs/preferences.ts +40 -40
- package/src/ui/dialogs/rehearsalMark.ts +64 -64
- package/src/ui/dialogs/rehearsalMarkVue.ts +57 -57
- package/src/ui/dialogs/scoreId.ts +35 -36
- package/src/ui/dialogs/scoreView.ts +42 -42
- package/src/ui/dialogs/slur.ts +308 -310
- package/src/ui/dialogs/slurVue.ts +91 -91
- package/src/ui/dialogs/staffGroup.ts +112 -112
- package/src/ui/dialogs/tabNote.ts +84 -84
- package/src/ui/dialogs/tabStave.ts +182 -182
- package/src/ui/dialogs/tempo.ts +261 -263
- package/src/ui/dialogs/tempoVue.ts +73 -73
- package/src/ui/dialogs/textBlockVue.ts +127 -127
- package/src/ui/dialogs/textBracket.ts +114 -116
- package/src/ui/dialogs/textBracketVue.ts +56 -56
- package/src/ui/dialogs/tie.ts +140 -142
- package/src/ui/dialogs/timeSignature.ts +65 -66
- package/src/ui/dialogs/transposeScore.ts +39 -39
- package/src/ui/dialogs/unsavedChanges.ts +43 -0
- package/src/ui/dialogs/volta.ts +120 -122
- package/src/ui/dialogs/voltaVue.ts +51 -51
- package/src/ui/fileio/library.ts +110 -111
- package/src/ui/menus/edit.ts +100 -1
- package/src/ui/menus/file.ts +19 -3
- package/tests/pageDivisions.ts +156 -0
- package/tests/promiseHelpersUsage.ts +142 -0
- package/tests/scoreChangeState.ts +102 -0
- package/tests/selectVoice.ts +189 -0
- package/tests/voiceCopyPaste.ts +417 -0
|
@@ -1,40 +1,40 @@
|
|
|
1
|
-
// [Smoosic](https://github.com/AaronDavidNewman/Smoosic)
|
|
2
|
-
// Copyright (c) Aaron David Newman 2021.
|
|
3
|
-
import { SmoScorePreferences } from '../../smo/data/scoreModifiers';
|
|
4
|
-
import { SuiDialogParams, InstallDialog } from './dialog';
|
|
5
|
-
import { replaceVueRoot, modalContainerId } from '../common';
|
|
6
|
-
import { reactive, watch, ref } from 'vue';
|
|
7
|
-
import scorePreferencesApp from '../components/dialogs/scorePreferences.vue';
|
|
8
|
-
|
|
9
|
-
declare var $: any;
|
|
10
|
-
|
|
11
|
-
export const SuiScorePreferencesDialogVue = (parameters: SuiDialogParams) => {
|
|
12
|
-
const preferences = reactive(new SmoScorePreferences(parameters.view.score.preferences));
|
|
13
|
-
const backup = new SmoScorePreferences(preferences);
|
|
14
|
-
|
|
15
|
-
const getPreferences = () => preferences;
|
|
16
|
-
const rootId = replaceVueRoot(modalContainerId);
|
|
17
|
-
const appParams = {
|
|
18
|
-
initialValue: preferences,
|
|
19
|
-
domId: rootId,
|
|
20
|
-
getPreferences
|
|
21
|
-
};
|
|
22
|
-
watch(preferences, async (newVal, oldVal) => {
|
|
23
|
-
await parameters.view.updateScorePreferences(newVal);
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
const cancelCb = async () => {
|
|
27
|
-
const p1 = JSON.stringify(preferences);
|
|
28
|
-
const p2 = JSON.stringify(backup);
|
|
29
|
-
if (p1 !== p2) {
|
|
30
|
-
await parameters.view.updateScorePreferences(backup);
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
const commitCb = async () => {
|
|
34
|
-
if (backup.transposingScore !== preferences.transposingScore ||
|
|
35
|
-
backup.hideEmptyLines !== preferences.hideEmptyLines) {
|
|
36
|
-
await parameters.view.refreshViewport();
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
InstallDialog({ root: rootId, app: scorePreferencesApp, appParams, dialogParams: parameters, commitCb, cancelCb });
|
|
40
|
-
}
|
|
1
|
+
// [Smoosic](https://github.com/AaronDavidNewman/Smoosic)
|
|
2
|
+
// Copyright (c) Aaron David Newman 2021.
|
|
3
|
+
import { SmoScorePreferences } from '../../smo/data/scoreModifiers';
|
|
4
|
+
import { SuiDialogParams, InstallDialog } from './dialog';
|
|
5
|
+
import { replaceVueRoot, modalContainerId } from '../common';
|
|
6
|
+
import { reactive, watch, ref } from 'vue';
|
|
7
|
+
import scorePreferencesApp from '../components/dialogs/scorePreferences.vue';
|
|
8
|
+
|
|
9
|
+
declare var $: any;
|
|
10
|
+
|
|
11
|
+
export const SuiScorePreferencesDialogVue = (parameters: SuiDialogParams) => {
|
|
12
|
+
const preferences = reactive(new SmoScorePreferences(parameters.view.score.preferences));
|
|
13
|
+
const backup = new SmoScorePreferences(preferences);
|
|
14
|
+
|
|
15
|
+
const getPreferences = () => preferences;
|
|
16
|
+
const rootId = replaceVueRoot(modalContainerId);
|
|
17
|
+
const appParams = {
|
|
18
|
+
initialValue: preferences,
|
|
19
|
+
domId: rootId,
|
|
20
|
+
getPreferences
|
|
21
|
+
};
|
|
22
|
+
watch(preferences, async (newVal, oldVal) => {
|
|
23
|
+
await parameters.view.updateScorePreferences(newVal);
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
const cancelCb = async () => {
|
|
27
|
+
const p1 = JSON.stringify(preferences);
|
|
28
|
+
const p2 = JSON.stringify(backup);
|
|
29
|
+
if (p1 !== p2) {
|
|
30
|
+
await parameters.view.updateScorePreferences(backup);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
const commitCb = async () => {
|
|
34
|
+
if (backup.transposingScore !== preferences.transposingScore ||
|
|
35
|
+
backup.hideEmptyLines !== preferences.hideEmptyLines) {
|
|
36
|
+
await parameters.view.refreshViewport();
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
InstallDialog({ root: rootId, app: scorePreferencesApp, appParams, dialogParams: parameters, commitCb, cancelCb });
|
|
40
|
+
}
|
|
@@ -1,64 +1,64 @@
|
|
|
1
|
-
// [Smoosic](https://github.com/AaronDavidNewman/Smoosic)
|
|
2
|
-
// Copyright (c) Aaron David Newman 2026.
|
|
3
|
-
import { SuiScoreViewOperations } from '../../render/sui/scoreViewOperations';
|
|
4
|
-
import { SmoRehearsalMark } from '../../smo/data/measureModifiers';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Edits a live SmoRehearsalMark. Modeled on SuiVoltaAdapter (src/ui/dialogs/volta.ts): every
|
|
8
|
-
* field write is pushed to the score immediately, and cancel() restores the backup taken when
|
|
9
|
-
* the dialog opened. Position is intentionally not editable (spec Assumptions).
|
|
10
|
-
* See specs/025-rehearsal-mark-dialog.
|
|
11
|
-
*/
|
|
12
|
-
export class SuiRehearsalMarkAdapter {
|
|
13
|
-
view: SuiScoreViewOperations;
|
|
14
|
-
mark: SmoRehearsalMark;
|
|
15
|
-
backup: SmoRehearsalMark;
|
|
16
|
-
changed: boolean = false;
|
|
17
|
-
constructor(view: SuiScoreViewOperations, mark: SmoRehearsalMark) {
|
|
18
|
-
this.view = view;
|
|
19
|
-
this.mark = mark;
|
|
20
|
-
this.backup = new SmoRehearsalMark(mark.serialize());
|
|
21
|
-
// the view finds the mark in the score by id, so the backup must carry the live mark's id
|
|
22
|
-
this.backup.attrs.id = mark.attrs.id;
|
|
23
|
-
}
|
|
24
|
-
get symbol(): string {
|
|
25
|
-
return this.mark.symbol;
|
|
26
|
-
}
|
|
27
|
-
set symbol(value: string) {
|
|
28
|
-
this.mark.symbol = value;
|
|
29
|
-
this.updateMark();
|
|
30
|
-
}
|
|
31
|
-
get cardinality(): string {
|
|
32
|
-
return this.mark.cardinality;
|
|
33
|
-
}
|
|
34
|
-
set cardinality(value: string) {
|
|
35
|
-
this.mark.cardinality = value;
|
|
36
|
-
// a measure-number mark is not part of a series, so turn auto-increment off
|
|
37
|
-
if (value === SmoRehearsalMark.cardinalities.measureNumber) {
|
|
38
|
-
this.mark.increment = false;
|
|
39
|
-
}
|
|
40
|
-
this.updateMark();
|
|
41
|
-
}
|
|
42
|
-
get increment(): boolean {
|
|
43
|
-
return this.mark.increment;
|
|
44
|
-
}
|
|
45
|
-
set increment(value: boolean) {
|
|
46
|
-
this.mark.increment = value;
|
|
47
|
-
this.updateMark();
|
|
48
|
-
}
|
|
49
|
-
updateMark() {
|
|
50
|
-
this.changed = true;
|
|
51
|
-
this.view.updateRehearsalMark(this.mark);
|
|
52
|
-
}
|
|
53
|
-
async commit(): Promise<void> {
|
|
54
|
-
return;
|
|
55
|
-
}
|
|
56
|
-
async cancel(): Promise<void> {
|
|
57
|
-
if (this.changed) {
|
|
58
|
-
await this.view.updateRehearsalMark(this.backup);
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
async remove(): Promise<void> {
|
|
62
|
-
await this.view.removeRehearsalMark(this.mark);
|
|
63
|
-
}
|
|
64
|
-
}
|
|
1
|
+
// [Smoosic](https://github.com/AaronDavidNewman/Smoosic)
|
|
2
|
+
// Copyright (c) Aaron David Newman 2026.
|
|
3
|
+
import { SuiScoreViewOperations } from '../../render/sui/scoreViewOperations';
|
|
4
|
+
import { SmoRehearsalMark } from '../../smo/data/measureModifiers';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Edits a live SmoRehearsalMark. Modeled on SuiVoltaAdapter (src/ui/dialogs/volta.ts): every
|
|
8
|
+
* field write is pushed to the score immediately, and cancel() restores the backup taken when
|
|
9
|
+
* the dialog opened. Position is intentionally not editable (spec Assumptions).
|
|
10
|
+
* See specs/025-rehearsal-mark-dialog.
|
|
11
|
+
*/
|
|
12
|
+
export class SuiRehearsalMarkAdapter {
|
|
13
|
+
view: SuiScoreViewOperations;
|
|
14
|
+
mark: SmoRehearsalMark;
|
|
15
|
+
backup: SmoRehearsalMark;
|
|
16
|
+
changed: boolean = false;
|
|
17
|
+
constructor(view: SuiScoreViewOperations, mark: SmoRehearsalMark) {
|
|
18
|
+
this.view = view;
|
|
19
|
+
this.mark = mark;
|
|
20
|
+
this.backup = new SmoRehearsalMark(mark.serialize());
|
|
21
|
+
// the view finds the mark in the score by id, so the backup must carry the live mark's id
|
|
22
|
+
this.backup.attrs.id = mark.attrs.id;
|
|
23
|
+
}
|
|
24
|
+
get symbol(): string {
|
|
25
|
+
return this.mark.symbol;
|
|
26
|
+
}
|
|
27
|
+
set symbol(value: string) {
|
|
28
|
+
this.mark.symbol = value;
|
|
29
|
+
this.updateMark();
|
|
30
|
+
}
|
|
31
|
+
get cardinality(): string {
|
|
32
|
+
return this.mark.cardinality;
|
|
33
|
+
}
|
|
34
|
+
set cardinality(value: string) {
|
|
35
|
+
this.mark.cardinality = value;
|
|
36
|
+
// a measure-number mark is not part of a series, so turn auto-increment off
|
|
37
|
+
if (value === SmoRehearsalMark.cardinalities.measureNumber) {
|
|
38
|
+
this.mark.increment = false;
|
|
39
|
+
}
|
|
40
|
+
this.updateMark();
|
|
41
|
+
}
|
|
42
|
+
get increment(): boolean {
|
|
43
|
+
return this.mark.increment;
|
|
44
|
+
}
|
|
45
|
+
set increment(value: boolean) {
|
|
46
|
+
this.mark.increment = value;
|
|
47
|
+
this.updateMark();
|
|
48
|
+
}
|
|
49
|
+
updateMark() {
|
|
50
|
+
this.changed = true;
|
|
51
|
+
this.view.updateRehearsalMark(this.mark);
|
|
52
|
+
}
|
|
53
|
+
async commit(): Promise<void> {
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
async cancel(): Promise<void> {
|
|
57
|
+
if (this.changed) {
|
|
58
|
+
await this.view.updateRehearsalMark(this.backup);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
async remove(): Promise<void> {
|
|
62
|
+
await this.view.removeRehearsalMark(this.mark);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
@@ -1,57 +1,57 @@
|
|
|
1
|
-
// [Smoosic](https://github.com/AaronDavidNewman/Smoosic)
|
|
2
|
-
// Copyright (c) Aaron David Newman 2026.
|
|
3
|
-
import { SuiDialogParams, InstallDialog } from './dialog';
|
|
4
|
-
import { SuiRehearsalMarkAdapter } from './rehearsalMark';
|
|
5
|
-
import { getModifierDialogPosition } from './adapter';
|
|
6
|
-
import rehearsalMarkComp from '../components/dialogs/rehearsalMark.vue';
|
|
7
|
-
import { replaceVueRoot, modalContainerId } from '../common';
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Vue-based properties dialog for an existing SmoRehearsalMark. Opened by the modifier factory
|
|
11
|
-
* when the rehearsal mark is selected (specs/025-rehearsal-mark-dialog). The adapter does the
|
|
12
|
-
* live model/score updates; this function only wires the presentation layer.
|
|
13
|
-
*/
|
|
14
|
-
export const SuiRehearsalMarkDialogVue = (parameters: SuiDialogParams) => {
|
|
15
|
-
const rootId = replaceVueRoot(modalContainerId);
|
|
16
|
-
const view = parameters.view;
|
|
17
|
-
const adapter = new SuiRehearsalMarkAdapter(view, parameters.modifier);
|
|
18
|
-
|
|
19
|
-
const updateFieldCb = (param: 'symbol' | 'cardinality' | 'increment', value: string | boolean) => {
|
|
20
|
-
if (param === 'increment') {
|
|
21
|
-
adapter.increment = value as boolean;
|
|
22
|
-
} else if (param === 'cardinality') {
|
|
23
|
-
adapter.cardinality = value as string;
|
|
24
|
-
} else {
|
|
25
|
-
adapter.symbol = value as string;
|
|
26
|
-
}
|
|
27
|
-
};
|
|
28
|
-
const commitCb = async () => {
|
|
29
|
-
await adapter.commit();
|
|
30
|
-
};
|
|
31
|
-
const cancelCb = async () => {
|
|
32
|
-
await adapter.cancel();
|
|
33
|
-
};
|
|
34
|
-
const removeCb = async () => {
|
|
35
|
-
await adapter.remove();
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
const appParams = {
|
|
39
|
-
domId: rootId,
|
|
40
|
-
label: 'Rehearsal Mark Properties',
|
|
41
|
-
initialPosition: getModifierDialogPosition(view, parameters.modifier),
|
|
42
|
-
symbol: adapter.symbol,
|
|
43
|
-
cardinality: adapter.cardinality,
|
|
44
|
-
increment: adapter.increment,
|
|
45
|
-
updateFieldCb
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
InstallDialog({
|
|
49
|
-
root: rootId,
|
|
50
|
-
app: rehearsalMarkComp,
|
|
51
|
-
appParams,
|
|
52
|
-
dialogParams: parameters,
|
|
53
|
-
commitCb,
|
|
54
|
-
cancelCb,
|
|
55
|
-
removeCb
|
|
56
|
-
});
|
|
57
|
-
};
|
|
1
|
+
// [Smoosic](https://github.com/AaronDavidNewman/Smoosic)
|
|
2
|
+
// Copyright (c) Aaron David Newman 2026.
|
|
3
|
+
import { SuiDialogParams, InstallDialog } from './dialog';
|
|
4
|
+
import { SuiRehearsalMarkAdapter } from './rehearsalMark';
|
|
5
|
+
import { getModifierDialogPosition } from './adapter';
|
|
6
|
+
import rehearsalMarkComp from '../components/dialogs/rehearsalMark.vue';
|
|
7
|
+
import { replaceVueRoot, modalContainerId } from '../common';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Vue-based properties dialog for an existing SmoRehearsalMark. Opened by the modifier factory
|
|
11
|
+
* when the rehearsal mark is selected (specs/025-rehearsal-mark-dialog). The adapter does the
|
|
12
|
+
* live model/score updates; this function only wires the presentation layer.
|
|
13
|
+
*/
|
|
14
|
+
export const SuiRehearsalMarkDialogVue = (parameters: SuiDialogParams) => {
|
|
15
|
+
const rootId = replaceVueRoot(modalContainerId);
|
|
16
|
+
const view = parameters.view;
|
|
17
|
+
const adapter = new SuiRehearsalMarkAdapter(view, parameters.modifier);
|
|
18
|
+
|
|
19
|
+
const updateFieldCb = (param: 'symbol' | 'cardinality' | 'increment', value: string | boolean) => {
|
|
20
|
+
if (param === 'increment') {
|
|
21
|
+
adapter.increment = value as boolean;
|
|
22
|
+
} else if (param === 'cardinality') {
|
|
23
|
+
adapter.cardinality = value as string;
|
|
24
|
+
} else {
|
|
25
|
+
adapter.symbol = value as string;
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
const commitCb = async () => {
|
|
29
|
+
await adapter.commit();
|
|
30
|
+
};
|
|
31
|
+
const cancelCb = async () => {
|
|
32
|
+
await adapter.cancel();
|
|
33
|
+
};
|
|
34
|
+
const removeCb = async () => {
|
|
35
|
+
await adapter.remove();
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
const appParams = {
|
|
39
|
+
domId: rootId,
|
|
40
|
+
label: 'Rehearsal Mark Properties',
|
|
41
|
+
initialPosition: getModifierDialogPosition(view, parameters.modifier),
|
|
42
|
+
symbol: adapter.symbol,
|
|
43
|
+
cardinality: adapter.cardinality,
|
|
44
|
+
increment: adapter.increment,
|
|
45
|
+
updateFieldCb
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
InstallDialog({
|
|
49
|
+
root: rootId,
|
|
50
|
+
app: rehearsalMarkComp,
|
|
51
|
+
appParams,
|
|
52
|
+
dialogParams: parameters,
|
|
53
|
+
commitCb,
|
|
54
|
+
cancelCb,
|
|
55
|
+
removeCb
|
|
56
|
+
});
|
|
57
|
+
};
|
|
@@ -1,36 +1,35 @@
|
|
|
1
|
-
// [Smoosic](https://github.com/AaronDavidNewman/Smoosic)
|
|
2
|
-
// Copyright (c) Aaron David Newman 2021.
|
|
3
|
-
import { SmoScoreInfo } from '../../smo/data/scoreModifiers';
|
|
4
|
-
|
|
5
|
-
import { SuiScoreViewOperations } from '../../render/sui/scoreViewOperations';
|
|
6
|
-
import { SuiComponentAdapter, SuiDialogAdapterBase } from './adapter';
|
|
7
|
-
import { DialogDefinition, SuiDialogParams, InstallDialog } from './dialog';
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
const
|
|
16
|
-
const
|
|
17
|
-
const
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
}
|
|
1
|
+
// [Smoosic](https://github.com/AaronDavidNewman/Smoosic)
|
|
2
|
+
// Copyright (c) Aaron David Newman 2021.
|
|
3
|
+
import { SmoScoreInfo } from '../../smo/data/scoreModifiers';
|
|
4
|
+
|
|
5
|
+
import { SuiScoreViewOperations } from '../../render/sui/scoreViewOperations';
|
|
6
|
+
import { SuiComponentAdapter, SuiDialogAdapterBase } from './adapter';
|
|
7
|
+
import { DialogDefinition, SuiDialogParams, InstallDialog } from './dialog';
|
|
8
|
+
import { reactive, watch, ref } from 'vue';
|
|
9
|
+
import { replaceVueRoot, modalContainerId } from '../common';
|
|
10
|
+
import scoreInfoApp from '../components/dialogs/scoreInfo.vue';
|
|
11
|
+
|
|
12
|
+
declare var $: any;
|
|
13
|
+
export const SuiScoreIdentificationDialogVue = (parameters: SuiDialogParams) => {
|
|
14
|
+
const scoreInfo = reactive(parameters.view.score.scoreInfo);
|
|
15
|
+
const backup = JSON.parse(JSON.stringify(scoreInfo));
|
|
16
|
+
const getScoreInfo = () => scoreInfo;
|
|
17
|
+
const rootId = replaceVueRoot(modalContainerId);
|
|
18
|
+
const appParams = {
|
|
19
|
+
initialValue: scoreInfo,
|
|
20
|
+
domId: rootId,
|
|
21
|
+
label: 'Score Information',
|
|
22
|
+
getScoreInfo
|
|
23
|
+
};
|
|
24
|
+
let changed = false;
|
|
25
|
+
const commitCb = async() => {
|
|
26
|
+
changed = true;
|
|
27
|
+
await parameters.view.updateScoreInfo(scoreInfo);
|
|
28
|
+
}
|
|
29
|
+
const cancelCb = async() => {
|
|
30
|
+
if (changed) {
|
|
31
|
+
await parameters.view.updateScoreInfo(backup);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
InstallDialog({ root: rootId, app: scoreInfoApp, appParams, dialogParams: parameters, commitCb, cancelCb });
|
|
35
|
+
}
|
|
@@ -1,42 +1,42 @@
|
|
|
1
|
-
// [Smoosic](https://github.com/AaronDavidNewman/Smoosic)
|
|
2
|
-
// Copyright (c) Aaron David Newman 2021.
|
|
3
|
-
import { ViewMapEntry } from '../../render/sui/scoreView';
|
|
4
|
-
import { SuiDialogParams, InstallDialog } from './dialog';
|
|
5
|
-
import { reactive, watch, ref } from 'vue';
|
|
6
|
-
import { replaceVueRoot, modalContainerId } from '../common';
|
|
7
|
-
import viewStavesApp from '../components/dialogs/viewStaves.vue';
|
|
8
|
-
import { SmoScorePreferences } from '../../smo/data/scoreModifiers';
|
|
9
|
-
|
|
10
|
-
export const SuiScoreViewDialogVue = (parameters: SuiDialogParams) => {
|
|
11
|
-
const currentView: ViewMapEntry[] = reactive(parameters.view.getView());
|
|
12
|
-
const score = parameters.view.storeScore;
|
|
13
|
-
let changed = false;
|
|
14
|
-
const getViewMap = () => currentView
|
|
15
|
-
const preferences = reactive(new SmoScorePreferences(parameters.view.score.preferences));
|
|
16
|
-
|
|
17
|
-
const getPreferences = () => preferences;
|
|
18
|
-
watch(preferences, async (newVal, oldVal) => {
|
|
19
|
-
await parameters.view.updateScorePreferences(newVal);
|
|
20
|
-
});
|
|
21
|
-
watch(currentView, async () => {
|
|
22
|
-
changed = true;
|
|
23
|
-
});
|
|
24
|
-
const rootId = replaceVueRoot(modalContainerId);
|
|
25
|
-
const appParams = {
|
|
26
|
-
domId: rootId,
|
|
27
|
-
getViewMap,
|
|
28
|
-
getPreferences,
|
|
29
|
-
label: 'View Staves',
|
|
30
|
-
score
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
const cancelCb = async () => {
|
|
34
|
-
}
|
|
35
|
-
const commitCb = async () => {
|
|
36
|
-
if (changed) {
|
|
37
|
-
parameters.view.setView(currentView);
|
|
38
|
-
await parameters.view.refreshViewport();
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
InstallDialog({ root: rootId, app: viewStavesApp, appParams, dialogParams: parameters, commitCb, cancelCb });
|
|
42
|
-
}
|
|
1
|
+
// [Smoosic](https://github.com/AaronDavidNewman/Smoosic)
|
|
2
|
+
// Copyright (c) Aaron David Newman 2021.
|
|
3
|
+
import { ViewMapEntry } from '../../render/sui/scoreView';
|
|
4
|
+
import { SuiDialogParams, InstallDialog } from './dialog';
|
|
5
|
+
import { reactive, watch, ref } from 'vue';
|
|
6
|
+
import { replaceVueRoot, modalContainerId } from '../common';
|
|
7
|
+
import viewStavesApp from '../components/dialogs/viewStaves.vue';
|
|
8
|
+
import { SmoScorePreferences } from '../../smo/data/scoreModifiers';
|
|
9
|
+
|
|
10
|
+
export const SuiScoreViewDialogVue = (parameters: SuiDialogParams) => {
|
|
11
|
+
const currentView: ViewMapEntry[] = reactive(parameters.view.getView());
|
|
12
|
+
const score = parameters.view.storeScore;
|
|
13
|
+
let changed = false;
|
|
14
|
+
const getViewMap = () => currentView
|
|
15
|
+
const preferences = reactive(new SmoScorePreferences(parameters.view.score.preferences));
|
|
16
|
+
|
|
17
|
+
const getPreferences = () => preferences;
|
|
18
|
+
watch(preferences, async (newVal, oldVal) => {
|
|
19
|
+
await parameters.view.updateScorePreferences(newVal);
|
|
20
|
+
});
|
|
21
|
+
watch(currentView, async () => {
|
|
22
|
+
changed = true;
|
|
23
|
+
});
|
|
24
|
+
const rootId = replaceVueRoot(modalContainerId);
|
|
25
|
+
const appParams = {
|
|
26
|
+
domId: rootId,
|
|
27
|
+
getViewMap,
|
|
28
|
+
getPreferences,
|
|
29
|
+
label: 'View Staves',
|
|
30
|
+
score
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
const cancelCb = async () => {
|
|
34
|
+
}
|
|
35
|
+
const commitCb = async () => {
|
|
36
|
+
if (changed) {
|
|
37
|
+
parameters.view.setView(currentView);
|
|
38
|
+
await parameters.view.refreshViewport();
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
InstallDialog({ root: rootId, app: viewStavesApp, appParams, dialogParams: parameters, commitCb, cancelCb });
|
|
42
|
+
}
|