text-guitar-chart 0.1.1 → 0.2.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/FORMAT.md +10 -4
- package/docs/app.js +5 -0
- package/docs/bundle.js +278 -208
- package/docs/bundle.js.map +2 -2
- package/docs/index.html +1 -0
- package/lib/editableSVGuitar.js +184 -127
- package/lib/fingeringToString.js +25 -2
- package/lib/stringToFingering.js +23 -2
- package/package.json +1 -1
- package/test/editableSVGuitar.test.js +15 -6
- package/test/fingeringToString.test.js +221 -0
- package/test/stringToFingering.test.js +176 -0
- package/types/editableSVGuitar.d.ts +22 -1
- package/types/stringToFingering.d.ts +3 -1
package/docs/bundle.js
CHANGED
|
@@ -1,4 +1,15 @@
|
|
|
1
1
|
// lib/fingeringToString.js
|
|
2
|
+
var COLOR_GREY = "#9B9B9B";
|
|
3
|
+
var COLOR_BLUE = "#4A90E2";
|
|
4
|
+
function getMarkerChar(color, isUnicode) {
|
|
5
|
+
if (color === COLOR_GREY) {
|
|
6
|
+
return isUnicode ? "\u25A1" : "O";
|
|
7
|
+
}
|
|
8
|
+
if (color === COLOR_BLUE) {
|
|
9
|
+
return isUnicode ? "\u25A0" : "+";
|
|
10
|
+
}
|
|
11
|
+
return isUnicode ? "\u25CF" : "*";
|
|
12
|
+
}
|
|
2
13
|
function fingeringToString(chord, options = {}) {
|
|
3
14
|
const { useUnicode = false } = options;
|
|
4
15
|
const { fingers = [], title = "", position: position2 } = chord;
|
|
@@ -44,7 +55,7 @@ function fingeringToString(chord, options = {}) {
|
|
|
44
55
|
}
|
|
45
56
|
}
|
|
46
57
|
function buildAsciiOutput(title, stringData, openStrings, mutedStrings, numFrets, position2) {
|
|
47
|
-
var
|
|
58
|
+
var _a12;
|
|
48
59
|
const lines = [];
|
|
49
60
|
if (title && title.length > 0) {
|
|
50
61
|
const clampedTitle = title.length > 15 ? title.slice(0, 15) : title;
|
|
@@ -81,10 +92,10 @@ function buildAsciiOutput(title, stringData, openStrings, mutedStrings, numFrets
|
|
|
81
92
|
line = " ";
|
|
82
93
|
}
|
|
83
94
|
for (let str = 6; str >= 1; str--) {
|
|
84
|
-
const fingerInfo = (
|
|
95
|
+
const fingerInfo = (_a12 = stringData.get(str)) == null ? void 0 : _a12.get(fret);
|
|
85
96
|
if (fingerInfo) {
|
|
86
97
|
if (fingerInfo.color !== "#000000") {
|
|
87
|
-
line +=
|
|
98
|
+
line += getMarkerChar(fingerInfo.color, false);
|
|
88
99
|
} else if (fingerInfo.text) {
|
|
89
100
|
line += fingerInfo.text[0];
|
|
90
101
|
} else {
|
|
@@ -99,7 +110,7 @@ function buildAsciiOutput(title, stringData, openStrings, mutedStrings, numFrets
|
|
|
99
110
|
return lines.join("\n");
|
|
100
111
|
}
|
|
101
112
|
function buildUnicodeOutput(title, stringData, openStrings, mutedStrings, numFrets, position2) {
|
|
102
|
-
var
|
|
113
|
+
var _a12;
|
|
103
114
|
const lines = [];
|
|
104
115
|
if (title && title.length > 0) {
|
|
105
116
|
const clampedTitle = title.length > 15 ? title.slice(0, 15) : title;
|
|
@@ -138,10 +149,10 @@ function buildUnicodeOutput(title, stringData, openStrings, mutedStrings, numFre
|
|
|
138
149
|
line = " ";
|
|
139
150
|
}
|
|
140
151
|
for (let str = 6; str >= 1; str--) {
|
|
141
|
-
const fingerInfo = (
|
|
152
|
+
const fingerInfo = (_a12 = stringData.get(str)) == null ? void 0 : _a12.get(fret);
|
|
142
153
|
if (fingerInfo) {
|
|
143
154
|
if (fingerInfo.color !== "#000000") {
|
|
144
|
-
line +=
|
|
155
|
+
line += getMarkerChar(fingerInfo.color, true);
|
|
145
156
|
} else if (fingerInfo.text) {
|
|
146
157
|
line += fingerInfo.text[0];
|
|
147
158
|
} else {
|
|
@@ -787,16 +798,16 @@ var Color = class _Color {
|
|
|
787
798
|
} else if (typeof a2 === "string") {
|
|
788
799
|
if (isRgb.test(a2)) {
|
|
789
800
|
const noWhitespace = a2.replace(whitespace, "");
|
|
790
|
-
const [
|
|
791
|
-
Object.assign(this, { _a:
|
|
801
|
+
const [_a13, _b2, _c2] = rgb.exec(noWhitespace).slice(1, 4).map((v2) => parseInt(v2));
|
|
802
|
+
Object.assign(this, { _a: _a13, _b: _b2, _c: _c2, _d: 0, space: "rgb" });
|
|
792
803
|
} else if (isHex.test(a2)) {
|
|
793
804
|
const hexParse = (v2) => parseInt(v2, 16);
|
|
794
|
-
const [,
|
|
795
|
-
Object.assign(this, { _a:
|
|
805
|
+
const [, _a13, _b2, _c2] = hex.exec(sixDigitHex(a2)).map(hexParse);
|
|
806
|
+
Object.assign(this, { _a: _a13, _b: _b2, _c: _c2, _d: 0, space: "rgb" });
|
|
796
807
|
} else throw Error("Unsupported string format, can't construct Color");
|
|
797
808
|
}
|
|
798
|
-
const { _a:
|
|
799
|
-
const components = this.space === "rgb" ? { r:
|
|
809
|
+
const { _a: _a12, _b, _c, _d } = this;
|
|
810
|
+
const components = this.space === "rgb" ? { r: _a12, g: _b, b: _c } : this.space === "xyz" ? { x: _a12, y: _b, z: _c } : this.space === "hsl" ? { h: _a12, s: _b, l: _c } : this.space === "lab" ? { l: _a12, a: _b, b: _c } : this.space === "lch" ? { l: _a12, c: _b, h: _c } : this.space === "cmyk" ? { c: _a12, m: _b, y: _c, k: _d } : {};
|
|
800
811
|
Object.assign(this, components);
|
|
801
812
|
}
|
|
802
813
|
/*
|
|
@@ -898,8 +909,8 @@ var Color = class _Color {
|
|
|
898
909
|
return color;
|
|
899
910
|
}
|
|
900
911
|
hsl() {
|
|
901
|
-
const { _a:
|
|
902
|
-
const [r2, g2, b2] = [
|
|
912
|
+
const { _a: _a12, _b, _c } = this.rgb();
|
|
913
|
+
const [r2, g2, b2] = [_a12, _b, _c].map((v2) => v2 / 255);
|
|
903
914
|
const max = Math.max(r2, g2, b2);
|
|
904
915
|
const min = Math.min(r2, g2, b2);
|
|
905
916
|
const l2 = (max + min) / 2;
|
|
@@ -911,8 +922,8 @@ var Color = class _Color {
|
|
|
911
922
|
return color;
|
|
912
923
|
}
|
|
913
924
|
cmyk() {
|
|
914
|
-
const { _a:
|
|
915
|
-
const [r2, g2, b2] = [
|
|
925
|
+
const { _a: _a12, _b, _c } = this.rgb();
|
|
926
|
+
const [r2, g2, b2] = [_a12, _b, _c].map((v2) => v2 / 255);
|
|
916
927
|
const k2 = Math.min(1 - r2, 1 - g2, 1 - b2);
|
|
917
928
|
if (k2 === 1) {
|
|
918
929
|
return new _Color(0, 0, 0, 1, "cmyk");
|
|
@@ -927,10 +938,10 @@ var Color = class _Color {
|
|
|
927
938
|
Input and Output methods
|
|
928
939
|
*/
|
|
929
940
|
_clamped() {
|
|
930
|
-
const { _a:
|
|
941
|
+
const { _a: _a12, _b, _c } = this.rgb();
|
|
931
942
|
const { max, min, round } = Math;
|
|
932
943
|
const format = (v2) => max(0, min(round(v2), 255));
|
|
933
|
-
return [
|
|
944
|
+
return [_a12, _b, _c].map(format);
|
|
934
945
|
}
|
|
935
946
|
toHex() {
|
|
936
947
|
const [r2, g2, b2] = this._clamped().map(componentHex);
|
|
@@ -945,8 +956,8 @@ var Color = class _Color {
|
|
|
945
956
|
return string;
|
|
946
957
|
}
|
|
947
958
|
toArray() {
|
|
948
|
-
const { _a:
|
|
949
|
-
return [
|
|
959
|
+
const { _a: _a12, _b, _c, _d, space } = this;
|
|
960
|
+
return [_a12, _b, _c, _d, space];
|
|
950
961
|
}
|
|
951
962
|
/*
|
|
952
963
|
Generating random colors
|
|
@@ -6286,8 +6297,8 @@ var Renderer = (
|
|
|
6286
6297
|
curY = radius + radius * Math.sin(a2 * Math.PI / 180);
|
|
6287
6298
|
points.push([curX, curY]);
|
|
6288
6299
|
}
|
|
6289
|
-
var lines = points.reduce(function(acc,
|
|
6290
|
-
var _b = __read(
|
|
6300
|
+
var lines = points.reduce(function(acc, _a12) {
|
|
6301
|
+
var _b = __read(_a12, 2), posX = _b[0], posY = _b[1];
|
|
6291
6302
|
return "".concat(acc, " L").concat(posX, " ").concat(posY);
|
|
6292
6303
|
}, "");
|
|
6293
6304
|
return "M".concat(curX, " ").concat(curY, " ").concat(lines);
|
|
@@ -6371,7 +6382,7 @@ var RoughJsRenderer = (
|
|
|
6371
6382
|
RoughJsRenderer2.prototype.embedDefs = function() {
|
|
6372
6383
|
var _this = this;
|
|
6373
6384
|
setTimeout(function() {
|
|
6374
|
-
var
|
|
6385
|
+
var _a12, _b, _c;
|
|
6375
6386
|
if (_this.svgNode.querySelector("defs [data-svguitar-def]")) {
|
|
6376
6387
|
return;
|
|
6377
6388
|
}
|
|
@@ -6382,7 +6393,7 @@ var RoughJsRenderer = (
|
|
|
6382
6393
|
}
|
|
6383
6394
|
var template = document.createElement("template");
|
|
6384
6395
|
template.innerHTML = defs.trim();
|
|
6385
|
-
var defsToAdd = (_c = (_b = (
|
|
6396
|
+
var defsToAdd = (_c = (_b = (_a12 = template.content.firstChild) === null || _a12 === void 0 ? void 0 : _a12.firstChild) === null || _b === void 0 ? void 0 : _b.parentElement) === null || _c === void 0 ? void 0 : _c.children;
|
|
6386
6397
|
if (defsToAdd) {
|
|
6387
6398
|
SVGArray.from(defsToAdd).forEach(function(def) {
|
|
6388
6399
|
def.setAttribute("data-svguitar-def", "true");
|
|
@@ -6397,7 +6408,7 @@ var RoughJsRenderer = (
|
|
|
6397
6408
|
this.svgNode.appendChild(titleEl);
|
|
6398
6409
|
};
|
|
6399
6410
|
RoughJsRenderer2.prototype.circle = function(x2, y2, diameter, strokeWidth, strokeColor, fill, classes2) {
|
|
6400
|
-
var
|
|
6411
|
+
var _a12;
|
|
6401
6412
|
var options = {
|
|
6402
6413
|
fill: fill || "none",
|
|
6403
6414
|
fillWeight: 2.5,
|
|
@@ -6408,7 +6419,7 @@ var RoughJsRenderer = (
|
|
|
6408
6419
|
options.strokeWidth = strokeWidth;
|
|
6409
6420
|
}
|
|
6410
6421
|
var circle = this.rc.circle(x2 + diameter / 2, y2 + diameter / 2, diameter, options);
|
|
6411
|
-
(
|
|
6422
|
+
(_a12 = circle.classList).add.apply(_a12, __spreadArray([], __read(RoughJsRenderer2.toClassArray(classes2)), false));
|
|
6412
6423
|
this.svgNode.appendChild(circle);
|
|
6413
6424
|
return RoughJsRenderer2.boxToElement(circle.getBBox(), function() {
|
|
6414
6425
|
return circle ? circle.remove() : void 0;
|
|
@@ -6425,7 +6436,7 @@ var RoughJsRenderer = (
|
|
|
6425
6436
|
this.svgNode.remove();
|
|
6426
6437
|
};
|
|
6427
6438
|
RoughJsRenderer2.prototype.line = function(x1, y1, x2, y2, strokeWidth, color, classes2) {
|
|
6428
|
-
var
|
|
6439
|
+
var _a12;
|
|
6429
6440
|
if (strokeWidth > 5 && (x1 - x2 === 0 || y1 - y2 === 0)) {
|
|
6430
6441
|
if (Math.abs(x1 - x2) > Math.abs(y1 - y2)) {
|
|
6431
6442
|
this.rect(x1, y1, x2 - x1, strokeWidth, 0, color, color);
|
|
@@ -6437,12 +6448,12 @@ var RoughJsRenderer = (
|
|
|
6437
6448
|
strokeWidth,
|
|
6438
6449
|
stroke: color
|
|
6439
6450
|
});
|
|
6440
|
-
(
|
|
6451
|
+
(_a12 = line.classList).add.apply(_a12, __spreadArray([], __read(RoughJsRenderer2.toClassArray(classes2)), false));
|
|
6441
6452
|
this.svgNode.appendChild(line);
|
|
6442
6453
|
}
|
|
6443
6454
|
};
|
|
6444
6455
|
RoughJsRenderer2.prototype.rect = function(x2, y2, width2, height2, strokeWidth, strokeColor, classes2, fill, radius) {
|
|
6445
|
-
var
|
|
6456
|
+
var _a12, _b;
|
|
6446
6457
|
var rect2 = this.rc.rectangle(x2, y2, width2, height2, {
|
|
6447
6458
|
// fill: fill || 'none',
|
|
6448
6459
|
fill: "none",
|
|
@@ -6463,7 +6474,7 @@ var RoughJsRenderer = (
|
|
|
6463
6474
|
roughness: 1.5
|
|
6464
6475
|
});
|
|
6465
6476
|
rect.setAttribute("transform", "translate(".concat(x2, ", ").concat(y2, ")"));
|
|
6466
|
-
(
|
|
6477
|
+
(_a12 = rect.classList).add.apply(_a12, __spreadArray([], __read(RoughJsRenderer2.toClassArray(classes2)), false));
|
|
6467
6478
|
(_b = rect2.classList).add.apply(_b, __spreadArray([], __read(RoughJsRenderer2.toClassArray(classes2)), false));
|
|
6468
6479
|
this.svgNode.appendChild(rect);
|
|
6469
6480
|
this.svgNode.appendChild(rect2);
|
|
@@ -6472,7 +6483,7 @@ var RoughJsRenderer = (
|
|
|
6472
6483
|
});
|
|
6473
6484
|
};
|
|
6474
6485
|
RoughJsRenderer2.prototype.arc = function(x2, y2, width2, height2, direction, strokeWidth, strokeColor, classes2, fill) {
|
|
6475
|
-
var
|
|
6486
|
+
var _a12;
|
|
6476
6487
|
var path = Renderer.arcBarrePath(x2, y2, width2, height2, direction);
|
|
6477
6488
|
var arc = this.rc.path(path, {
|
|
6478
6489
|
fill: fill || "none",
|
|
@@ -6480,14 +6491,14 @@ var RoughJsRenderer = (
|
|
|
6480
6491
|
stroke: strokeColor || fill || "none",
|
|
6481
6492
|
roughness: 1.5
|
|
6482
6493
|
});
|
|
6483
|
-
(
|
|
6494
|
+
(_a12 = arc.classList).add.apply(_a12, __spreadArray([], __read(RoughJsRenderer2.toClassArray(classes2)), false));
|
|
6484
6495
|
this.svgNode.appendChild(arc);
|
|
6485
6496
|
return RoughJsRenderer2.boxToElement(arc.getBBox(), function() {
|
|
6486
6497
|
return arc.remove();
|
|
6487
6498
|
});
|
|
6488
6499
|
};
|
|
6489
6500
|
RoughJsRenderer2.prototype.triangle = function(x2, y2, size2, strokeWidth, strokeColor, classes2, fill) {
|
|
6490
|
-
var
|
|
6501
|
+
var _a12;
|
|
6491
6502
|
var triangle = this.rc.path(Renderer.trianglePath(0, 0, size2), {
|
|
6492
6503
|
fill: fill || "none",
|
|
6493
6504
|
fillWeight: 2.5,
|
|
@@ -6495,14 +6506,14 @@ var RoughJsRenderer = (
|
|
|
6495
6506
|
roughness: 1.5
|
|
6496
6507
|
});
|
|
6497
6508
|
triangle.setAttribute("transform", "translate(".concat(x2, ", ").concat(y2, ")"));
|
|
6498
|
-
(
|
|
6509
|
+
(_a12 = triangle.classList).add.apply(_a12, __spreadArray([], __read(RoughJsRenderer2.toClassArray(classes2)), false));
|
|
6499
6510
|
this.svgNode.appendChild(triangle);
|
|
6500
6511
|
return RoughJsRenderer2.boxToElement(triangle.getBBox(), function() {
|
|
6501
6512
|
return triangle.remove();
|
|
6502
6513
|
});
|
|
6503
6514
|
};
|
|
6504
6515
|
RoughJsRenderer2.prototype.pentagon = function(x2, y2, size2, strokeWidth, strokeColor, fill, classes2, spikes) {
|
|
6505
|
-
var
|
|
6516
|
+
var _a12;
|
|
6506
6517
|
if (spikes === void 0) {
|
|
6507
6518
|
spikes = 5;
|
|
6508
6519
|
}
|
|
@@ -6513,7 +6524,7 @@ var RoughJsRenderer = (
|
|
|
6513
6524
|
roughness: 1.5
|
|
6514
6525
|
});
|
|
6515
6526
|
pentagon.setAttribute("transform", "translate(".concat(x2, ", ").concat(y2, ")"));
|
|
6516
|
-
(
|
|
6527
|
+
(_a12 = pentagon.classList).add.apply(_a12, __spreadArray([], __read(RoughJsRenderer2.toClassArray(classes2)), false));
|
|
6517
6528
|
this.svgNode.appendChild(pentagon);
|
|
6518
6529
|
return RoughJsRenderer2.boxToElement(pentagon.getBBox(), function() {
|
|
6519
6530
|
return pentagon.remove();
|
|
@@ -6530,7 +6541,7 @@ var RoughJsRenderer = (
|
|
|
6530
6541
|
this.svgNode.insertBefore(bg, this.svgNode.firstChild);
|
|
6531
6542
|
};
|
|
6532
6543
|
RoughJsRenderer2.prototype.text = function(text, x2, y2, fontSize, color, fontFamily, alignment, classes2, plain2) {
|
|
6533
|
-
var
|
|
6544
|
+
var _a12;
|
|
6534
6545
|
var txtElem = document.createElementNS("http://www.w3.org/2000/svg", "text");
|
|
6535
6546
|
txtElem.setAttributeNS(null, "x", String(x2));
|
|
6536
6547
|
txtElem.setAttributeNS(null, "y", String(y2));
|
|
@@ -6558,15 +6569,15 @@ var RoughJsRenderer = (
|
|
|
6558
6569
|
default:
|
|
6559
6570
|
throw new Error("Invalid alignment ".concat(alignment));
|
|
6560
6571
|
}
|
|
6561
|
-
(
|
|
6572
|
+
(_a12 = txtElem.classList).add.apply(_a12, __spreadArray([], __read(RoughJsRenderer2.toClassArray(classes2)), false));
|
|
6562
6573
|
txtElem.setAttributeNS(null, "x", String(x2 + xOffset));
|
|
6563
6574
|
txtElem.setAttributeNS(null, "y", String(y2 + (plain2 ? 0 : bbox2.height / 2)));
|
|
6564
6575
|
return RoughJsRenderer2.boxToElement(txtElem.getBBox(), txtElem.remove.bind(txtElem));
|
|
6565
6576
|
};
|
|
6566
6577
|
RoughJsRenderer2.boxToElement = function(box, remove) {
|
|
6567
|
-
var
|
|
6578
|
+
var _a12, _b, _c, _d;
|
|
6568
6579
|
return {
|
|
6569
|
-
width: (
|
|
6580
|
+
width: (_a12 = box.width) !== null && _a12 !== void 0 ? _a12 : 0,
|
|
6570
6581
|
height: (_b = box.height) !== null && _b !== void 0 ? _b : 0,
|
|
6571
6582
|
x: (_c = box.x) !== null && _c !== void 0 ? _c : 0,
|
|
6572
6583
|
y: (_d = box.y) !== null && _d !== void 0 ? _d : 0,
|
|
@@ -6801,23 +6812,23 @@ var SVGuitarChord = (
|
|
|
6801
6812
|
});
|
|
6802
6813
|
}
|
|
6803
6814
|
SVGuitarChord2.plugin = function(plugin) {
|
|
6804
|
-
var
|
|
6815
|
+
var _a12;
|
|
6805
6816
|
var currentPlugins = this.plugins;
|
|
6806
|
-
var BaseWithPlugins = (
|
|
6817
|
+
var BaseWithPlugins = (_a12 = /** @class */
|
|
6807
6818
|
(function(_super) {
|
|
6808
6819
|
__extends(class_1, _super);
|
|
6809
6820
|
function class_1() {
|
|
6810
6821
|
return _super !== null && _super.apply(this, arguments) || this;
|
|
6811
6822
|
}
|
|
6812
6823
|
return class_1;
|
|
6813
|
-
})(this),
|
|
6824
|
+
})(this), _a12.plugins = currentPlugins.concat(plugin), _a12);
|
|
6814
6825
|
return BaseWithPlugins;
|
|
6815
6826
|
};
|
|
6816
6827
|
Object.defineProperty(SVGuitarChord2.prototype, "renderer", {
|
|
6817
6828
|
get: function() {
|
|
6818
|
-
var
|
|
6829
|
+
var _a12;
|
|
6819
6830
|
if (!this.rendererInternal) {
|
|
6820
|
-
var style = (
|
|
6831
|
+
var style = (_a12 = this.settings.style) !== null && _a12 !== void 0 ? _a12 : defaultSettings.style;
|
|
6821
6832
|
switch (style) {
|
|
6822
6833
|
case ChordStyle.normal:
|
|
6823
6834
|
this.rendererInternal = new SvgJsRenderer(this.container);
|
|
@@ -6848,14 +6859,14 @@ var SVGuitarChord = (
|
|
|
6848
6859
|
return this;
|
|
6849
6860
|
};
|
|
6850
6861
|
SVGuitarChord2.prototype.draw = function() {
|
|
6851
|
-
var
|
|
6862
|
+
var _a12;
|
|
6852
6863
|
this.clear();
|
|
6853
6864
|
this.drawBackground();
|
|
6854
6865
|
if (this.settings.svgTitle) {
|
|
6855
6866
|
this.renderer.title(this.settings.svgTitle);
|
|
6856
6867
|
}
|
|
6857
6868
|
var y2;
|
|
6858
|
-
y2 = this.drawTitle((
|
|
6869
|
+
y2 = this.drawTitle((_a12 = this.settings.titleFontSize) !== null && _a12 !== void 0 ? _a12 : defaultSettings.titleFontSize);
|
|
6859
6870
|
y2 = this.drawEmptyStringIndicators(y2);
|
|
6860
6871
|
y2 = this.drawTopFret(y2);
|
|
6861
6872
|
this.drawPosition(y2);
|
|
@@ -6897,11 +6908,11 @@ var SVGuitarChord = (
|
|
|
6897
6908
|
};
|
|
6898
6909
|
SVGuitarChord2.prototype.drawTunings = function(y2) {
|
|
6899
6910
|
var _this = this;
|
|
6900
|
-
var
|
|
6911
|
+
var _a12, _b, _c, _d, _e;
|
|
6901
6912
|
var padding = this.fretSpacing() / 5;
|
|
6902
6913
|
var stringXPositions = this.stringXPos();
|
|
6903
6914
|
var strings = this.numStrings();
|
|
6904
|
-
var color = (_b = (
|
|
6915
|
+
var color = (_b = (_a12 = this.settings.tuningsColor) !== null && _a12 !== void 0 ? _a12 : this.settings.color) !== null && _b !== void 0 ? _b : defaultSettings.color;
|
|
6905
6916
|
var tuning = (_c = this.settings.tuning) !== null && _c !== void 0 ? _c : defaultSettings.tuning;
|
|
6906
6917
|
var fontFamily = (_d = this.settings.fontFamily) !== null && _d !== void 0 ? _d : defaultSettings.fontFamily;
|
|
6907
6918
|
var tuningsFontSize = (_e = this.settings.tuningsFontSize) !== null && _e !== void 0 ? _e : defaultSettings.tuningsFontSize;
|
|
@@ -6909,7 +6920,7 @@ var SVGuitarChord = (
|
|
|
6909
6920
|
tuning.forEach(function(tuning_, i2) {
|
|
6910
6921
|
if (i2 < strings) {
|
|
6911
6922
|
var classNames = [ElementType.TUNING, "".concat(ElementType.TUNING, "-").concat(i2)];
|
|
6912
|
-
var
|
|
6923
|
+
var _a13 = _this.coordinates(stringXPositions[i2], y2 + padding), textX = _a13.x, textY = _a13.y;
|
|
6913
6924
|
var tuningText = _this.renderer.text(tuning_, textX, textY, tuningsFontSize, color, fontFamily, Alignment.MIDDLE, classNames, true);
|
|
6914
6925
|
if (tuning_) {
|
|
6915
6926
|
text = tuningText;
|
|
@@ -6922,12 +6933,12 @@ var SVGuitarChord = (
|
|
|
6922
6933
|
return y2;
|
|
6923
6934
|
};
|
|
6924
6935
|
SVGuitarChord2.prototype.drawWatermark = function(y2) {
|
|
6925
|
-
var
|
|
6936
|
+
var _a12, _b, _c, _d, _e, _f;
|
|
6926
6937
|
if (!this.settings.watermark) {
|
|
6927
6938
|
return y2;
|
|
6928
6939
|
}
|
|
6929
6940
|
var padding = this.fretSpacing() / 5;
|
|
6930
|
-
var orientation = (
|
|
6941
|
+
var orientation = (_a12 = this.settings.orientation) !== null && _a12 !== void 0 ? _a12 : defaultSettings.orientation;
|
|
6931
6942
|
var stringXPositions = this.stringXPos();
|
|
6932
6943
|
var endX = stringXPositions[stringXPositions.length - 1];
|
|
6933
6944
|
var startX = stringXPositions[0];
|
|
@@ -6950,8 +6961,8 @@ var SVGuitarChord = (
|
|
|
6950
6961
|
};
|
|
6951
6962
|
SVGuitarChord2.prototype.drawPosition = function(y2) {
|
|
6952
6963
|
var _this = this;
|
|
6953
|
-
var
|
|
6954
|
-
var position2 = (_b = (
|
|
6964
|
+
var _a12, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
6965
|
+
var position2 = (_b = (_a12 = this.chordInternal.position) !== null && _a12 !== void 0 ? _a12 : this.settings.position) !== null && _b !== void 0 ? _b : defaultSettings.position;
|
|
6955
6966
|
var noPosition = (_c = this.settings.noPosition) !== null && _c !== void 0 ? _c : defaultSettings.noPosition;
|
|
6956
6967
|
if (position2 <= 1 || noPosition) {
|
|
6957
6968
|
return;
|
|
@@ -6999,8 +7010,8 @@ var SVGuitarChord = (
|
|
|
6999
7010
|
this.renderer.text(text, textX, textY, size2, color, fontFamily, Alignment.MIDDLE, className, true);
|
|
7000
7011
|
};
|
|
7001
7012
|
SVGuitarChord2.prototype.drawTopEdges = function(y2) {
|
|
7002
|
-
var
|
|
7003
|
-
var orientation = (
|
|
7013
|
+
var _a12;
|
|
7014
|
+
var orientation = (_a12 = this.settings.orientation) !== null && _a12 !== void 0 ? _a12 : defaultSettings.orientation;
|
|
7004
7015
|
var xTopRight = orientation === Orientation.vertical ? constants.width : y2;
|
|
7005
7016
|
this.renderer.circle(0, 0, 0, 0, "transparent", "none", "top-left");
|
|
7006
7017
|
this.renderer.circle(xTopRight, 0, 0, 0, "transparent", "none", "top-right");
|
|
@@ -7011,20 +7022,20 @@ var SVGuitarChord = (
|
|
|
7011
7022
|
}
|
|
7012
7023
|
};
|
|
7013
7024
|
SVGuitarChord2.prototype.topFretSize = function() {
|
|
7014
|
-
var
|
|
7025
|
+
var _a12, _b, _c, _d, _e;
|
|
7015
7026
|
var strokeWidth = this.strokeWidth();
|
|
7016
|
-
var position2 = (_b = (
|
|
7027
|
+
var position2 = (_b = (_a12 = this.chordInternal.position) !== null && _a12 !== void 0 ? _a12 : this.settings.position) !== null && _b !== void 0 ? _b : defaultSettings.position;
|
|
7017
7028
|
var noPositon = (_c = this.settings.noPosition) !== null && _c !== void 0 ? _c : defaultSettings.noPosition;
|
|
7018
7029
|
var nutWidth = (_e = (_d = this.settings.nutWidth) !== null && _d !== void 0 ? _d : this.settings.nutWidth) !== null && _e !== void 0 ? _e : defaultSettings.nutWidth;
|
|
7019
7030
|
return position2 > 1 || noPositon ? strokeWidth : nutWidth;
|
|
7020
7031
|
};
|
|
7021
7032
|
SVGuitarChord2.prototype.drawTopFret = function(y2) {
|
|
7022
|
-
var
|
|
7033
|
+
var _a12, _b;
|
|
7023
7034
|
var strokeWidth = this.strokeWidth();
|
|
7024
7035
|
var stringXpositions = this.stringXPos();
|
|
7025
7036
|
var startX = stringXpositions[0] - strokeWidth / 2;
|
|
7026
7037
|
var endX = stringXpositions[stringXpositions.length - 1] + strokeWidth / 2;
|
|
7027
|
-
var color = (_b = (
|
|
7038
|
+
var color = (_b = (_a12 = this.settings.fretColor) !== null && _a12 !== void 0 ? _a12 : this.settings.color) !== null && _b !== void 0 ? _b : defaultSettings.color;
|
|
7028
7039
|
var fretSize = this.topFretSize();
|
|
7029
7040
|
var _c = this.coordinates(startX, y2 + fretSize / 2), lineX1 = _c.x, lineY1 = _c.y;
|
|
7030
7041
|
var _d = this.coordinates(endX, y2 + fretSize / 2), lineX2 = _d.x, lineY2 = _d.y;
|
|
@@ -7032,9 +7043,9 @@ var SVGuitarChord = (
|
|
|
7032
7043
|
return y2 + fretSize;
|
|
7033
7044
|
};
|
|
7034
7045
|
SVGuitarChord2.prototype.stringXPos = function() {
|
|
7035
|
-
var
|
|
7046
|
+
var _a12;
|
|
7036
7047
|
var strings = this.numStrings();
|
|
7037
|
-
var sidePadding = (
|
|
7048
|
+
var sidePadding = (_a12 = this.settings.sidePadding) !== null && _a12 !== void 0 ? _a12 : defaultSettings.sidePadding;
|
|
7038
7049
|
var startX = constants.width * sidePadding;
|
|
7039
7050
|
var stringsSpacing = this.stringSpacing();
|
|
7040
7051
|
return range(strings).map(function(i2) {
|
|
@@ -7042,16 +7053,16 @@ var SVGuitarChord = (
|
|
|
7042
7053
|
});
|
|
7043
7054
|
};
|
|
7044
7055
|
SVGuitarChord2.prototype.numStrings = function() {
|
|
7045
|
-
var
|
|
7046
|
-
return (
|
|
7056
|
+
var _a12;
|
|
7057
|
+
return (_a12 = this.settings.strings) !== null && _a12 !== void 0 ? _a12 : defaultSettings.strings;
|
|
7047
7058
|
};
|
|
7048
7059
|
SVGuitarChord2.prototype.numFrets = function() {
|
|
7049
|
-
var
|
|
7050
|
-
return (
|
|
7060
|
+
var _a12;
|
|
7061
|
+
return (_a12 = this.settings.frets) !== null && _a12 !== void 0 ? _a12 : defaultSettings.frets;
|
|
7051
7062
|
};
|
|
7052
7063
|
SVGuitarChord2.prototype.stringSpacing = function() {
|
|
7053
|
-
var
|
|
7054
|
-
var sidePadding = (
|
|
7064
|
+
var _a12;
|
|
7065
|
+
var sidePadding = (_a12 = this.settings.sidePadding) !== null && _a12 !== void 0 ? _a12 : defaultSettings.sidePadding;
|
|
7055
7066
|
var strings = this.numStrings();
|
|
7056
7067
|
var startX = constants.width * sidePadding;
|
|
7057
7068
|
var endX = constants.width - startX;
|
|
@@ -7059,21 +7070,21 @@ var SVGuitarChord = (
|
|
|
7059
7070
|
return width2 / (strings - 1);
|
|
7060
7071
|
};
|
|
7061
7072
|
SVGuitarChord2.prototype.fingerSize = function() {
|
|
7062
|
-
var
|
|
7063
|
-
var relativeFingerSize = (
|
|
7073
|
+
var _a12;
|
|
7074
|
+
var relativeFingerSize = (_a12 = this.settings.fingerSize) !== null && _a12 !== void 0 ? _a12 : defaultSettings.fingerSize;
|
|
7064
7075
|
return relativeFingerSize * this.stringSpacing();
|
|
7065
7076
|
};
|
|
7066
7077
|
SVGuitarChord2.prototype.arcBarHeight = function() {
|
|
7067
7078
|
return this.fingerSize() / 1.5;
|
|
7068
7079
|
};
|
|
7069
7080
|
SVGuitarChord2.prototype.strokeWidth = function() {
|
|
7070
|
-
var
|
|
7071
|
-
return (
|
|
7081
|
+
var _a12;
|
|
7082
|
+
return (_a12 = this.settings.strokeWidth) !== null && _a12 !== void 0 ? _a12 : defaultSettings.strokeWidth;
|
|
7072
7083
|
};
|
|
7073
7084
|
SVGuitarChord2.prototype.fretSpacing = function() {
|
|
7074
|
-
var
|
|
7085
|
+
var _a12;
|
|
7075
7086
|
var stringSpacing = this.stringSpacing();
|
|
7076
|
-
var fretSize = (
|
|
7087
|
+
var fretSize = (_a12 = this.settings.fretSize) !== null && _a12 !== void 0 ? _a12 : defaultSettings.fretSize;
|
|
7077
7088
|
return stringSpacing * fretSize;
|
|
7078
7089
|
};
|
|
7079
7090
|
SVGuitarChord2.prototype.fretLinesYPos = function(startY) {
|
|
@@ -7089,28 +7100,28 @@ var SVGuitarChord = (
|
|
|
7089
7100
|
};
|
|
7090
7101
|
SVGuitarChord2.prototype.drawEmptyStringIndicators = function(y2) {
|
|
7091
7102
|
var _this = this;
|
|
7092
|
-
var
|
|
7103
|
+
var _a12, _b, _c, _d, _e, _f;
|
|
7093
7104
|
var stringXPositions = this.stringXPos();
|
|
7094
7105
|
var stringSpacing = this.stringSpacing();
|
|
7095
|
-
var emptyStringIndicatorSize = (
|
|
7106
|
+
var emptyStringIndicatorSize = (_a12 = this.settings.emptyStringIndicatorSize) !== null && _a12 !== void 0 ? _a12 : defaultSettings.emptyStringIndicatorSize;
|
|
7096
7107
|
var size2 = emptyStringIndicatorSize * stringSpacing;
|
|
7097
7108
|
var padding = size2 / 3;
|
|
7098
7109
|
var color = (_b = this.settings.color) !== null && _b !== void 0 ? _b : defaultSettings.color;
|
|
7099
7110
|
var strokeWidth = (_c = this.settings.strokeWidth) !== null && _c !== void 0 ? _c : defaultSettings.strokeWidth;
|
|
7100
7111
|
var hasEmpty = false;
|
|
7101
|
-
this.chordInternal.fingers.filter(function(
|
|
7102
|
-
var _b2 = __read(
|
|
7112
|
+
this.chordInternal.fingers.filter(function(_a13) {
|
|
7113
|
+
var _b2 = __read(_a13, 2), value = _b2[1];
|
|
7103
7114
|
return value === SILENT || value === OPEN;
|
|
7104
|
-
}).map(function(
|
|
7105
|
-
var _b2 = __read(
|
|
7115
|
+
}).map(function(_a13) {
|
|
7116
|
+
var _b2 = __read(_a13, 3), index = _b2[0], value = _b2[1], textOrOptions = _b2[2];
|
|
7106
7117
|
return [
|
|
7107
7118
|
_this.toArrayIndex(index),
|
|
7108
7119
|
value,
|
|
7109
7120
|
textOrOptions
|
|
7110
7121
|
];
|
|
7111
|
-
}).forEach(function(
|
|
7122
|
+
}).forEach(function(_a13) {
|
|
7112
7123
|
var _b2, _c2, _d2, _e2, _f2, _g;
|
|
7113
|
-
var _h = __read(
|
|
7124
|
+
var _h = __read(_a13, 3), stringIndex = _h[0], value = _h[1], textOrOptions = _h[2];
|
|
7114
7125
|
hasEmpty = true;
|
|
7115
7126
|
var fingerOptions = SVGuitarChord2.getFingerOptions(textOrOptions);
|
|
7116
7127
|
var effectiveStrokeWidth = (_b2 = fingerOptions.strokeWidth) !== null && _b2 !== void 0 ? _b2 : strokeWidth;
|
|
@@ -7156,9 +7167,9 @@ var SVGuitarChord = (
|
|
|
7156
7167
|
};
|
|
7157
7168
|
SVGuitarChord2.prototype.drawGrid = function(y2) {
|
|
7158
7169
|
var _this = this;
|
|
7159
|
-
var
|
|
7170
|
+
var _a12, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
7160
7171
|
var frets = this.numFrets();
|
|
7161
|
-
var fretSize = (
|
|
7172
|
+
var fretSize = (_a12 = this.settings.fretSize) !== null && _a12 !== void 0 ? _a12 : defaultSettings.fretSize;
|
|
7162
7173
|
var relativeFingerSize = (_b = this.settings.fingerSize) !== null && _b !== void 0 ? _b : defaultSettings.fingerSize;
|
|
7163
7174
|
var stringXPositions = this.stringXPos();
|
|
7164
7175
|
var fretYPositions = this.fretLinesYPos(y2);
|
|
@@ -7177,19 +7188,19 @@ var SVGuitarChord = (
|
|
|
7177
7188
|
var fingerTextSize = (_k = this.settings.fingerTextSize) !== null && _k !== void 0 ? _k : defaultSettings.fingerTextSize;
|
|
7178
7189
|
fretYPositions.forEach(function(fretY, i2) {
|
|
7179
7190
|
var classNames = [ElementType.FRET, "".concat(ElementType.FRET, "-").concat(i2)];
|
|
7180
|
-
var
|
|
7191
|
+
var _a13 = _this.coordinates(startX, fretY), lineX1 = _a13.x, lineY1 = _a13.y;
|
|
7181
7192
|
var _b2 = _this.coordinates(endX, fretY), lineX2 = _b2.x, lineY2 = _b2.y;
|
|
7182
7193
|
_this.renderer.line(lineX1, lineY1, lineX2, lineY2, strokeWidth, fretColor, classNames);
|
|
7183
7194
|
});
|
|
7184
7195
|
stringXPositions.forEach(function(stringX, i2) {
|
|
7185
7196
|
var classNames = [ElementType.STRING, "".concat(ElementType.STRING, "-").concat(i2)];
|
|
7186
|
-
var
|
|
7197
|
+
var _a13 = _this.coordinates(stringX, y2), lineX1 = _a13.x, lineY1 = _a13.y;
|
|
7187
7198
|
var _b2 = _this.coordinates(stringX, y2 + height2 + strokeWidth / 2), lineX2 = _b2.x, lineY2 = _b2.y;
|
|
7188
7199
|
_this.renderer.line(lineX1, lineY1, lineX2, lineY2, strokeWidth, fretColor, classNames);
|
|
7189
7200
|
});
|
|
7190
|
-
this.chordInternal.barres.forEach(function(
|
|
7201
|
+
this.chordInternal.barres.forEach(function(_a13) {
|
|
7191
7202
|
var _b2, _c2, _d2, _e2, _f2, _g2;
|
|
7192
|
-
var fret =
|
|
7203
|
+
var fret = _a13.fret, fromString = _a13.fromString, toString = _a13.toString, style = _a13.style, text = _a13.text, color = _a13.color, textColor = _a13.textColor, strokeColor = _a13.strokeColor, className = _a13.className, individualBarreChordStrokeWidth = _a13.strokeWidth;
|
|
7193
7204
|
var barreCenterY = fretYPositions[fret - 1] - strokeWidth / 4 - fretSpacing / 2;
|
|
7194
7205
|
var fromStringX = stringXPositions[_this.toArrayIndex(fromString)];
|
|
7195
7206
|
var distance = Math.abs(toString - fromString) * stringSpacing;
|
|
@@ -7221,18 +7232,18 @@ var SVGuitarChord = (
|
|
|
7221
7232
|
_this.renderer.text(text, textX, textY, fingerTextSize, textColor !== null && textColor !== void 0 ? textColor : fingerTextColor, fontFamily, Alignment.MIDDLE, textClassNames, true);
|
|
7222
7233
|
}
|
|
7223
7234
|
});
|
|
7224
|
-
this.chordInternal.fingers.filter(function(
|
|
7225
|
-
var _b2 = __read(
|
|
7235
|
+
this.chordInternal.fingers.filter(function(_a13) {
|
|
7236
|
+
var _b2 = __read(_a13, 2), value = _b2[1];
|
|
7226
7237
|
return value !== SILENT && value !== OPEN;
|
|
7227
|
-
}).map(function(
|
|
7228
|
-
var _b2 = __read(
|
|
7238
|
+
}).map(function(_a13) {
|
|
7239
|
+
var _b2 = __read(_a13, 3), stringIndex = _b2[0], fretIndex = _b2[1], text = _b2[2];
|
|
7229
7240
|
return [
|
|
7230
7241
|
_this.toArrayIndex(stringIndex),
|
|
7231
7242
|
fretIndex,
|
|
7232
7243
|
text
|
|
7233
7244
|
];
|
|
7234
|
-
}).forEach(function(
|
|
7235
|
-
var _b2 = __read(
|
|
7245
|
+
}).forEach(function(_a13) {
|
|
7246
|
+
var _b2 = __read(_a13, 3), stringIndex = _b2[0], fretIndex = _b2[1], textOrOptions = _b2[2];
|
|
7236
7247
|
var fingerCenterX = startX + stringIndex * stringSpacing;
|
|
7237
7248
|
var fingerCenterY = y2 + fretIndex * fretSpacing - fretSpacing / 2;
|
|
7238
7249
|
var fingerOptions = SVGuitarChord2.getFingerOptions(textOrOptions);
|
|
@@ -7246,7 +7257,7 @@ var SVGuitarChord = (
|
|
|
7246
7257
|
});
|
|
7247
7258
|
if ((_l = this.settings.showFretMarkers) !== null && _l !== void 0 ? _l : defaultSettings.showFretMarkers) {
|
|
7248
7259
|
(_m = this.settings.fretMarkers) === null || _m === void 0 ? void 0 : _m.forEach(function(fretMarker) {
|
|
7249
|
-
var
|
|
7260
|
+
var _a13, _b2, _c2, _d2, _e2;
|
|
7250
7261
|
var fretMarkerOptions = typeof fretMarker == "number" ? {
|
|
7251
7262
|
fret: fretMarker
|
|
7252
7263
|
} : fretMarker;
|
|
@@ -7256,7 +7267,7 @@ var SVGuitarChord = (
|
|
|
7256
7267
|
var fretMarkerIndex = fretMarkerOptions.fret;
|
|
7257
7268
|
var fretMarkerCenterX = constants.width / 2;
|
|
7258
7269
|
var fretMarkerCenterY = y2 + (fretMarkerIndex + 1) * fretSpacing - fretSpacing / 2;
|
|
7259
|
-
var fretMarkerSize = (
|
|
7270
|
+
var fretMarkerSize = (_a13 = _this.settings.fretMarkerSize) !== null && _a13 !== void 0 ? _a13 : defaultSettings.fretMarkerSize;
|
|
7260
7271
|
var fretMarkerColor = (_b2 = _this.settings.fretMarkerColor) !== null && _b2 !== void 0 ? _b2 : defaultSettings.fretMarkerColor;
|
|
7261
7272
|
var classNames = __spreadArray([
|
|
7262
7273
|
ElementType.FRET_MARKER,
|
|
@@ -7277,9 +7288,9 @@ var SVGuitarChord = (
|
|
|
7277
7288
|
return y2 + height2;
|
|
7278
7289
|
};
|
|
7279
7290
|
SVGuitarChord2.prototype.drawFretMarker = function(x2, y2, size2, color, fretMarketOptions, classNames) {
|
|
7280
|
-
var
|
|
7291
|
+
var _a12, _b, _c, _d, _e, _f, _g, _h;
|
|
7281
7292
|
var markerOptions = typeof fretMarketOptions === "number" ? { fret: fretMarketOptions } : fretMarketOptions;
|
|
7282
|
-
var shape = (
|
|
7293
|
+
var shape = (_a12 = markerOptions.shape) !== null && _a12 !== void 0 ? _a12 : defaultSettings.fretMarkerShape;
|
|
7283
7294
|
var fretMarkerColor = (_c = (_b = markerOptions.color) !== null && _b !== void 0 ? _b : this.settings.fretMarkerColor) !== null && _c !== void 0 ? _c : defaultSettings.fretMarkerColor;
|
|
7284
7295
|
var fretMarkerStrokeColor = (_e = (_d = markerOptions.strokeColor) !== null && _d !== void 0 ? _d : this.settings.fretMarkerStrokeColor) !== null && _e !== void 0 ? _e : color;
|
|
7285
7296
|
var fretMarkerStrokeWidth = (_g = (_f = markerOptions.strokeWidth) !== null && _f !== void 0 ? _f : this.settings.fretMarkerStrokeWidth) !== null && _g !== void 0 ? _g : 0;
|
|
@@ -7291,8 +7302,8 @@ var SVGuitarChord = (
|
|
|
7291
7302
|
this.drawShape(shape, x0, y0, fretMarkerSize, fretMarkerStrokeWidth, fretMarkerStrokeColor, fretMarkerColor !== null && fretMarkerColor !== void 0 ? fretMarkerColor : color, classNamesWithShape);
|
|
7292
7303
|
};
|
|
7293
7304
|
SVGuitarChord2.prototype.drawFinger = function(x2, y2, size2, color, textSize, fontFamily, fingerOptions, classNames) {
|
|
7294
|
-
var
|
|
7295
|
-
var shape = (
|
|
7305
|
+
var _a12, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
7306
|
+
var shape = (_a12 = fingerOptions.shape) !== null && _a12 !== void 0 ? _a12 : defaultSettings.shape;
|
|
7296
7307
|
var fingerTextColor = (_c = (_b = fingerOptions.textColor) !== null && _b !== void 0 ? _b : this.settings.fingerTextColor) !== null && _c !== void 0 ? _c : defaultSettings.fingerTextColor;
|
|
7297
7308
|
var fingerStrokeColor = (_g = (_f = (_e = (_d = fingerOptions.strokeColor) !== null && _d !== void 0 ? _d : this.settings.fingerStrokeColor) !== null && _e !== void 0 ? _e : this.settings.fingerColor) !== null && _f !== void 0 ? _f : this.settings.color) !== null && _g !== void 0 ? _g : defaultSettings.color;
|
|
7298
7309
|
var fingerStrokeWidth = (_j = (_h = fingerOptions.strokeWidth) !== null && _h !== void 0 ? _h : this.settings.fingerStrokeWidth) !== null && _j !== void 0 ? _j : defaultSettings.fingerStrokeWidth;
|
|
@@ -7328,8 +7339,8 @@ var SVGuitarChord = (
|
|
|
7328
7339
|
}
|
|
7329
7340
|
};
|
|
7330
7341
|
SVGuitarChord2.prototype.drawTitle = function(size2) {
|
|
7331
|
-
var
|
|
7332
|
-
var color = (
|
|
7342
|
+
var _a12, _b, _c, _d, _e;
|
|
7343
|
+
var color = (_a12 = this.settings.color) !== null && _a12 !== void 0 ? _a12 : defaultSettings.color;
|
|
7333
7344
|
var titleBottomMargin = (_b = this.settings.titleBottomMargin) !== null && _b !== void 0 ? _b : defaultSettings.titleBottomMargin;
|
|
7334
7345
|
var fontFamily = (_c = this.settings.fontFamily) !== null && _c !== void 0 ? _c : defaultSettings.fontFamily;
|
|
7335
7346
|
var title = (_e = (_d = this.chordInternal.title) !== null && _d !== void 0 ? _d : this.settings.title) !== null && _e !== void 0 ? _e : this.settings.fixedDiagramPosition ? "X" : "";
|
|
@@ -7406,8 +7417,8 @@ var SVGuitarChord = (
|
|
|
7406
7417
|
};
|
|
7407
7418
|
Object.defineProperty(SVGuitarChord2.prototype, "orientation", {
|
|
7408
7419
|
get: function() {
|
|
7409
|
-
var
|
|
7410
|
-
return (
|
|
7420
|
+
var _a12;
|
|
7421
|
+
return (_a12 = this.settings.orientation) !== null && _a12 !== void 0 ? _a12 : defaultSettings.orientation;
|
|
7411
7422
|
},
|
|
7412
7423
|
enumerable: false,
|
|
7413
7424
|
configurable: true
|
|
@@ -7420,7 +7431,9 @@ var SVGuitarChord = (
|
|
|
7420
7431
|
// lib/editableSVGuitar.js
|
|
7421
7432
|
var DOT_COLORS = {
|
|
7422
7433
|
RED: "#e74c3c",
|
|
7423
|
-
BLACK: "#000000"
|
|
7434
|
+
BLACK: "#000000",
|
|
7435
|
+
GREY: "#9B9B9B",
|
|
7436
|
+
BLUE: "#4A90E2"
|
|
7424
7437
|
};
|
|
7425
7438
|
var EditableSVGuitarChord = class {
|
|
7426
7439
|
/**
|
|
@@ -7491,7 +7504,7 @@ var EditableSVGuitarChord = class {
|
|
|
7491
7504
|
padding: 20px;
|
|
7492
7505
|
box-shadow: 0 4px 20px rgba(0,0,0,0.3);
|
|
7493
7506
|
z-index: 1000;
|
|
7494
|
-
min-width:
|
|
7507
|
+
min-width: 220px;
|
|
7495
7508
|
`;
|
|
7496
7509
|
const title = document.createElement("h3");
|
|
7497
7510
|
title.textContent = "Chord Settings";
|
|
@@ -7499,28 +7512,32 @@ var EditableSVGuitarChord = class {
|
|
|
7499
7512
|
const titleSection = document.createElement("div");
|
|
7500
7513
|
titleSection.style.cssText = "margin-bottom: 15px;";
|
|
7501
7514
|
const titleLabel = document.createElement("label");
|
|
7502
|
-
titleLabel.textContent = "Title
|
|
7503
|
-
titleLabel.
|
|
7515
|
+
titleLabel.textContent = "Title: ";
|
|
7516
|
+
titleLabel.htmlFor = "editable-svguitar-title-input";
|
|
7517
|
+
titleLabel.style.cssText = "display: inline-block; margin-bottom: 5px; font-weight: bold; width: 80px;";
|
|
7504
7518
|
this.titleInput = document.createElement("input");
|
|
7519
|
+
this.titleInput.id = "editable-svguitar-title-input";
|
|
7505
7520
|
this.titleInput.type = "text";
|
|
7506
7521
|
this.titleInput.placeholder = "e.g. A min";
|
|
7507
7522
|
this.titleInput.maxLength = 10;
|
|
7508
7523
|
this.titleInput.style.cssText = "width: 10em; padding: 6px; border: 1px solid #ccc; border-radius: 3px; box-sizing: border-box;";
|
|
7509
|
-
titleLabel.appendChild(this.titleInput);
|
|
7510
7524
|
titleSection.appendChild(titleLabel);
|
|
7525
|
+
titleSection.appendChild(this.titleInput);
|
|
7511
7526
|
const positionSection = document.createElement("div");
|
|
7512
7527
|
positionSection.style.cssText = "margin-bottom: 15px;";
|
|
7513
7528
|
const positionLabel = document.createElement("label");
|
|
7514
|
-
positionLabel.textContent = "Position
|
|
7515
|
-
positionLabel.
|
|
7529
|
+
positionLabel.textContent = "Position: ";
|
|
7530
|
+
positionLabel.htmlFor = "editable-svguitar-position-input";
|
|
7531
|
+
positionLabel.style.cssText = "display: inline-block; margin-bottom: 5px; font-weight: bold; width: 80px;";
|
|
7516
7532
|
this.positionInput = document.createElement("input");
|
|
7533
|
+
this.positionInput.id = "editable-svguitar-position-input";
|
|
7517
7534
|
this.positionInput.type = "number";
|
|
7518
7535
|
this.positionInput.min = "1";
|
|
7519
7536
|
this.positionInput.max = "30";
|
|
7520
7537
|
this.positionInput.placeholder = "1-30";
|
|
7521
7538
|
this.positionInput.style.cssText = "width: 5em; padding: 6px; border: 1px solid #ccc; border-radius: 3px; box-sizing: border-box;";
|
|
7522
|
-
positionLabel.appendChild(this.positionInput);
|
|
7523
7539
|
positionSection.appendChild(positionLabel);
|
|
7540
|
+
positionSection.appendChild(this.positionInput);
|
|
7524
7541
|
const buttonDiv = document.createElement("div");
|
|
7525
7542
|
buttonDiv.style.cssText = "display: flex; gap: 10px; justify-content: flex-end;";
|
|
7526
7543
|
const cancelBtn = document.createElement("button");
|
|
@@ -7568,60 +7585,82 @@ var EditableSVGuitarChord = class {
|
|
|
7568
7585
|
padding: 20px;
|
|
7569
7586
|
box-shadow: 0 4px 20px rgba(0,0,0,0.3);
|
|
7570
7587
|
z-index: 1000;
|
|
7571
|
-
min-width:
|
|
7588
|
+
min-width: 200px;
|
|
7572
7589
|
`;
|
|
7573
7590
|
const title = document.createElement("h3");
|
|
7574
7591
|
title.textContent = "Edit Dot";
|
|
7575
7592
|
title.style.cssText = "margin: 0 0 15px 0; font-size: 16px;";
|
|
7576
7593
|
const colorSection = document.createElement("div");
|
|
7577
7594
|
colorSection.style.cssText = "margin-bottom: 15px;";
|
|
7578
|
-
const colorLabel = document.createElement("div");
|
|
7579
|
-
colorLabel.textContent = "Color:";
|
|
7580
|
-
colorLabel.style.cssText = "font-weight: bold; margin-bottom: 8px;";
|
|
7581
|
-
colorSection.appendChild(colorLabel);
|
|
7582
7595
|
const colorOptions = document.createElement("div");
|
|
7583
|
-
colorOptions.style.cssText = "display: flex; gap:
|
|
7596
|
+
colorOptions.style.cssText = "display: flex; gap: 8px; align-items: center;";
|
|
7597
|
+
const hiddenRadioStyle = "position:absolute;opacity:0;width:0;height:0;";
|
|
7598
|
+
const swatchStyle = (color) => `width:28px;height:28px;display:block;background:${color};border-radius:3px;cursor:pointer;box-sizing:border-box;`;
|
|
7584
7599
|
const redOption = document.createElement("label");
|
|
7585
|
-
redOption.style.cssText = "display:
|
|
7600
|
+
redOption.style.cssText = "display:inline-block;position:relative;cursor:pointer;";
|
|
7586
7601
|
this.redRadio = document.createElement("input");
|
|
7587
7602
|
this.redRadio.type = "radio";
|
|
7588
7603
|
this.redRadio.name = "dotColor";
|
|
7589
7604
|
this.redRadio.value = DOT_COLORS.RED;
|
|
7605
|
+
this.redRadio.style.cssText = hiddenRadioStyle;
|
|
7590
7606
|
this.redRadio.addEventListener("change", () => this.updateDotColor());
|
|
7591
|
-
const
|
|
7592
|
-
|
|
7593
|
-
|
|
7607
|
+
const redSwatch = document.createElement("span");
|
|
7608
|
+
redSwatch.className = "color-swatch";
|
|
7609
|
+
redSwatch.style.cssText = swatchStyle(DOT_COLORS.RED);
|
|
7594
7610
|
redOption.appendChild(this.redRadio);
|
|
7595
|
-
redOption.appendChild(
|
|
7611
|
+
redOption.appendChild(redSwatch);
|
|
7612
|
+
const greyOption = document.createElement("label");
|
|
7613
|
+
greyOption.style.cssText = "display:inline-block;position:relative;cursor:pointer;";
|
|
7614
|
+
this.greyRadio = document.createElement("input");
|
|
7615
|
+
this.greyRadio.type = "radio";
|
|
7616
|
+
this.greyRadio.name = "dotColor";
|
|
7617
|
+
this.greyRadio.value = DOT_COLORS.GREY;
|
|
7618
|
+
this.greyRadio.style.cssText = hiddenRadioStyle;
|
|
7619
|
+
this.greyRadio.addEventListener("change", () => this.updateDotColor());
|
|
7620
|
+
const greySwatch = document.createElement("span");
|
|
7621
|
+
greySwatch.className = "color-swatch";
|
|
7622
|
+
greySwatch.style.cssText = swatchStyle(DOT_COLORS.GREY);
|
|
7623
|
+
greyOption.appendChild(this.greyRadio);
|
|
7624
|
+
greyOption.appendChild(greySwatch);
|
|
7625
|
+
const blueOption = document.createElement("label");
|
|
7626
|
+
blueOption.style.cssText = "display:inline-block;position:relative;cursor:pointer;";
|
|
7627
|
+
this.blueRadio = document.createElement("input");
|
|
7628
|
+
this.blueRadio.type = "radio";
|
|
7629
|
+
this.blueRadio.name = "dotColor";
|
|
7630
|
+
this.blueRadio.value = DOT_COLORS.BLUE;
|
|
7631
|
+
this.blueRadio.style.cssText = hiddenRadioStyle;
|
|
7632
|
+
this.blueRadio.addEventListener("change", () => this.updateDotColor());
|
|
7633
|
+
const blueSwatch = document.createElement("span");
|
|
7634
|
+
blueSwatch.className = "color-swatch";
|
|
7635
|
+
blueSwatch.style.cssText = swatchStyle(DOT_COLORS.BLUE);
|
|
7636
|
+
blueOption.appendChild(this.blueRadio);
|
|
7637
|
+
blueOption.appendChild(blueSwatch);
|
|
7596
7638
|
const blackOption = document.createElement("label");
|
|
7597
|
-
blackOption.style.cssText = "display:
|
|
7639
|
+
blackOption.style.cssText = "display:inline-block;position:relative;cursor:pointer;";
|
|
7598
7640
|
this.blackRadio = document.createElement("input");
|
|
7599
7641
|
this.blackRadio.type = "radio";
|
|
7600
7642
|
this.blackRadio.name = "dotColor";
|
|
7601
7643
|
this.blackRadio.value = DOT_COLORS.BLACK;
|
|
7602
7644
|
this.blackRadio.checked = true;
|
|
7645
|
+
this.blackRadio.style.cssText = hiddenRadioStyle;
|
|
7603
7646
|
this.blackRadio.addEventListener("change", () => this.updateDotColor());
|
|
7604
|
-
const
|
|
7605
|
-
|
|
7606
|
-
|
|
7647
|
+
const blackSwatch = document.createElement("span");
|
|
7648
|
+
blackSwatch.className = "color-swatch";
|
|
7649
|
+
blackSwatch.style.cssText = swatchStyle(DOT_COLORS.BLACK);
|
|
7607
7650
|
blackOption.appendChild(this.blackRadio);
|
|
7608
|
-
blackOption.appendChild(
|
|
7651
|
+
blackOption.appendChild(blackSwatch);
|
|
7609
7652
|
colorOptions.appendChild(redOption);
|
|
7653
|
+
colorOptions.appendChild(greyOption);
|
|
7654
|
+
colorOptions.appendChild(blueOption);
|
|
7610
7655
|
colorOptions.appendChild(blackOption);
|
|
7611
|
-
colorSection.appendChild(colorOptions);
|
|
7612
|
-
this.textSection = document.createElement("div");
|
|
7613
|
-
this.textSection.style.cssText = "margin-bottom: 15px;";
|
|
7614
|
-
const textLabel = document.createElement("label");
|
|
7615
|
-
textLabel.textContent = "Text (optional): ";
|
|
7616
|
-
textLabel.style.cssText = "display: block; margin-bottom: 5px; font-weight: bold;";
|
|
7617
7656
|
this.textInput = document.createElement("input");
|
|
7618
7657
|
this.textInput.type = "text";
|
|
7619
|
-
this.textInput.maxLength =
|
|
7620
|
-
this.textInput.placeholder = "
|
|
7621
|
-
this.textInput.style.cssText = "width:
|
|
7658
|
+
this.textInput.maxLength = 1;
|
|
7659
|
+
this.textInput.placeholder = "Aa";
|
|
7660
|
+
this.textInput.style.cssText = "width:32px;height:28px;padding:0 4px;margin-left:4px;border:1px solid #ccc;border-radius:3px;box-sizing:border-box;";
|
|
7622
7661
|
this.textInput.addEventListener("input", () => this.updateDotText());
|
|
7623
|
-
|
|
7624
|
-
|
|
7662
|
+
colorOptions.appendChild(this.textInput);
|
|
7663
|
+
colorSection.appendChild(colorOptions);
|
|
7625
7664
|
const buttonDiv = document.createElement("div");
|
|
7626
7665
|
buttonDiv.style.cssText = "display: flex; gap: 10px; justify-content: flex-end;";
|
|
7627
7666
|
const removeBtn = document.createElement("button");
|
|
@@ -7636,7 +7675,6 @@ var EditableSVGuitarChord = class {
|
|
|
7636
7675
|
buttonDiv.appendChild(doneBtn);
|
|
7637
7676
|
this.dialog.appendChild(title);
|
|
7638
7677
|
this.dialog.appendChild(colorSection);
|
|
7639
|
-
this.dialog.appendChild(this.textSection);
|
|
7640
7678
|
this.dialog.appendChild(buttonDiv);
|
|
7641
7679
|
document.body.appendChild(this.dialog);
|
|
7642
7680
|
this.backdrop = document.createElement("div");
|
|
@@ -7670,60 +7708,59 @@ var EditableSVGuitarChord = class {
|
|
|
7670
7708
|
padding: 20px;
|
|
7671
7709
|
box-shadow: 0 4px 20px rgba(0,0,0,0.3);
|
|
7672
7710
|
z-index: 1000;
|
|
7673
|
-
min-width:
|
|
7711
|
+
min-width: 165px;
|
|
7674
7712
|
`;
|
|
7675
7713
|
const title = document.createElement("h3");
|
|
7676
7714
|
title.textContent = "Edit Open String";
|
|
7677
7715
|
title.style.cssText = "margin: 0 0 15px 0; font-size: 16px;";
|
|
7678
7716
|
const typeSection = document.createElement("div");
|
|
7679
7717
|
typeSection.style.cssText = "margin-bottom: 15px;";
|
|
7680
|
-
const typeLabel = document.createElement("div");
|
|
7681
|
-
typeLabel.textContent = "Type:";
|
|
7682
|
-
typeLabel.style.cssText = "font-weight: bold; margin-bottom: 8px;";
|
|
7683
|
-
typeSection.appendChild(typeLabel);
|
|
7684
7718
|
const typeOptions = document.createElement("div");
|
|
7685
|
-
typeOptions.style.cssText = "display: flex; gap:
|
|
7719
|
+
typeOptions.style.cssText = "display: flex; gap: 8px; align-items: center;";
|
|
7720
|
+
const hiddenRadioStyle = "position:absolute;opacity:0;width:0;height:0;";
|
|
7721
|
+
const openStringSwatchStyle = "width:28px;height:28px;display:flex;align-items:center;justify-content:center;background:#fff;border:1px solid #ccc;border-radius:3px;cursor:pointer;box-sizing:border-box;font-size:16px;font-weight:bold;user-select:none;";
|
|
7722
|
+
const mutedOption = document.createElement("label");
|
|
7723
|
+
mutedOption.style.cssText = "display:inline-block;position:relative;cursor:pointer;";
|
|
7724
|
+
this.mutedRadio = document.createElement("input");
|
|
7725
|
+
this.mutedRadio.type = "radio";
|
|
7726
|
+
this.mutedRadio.name = "openStringType";
|
|
7727
|
+
this.mutedRadio.value = "x";
|
|
7728
|
+
this.mutedRadio.style.cssText = hiddenRadioStyle;
|
|
7729
|
+
this.mutedRadio.addEventListener("change", () => this.updateOpenStringType());
|
|
7730
|
+
const mutedSwatch = document.createElement("span");
|
|
7731
|
+
mutedSwatch.className = "open-string-swatch";
|
|
7732
|
+
mutedSwatch.textContent = "\xD7";
|
|
7733
|
+
mutedSwatch.style.cssText = openStringSwatchStyle;
|
|
7734
|
+
mutedOption.appendChild(this.mutedRadio);
|
|
7735
|
+
mutedOption.appendChild(mutedSwatch);
|
|
7686
7736
|
const openOption = document.createElement("label");
|
|
7687
|
-
openOption.style.cssText = "display:
|
|
7737
|
+
openOption.style.cssText = "display:inline-block;position:relative;cursor:pointer;";
|
|
7688
7738
|
this.openRadio = document.createElement("input");
|
|
7689
7739
|
this.openRadio.type = "radio";
|
|
7690
7740
|
this.openRadio.name = "openStringType";
|
|
7691
7741
|
this.openRadio.value = "0";
|
|
7692
7742
|
this.openRadio.checked = true;
|
|
7743
|
+
this.openRadio.style.cssText = hiddenRadioStyle;
|
|
7693
7744
|
this.openRadio.addEventListener("change", () => this.updateOpenStringType());
|
|
7694
|
-
const
|
|
7695
|
-
|
|
7696
|
-
|
|
7745
|
+
const openSwatch = document.createElement("span");
|
|
7746
|
+
openSwatch.className = "open-string-swatch";
|
|
7747
|
+
openSwatch.textContent = "\u25CB";
|
|
7748
|
+
openSwatch.style.cssText = openStringSwatchStyle;
|
|
7697
7749
|
openOption.appendChild(this.openRadio);
|
|
7698
|
-
openOption.appendChild(
|
|
7699
|
-
const mutedOption = document.createElement("label");
|
|
7700
|
-
mutedOption.style.cssText = "display: flex; align-items: center; cursor: pointer;";
|
|
7701
|
-
this.mutedRadio = document.createElement("input");
|
|
7702
|
-
this.mutedRadio.type = "radio";
|
|
7703
|
-
this.mutedRadio.name = "openStringType";
|
|
7704
|
-
this.mutedRadio.value = "x";
|
|
7705
|
-
this.mutedRadio.addEventListener("change", () => this.updateOpenStringType());
|
|
7706
|
-
const mutedLabel = document.createElement("span");
|
|
7707
|
-
mutedLabel.textContent = "Muted";
|
|
7708
|
-
mutedLabel.style.cssText = "margin-left: 5px; font-weight: bold;";
|
|
7709
|
-
mutedOption.appendChild(this.mutedRadio);
|
|
7710
|
-
mutedOption.appendChild(mutedLabel);
|
|
7711
|
-
typeOptions.appendChild(openOption);
|
|
7750
|
+
openOption.appendChild(openSwatch);
|
|
7712
7751
|
typeOptions.appendChild(mutedOption);
|
|
7713
|
-
|
|
7714
|
-
this.openStringTextSection = document.createElement("div");
|
|
7715
|
-
this.openStringTextSection.style.cssText = "margin-bottom: 15px;";
|
|
7716
|
-
const textLabel = document.createElement("label");
|
|
7717
|
-
textLabel.textContent = "Text (optional): ";
|
|
7718
|
-
textLabel.style.cssText = "display: block; margin-bottom: 5px; font-weight: bold;";
|
|
7752
|
+
typeOptions.appendChild(openOption);
|
|
7719
7753
|
this.openStringTextInput = document.createElement("input");
|
|
7720
7754
|
this.openStringTextInput.type = "text";
|
|
7721
|
-
this.openStringTextInput.maxLength =
|
|
7722
|
-
this.openStringTextInput.placeholder = "
|
|
7723
|
-
this.openStringTextInput.style.cssText = "width:
|
|
7724
|
-
this.openStringTextInput.addEventListener(
|
|
7725
|
-
|
|
7726
|
-
|
|
7755
|
+
this.openStringTextInput.maxLength = 1;
|
|
7756
|
+
this.openStringTextInput.placeholder = "Aa";
|
|
7757
|
+
this.openStringTextInput.style.cssText = "width:32px;height:28px;padding:0 4px;margin-left:4px;border:1px solid #ccc;border-radius:3px;box-sizing:border-box;";
|
|
7758
|
+
this.openStringTextInput.addEventListener(
|
|
7759
|
+
"input",
|
|
7760
|
+
() => this.updateOpenStringText()
|
|
7761
|
+
);
|
|
7762
|
+
typeOptions.appendChild(this.openStringTextInput);
|
|
7763
|
+
typeSection.appendChild(typeOptions);
|
|
7727
7764
|
const buttonDiv = document.createElement("div");
|
|
7728
7765
|
buttonDiv.style.cssText = "display: flex; gap: 10px; justify-content: flex-end;";
|
|
7729
7766
|
const removeBtn = document.createElement("button");
|
|
@@ -7738,7 +7775,6 @@ var EditableSVGuitarChord = class {
|
|
|
7738
7775
|
buttonDiv.appendChild(doneBtn);
|
|
7739
7776
|
this.openStringDialog.appendChild(title);
|
|
7740
7777
|
this.openStringDialog.appendChild(typeSection);
|
|
7741
|
-
this.openStringDialog.appendChild(this.openStringTextSection);
|
|
7742
7778
|
this.openStringDialog.appendChild(buttonDiv);
|
|
7743
7779
|
document.body.appendChild(this.openStringDialog);
|
|
7744
7780
|
this.openStringBackdrop = document.createElement("div");
|
|
@@ -7975,17 +8011,22 @@ var EditableSVGuitarChord = class {
|
|
|
7975
8011
|
* @param {number} fret
|
|
7976
8012
|
*/
|
|
7977
8013
|
editDot(string, fret) {
|
|
7978
|
-
var
|
|
8014
|
+
var _a12, _b;
|
|
7979
8015
|
const finger = this.chordConfig.fingers.find(([s2, f2]) => s2 === string && f2 === fret);
|
|
7980
8016
|
if (!finger) return;
|
|
7981
8017
|
this.currentEditFinger = finger;
|
|
7982
8018
|
this.currentEditString = string;
|
|
7983
8019
|
this.currentEditFret = fret;
|
|
7984
|
-
const currentColor = typeof finger[2] === "object" && ((
|
|
8020
|
+
const currentColor = typeof finger[2] === "object" && ((_a12 = finger[2]) == null ? void 0 : _a12.color) || DOT_COLORS.BLACK;
|
|
7985
8021
|
const currentText = typeof finger[2] === "object" && ((_b = finger[2]) == null ? void 0 : _b.text) || "";
|
|
7986
|
-
|
|
8022
|
+
let normalizedColor = DOT_COLORS.BLACK;
|
|
8023
|
+
if (currentColor === DOT_COLORS.RED) normalizedColor = DOT_COLORS.RED;
|
|
8024
|
+
else if (currentColor === DOT_COLORS.GREY) normalizedColor = DOT_COLORS.GREY;
|
|
8025
|
+
else if (currentColor === DOT_COLORS.BLUE) normalizedColor = DOT_COLORS.BLUE;
|
|
7987
8026
|
this.redRadio.checked = normalizedColor === DOT_COLORS.RED;
|
|
7988
8027
|
this.blackRadio.checked = normalizedColor === DOT_COLORS.BLACK;
|
|
8028
|
+
this.greyRadio.checked = normalizedColor === DOT_COLORS.GREY;
|
|
8029
|
+
this.blueRadio.checked = normalizedColor === DOT_COLORS.BLUE;
|
|
7989
8030
|
this.textInput.value = currentText;
|
|
7990
8031
|
this.updateTextSectionVisibility();
|
|
7991
8032
|
this.openDialog();
|
|
@@ -7996,14 +8037,14 @@ var EditableSVGuitarChord = class {
|
|
|
7996
8037
|
* @param {Element} openStringElement
|
|
7997
8038
|
*/
|
|
7998
8039
|
editOpenString(string, openStringElement) {
|
|
7999
|
-
var
|
|
8040
|
+
var _a12;
|
|
8000
8041
|
const finger = this.chordConfig.fingers.find(([s2, f2]) => s2 === string && (f2 === 0 || f2 === "x"));
|
|
8001
8042
|
if (!finger) return;
|
|
8002
8043
|
this.currentEditFinger = finger;
|
|
8003
8044
|
this.currentEditString = string;
|
|
8004
8045
|
this.currentEditElement = openStringElement;
|
|
8005
8046
|
const currentFret = finger[1];
|
|
8006
|
-
const currentText = typeof finger[2] === "object" && ((
|
|
8047
|
+
const currentText = typeof finger[2] === "object" && ((_a12 = finger[2]) == null ? void 0 : _a12.text) || "";
|
|
8007
8048
|
this.openRadio.checked = currentFret === 0;
|
|
8008
8049
|
this.mutedRadio.checked = currentFret === "x";
|
|
8009
8050
|
this.openStringTextInput.value = currentText;
|
|
@@ -8207,6 +8248,14 @@ var EditableSVGuitarChord = class {
|
|
|
8207
8248
|
.editable-svguitar-settings-btn:hover {
|
|
8208
8249
|
background: #f0f0f0;
|
|
8209
8250
|
}
|
|
8251
|
+
|
|
8252
|
+
.editable-svguitar-dialog input[name="dotColor"]:checked + .color-swatch {
|
|
8253
|
+
box-shadow: 0 0 0 2px white, 0 0 0 4px grey;
|
|
8254
|
+
}
|
|
8255
|
+
|
|
8256
|
+
.editable-svguitar-open-string-dialog input[name="openStringType"]:checked + .open-string-swatch {
|
|
8257
|
+
box-shadow: 0 0 0 2px white, 0 0 0 4px grey;
|
|
8258
|
+
}
|
|
8210
8259
|
`;
|
|
8211
8260
|
document.head.appendChild(style);
|
|
8212
8261
|
}
|
|
@@ -8238,23 +8287,19 @@ var EditableSVGuitarChord = class {
|
|
|
8238
8287
|
* Update text section visibility based on color selection
|
|
8239
8288
|
*/
|
|
8240
8289
|
updateTextSectionVisibility() {
|
|
8241
|
-
if (!this.
|
|
8290
|
+
if (!this.textInput) return;
|
|
8242
8291
|
const isBlack = this.blackRadio && this.blackRadio.checked;
|
|
8243
|
-
this.
|
|
8244
|
-
|
|
8245
|
-
this.textInput.disabled = !isBlack;
|
|
8246
|
-
}
|
|
8292
|
+
this.textInput.style.display = isBlack ? "inline-block" : "none";
|
|
8293
|
+
this.textInput.disabled = !isBlack;
|
|
8247
8294
|
}
|
|
8248
8295
|
/**
|
|
8249
8296
|
* Update text section visibility for open string dialog based on type selection
|
|
8250
8297
|
*/
|
|
8251
8298
|
updateOpenStringTextSectionVisibility() {
|
|
8252
|
-
if (!this.
|
|
8299
|
+
if (!this.openStringTextInput) return;
|
|
8253
8300
|
const isOpen = this.openRadio && this.openRadio.checked;
|
|
8254
|
-
this.
|
|
8255
|
-
|
|
8256
|
-
this.openStringTextInput.disabled = !isOpen;
|
|
8257
|
-
}
|
|
8301
|
+
this.openStringTextInput.style.display = isOpen ? "inline-block" : "none";
|
|
8302
|
+
this.openStringTextInput.disabled = !isOpen;
|
|
8258
8303
|
}
|
|
8259
8304
|
/**
|
|
8260
8305
|
* Update dot text in real-time
|
|
@@ -8287,11 +8332,11 @@ var EditableSVGuitarChord = class {
|
|
|
8287
8332
|
* Update open string type (open vs muted) in real-time
|
|
8288
8333
|
*/
|
|
8289
8334
|
updateOpenStringType() {
|
|
8290
|
-
var
|
|
8335
|
+
var _a12;
|
|
8291
8336
|
if (!this.currentEditFinger) return;
|
|
8292
8337
|
const newFret = this.openRadio.checked ? 0 : "x";
|
|
8293
8338
|
this.currentEditFinger[1] = newFret;
|
|
8294
|
-
if (newFret === "x" && typeof this.currentEditFinger[2] === "object" && ((
|
|
8339
|
+
if (newFret === "x" && typeof this.currentEditFinger[2] === "object" && ((_a12 = this.currentEditFinger[2]) == null ? void 0 : _a12.text)) {
|
|
8295
8340
|
this.openStringTextInput.value = "";
|
|
8296
8341
|
const fingerOptions = typeof this.currentEditFinger[2] === "object" ? this.currentEditFinger[2] : {};
|
|
8297
8342
|
this.currentEditFinger[2] = { ...fingerOptions, text: "" };
|
|
@@ -8308,10 +8353,13 @@ var EditableSVGuitarChord = class {
|
|
|
8308
8353
|
if (!this.currentEditFinger[2]) {
|
|
8309
8354
|
this.currentEditFinger[2] = {};
|
|
8310
8355
|
}
|
|
8311
|
-
|
|
8356
|
+
let selectedColor = DOT_COLORS.BLACK;
|
|
8357
|
+
if (this.redRadio.checked) selectedColor = DOT_COLORS.RED;
|
|
8358
|
+
else if (this.greyRadio.checked) selectedColor = DOT_COLORS.GREY;
|
|
8359
|
+
else if (this.blueRadio.checked) selectedColor = DOT_COLORS.BLUE;
|
|
8312
8360
|
const fingerOptions = typeof this.currentEditFinger[2] === "object" ? this.currentEditFinger[2] : {};
|
|
8313
8361
|
this.currentEditFinger[2] = { ...fingerOptions, color: selectedColor };
|
|
8314
|
-
if (selectedColor
|
|
8362
|
+
if (selectedColor !== DOT_COLORS.BLACK) {
|
|
8315
8363
|
this.currentEditFinger[2].text = "";
|
|
8316
8364
|
this.textInput.value = "";
|
|
8317
8365
|
}
|
|
@@ -8327,7 +8375,10 @@ var EditableSVGuitarChord = class {
|
|
|
8327
8375
|
if (!this.currentEditFinger[2]) {
|
|
8328
8376
|
this.currentEditFinger[2] = {};
|
|
8329
8377
|
}
|
|
8330
|
-
|
|
8378
|
+
let selectedColor = DOT_COLORS.BLACK;
|
|
8379
|
+
if (this.redRadio.checked) selectedColor = DOT_COLORS.RED;
|
|
8380
|
+
else if (this.greyRadio.checked) selectedColor = DOT_COLORS.GREY;
|
|
8381
|
+
else if (this.blueRadio.checked) selectedColor = DOT_COLORS.BLUE;
|
|
8331
8382
|
this.currentEditFinger[2] = { text: this.textInput.value, color: selectedColor };
|
|
8332
8383
|
this.closeDialog();
|
|
8333
8384
|
this.redraw();
|
|
@@ -8543,13 +8594,17 @@ var ASCII_EQUALS = "=";
|
|
|
8543
8594
|
var ASCII_OPEN = "o";
|
|
8544
8595
|
var ASCII_MUTED = "x";
|
|
8545
8596
|
var ASCII_ROOT = "*";
|
|
8597
|
+
var ASCII_GREY = "O";
|
|
8598
|
+
var ASCII_BLUE = "+";
|
|
8546
8599
|
var UNICODE_VERTICAL = "\u2502";
|
|
8547
8600
|
var UNICODE_OPEN = "\u25CB";
|
|
8548
8601
|
var UNICODE_MUTED = "\xD7";
|
|
8549
8602
|
var UNICODE_ROOT = "\u25CF";
|
|
8603
|
+
var UNICODE_GREY = "\u25A1";
|
|
8604
|
+
var UNICODE_BLUE = "\u25A0";
|
|
8550
8605
|
var UNICODE_BOX_CHARS = "\u2552\u2550\u2564\u2555\u251C\u2500\u253C\u2524\u2514\u2534\u2518\u250C\u252C\u2510";
|
|
8551
8606
|
function isUnicodeFormat(str) {
|
|
8552
|
-
return str.includes(UNICODE_VERTICAL) || str.includes(UNICODE_OPEN) || str.includes(UNICODE_ROOT) || str.includes(UNICODE_MUTED) || [...UNICODE_BOX_CHARS].some((c2) => str.includes(c2));
|
|
8607
|
+
return str.includes(UNICODE_VERTICAL) || str.includes(UNICODE_OPEN) || str.includes(UNICODE_ROOT) || str.includes(UNICODE_MUTED) || str.includes(UNICODE_GREY) || str.includes(UNICODE_BLUE) || [...UNICODE_BOX_CHARS].some((c2) => str.includes(c2));
|
|
8553
8608
|
}
|
|
8554
8609
|
function findUnicodeGridBoundaries(lines, firstGridRowIdx) {
|
|
8555
8610
|
const firstLine = lines[firstGridRowIdx];
|
|
@@ -8626,7 +8681,12 @@ function isGridRow(line, isUnicode) {
|
|
|
8626
8681
|
}
|
|
8627
8682
|
}
|
|
8628
8683
|
function stringToFingering(fingeringStr, options = {}) {
|
|
8629
|
-
const {
|
|
8684
|
+
const {
|
|
8685
|
+
redColor = "#e74c3c",
|
|
8686
|
+
blackColor = "#000000",
|
|
8687
|
+
greyColor = "#9B9B9B",
|
|
8688
|
+
blueColor = "#4A90E2"
|
|
8689
|
+
} = options;
|
|
8630
8690
|
if (!fingeringStr || fingeringStr.trim() === "") {
|
|
8631
8691
|
return null;
|
|
8632
8692
|
}
|
|
@@ -8635,6 +8695,8 @@ function stringToFingering(fingeringStr, options = {}) {
|
|
|
8635
8695
|
const openChar = isUnicode ? UNICODE_OPEN : ASCII_OPEN;
|
|
8636
8696
|
const mutedChar = isUnicode ? UNICODE_MUTED : ASCII_MUTED;
|
|
8637
8697
|
const rootChar = isUnicode ? UNICODE_ROOT : ASCII_ROOT;
|
|
8698
|
+
const greyChar = isUnicode ? UNICODE_GREY : ASCII_GREY;
|
|
8699
|
+
const blueChar = isUnicode ? UNICODE_BLUE : ASCII_BLUE;
|
|
8638
8700
|
const fingers = [];
|
|
8639
8701
|
let title;
|
|
8640
8702
|
let position2;
|
|
@@ -8746,6 +8808,10 @@ function stringToFingering(fingeringStr, options = {}) {
|
|
|
8746
8808
|
}
|
|
8747
8809
|
if (char === rootChar) {
|
|
8748
8810
|
fingers.push([stringNum, fretNumber, { text: "", color: redColor }]);
|
|
8811
|
+
} else if (char === greyChar) {
|
|
8812
|
+
fingers.push([stringNum, fretNumber, { text: "", color: greyColor }]);
|
|
8813
|
+
} else if (char === blueChar) {
|
|
8814
|
+
fingers.push([stringNum, fretNumber, { text: "", color: blueColor }]);
|
|
8749
8815
|
} else if (char === UNICODE_OPEN || char === ASCII_OPEN) {
|
|
8750
8816
|
fingers.push([stringNum, fretNumber, { text: "", color: blackColor }]);
|
|
8751
8817
|
} else if (/\S/.test(char)) {
|
|
@@ -8871,16 +8937,16 @@ var _a4;
|
|
|
8871
8937
|
updateJSON();
|
|
8872
8938
|
var _a5;
|
|
8873
8939
|
(_a5 = document.getElementById("tab-editor")) == null ? void 0 : _a5.addEventListener("click", () => {
|
|
8874
|
-
var
|
|
8875
|
-
(
|
|
8940
|
+
var _a12, _b, _c, _d;
|
|
8941
|
+
(_a12 = document.getElementById("tab-editor")) == null ? void 0 : _a12.classList.add("active");
|
|
8876
8942
|
(_b = document.getElementById("tab-batch")) == null ? void 0 : _b.classList.remove("active");
|
|
8877
8943
|
(_c = document.getElementById("interactive-editor")) == null ? void 0 : _c.classList.add("active");
|
|
8878
8944
|
(_d = document.getElementById("batch-converter")) == null ? void 0 : _d.classList.remove("active");
|
|
8879
8945
|
});
|
|
8880
8946
|
var _a6;
|
|
8881
8947
|
(_a6 = document.getElementById("tab-batch")) == null ? void 0 : _a6.addEventListener("click", () => {
|
|
8882
|
-
var
|
|
8883
|
-
(
|
|
8948
|
+
var _a12, _b, _c, _d;
|
|
8949
|
+
(_a12 = document.getElementById("tab-batch")) == null ? void 0 : _a12.classList.add("active");
|
|
8884
8950
|
(_b = document.getElementById("tab-editor")) == null ? void 0 : _b.classList.remove("active");
|
|
8885
8951
|
(_c = document.getElementById("batch-converter")) == null ? void 0 : _c.classList.add("active");
|
|
8886
8952
|
(_d = document.getElementById("interactive-editor")) == null ? void 0 : _d.classList.remove("active");
|
|
@@ -8948,15 +9014,19 @@ function layout(columnNumber) {
|
|
|
8948
9014
|
textarea.value = layout2;
|
|
8949
9015
|
}
|
|
8950
9016
|
var _a8;
|
|
8951
|
-
(_a8 = document.getElementById("layout-
|
|
8952
|
-
layout(
|
|
9017
|
+
(_a8 = document.getElementById("layout-1-btn")) == null ? void 0 : _a8.addEventListener("click", () => {
|
|
9018
|
+
layout(1);
|
|
8953
9019
|
});
|
|
8954
9020
|
var _a9;
|
|
8955
|
-
(_a9 = document.getElementById("layout-
|
|
8956
|
-
layout(
|
|
9021
|
+
(_a9 = document.getElementById("layout-2-btn")) == null ? void 0 : _a9.addEventListener("click", () => {
|
|
9022
|
+
layout(2);
|
|
8957
9023
|
});
|
|
8958
9024
|
var _a10;
|
|
8959
|
-
(_a10 = document.getElementById("layout-
|
|
9025
|
+
(_a10 = document.getElementById("layout-3-btn")) == null ? void 0 : _a10.addEventListener("click", () => {
|
|
9026
|
+
layout(3);
|
|
9027
|
+
});
|
|
9028
|
+
var _a11;
|
|
9029
|
+
(_a11 = document.getElementById("layout-4-btn")) == null ? void 0 : _a11.addEventListener("click", () => {
|
|
8960
9030
|
layout(4);
|
|
8961
9031
|
});
|
|
8962
9032
|
//# sourceMappingURL=bundle.js.map
|