smoosic 1.0.8 → 1.0.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. package/build/html/loading-unittest.html +2 -4
  2. package/build/html/smoosic.html +0 -1
  3. package/build/smoosic.js +19 -19
  4. package/package.json +2 -3
  5. package/release/smoosic.js +19 -19
  6. package/src/application/exports.ts +3 -2
  7. package/{build → src/common}/midi-parser.js +1 -1
  8. package/src/render/sui/scoreView.ts +8 -0
  9. package/src/render/vex/vxMeasure.ts +1 -1
  10. package/src/smo/data/measure.ts +8 -3
  11. package/src/smo/data/noteModifiers.ts +3 -3
  12. package/src/smo/data/score.ts +6 -0
  13. package/src/ui/dialogs/fileDialogs.ts +1 -1
  14. package/src/ui/dialogs/preferences.ts +8 -2
  15. package/types/src/application/exports.d.ts +526 -525
  16. package/types/src/application/exports.d.ts.map +1 -1
  17. package/types/src/common/midi-parser.d.ts +39 -0
  18. package/types/src/common/midi-parser.d.ts.map +1 -0
  19. package/types/src/common/vex.d.ts +2 -0
  20. package/types/src/common/vex.d.ts.map +1 -1
  21. package/types/src/render/sui/scoreViewOperations.d.ts +3 -3
  22. package/types/src/render/sui/scoreViewOperations.d.ts.map +1 -1
  23. package/types/src/render/vex/smoAdapter.d.ts +46 -46
  24. package/types/src/render/vex/vxMeasure.d.ts.map +1 -1
  25. package/types/src/smo/data/measure.d.ts +1 -0
  26. package/types/src/smo/data/measure.d.ts.map +1 -1
  27. package/types/src/smo/data/tuplet.d.ts.map +1 -1
  28. package/types/src/smo/xform/copypaste.d.ts.map +1 -1
  29. package/types/src/smo/xform/operations.d.ts +7 -1
  30. package/types/src/smo/xform/operations.d.ts.map +1 -1
  31. package/types/src/smo/xform/tickDuration.d.ts +6 -0
  32. package/types/src/smo/xform/tickDuration.d.ts.map +1 -1
  33. package/types/src/smo/xform/undo.d.ts.map +1 -1
  34. package/types/src/ui/dialogs/components/baseComponent.d.ts +4 -0
  35. package/types/src/ui/dialogs/components/baseComponent.d.ts.map +1 -1
  36. package/types/src/ui/dialogs/components/rocker.d.ts +4 -0
  37. package/types/src/ui/dialogs/components/rocker.d.ts.map +1 -1
  38. package/types/src/ui/dialogs/customTuplets.d.ts +26 -0
  39. package/types/src/ui/dialogs/customTuplets.d.ts.map +1 -0
  40. package/types/src/ui/menus/beams.d.ts.map +1 -1
  41. package/types/src/ui/menus/manager.d.ts.map +1 -1
  42. package/types/src/ui/menus/menu.d.ts +136 -136
  43. package/types/src/ui/menus/tuplets.d.ts +14 -0
  44. package/types/src/ui/menus/tuplets.d.ts.map +1 -0
  45. package/types/src/ui/ribbonLayout/default/defaultRibbon.d.ts.map +1 -1
  46. package/types/tests/file-load.d.ts +1 -1
  47. package/types/tests/file-load.d.ts.map +1 -1
  48. package/build/html/penLoadFile.html +0 -50
  49. package/build/html/penLoadXml.html +0 -51
  50. package/release/html/asyncPen.html +0 -230
  51. package/release/html/penLoadFile.html +0 -50
  52. package/release/html/penLoadXml.html +0 -51
  53. package/release/html/syncPen.html +0 -149
  54. package/tests/file-load.ts +0 -62
  55. package/tests/types/qunit.d.ts +0 -76
@@ -1,50 +0,0 @@
1
- <!DOCTYPE HTML>
2
- <html lang="en" xmlns="http://www.w3.org/1999/xhtml">
3
-
4
- <head>
5
- <meta charset="utf-8">
6
- <title>Smoosic Editor</title>
7
- <link href="../styles/fonts.css" rel="stylesheet">
8
- <link href="../styles/media.css" rel="stylesheet">
9
- <link href="../styles/ribbon.css" rel="stylesheet">
10
- <link href="../styles/dialogs.css" rel="stylesheet">
11
- <link href="../styles/menus.css" rel="stylesheet">
12
- <link href="../styles/piano.css" rel="stylesheet">
13
- <link href="../styles/tree.css" rel="stylesheet">
14
- <script type="text/javascript"
15
- src="https://aarondavidnewman.github.io/vexflow_smoosic/releases/vexflow-debug.js"></script>
16
- <script src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.6.0/jszip.min.js"
17
- integrity="sha512-uVSVjE7zYsGz4ag0HEzfugJ78oHCI1KhdkivjQro8ABL/PRiEO4ROwvrolYAcZnky0Fl/baWKYilQfWvESliRA=="
18
- crossorigin="anonymous" referrerpolicy="no-referrer"></script>
19
- <!-- script type="text/javascript" src="../../../vex_smoosic/vexflow_smoosic/build/vexflow-debug.js"></script -->
20
- <script type="text/javascript" src="https://code.jquery.com/jquery-3.3.1.slim.js"></script>
21
- <script type="text/javascript" src="../smoosic.js"></script>
22
- <script type="text/javascript">
23
- document.addEventListener("DOMContentLoaded", function (event) {
24
- // A simple music program using Smoosic in library mode.
25
- // Load a Smoosic JSON file and render the score
26
- const path = 'https://aarondavidnewman.github.io/Smoosic/release/library/hymns/Precious Lord.json';
27
- Smo.SuiApplication.configure({
28
- mode: 'library',
29
- scoreDomContainer: 'outer-container',
30
- remoteScore: path
31
- }).then((application) => {
32
- console.log('done');
33
- });
34
- });
35
- </script>
36
- </head>
37
-
38
- <body>
39
- <sub id="link-hdr"><a href="https://github.com/Smoosic/smoosic">Github site</a> |
40
- <a href="https://smoosic.github.io/Smoosic/release/docs/modules.html">source documentation</a> |
41
- <a href="https://smoosic.github.io/Smoosic/changes.html">change notes</a> |
42
- <a href="https://smoosic.github.io/Smoosic/release/html/smoosic.html">application</a><button class="close-header"><span class="icon icon-cross"></span></button></sub>
43
- <div id="outer-container" style="overflow:auto">
44
- <div id="container1">
45
-
46
- </div>
47
- </div>
48
- </body>
49
-
50
- </html>
@@ -1,51 +0,0 @@
1
- <!DOCTYPE HTML>
2
- <html lang="en" xmlns="http://www.w3.org/1999/xhtml">
3
-
4
- <head>
5
- <meta charset="utf-8">
6
- <title>Smoosic Editor</title>
7
- <link href="../styles/fonts.css" rel="stylesheet">
8
- <link href="../styles/media.css" rel="stylesheet">
9
- <link href="../styles/ribbon.css" rel="stylesheet">
10
- <link href="../styles/dialogs.css" rel="stylesheet">
11
- <link href="../styles/menus.css" rel="stylesheet">
12
- <link href="../styles/piano.css" rel="stylesheet">
13
- <link href="../styles/tree.css" rel="stylesheet">
14
- <script type="text/javascript"
15
- src="https://aarondavidnewman.github.io/vexflow_smoosic/releases/vexflow-debug.js"></script>
16
- <script src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.6.0/jszip.min.js"
17
- integrity="sha512-uVSVjE7zYsGz4ag0HEzfugJ78oHCI1KhdkivjQro8ABL/PRiEO4ROwvrolYAcZnky0Fl/baWKYilQfWvESliRA=="
18
- crossorigin="anonymous" referrerpolicy="no-referrer"></script>
19
- <!-- script type="text/javascript" src="../../../vex_smoosic/vexflow_smoosic/build/vexflow-debug.js"></script -->
20
- <script type="text/javascript" src="https://code.jquery.com/jquery-3.3.1.slim.js"></script>
21
- <script type="text/javascript" src="../smoosic.js"></script>
22
- <script type="text/javascript">
23
- document.addEventListener("DOMContentLoaded", function (event) {
24
-
25
- // A simple music program using Smoosic in library mode.
26
- // Load a Music XML file (Finale) and render it
27
- const path = 'https://aarondavidnewman.github.io/Smoosic/release/library/Beethoven_AnDieFerneGeliebte.xml';
28
- Smo.SuiApplication.configure({
29
- mode: 'library',
30
- scoreDomContainer: 'outer-container',
31
- remoteScore: path
32
- }).then((application) => {
33
- console.log('done!');
34
- });
35
- });
36
- </script>
37
- </head>
38
-
39
- <body>
40
- <sub id="link-hdr"><a href="https://github.com/Smoosic/smoosic">Github site</a> |
41
- <a href="https://smoosic.github.io/Smoosic/release/docs/modules.html">source documentation</a> |
42
- <a href="https://smoosic.github.io/Smoosic/changes.html">change notes</a> |
43
- <a href="https://smoosic.github.io/Smoosic/release/html/smoosic.html">application</a><button class="close-header"><span class="icon icon-cross"></span></button></sub>
44
- <div id="outer-container" style="overflow:auto">
45
- <div id="container1">
46
-
47
- </div>
48
- </div>
49
- </body>
50
-
51
- </html>
@@ -1,149 +0,0 @@
1
- <!DOCTYPE HTML>
2
- <html lang="en" xmlns="http://www.w3.org/1999/xhtml">
3
-
4
- <head>
5
- <meta charset="utf-8">
6
- <title>Smoosic Editor</title>
7
- <link href="../styles/fonts.css" rel="stylesheet">
8
- <link href="../styles/media.css" rel="stylesheet">
9
- <link href="../styles/ribbon.css" rel="stylesheet">
10
- <link href="../styles/dialogs.css" rel="stylesheet">
11
- <link href="../styles/menus.css" rel="stylesheet">
12
- <link href="../styles/piano.css" rel="stylesheet">
13
- <link href="../styles/tree.css" rel="stylesheet">
14
- <script type="text/javascript"
15
- src="https://aarondavidnewman.github.io/vexflow_smoosic/releases/vexflow-debug.js"></script>
16
- <script src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.6.0/jszip.min.js"
17
- integrity="sha512-uVSVjE7zYsGz4ag0HEzfugJ78oHCI1KhdkivjQro8ABL/PRiEO4ROwvrolYAcZnky0Fl/baWKYilQfWvESliRA=="
18
- crossorigin="anonymous" referrerpolicy="no-referrer"></script>
19
- <!-- script type="text/javascript" src="../../../vex_smoosic/vexflow_smoosic/build/vexflow-debug.js"></script -->
20
- <script type="text/javascript" src="https://code.jquery.com/jquery-3.3.1.slim.js"></script>
21
- <script type="text/javascript" src="../smoosic.js"></script>
22
- <script type="text/javascript">
23
- document.addEventListener("DOMContentLoaded", function (event) {
24
- // @@@@@@
25
- // A simple music program using Smoosic in library mode. We add the music
26
- // to the score by creating SMO objects directly. Since we are not using async mode,
27
- // we need to create our own selections, since tracker will not be aware of music changes
28
- // made before the item renders.
29
-
30
- // convienience function to create a SmoNote from letter name (smoosic pitches are json triples: letter, accidental, octave).
31
- const notesFromLetters = Smo.SmoMusic.notesFromLetters;
32
-
33
- // Create an empty score. 'Empty' score actually has a single treble-clef measure of rests.
34
- const score = Smo.SmoScore.getDefaultScore(Smo.SmoScore.defaults, null);
35
-
36
- // create a new measure - we are going to replace the default measure with it.
37
- // Most SMO objects have defaults that you can use to construct a generic version
38
- let measure = new Smo.SmoMeasure(Smo.SmoMeasure.defaults);
39
- let voice = { notes: [] };
40
- // create the first 8 16th notes
41
- notesFromLetters(Smo.SmoMeasure.defaultPitchForClef['treble'], 'treble', 'c', '16', 'ccdefdec').forEach((note) => {
42
- note.pitches[0].octave -= 1; // adjust octave
43
- voice.notes.push(note);
44
- });
45
- // first note is a rest
46
- voice.notes[0].noteType = 'r';
47
-
48
- // create next 4 1/8 notes
49
- notesFromLetters(Smo.SmoMeasure.defaultPitchForClef['treble'], 'treble', 'c', '8', 'gcbc').forEach((note) => {
50
- note.beamBeats = 4096 * 2; // beam 4 1/8 notes, default is 2
51
- voice.notes.push(note);
52
- });
53
- // adjust the beams the way we want it.
54
- voice.notes[3].endBeam = true;
55
-
56
- // You would not want to do this in an interactive app, because the tracker and UI don't won't know about the new voice
57
- // until it's been rendered. But since we're doing this all without rendering the score, it's OK.
58
- measure.voices[0] = voice;
59
-
60
- // Add ornament to the note. A common pattern is to create the defaults object and make changes to it
61
- // for your object
62
- const orn1 = Smo.SmoOrnament.defaults;
63
- orn1.ornament = Smo.SmoOrnament.downmordent;
64
- voice.notes[10].toggleOrnament(new Smo.SmoOrnament(orn1));
65
- score.staves[0].measures = [measure];
66
-
67
- // Now create the second line. We want bass clef so create a bass clef instrument
68
- const instDefs = Smo.SmoInstrument.defaults;
69
- instDefs.clef = 'bass';
70
- const instMap = {};
71
- // map measure '0' to this instrument, which is currently the only measure we have
72
- instMap[0] = instDefs;
73
- // Use the defaults, but add the bass clef instrument to the constructor parameters
74
- const staveDefs = Smo.SmoSystemStaff.defaults;
75
- staveDefs.measureInstrumentMap = instMap;
76
- score.addStaff(staveDefs);
77
-
78
- // now fill in those notes
79
- voice = { notes: [] };
80
- notesFromLetters(Smo.SmoMeasure.defaultPitchForClef['bass'], 'bass', 'c', 'h', 'd').forEach((note) => voice.notes.push(note));
81
- voice.notes[0].noteType = 'r';
82
- notesFromLetters(Smo.SmoMeasure.defaultPitchForClef['bass'], 'bass', 'c', '16', 'ccdefdec').forEach((note) => voice.notes.push(note));
83
- voice.notes[1].noteType = 'r';
84
- voice.notes[4].endBeam = true;
85
-
86
- // Add the notes to the measure we just created.
87
- score.staves[1].measures[0].voices = [voice];
88
-
89
- // create a staff group, so the notes are justified
90
- const systemParams = Smo.SmoSystemGroup.defaults;
91
-
92
- // A selector is a single point in the music (a 'tickable')
93
- const endSelector = Smo.SmoSelector.default;
94
- endSelector.staff = 1;
95
- systemParams.leftConnector = Smo.SmoSystemGroup.connectorTypes.brace;
96
- systemParams.rightConnector = Smo.SmoSystemGroup.connectorTypes.single;
97
- systemParams.endSelector = endSelector;
98
- score.addOrReplaceSystemGroup(new Smo.SmoSystemGroup(systemParams));
99
-
100
- // measure 2:
101
- score.addMeasure(1);
102
- voice = { notes: [] };
103
- notesFromLetters(Smo.SmoMeasure.defaultPitchForClef['treble'], 'treble', 'c', '16', 'dgabcabg').forEach((note) => voice.notes.push(note));
104
- for (var i = 1; i <= 7; ++i) {
105
- voice.notes[i].pitches[0].octave -= 1;
106
- }
107
- notesFromLetters(Smo.SmoMeasure.defaultPitchForClef['treble'], 'treble', 'c', '8', 'dgfg')
108
- .forEach((note) => {
109
- note.beamBeats = 4096 * 2;
110
- voice.notes.push(note);
111
- });
112
- voice.notes[10].toggleOrnament(new Smo.SmoOrnament(orn1));
113
- score.staves[0].measures[1].voices = [voice];
114
-
115
- voice = { notes: [] };
116
- notesFromLetters(Smo.SmoMeasure.defaultPitchForClef['treble'], 'treble', 'c', '8', 'gg').forEach((note) => voice.notes.push(note));
117
- notesFromLetters(Smo.SmoMeasure.defaultPitchForClef['bass'], 'bass', 'c', '4', 'd').forEach((note) => voice.notes.push(note));
118
- notesFromLetters(Smo.SmoMeasure.defaultPitchForClef['bass'], 'bass', 'c', '16', 'ggabcabg').forEach((note) => voice.notes.push(note));
119
- voice.notes[0].pitches[0].octave += 1;
120
- voice.notes[2].noteType = 'r';
121
- voice.notes[3].noteType = 'r';
122
- voice.notes[6].endBeam = true;
123
- score.staves[1].measures[1].voices = [voice];
124
-
125
- // scale so it fits within a pen
126
- score.layoutManager.globalLayout.svgScale = 0.55;
127
- Smo.SuiApplication.configure({
128
- mode: 'library',
129
- initialScore: score,
130
- scoreDomContainer: document.getElementById('outer-container')
131
- });
132
-
133
- // Create the renderer that renderer, view, and start the engine which renders the score.
134
- });
135
- </script>
136
- </head>
137
-
138
- <body>
139
- <sub id="link-hdr"><a href="https://github.com/Smoosic/smoosic">Github site</a> |
140
- <a href="https://smoosic.github.io/Smoosic/changes.md">change notes</a> |
141
- <a href="https://smoosic.github.io/Smoosic/release/html/smoosic.html">application</a><button class="close-header"><span class="icon icon-cross"></span></button></sub>
142
- <div id="outer-container">
143
- <div id="container1">
144
-
145
- </div>
146
- </div>
147
- </body>
148
-
149
- </html>
@@ -1,62 +0,0 @@
1
- import { SuiApplication } from '../src/application/application';
2
- import { SmoToXml } from '../src/smo/mxml/smoToXml';
3
- import { XmlToSmo } from '../src/smo/mxml/xmlToSmo';
4
- import { SuiXhrLoader } from '../src/ui/fileio/xhrLoader';
5
- import { MidiToSmo } from '../src/smo/midi/midiToSmo';
6
-
7
- declare var $: any;
8
- declare var parseMidi: any;
9
-
10
- export function createLoadTests(): void {
11
- const jsonPath = 'https://aarondavidnewman.github.io/Smoosic/release/library/hymns/Precious Lord.json';
12
- const midiTiesPath = 'https://aarondavidnewman.github.io/Smoosic/release/library/miditest/ties.mid';
13
- const midiTripletPath = 'https://aarondavidnewman.github.io/Smoosic/release/library/miditest/triplet.mid';
14
- const midiKeyPath = 'https://aarondavidnewman.github.io/Smoosic/release/library/miditest/keytime.mid';
15
- var app = async (application: SuiApplication) => {
16
- const view = application.view!;
17
- await view.loadRemoteScore(jsonPath);
18
- await view.renderPromise();
19
- QUnit.test('loaded', assert => {
20
- assert.equal(view.score.staves[0].measures.length, 17);
21
- assert.equal($('#boo .vf-annotation').length, 82);
22
- });
23
- const xml = SmoToXml.convert(view.score);
24
- const newScore = XmlToSmo.convert(xml);
25
- await view.changeScore(newScore);
26
- QUnit.test('loadXml', assert => {
27
- assert.equal(view.score.staves[0].measures.length, 17);
28
- assert.equal($('#boo .vf-annotation').length, 82);
29
- });
30
- let midiData = new SuiXhrLoader(midiTiesPath);
31
- await midiData.loadAsync();
32
- let midiScore = (new MidiToSmo(parseMidi(midiData.value), 1024)).convert();
33
- await view.changeScore(midiScore);
34
- QUnit.test('loadMidi1', assert => {
35
- assert.equal(midiScore.staves[0].getTiesEndingAt({ staff: 0, measure: 1, voice: 0, tick: 0, pitches: [] }).length, 1);
36
- });
37
- midiData = new SuiXhrLoader(midiTripletPath);
38
- await midiData.loadAsync();
39
- midiScore = (new MidiToSmo(parseMidi(midiData.value), 1024)).convert();
40
- await view.changeScore(midiScore);
41
- QUnit.test('loadMidi2', assert => {
42
- assert.equal(midiScore.staves[0].measures[0].tupletTrees.length, 1);
43
- });
44
- midiData = new SuiXhrLoader(midiKeyPath);
45
- await midiData.loadAsync();
46
- midiScore = (new MidiToSmo(parseMidi(midiData.value), 1024)).convert();
47
- await view.changeScore(midiScore);
48
- QUnit.test('loadMidi2', assert => {
49
- assert.equal(midiScore.staves.length, 2);
50
- assert.equal(midiScore.staves[0].measures[0].keySignature, 'eb');
51
- });
52
- // console.log('measures ' + view.score.staves[0].measures.length);
53
- };
54
-
55
- SuiApplication.configure({
56
- mode: 'library',
57
- idleRedrawTime: 5,
58
- scoreDomContainer: 'outer-container'
59
- }).then((application) => {
60
- app(application)
61
- });
62
- }
@@ -1,76 +0,0 @@
1
- // [VexFlow](https://vexflow.com) - Copyright (c) Mohit Muthanna 2010.
2
- // MIT License
3
- //
4
-
5
- /* eslint-disable */
6
-
7
- // Declarations to interface with qunit.js
8
- // We are currently using QUnit 1.19.0.
9
- //
10
- // QUnit 2 no longer uses global functions. The assertion methods
11
- // are exposed through an assert object that is bound to each test.
12
- // See: https://qunitjs.com/upgrade-guide-2.x/
13
- //
14
- // However, we stick with the global methods for readability.
15
-
16
- // Let the TS compiler know that QUnit and its related functions are available globally.
17
- // https://www.typescriptlang.org/docs/handbook/declaration-merging.html#global-augmentation
18
- declare global {
19
- // See: https://api.qunitjs.com/QUnit/
20
- const QUnit: {
21
- module: (name: string) => void;
22
- test: typeof test;
23
-
24
- // generate_png_images.js and vexflow_test_helpers.ts
25
- // use these two fields to pass the name of the current module and test.
26
- current_module: string;
27
- current_test: string;
28
- };
29
-
30
- const test: (name: string, callback: (assert: Assert) => void) => void;
31
- const expect: (amount: number) => void;
32
- const ok: (state: any, message?: string) => void;
33
- const notOk: (state: any, message?: string) => void;
34
- const equal: (actual: any, expected: any, message?: string) => void;
35
- const notEqual: (actual: any, expected: any, message?: string) => void;
36
- const deepEqual: (actual: any, expected: any, message?: string) => void;
37
- const notDeepEqual: (actual: any, expected: any, message?: string) => void;
38
- const strictEqual: (actual: any, expected: any, message?: string) => void;
39
- const notStrictEqual: (actual: any, expected: any, message?: string) => void;
40
- const propEqual: (actual: any, expected: any, message?: string) => void;
41
- const notPropEqual: (actual: any, expected: any, message?: string) => void;
42
- const throws: (blockFn: () => any, expectedMatcher?: any, message?: string) => void;
43
- const raises: (blockFn: () => any, expectedMatcher?: any, message?: string) => void; // alias for throws
44
- const step: (message?: string) => void;
45
- const verifySteps: (steps: string[], message?: string) => void;
46
- }
47
-
48
- /**
49
- * QUnit.test(name, callback) passes an Assert object to the callback.
50
- * This object contains the testContext and also provides access to
51
- * all the QUnit assertion methods (See: https://api.qunitjs.com/assert/).
52
- */
53
- export interface Assert {
54
- /**
55
- * The current testContext. See line 1238 of qunit.js.
56
- * It has properties like module, testName, assert, and more.
57
- * `vexflow_test_helpers.ts` stores the module name into this object.
58
- */
59
- test: any;
60
-
61
- expect: typeof expect;
62
- ok: typeof ok;
63
- notOk: typeof notOk;
64
- equal: typeof equal;
65
- notEqual: typeof notEqual;
66
- deepEqual: typeof deepEqual;
67
- notDeepEqual: typeof notDeepEqual;
68
- strictEqual: typeof strictEqual;
69
- notStrictEqual: typeof notStrictEqual;
70
- propEqual: typeof propEqual;
71
- notPropEqual: typeof notPropEqual;
72
- throws: typeof throws;
73
- raises: typeof raises;
74
- step: typeof step;
75
- verifySteps: typeof verifySteps;
76
- }