@chordproject/diagrammer 1.0.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/LICENSE +661 -0
- package/README.md +176 -0
- package/data/CHORDS_DB_LICENSE +21 -0
- package/data/guitar.json +1 -0
- package/data/supplemental-guitar.json +11 -0
- package/dist/index.cjs +546 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +126 -0
- package/dist/index.d.ts +126 -0
- package/dist/index.js +514 -0
- package/dist/index.js.map +1 -0
- package/package.json +53 -0
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
interface BarreData {
|
|
2
|
+
fret: number;
|
|
3
|
+
startString: number;
|
|
4
|
+
endString: number;
|
|
5
|
+
}
|
|
6
|
+
declare class ChordDiagram {
|
|
7
|
+
frets: number[];
|
|
8
|
+
fingers: number[];
|
|
9
|
+
baseFret: number;
|
|
10
|
+
variation?: number;
|
|
11
|
+
constructor(init?: Partial<ChordDiagram>);
|
|
12
|
+
get barres(): BarreData[];
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
declare class Instrument {
|
|
16
|
+
/**
|
|
17
|
+
*
|
|
18
|
+
*/
|
|
19
|
+
constructor(name: string, stringsCount: number, fretsOnDiagram: number, tuning: string[]);
|
|
20
|
+
/**
|
|
21
|
+
* Number of strings
|
|
22
|
+
*/
|
|
23
|
+
stringsCount: number;
|
|
24
|
+
/**
|
|
25
|
+
* Number of frets to show on the diagram
|
|
26
|
+
*/
|
|
27
|
+
fretsOnDiagram: number;
|
|
28
|
+
/**
|
|
29
|
+
* Instrument's name
|
|
30
|
+
*/
|
|
31
|
+
name: string;
|
|
32
|
+
/**
|
|
33
|
+
* Instrument's tuning
|
|
34
|
+
*/
|
|
35
|
+
tuning: string[];
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
interface LineSettings {
|
|
39
|
+
color: string;
|
|
40
|
+
width: number;
|
|
41
|
+
visible: boolean;
|
|
42
|
+
}
|
|
43
|
+
interface TextSettings {
|
|
44
|
+
color: string;
|
|
45
|
+
size: number;
|
|
46
|
+
visible: boolean;
|
|
47
|
+
margin: number;
|
|
48
|
+
}
|
|
49
|
+
interface DotSettings {
|
|
50
|
+
/**
|
|
51
|
+
* Circle radius
|
|
52
|
+
*/
|
|
53
|
+
radius: number;
|
|
54
|
+
/**
|
|
55
|
+
* Dot border width
|
|
56
|
+
*/
|
|
57
|
+
borderWidth: number;
|
|
58
|
+
/**
|
|
59
|
+
* Dot fill color
|
|
60
|
+
*/
|
|
61
|
+
fillColor: string;
|
|
62
|
+
/**
|
|
63
|
+
* Dot stroke color
|
|
64
|
+
*/
|
|
65
|
+
strokeColor: string;
|
|
66
|
+
/**
|
|
67
|
+
* Open string circle radius
|
|
68
|
+
*/
|
|
69
|
+
openStringRadius: number;
|
|
70
|
+
}
|
|
71
|
+
interface NeckSettings {
|
|
72
|
+
useRoman: boolean;
|
|
73
|
+
color: string;
|
|
74
|
+
nut: LineSettings;
|
|
75
|
+
grid: LineSettings;
|
|
76
|
+
stringName: TextSettings;
|
|
77
|
+
baseFret: TextSettings;
|
|
78
|
+
stringInfo: TextSettings;
|
|
79
|
+
}
|
|
80
|
+
declare class Settings {
|
|
81
|
+
stringSpace: number;
|
|
82
|
+
fretSpace: number;
|
|
83
|
+
fontFamily: string;
|
|
84
|
+
fingering: TextSettings;
|
|
85
|
+
dot: DotSettings;
|
|
86
|
+
neck: NeckSettings;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
declare class SvgBuilder {
|
|
90
|
+
settings: Settings;
|
|
91
|
+
build(chord: ChordDiagram, instrument: Instrument): SVGElement;
|
|
92
|
+
private onlyDots;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
declare class Chord {
|
|
96
|
+
readonly key: string;
|
|
97
|
+
readonly type: string;
|
|
98
|
+
readonly bass: string;
|
|
99
|
+
constructor(key: string, type: string, bass?: string);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
interface DiagramDefinition {
|
|
103
|
+
key: string;
|
|
104
|
+
type: string;
|
|
105
|
+
bass?: string;
|
|
106
|
+
frets: number[];
|
|
107
|
+
fingers?: number[];
|
|
108
|
+
baseFret?: number;
|
|
109
|
+
variation?: number;
|
|
110
|
+
instrument?: number;
|
|
111
|
+
}
|
|
112
|
+
declare class ChordDiagramCollection {
|
|
113
|
+
private readonly definitions;
|
|
114
|
+
constructor(definitions?: readonly DiagramDefinition[]);
|
|
115
|
+
get(chord: Chord): ChordDiagram[];
|
|
116
|
+
private getBaseFret;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
declare class ChordAliases {
|
|
120
|
+
static readonly keyAliases: Map<string, string>;
|
|
121
|
+
static readonly typeAliases: Map<string, string>;
|
|
122
|
+
static key(key: string): string;
|
|
123
|
+
static type(type: string): string;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
export { Chord, ChordAliases, ChordDiagram, ChordDiagramCollection, type DiagramDefinition, Instrument, SvgBuilder };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
interface BarreData {
|
|
2
|
+
fret: number;
|
|
3
|
+
startString: number;
|
|
4
|
+
endString: number;
|
|
5
|
+
}
|
|
6
|
+
declare class ChordDiagram {
|
|
7
|
+
frets: number[];
|
|
8
|
+
fingers: number[];
|
|
9
|
+
baseFret: number;
|
|
10
|
+
variation?: number;
|
|
11
|
+
constructor(init?: Partial<ChordDiagram>);
|
|
12
|
+
get barres(): BarreData[];
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
declare class Instrument {
|
|
16
|
+
/**
|
|
17
|
+
*
|
|
18
|
+
*/
|
|
19
|
+
constructor(name: string, stringsCount: number, fretsOnDiagram: number, tuning: string[]);
|
|
20
|
+
/**
|
|
21
|
+
* Number of strings
|
|
22
|
+
*/
|
|
23
|
+
stringsCount: number;
|
|
24
|
+
/**
|
|
25
|
+
* Number of frets to show on the diagram
|
|
26
|
+
*/
|
|
27
|
+
fretsOnDiagram: number;
|
|
28
|
+
/**
|
|
29
|
+
* Instrument's name
|
|
30
|
+
*/
|
|
31
|
+
name: string;
|
|
32
|
+
/**
|
|
33
|
+
* Instrument's tuning
|
|
34
|
+
*/
|
|
35
|
+
tuning: string[];
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
interface LineSettings {
|
|
39
|
+
color: string;
|
|
40
|
+
width: number;
|
|
41
|
+
visible: boolean;
|
|
42
|
+
}
|
|
43
|
+
interface TextSettings {
|
|
44
|
+
color: string;
|
|
45
|
+
size: number;
|
|
46
|
+
visible: boolean;
|
|
47
|
+
margin: number;
|
|
48
|
+
}
|
|
49
|
+
interface DotSettings {
|
|
50
|
+
/**
|
|
51
|
+
* Circle radius
|
|
52
|
+
*/
|
|
53
|
+
radius: number;
|
|
54
|
+
/**
|
|
55
|
+
* Dot border width
|
|
56
|
+
*/
|
|
57
|
+
borderWidth: number;
|
|
58
|
+
/**
|
|
59
|
+
* Dot fill color
|
|
60
|
+
*/
|
|
61
|
+
fillColor: string;
|
|
62
|
+
/**
|
|
63
|
+
* Dot stroke color
|
|
64
|
+
*/
|
|
65
|
+
strokeColor: string;
|
|
66
|
+
/**
|
|
67
|
+
* Open string circle radius
|
|
68
|
+
*/
|
|
69
|
+
openStringRadius: number;
|
|
70
|
+
}
|
|
71
|
+
interface NeckSettings {
|
|
72
|
+
useRoman: boolean;
|
|
73
|
+
color: string;
|
|
74
|
+
nut: LineSettings;
|
|
75
|
+
grid: LineSettings;
|
|
76
|
+
stringName: TextSettings;
|
|
77
|
+
baseFret: TextSettings;
|
|
78
|
+
stringInfo: TextSettings;
|
|
79
|
+
}
|
|
80
|
+
declare class Settings {
|
|
81
|
+
stringSpace: number;
|
|
82
|
+
fretSpace: number;
|
|
83
|
+
fontFamily: string;
|
|
84
|
+
fingering: TextSettings;
|
|
85
|
+
dot: DotSettings;
|
|
86
|
+
neck: NeckSettings;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
declare class SvgBuilder {
|
|
90
|
+
settings: Settings;
|
|
91
|
+
build(chord: ChordDiagram, instrument: Instrument): SVGElement;
|
|
92
|
+
private onlyDots;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
declare class Chord {
|
|
96
|
+
readonly key: string;
|
|
97
|
+
readonly type: string;
|
|
98
|
+
readonly bass: string;
|
|
99
|
+
constructor(key: string, type: string, bass?: string);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
interface DiagramDefinition {
|
|
103
|
+
key: string;
|
|
104
|
+
type: string;
|
|
105
|
+
bass?: string;
|
|
106
|
+
frets: number[];
|
|
107
|
+
fingers?: number[];
|
|
108
|
+
baseFret?: number;
|
|
109
|
+
variation?: number;
|
|
110
|
+
instrument?: number;
|
|
111
|
+
}
|
|
112
|
+
declare class ChordDiagramCollection {
|
|
113
|
+
private readonly definitions;
|
|
114
|
+
constructor(definitions?: readonly DiagramDefinition[]);
|
|
115
|
+
get(chord: Chord): ChordDiagram[];
|
|
116
|
+
private getBaseFret;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
declare class ChordAliases {
|
|
120
|
+
static readonly keyAliases: Map<string, string>;
|
|
121
|
+
static readonly typeAliases: Map<string, string>;
|
|
122
|
+
static key(key: string): string;
|
|
123
|
+
static type(type: string): string;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
export { Chord, ChordAliases, ChordDiagram, ChordDiagramCollection, type DiagramDefinition, Instrument, SvgBuilder };
|