abcjs 6.3.0 → 6.4.0
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/README.md +4 -0
- package/RELEASE.md +44 -0
- package/dist/abcjs-basic-min.js +2 -2
- package/dist/abcjs-basic.js +1028 -622
- package/dist/abcjs-basic.js.map +1 -1
- package/dist/abcjs-plugin-min.js +2 -2
- package/index.js +1 -0
- package/package.json +1 -1
- package/src/api/tune-metrics.js +18 -0
- package/src/data/abc_tune.js +13 -2
- package/src/edit/abc_editarea.js +4 -1
- package/src/parse/abc_parse.js +2 -0
- package/src/parse/abc_parse_directive.js +6 -0
- package/src/synth/abc_midi_flattener.js +40 -462
- package/src/synth/abc_midi_sequencer.js +25 -10
- package/src/synth/chord-track.js +562 -0
- package/src/synth/create-note-map.js +2 -1
- package/src/synth/create-synth.js +91 -42
- package/src/test/abc_parser_lint.js +1 -0
- package/src/write/creation/abstract-engraver.js +4 -1
- package/src/write/creation/decoration.js +3 -2
- package/src/write/creation/elements/tie-element.js +23 -0
- package/src/write/draw/draw.js +1 -1
- package/src/write/engraver-controller.js +9 -5
- package/src/write/interactive/create-analysis.js +50 -0
- package/src/write/interactive/find-selectable-element.js +24 -0
- package/src/write/interactive/selection.js +5 -45
- package/src/write/layout/layout-in-grid.js +83 -0
- package/src/write/layout/layout.js +29 -24
- package/src/write/layout/set-upper-and-lower-elements.js +2 -0
- package/src/write/layout/staff-group.js +2 -2
- package/src/write/layout/voice-elements.js +1 -1
- package/src/write/layout/voice.js +1 -1
- package/src/write/renderer.js +3 -0
- package/temp.txt +1 -48
- package/types/index.d.ts +96 -32
- package/version.js +1 -1
- package/abc2xml_239/abc2xml.html +0 -769
- package/abc2xml_239/abc2xml.py +0 -2248
- package/abc2xml_239/abc2xml_changelog.html +0 -124
- package/abc2xml_239/lazy-river.abc +0 -26
- package/abc2xml_239/lazy-river.xml +0 -3698
- package/abc2xml_239/mean-to-me.abc +0 -22
- package/abc2xml_239/mean-to-me.xml +0 -2954
- package/abc2xml_239/pyparsing.py +0 -3672
- package/abc2xml_239/pyparsing.pyc +0 -0
package/index.js
CHANGED
|
@@ -40,6 +40,7 @@ Object.keys(tuneBook).forEach(function (key) {
|
|
|
40
40
|
});
|
|
41
41
|
|
|
42
42
|
abcjs.renderAbc = require('./src/api/abc_tunebook_svg');
|
|
43
|
+
abcjs.tuneMetrics = require('./src/api/tune-metrics');
|
|
43
44
|
abcjs.TimingCallbacks = require('./src/api/abc_timing_callbacks');
|
|
44
45
|
|
|
45
46
|
var glyphs = require('./src/write/creation/glyphs');
|
package/package.json
CHANGED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
var tunebook = require('./abc_tunebook');
|
|
2
|
+
var EngraverController = require('../write/engraver-controller');
|
|
3
|
+
|
|
4
|
+
var tuneMetrics = function(abc, params) {
|
|
5
|
+
function callback(div, tune, tuneNumber, abcString) {
|
|
6
|
+
div = document.createElement("div");
|
|
7
|
+
div.setAttribute("style", "visibility: hidden;");
|
|
8
|
+
document.body.appendChild(div);
|
|
9
|
+
var engraver_controller = new EngraverController(div, params);
|
|
10
|
+
var widths = engraver_controller.getMeasureWidths(tune);
|
|
11
|
+
div.parentNode.removeChild(div);
|
|
12
|
+
return {sections: widths};
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
return tunebook.renderEngine(callback, "*", abc, params);
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
module.exports = tuneMetrics;
|
package/src/data/abc_tune.js
CHANGED
|
@@ -374,8 +374,9 @@ var Tune = function() {
|
|
|
374
374
|
eventHash["event" + voiceTimeMilliseconds].measureStart = true;
|
|
375
375
|
nextIsBar = false;
|
|
376
376
|
}
|
|
377
|
-
|
|
378
|
-
|
|
377
|
+
// TODO-PER: There doesn't seem to be a harm in letting ties be two different notes and it fixes a bug when a tie goes to a new line. If there aren't other problems with this change, then the variable can be removed completely.
|
|
378
|
+
// if (isTiedToNext)
|
|
379
|
+
// isTiedState = voiceTimeMilliseconds;
|
|
379
380
|
}
|
|
380
381
|
}
|
|
381
382
|
return { isTiedState: isTiedState, duration: realDuration / timeDivider, nextIsBar: nextIsBar || element.type === 'bar' };
|
|
@@ -616,6 +617,16 @@ var Tune = function() {
|
|
|
616
617
|
this.deline = function(options) {
|
|
617
618
|
return delineTune(this.lines, options);
|
|
618
619
|
}
|
|
620
|
+
this.findSelectableElement = function(target) {
|
|
621
|
+
if (this.engraver && this.engraver.selectables)
|
|
622
|
+
return this.engraver.findSelectableElement(target)
|
|
623
|
+
return null
|
|
624
|
+
}
|
|
625
|
+
this.getSelectableArray = function() {
|
|
626
|
+
if (this.engraver && this.engraver.selectables)
|
|
627
|
+
return this.engraver.selectables
|
|
628
|
+
return []
|
|
629
|
+
}
|
|
619
630
|
};
|
|
620
631
|
|
|
621
632
|
module.exports = Tune;
|
package/src/edit/abc_editarea.js
CHANGED
|
@@ -44,7 +44,10 @@ try {
|
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
var EditArea = function(textareaid) {
|
|
47
|
-
|
|
47
|
+
if (typeof textareaid === "string")
|
|
48
|
+
this.textarea = document.getElementById(textareaid);
|
|
49
|
+
else
|
|
50
|
+
this.textarea = textareaid;
|
|
48
51
|
this.initialText = this.textarea.value;
|
|
49
52
|
this.isDragging = false;
|
|
50
53
|
}
|
package/src/parse/abc_parse.js
CHANGED
|
@@ -46,6 +46,8 @@ var Parse = function() {
|
|
|
46
46
|
setTiming: tune.setTiming,
|
|
47
47
|
setUpAudio: tune.setUpAudio,
|
|
48
48
|
deline: tune.deline,
|
|
49
|
+
findSelectableElement: tune.findSelectableElement,
|
|
50
|
+
getSelectableArray: tune.getSelectableArray,
|
|
49
51
|
};
|
|
50
52
|
if (tune.lineBreaks)
|
|
51
53
|
t.lineBreaks = tune.lineBreaks;
|
|
@@ -797,6 +797,7 @@ var parseDirective = {};
|
|
|
797
797
|
case "pageheight":
|
|
798
798
|
case "pagewidth":
|
|
799
799
|
case "rightmargin":
|
|
800
|
+
case "stafftopmargin":
|
|
800
801
|
case "staffsep":
|
|
801
802
|
case "staffwidth":
|
|
802
803
|
case "subtitlespace":
|
|
@@ -1197,6 +1198,11 @@ var parseDirective = {};
|
|
|
1197
1198
|
warn("Directive \"" + cmd + "\" requires a number as a parameter.");
|
|
1198
1199
|
tune.formatting.fontboxpadding = tokens[0].floatt;
|
|
1199
1200
|
break;
|
|
1201
|
+
case "stafftopmargin":
|
|
1202
|
+
if (tokens.length !== 1 || tokens[0].type !== 'number')
|
|
1203
|
+
warn("Directive \"" + cmd + "\" requires a number as a parameter.");
|
|
1204
|
+
tune.formatting.stafftopmargin = tokens[0].floatt;
|
|
1205
|
+
break;
|
|
1200
1206
|
case "stretchlast":
|
|
1201
1207
|
var sl = parseStretchLast(tokens);
|
|
1202
1208
|
if (sl.value !== undefined)
|