abcjs 6.1.5 → 6.1.7

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "abcjs",
3
- "version": "6.1.5",
3
+ "version": "6.1.7",
4
4
  "description": "Renderer for abc music notation",
5
5
  "main": "index.js",
6
6
  "types": "types/index.d.ts",
@@ -10,7 +10,8 @@
10
10
  "build:basic": "npm run webpack -- --mode development --config-name basic",
11
11
  "build:basic-min": "npm run webpack -- --mode production --config-name basic",
12
12
  "build:plugin": "npm run webpack -- --mode production --config-name plugin",
13
- "test": "echo 'To run tests, open the file tests/all.html in a browser.'",
13
+ "test-server": "npx http-server",
14
+ "test": "concurrently \"http-server\" \"npx opener http://localhost:8080/tests/all.html\"",
14
15
  "docs:dev": "vuepress dev docs",
15
16
  "docs:build": "vuepress build docs",
16
17
  "build:analyze": "npm run build:basic -- --env analyze"
@@ -43,15 +44,18 @@
43
44
  },
44
45
  "homepage": "https://abcjs.net",
45
46
  "devDependencies": {
46
- "@babel/core": "7.14.3",
47
- "@babel/preset-env": "7.14.4",
47
+ "@babel/core": "7.20.2",
48
+ "@babel/preset-env": "7.20.2",
48
49
  "@tarp/require": "1.4.3",
49
- "babel-loader": "8.2.2",
50
- "chai": "4.3.4",
51
- "mocha": "8.4.0",
50
+ "babel-loader": "9.1.0",
51
+ "chai": "4.3.7",
52
+ "concurrently": "7.5.0",
53
+ "http-server": "14.1.1",
54
+ "mocha": "10.1.0",
55
+ "opener": "1.5.2",
52
56
  "vuepress": "2.0.0-beta.26",
53
- "vuex": "4.0.0",
54
- "webpack-bundle-analyzer": "4.4.2",
55
- "webpack-cli": "4.9.0"
57
+ "vuex": "4.1.0",
58
+ "webpack-bundle-analyzer": "4.7.0",
59
+ "webpack-cli": "4.10.0"
56
60
  }
57
61
  }
@@ -920,8 +920,11 @@ AbstractEngraver.prototype.createNote = function(elem, nostem, isSingleLineStaff
920
920
 
921
921
  AbstractEngraver.prototype.addMeasureNumber = function (number, abselem) {
922
922
  var measureNumDim = this.getTextSize.calc(number, "measurefont", 'bar-number');
923
- var dx = measureNumDim.width > 18 && abselem.abcelem.type === "treble" ? -7 : 0;
924
- abselem.addFixed(new RelativeElement(number, dx, measureNumDim.width, 11+measureNumDim.height / spacing.STEP, {type:"barNumber", dim: this.getTextSize.attr("measurefont", 'bar-number')}));
923
+ var dx = 0;
924
+ if (abselem.isClef) // If this is a clef rather than bar line, then the number shouldn't be centered because it could overlap the left side. This is an easy way to let it be centered but move it over, too.
925
+ dx += measureNumDim.width / 2
926
+ var vert = measureNumDim.width > 10 && abselem.abcelem.type === "treble" ? 13 : 11
927
+ abselem.addFixed(new RelativeElement(number, dx, measureNumDim.width, vert+measureNumDim.height / spacing.STEP, {type:"barNumber", dim: this.getTextSize.attr("measurefont", 'bar-number')}));
925
928
  };
926
929
 
927
930
  AbstractEngraver.prototype.createBarLine = function (voice, elem, isFirstStaff) {
@@ -32,7 +32,7 @@ function getCoord(ev) {
32
32
 
33
33
  // when renderer.options.responsive === 'resize' the click coords are in relation to the HTML
34
34
  // element, we need to convert to the SVG viewBox coords
35
- if (svg.viewBox.baseVal) { // Firefox passes null to this when no viewBox is given
35
+ if (svg && svg.viewBox && svg.viewBox.baseVal) { // Firefox passes null to this when no viewBox is given
36
36
  // Chrome makes these values null when no viewBox is given.
37
37
  if (svg.viewBox.baseVal.width !== 0)
38
38
  scaleX = svg.viewBox.baseVal.width / svg.clientWidth
@@ -302,7 +302,7 @@ function mouseUp(ev) {
302
302
  var _ev = ev;
303
303
  if (ev.type === 'touchend' && this.lastTouchMove) {
304
304
  attachMissingTouchEventAttributes(this.lastTouchMove);
305
- if (this.lastTouchMove.touches.length > 0)
305
+ if (this.lastTouchMove && this.lastTouchMove.touches && this.lastTouchMove.touches.length > 0)
306
306
  _ev = this.lastTouchMove.touches[0];
307
307
  }
308
308
 
@@ -357,10 +357,10 @@ function notifySelect(target, dragStep, dragMax, dragIndex, ev) {
357
357
  if (target.staffPos)
358
358
  analysis.staffPos = target.staffPos;
359
359
  var closest = ev.target;
360
- while (closest && !closest.dataset.name && closest.tagName.toLowerCase() !== 'svg')
360
+ while (closest && closest.dataset && !closest.dataset.name && closest.tagName.toLowerCase() !== 'svg')
361
361
  closest = closest.parentNode;
362
362
  var parent = ev.target;
363
- while (parent && !parent.dataset.index && parent.tagName.toLowerCase() !== 'svg')
363
+ while (parent && parent.dataset && !parent.dataset.index && parent.tagName.toLowerCase() !== 'svg')
364
364
  parent = parent.parentNode;
365
365
  analysis.name = parent.dataset.name;
366
366
  analysis.clickedName = closest.dataset.name;
package/version.js CHANGED
@@ -1,3 +1,3 @@
1
- var version = '6.1.5';
1
+ var version = '6.1.7';
2
2
 
3
3
  module.exports = version;