@dsebastien/music-notation 0.1.0 → 0.1.2

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 CHANGED
@@ -37,7 +37,7 @@ labels: intervals
37
37
  ```
38
38
  ````
39
39
 
40
- The full syntax is in the [guide](https://dsebastien.github.io/music-notation/). Mistakes show an inline message and leave the source untouched.
40
+ The full syntax is in the [guide](https://dsebastien.github.io/music-notation/), with [live examples](https://dsebastien.github.io/music-notation/examples.html) and a [playground](https://dsebastien.github.io/music-notation/playground.html). Mistakes show an inline message and leave the source untouched.
41
41
 
42
42
  ## Install
43
43
 
@@ -0,0 +1,82 @@
1
+ // src/theory/pitch.ts
2
+ var SHARP_NAMES = [
3
+ "C",
4
+ "C#",
5
+ "D",
6
+ "D#",
7
+ "E",
8
+ "F",
9
+ "F#",
10
+ "G",
11
+ "G#",
12
+ "A",
13
+ "A#",
14
+ "B"
15
+ ];
16
+ var FLAT_NAMES = ["C", "Db", "D", "Eb", "E", "F", "Gb", "G", "Ab", "A", "Bb", "B"];
17
+ var LETTER_CHROMA = { C: 0, D: 2, E: 4, F: 5, G: 7, A: 9, B: 11 };
18
+ function chromaOf(name) {
19
+ const m = /^([A-Ga-g])([#♯b♭]*)$/.exec(name.trim());
20
+ if (!m)
21
+ return null;
22
+ let chroma = LETTER_CHROMA[m[1].toUpperCase()];
23
+ for (const accidental of m[2])
24
+ chroma += accidental === "#" || accidental === "♯" ? 1 : -1;
25
+ return (chroma % 12 + 12) % 12;
26
+ }
27
+ function midiOf(note) {
28
+ const m = /^([A-Ga-g][#♯b♭]*)(-?\d)$/.exec(note.trim());
29
+ if (!m)
30
+ return null;
31
+ const chroma = chromaOf(m[1]);
32
+ if (chroma === null)
33
+ return null;
34
+ const letter = LETTER_CHROMA[m[1][0].toUpperCase()];
35
+ const shift = Math.round((chroma - letter) / 12);
36
+ return (Number(m[2]) + 1) * 12 + chroma - shift * 12;
37
+ }
38
+ var nameOf = (chroma, preferFlats = false) => (preferFlats ? FLAT_NAMES : SHARP_NAMES)[((Math.round(chroma) || 0) % 12 + 12) % 12];
39
+ function splitChordSymbol(symbol) {
40
+ const normalized = symbol.trim().replace(/♯/g, "#").replace(/♭/g, "b");
41
+ const m = /^([A-G][#b]?)(.*?)(?:\/([A-G][#b]?))?$/.exec(normalized);
42
+ return m ? { root: m[1], suffix: m[2], bass: m[3] ?? null } : null;
43
+ }
44
+ var isFlat = (name) => /^[A-Ga-g][b♭]/.test(name.trim());
45
+
46
+ // src/theory/suffix.ts
47
+ var CANONICAL = new Map([
48
+ ["M", ""],
49
+ ["maj", ""],
50
+ ["min", "m"],
51
+ ["-", "m"],
52
+ ["M7", "maj7"],
53
+ ["Δ", "maj7"],
54
+ ["Δ7", "maj7"],
55
+ ["M9", "maj9"],
56
+ ["Δ9", "maj9"],
57
+ ["min6", "m6"],
58
+ ["-6", "m6"],
59
+ ["min7", "m7"],
60
+ ["-7", "m7"],
61
+ ["min9", "m9"],
62
+ ["-9", "m9"],
63
+ ["ø", "m7b5"],
64
+ ["ø7", "m7b5"],
65
+ ["m7-5", "m7b5"],
66
+ ["mmaj7", "mMaj7"],
67
+ ["mM7", "mMaj7"],
68
+ ["m(maj7)", "mMaj7"],
69
+ ["-(maj7)", "mMaj7"],
70
+ ["°", "dim"],
71
+ ["°7", "dim7"],
72
+ ["+", "aug"],
73
+ ["sus", "sus4"],
74
+ ["add2", "add9"],
75
+ ["69", "6/9"]
76
+ ]);
77
+ var canonicalSuffix = (suffix) => CANONICAL.get(suffix) ?? suffix;
78
+
79
+ export { chromaOf, midiOf, nameOf, splitChordSymbol, isFlat, canonicalSuffix };
80
+
81
+ //# debugId=CC145C48B0360EE764756E2164756E21
82
+ //# sourceMappingURL=index-26cddyf5.js.map
@@ -1,10 +1,11 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../src/theory/pitch.ts"],
3
+ "sources": ["../src/theory/pitch.ts", "../src/theory/suffix.ts"],
4
4
  "sourcesContent": [
5
- "/**\n * Pitch classes and note names. A pitch class is a chroma: 0 = C … 11 = B. Names accept ASCII\n * (`#`, `b`) and Unicode (`♯`, `♭`) accidentals.\n */\n\nexport const SHARP_NAMES = [\n 'C',\n 'C#',\n 'D',\n 'D#',\n 'E',\n 'F',\n 'F#',\n 'G',\n 'G#',\n 'A',\n 'A#',\n 'B'\n] as const\nexport const FLAT_NAMES = ['C', 'Db', 'D', 'Eb', 'E', 'F', 'Gb', 'G', 'Ab', 'A', 'Bb', 'B'] as const\n\nconst LETTER_CHROMA: Record<string, number> = { C: 0, D: 2, E: 4, F: 5, G: 7, A: 9, B: 11 }\n\n/** \"C#\", \"Db\", \"D♭\", \"E\" → 0..11; null when it isn't a note name. */\nexport function chromaOf(name: string): number | null {\n const m = /^([A-Ga-g])([#♯b♭]*)$/.exec(name.trim())\n if (!m) return null\n let chroma = LETTER_CHROMA[m[1]!.toUpperCase()]!\n for (const accidental of m[2]!) chroma += accidental === '#' || accidental === '♯' ? 1 : -1\n return ((chroma % 12) + 12) % 12\n}\n\n/** A note with its octave, scientific pitch notation (\"C4\" = MIDI 60); null when invalid. */\nexport function midiOf(note: string): number | null {\n const m = /^([A-Ga-g][#♯b♭]*)(-?\\d)$/.exec(note.trim())\n if (!m) return null\n const chroma = chromaOf(m[1]!)\n if (chroma === null) return null\n // B#3 is C4 and Cb4 is B3: the letter decides the octave, the accidental can cross it.\n const letter = LETTER_CHROMA[m[1]![0]!.toUpperCase()]!\n const shift = Math.round((chroma - letter) / 12)\n return (Number(m[2]) + 1) * 12 + chroma - shift * 12\n}\n\n/** Name of a pitch class, with sharps or flats. Non-integers are rounded. */\nexport const nameOf = (chroma: number, preferFlats = false): string =>\n (preferFlats ? FLAT_NAMES : SHARP_NAMES)[(((Math.round(chroma) || 0) % 12) + 12) % 12]!\n\nexport interface ChordSymbolParts {\n root: string\n /** Everything between the root and the bass: \"m7\", \"6/9\", \"\". */\n suffix: string\n bass: string | null\n}\n\n/**\n * \"F♯m7/C#\" → root F#, suffix m7, bass C#. A slash starts a bass only when a note name follows\n * (\"C6/9\" has no bass). ♯ and ♭ become # and b.\n */\nexport function splitChordSymbol(symbol: string): ChordSymbolParts | null {\n const normalized = symbol.trim().replace(/♯/g, '#').replace(/♭/g, 'b')\n const m = /^([A-G][#b]?)(.*?)(?:\\/([A-G][#b]?))?$/.exec(normalized)\n return m ? { root: m[1]!, suffix: m[2]!, bass: m[3] ?? null } : null\n}\n\n/** \"C4\" for MIDI 60. */\nexport const noteOf = (midi: number, preferFlats = false): string =>\n `${nameOf(midi, preferFlats)}${Math.floor(midi / 12) - 1}`\n\n/** Whether a name is spelled with a flat (\"Bb\", \"E♭\"). */\nexport const isFlat = (name: string): boolean => /^[A-Ga-g][b♭]/.test(name.trim())\n"
5
+ "/**\n * Pitch classes and note names. A pitch class is a chroma: 0 = C … 11 = B. Names accept ASCII\n * (`#`, `b`) and Unicode (`♯`, `♭`) accidentals.\n */\n\nexport const SHARP_NAMES = [\n 'C',\n 'C#',\n 'D',\n 'D#',\n 'E',\n 'F',\n 'F#',\n 'G',\n 'G#',\n 'A',\n 'A#',\n 'B'\n] as const\nexport const FLAT_NAMES = ['C', 'Db', 'D', 'Eb', 'E', 'F', 'Gb', 'G', 'Ab', 'A', 'Bb', 'B'] as const\n\nconst LETTER_CHROMA: Record<string, number> = { C: 0, D: 2, E: 4, F: 5, G: 7, A: 9, B: 11 }\n\n/** \"C#\", \"Db\", \"D♭\", \"E\" → 0..11; null when it isn't a note name. */\nexport function chromaOf(name: string): number | null {\n const m = /^([A-Ga-g])([#♯b♭]*)$/.exec(name.trim())\n if (!m) return null\n let chroma = LETTER_CHROMA[m[1]!.toUpperCase()]!\n for (const accidental of m[2]!) chroma += accidental === '#' || accidental === '♯' ? 1 : -1\n return ((chroma % 12) + 12) % 12\n}\n\n/** A note with its octave, scientific pitch notation (\"C4\" = MIDI 60); null when invalid. */\nexport function midiOf(note: string): number | null {\n const m = /^([A-Ga-g][#♯b♭]*)(-?\\d)$/.exec(note.trim())\n if (!m) return null\n const chroma = chromaOf(m[1]!)\n if (chroma === null) return null\n // B#3 is C4 and Cb4 is B3: the letter decides the octave, the accidental can cross it.\n const letter = LETTER_CHROMA[m[1]![0]!.toUpperCase()]!\n const shift = Math.round((chroma - letter) / 12)\n return (Number(m[2]) + 1) * 12 + chroma - shift * 12\n}\n\n/** Name of a pitch class, with sharps or flats. Non-integers are rounded. */\nexport const nameOf = (chroma: number, preferFlats = false): string =>\n (preferFlats ? FLAT_NAMES : SHARP_NAMES)[(((Math.round(chroma) || 0) % 12) + 12) % 12]!\n\nexport interface ChordSymbolParts {\n root: string\n /** Everything between the root and the bass: \"m7\", \"6/9\", \"\". */\n suffix: string\n bass: string | null\n}\n\n/**\n * \"F♯m7/C#\" → root F#, suffix m7, bass C#. A slash starts a bass only when a note name follows\n * (\"C6/9\" has no bass). ♯ and ♭ become # and b.\n */\nexport function splitChordSymbol(symbol: string): ChordSymbolParts | null {\n const normalized = symbol.trim().replace(/♯/g, '#').replace(/♭/g, 'b')\n const m = /^([A-G][#b]?)(.*?)(?:\\/([A-G][#b]?))?$/.exec(normalized)\n return m ? { root: m[1]!, suffix: m[2]!, bass: m[3] ?? null } : null\n}\n\n/** \"C4\" for MIDI 60. */\nexport const noteOf = (midi: number, preferFlats = false): string =>\n `${nameOf(midi, preferFlats)}${Math.floor(midi / 12) - 1}`\n\n/** Whether a name is spelled with a flat (\"Bb\", \"E♭\"). */\nexport const isFlat = (name: string): boolean => /^[A-Ga-g][b♭]/.test(name.trim())\n",
6
+ "/**\n * Chord suffixes are written many ways (\"Δ7\", \"M7\", \"maj7\"). One spelling per chord, the one tonal\n * and the voicing data understand, so every spelling the symbol parser accepts also draws.\n */\nconst CANONICAL = new Map<string, string>([\n ['M', ''],\n ['maj', ''],\n ['min', 'm'],\n ['-', 'm'],\n ['M7', 'maj7'],\n ['Δ', 'maj7'],\n ['Δ7', 'maj7'],\n ['M9', 'maj9'],\n ['Δ9', 'maj9'],\n ['min6', 'm6'],\n ['-6', 'm6'],\n ['min7', 'm7'],\n ['-7', 'm7'],\n ['min9', 'm9'],\n ['-9', 'm9'],\n ['ø', 'm7b5'],\n ['ø7', 'm7b5'],\n ['m7-5', 'm7b5'],\n ['mmaj7', 'mMaj7'],\n ['mM7', 'mMaj7'],\n ['m(maj7)', 'mMaj7'],\n ['-(maj7)', 'mMaj7'],\n ['°', 'dim'],\n ['°7', 'dim7'],\n ['+', 'aug'],\n ['sus', 'sus4'],\n ['add2', 'add9'],\n ['69', '6/9']\n])\n\nexport const canonicalSuffix = (suffix: string): string => CANONICAL.get(suffix) ?? suffix\n"
6
7
  ],
7
- "mappings": ";AAKO,IAAM,eAAc;AAAA,EACvB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACJ;AACO,IAAM,cAAa,CAAC,KAAK,MAAM,KAAK,MAAM,KAAK,KAAK,MAAM,KAAK,MAAM,KAAK,MAAM,GAAG;AAE1F,IAAM,gBAAwC,EAAE,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG;AAGnF,SAAS,SAAQ,CAAC,MAA6B;AAAA,EAClD,MAAM,IAAI,wBAAwB,KAAK,KAAK,KAAK,CAAC;AAAA,EAClD,IAAI,CAAC;AAAA,IAAG,OAAO;AAAA,EACf,IAAI,SAAS,cAAc,EAAE,GAAI,YAAY;AAAA,EAC7C,WAAW,cAAc,EAAE;AAAA,IAAK,UAAU,eAAe,OAAO,eAAe,MAAM,IAAI;AAAA,EACzF,QAAS,SAAS,KAAM,MAAM;AAAA;AAI3B,SAAS,OAAM,CAAC,MAA6B;AAAA,EAChD,MAAM,IAAI,4BAA4B,KAAK,KAAK,KAAK,CAAC;AAAA,EACtD,IAAI,CAAC;AAAA,IAAG,OAAO;AAAA,EACf,MAAM,SAAS,UA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G;AAAA,EACX,CAAC,KAAK,GAAG;AAAA,EACT,CAAC,MAAM,MAAM;AAAA,EACb,CAAC,KAAK,MAAM;AAAA,EACZ,CAAC,MAAM,MAAM;AAAA,EACb,CAAC,MAAM,MAAM;AAAA,EACb,CAAC,MAAM,MAAM;AAAA,EACb,CAAC,QAAQ,IAAI;AAAA,EACb,CAAC,MAAM,IAAI;AAAA,EACX,CAAC,QAAQ,IAAI;AAAA,EACb,CAAC,MAAM,IAAI;AAAA,EACX,CAAC,QAAQ,IAAI;AAAA,EACb,CAAC,MAAM,IAAI;AAAA,EACX,CAAC,KAAK,MAAM;AAAA,EACZ,CAAC,MAAM,MAAM;AAAA,EACb,CAAC,QAAQ,MAAM;AAAA,EACf,CAAC,SAAS,OAAO;AAAA,EACjB,CAAC,OAAO,OAAO;AAAA,EACf,CAAC,WAAW,OAAO;AAAA,EACnB,CAAC,WAAW,OAAO;AAAA,EACnB,CAAC,KAAK,KAAK;AAAA,EACX,CAAC,MAAM,MAAM;AAAA,EACb,CAAC,KAAK,KAAK;AAAA,EACX,CAAC,OAAO,MAAM;AAAA,EACd,CAAC,QAAQ,MAAM;AAAA,EACf,CAAC,MAAM,KAAK;AAChB,CAAC;AAEM,IAAM,kBAAkB,CAAC,WAA2B,UAAU,IAAI,MAAM,KAAK;",
9
+ "debugId": "CC145C48B0360EE764756E2164756E21",
9
10
  "names": []
10
11
  }
package/dist/index.js CHANGED
@@ -1,281 +1,40 @@
1
- import {
2
- STANDARD_TUNING2,
3
- parseFrets2,
4
- parseFingers2,
5
- baseFretOf2,
6
- renderGuitarDiagram2,
7
- parseLyrics2,
8
- parseChordPro2,
9
- keyPrefersFlats2,
10
- transposeChord2,
11
- transposeKey2,
12
- renderChart2,
13
- memberOf2,
14
- intervalLabel2,
15
- labelOf2,
16
- chordNoteSet2,
17
- scaleNoteSet2,
18
- listNoteSet2,
19
- renderFretboard2,
20
- parseTuning2,
21
- parseKeyRange2,
22
- keyRangeOf2,
23
- renderKeyboard2,
24
- parseChord2,
25
- LANGUAGES2,
26
- isNotationLanguage2,
27
- renderBlock2
28
- } from "./chunks/index-b71brbpf.js";
29
- import {
30
- SHARP_NAMES2,
31
- FLAT_NAMES2,
32
- chromaOf2,
33
- midiOf2,
34
- nameOf2,
35
- noteOf2,
36
- isFlat2
37
- } from "./chunks/index-y8a78sfx.js";
38
- // src/styles.css
39
- var styles_default = `/* Music notation. Colors follow Obsidian's theme variables when present, with fallbacks for any page. */
40
- .mn-block,
41
- .mn-svg,
42
- .mn-chart {
43
- --mn-fg: var(--text-normal, currentColor);
44
- --mn-muted: var(--text-muted, #8a8a8a);
45
- --mn-faint: var(--background-modifier-border, #d0d0d0);
46
- --mn-accent: var(--interactive-accent, #7c3aed);
47
- --mn-on-accent: var(--text-on-accent, #fff);
48
- /* Dark enough for white labels in light and dark themes. */
49
- --mn-root: #c2410c;
50
- /* Piano keys keep their real colors in every theme. */
51
- --mn-key-white: #fafafa;
52
- --mn-key-black: #222;
53
- font-family: var(--font-interface, system-ui, sans-serif);
54
- }
55
-
56
- .mn-block {
57
- color: var(--mn-fg);
58
- margin: 0.5em 0;
59
- overflow-x: auto;
60
- }
61
-
62
- .mn-svg {
63
- display: block;
64
- max-width: 100%;
65
- height: auto;
66
- }
67
-
68
- .mn-svg text {
69
- fill: var(--mn-fg);
70
- font-size: 11px;
71
- }
72
-
73
- .mn-svg .mn-title {
74
- font-size: 14px;
75
- font-weight: 600;
76
- }
77
-
78
- .mn-svg .mn-string,
79
- .mn-svg .mn-fret {
80
- stroke: var(--mn-muted);
81
- stroke-width: 1;
82
- }
83
-
84
- .mn-svg .mn-nut {
85
- stroke: var(--mn-fg);
86
- stroke-width: 4;
87
- }
88
-
89
- .mn-svg .mn-dot,
90
- .mn-svg .mn-barre {
91
- fill: var(--mn-accent);
92
- }
93
-
94
- .mn-svg .mn-dot.mn-root {
95
- fill: var(--mn-root);
96
- }
97
-
98
- .mn-svg .mn-dot-text {
99
- fill: var(--mn-on-accent);
100
- font-size: 10px;
101
- font-weight: 600;
102
- }
103
-
104
- .mn-svg .mn-open {
105
- fill: none;
106
- stroke: var(--mn-fg);
107
- stroke-width: 1.5;
108
- }
109
-
110
- .mn-svg .mn-open.mn-root {
111
- stroke: var(--mn-root);
112
- }
113
-
114
- .mn-svg .mn-muted,
115
- .mn-svg .mn-base-fret,
116
- .mn-svg .mn-fret-number,
117
- .mn-svg .mn-string-name {
118
- fill: var(--mn-muted);
119
- }
120
-
121
- .mn-svg .mn-inlay {
122
- fill: var(--mn-faint);
123
- }
124
-
125
- .mn-svg .mn-key-white {
126
- fill: var(--mn-key-white);
127
- stroke: #888;
128
- }
129
-
130
- .mn-svg .mn-key-black {
131
- fill: var(--mn-key-black);
132
- stroke: var(--mn-key-black);
133
- }
134
-
135
- .mn-svg .mn-key-white.mn-on,
136
- .mn-svg .mn-key-black.mn-on {
137
- fill: var(--mn-accent);
138
- }
139
-
140
- .mn-svg .mn-key-white.mn-on.mn-root,
141
- .mn-svg .mn-key-black.mn-on.mn-root {
142
- fill: var(--mn-root);
143
- }
144
-
145
- .mn-svg .mn-key-label {
146
- font-size: 10px;
147
- fill: var(--mn-on-accent);
148
- font-weight: 600;
149
- }
150
-
151
- /* Chord charts */
152
- .mn-chart {
153
- line-height: 1.3;
154
- }
155
-
156
- .mn-chart-title {
157
- font-size: 1.3em;
158
- font-weight: 700;
159
- }
160
-
161
- .mn-chart-subtitle,
162
- .mn-chart-meta {
163
- color: var(--mn-muted);
164
- }
165
-
166
- .mn-chart-meta {
167
- font-size: 0.9em;
168
- margin-top: 0.2em;
169
- }
170
-
171
- .mn-section {
172
- margin-top: 0.9em;
173
- }
174
-
175
- .mn-section-chorus {
176
- border-left: 3px solid var(--mn-accent);
177
- padding-left: 0.75em;
178
- }
179
-
180
- .mn-section-label {
181
- font-weight: 600;
182
- font-size: 0.85em;
183
- color: var(--mn-muted);
184
- text-transform: uppercase;
185
- letter-spacing: 0.04em;
186
- }
187
-
188
- .mn-line {
189
- display: flex;
190
- flex-wrap: wrap;
191
- align-items: flex-end;
192
- min-height: 1.3em;
193
- }
194
-
195
- .mn-seg {
196
- display: inline-flex;
197
- flex-direction: column;
198
- min-width: 0;
199
- max-width: 100%;
200
- white-space: pre-wrap;
201
- }
202
-
203
- .mn-chord {
204
- color: var(--mn-accent);
205
- font-weight: 700;
206
- min-height: 1.3em;
207
- padding-right: 0.4em;
208
- }
209
-
210
- .mn-chords-only .mn-seg {
211
- margin-right: 0.6em;
212
- }
213
-
214
- .mn-comment {
215
- font-style: italic;
216
- color: var(--mn-muted);
217
- }
218
-
219
- .mn-pre {
220
- font-family: var(--font-monospace, ui-monospace, monospace);
221
- margin: 0;
222
- white-space: pre;
223
- }
224
-
225
- .mn-error-message {
226
- color: var(--text-error, #c92a2a);
227
- font-size: 0.9em;
228
- }
229
- `;
230
-
231
- // src/styles.ts
232
- var STYLES = styles_default;
233
- var STYLE_ID = "music-notation-styles";
234
- function injectStyles(doc) {
235
- if (doc.getElementById(STYLE_ID))
236
- return;
237
- const style = doc.createElement("style");
238
- style.id = STYLE_ID;
239
- style.textContent = STYLES;
240
- doc.head.appendChild(style);
241
- }
242
1
  export {
243
- FLAT_NAMES2 as FLAT_NAMES,
244
- LANGUAGES2 as LANGUAGES,
245
- SHARP_NAMES2 as SHARP_NAMES,
246
- STANDARD_TUNING2 as STANDARD_TUNING,
2
+ FLAT_NAMES,
3
+ LANGUAGES,
4
+ SHARP_NAMES,
5
+ STANDARD_TUNING,
247
6
  STYLES,
248
- baseFretOf2 as baseFretOf,
249
- chordNoteSet2 as chordNoteSet,
250
- chromaOf2 as chromaOf,
7
+ baseFretOf,
8
+ chordNoteSet,
9
+ chromaOf,
251
10
  injectStyles,
252
- intervalLabel2 as intervalLabel,
253
- isFlat2 as isFlat,
254
- isNotationLanguage2 as isNotationLanguage,
255
- keyPrefersFlats2 as keyPrefersFlats,
256
- keyRangeOf2 as keyRangeOf,
257
- labelOf2 as labelOf,
258
- listNoteSet2 as listNoteSet,
259
- memberOf2 as memberOf,
260
- midiOf2 as midiOf,
261
- nameOf2 as nameOf,
262
- noteOf2 as noteOf,
263
- parseChord2 as parseChord,
264
- parseChordPro2 as parseChordPro,
265
- parseFingers2 as parseFingers,
266
- parseFrets2 as parseFrets,
267
- parseKeyRange2 as parseKeyRange,
268
- parseLyrics2 as parseLyrics,
269
- parseTuning2 as parseTuning,
270
- renderBlock2 as renderBlock,
271
- renderChart2 as renderChart,
272
- renderFretboard2 as renderFretboard,
273
- renderGuitarDiagram2 as renderGuitarDiagram,
274
- renderKeyboard2 as renderKeyboard,
275
- scaleNoteSet2 as scaleNoteSet,
276
- transposeChord2 as transposeChord,
277
- transposeKey2 as transposeKey
11
+ intervalLabel,
12
+ isFlat,
13
+ isNotationLanguage,
14
+ keyPrefersFlats,
15
+ keyRangeOf,
16
+ labelOf,
17
+ listNoteSet,
18
+ memberOf,
19
+ midiOf,
20
+ nameOf,
21
+ noteOf,
22
+ parseChord,
23
+ parseChordPro,
24
+ parseFingers,
25
+ parseFrets,
26
+ parseKeyRange,
27
+ parseLyrics,
28
+ parseTuning,
29
+ renderBlock,
30
+ renderChart,
31
+ renderFretboard,
32
+ renderGuitarDiagram,
33
+ renderKeyboard,
34
+ scaleNoteSet,
35
+ transposeChord,
36
+ transposeKey
278
37
  };
279
38
 
280
- //# debugId=07DF99AB4B3183CE64756E2164756E21
39
+ //# debugId=95429F22282564C864756E2164756E21
281
40
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1,10 +1,9 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../src/styles.ts"],
3
+ "sources": [],
4
4
  "sourcesContent": [
5
- "import css from './styles.css' with { type: 'text' }\n\n/** The library's stylesheet, for hosts that inject it themselves. */\nexport const STYLES: string = css\n\nconst STYLE_ID = 'music-notation-styles'\n\n/** Add the stylesheet to a document once. */\nexport function injectStyles(doc: Document): void {\n if (doc.getElementById(STYLE_ID)) return\n const style = doc.createElement('style')\n style.id = STYLE_ID\n style.textContent = STYLES\n doc.head.appendChild(style)\n}\n"
6
5
  ],
7
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGO,IAAM,SAAiB;AAE9B,IAAM,WAAW;AAGV,SAAS,YAAY,CAAC,KAAqB;AAAA,EAC9C,IAAI,IAAI,eAAe,QAAQ;AAAA,IAAG;AAAA,EAClC,MAAM,QAAQ,IAAI,cAAc,OAAO;AAAA,EACvC,MAAM,KAAK;AAAA,EACX,MAAM,cAAc;AAAA,EACpB,IAAI,KAAK,YAAY,KAAK;AAAA;",
8
- "debugId": "07DF99AB4B3183CE64756E2164756E21",
6
+ "mappings": "",
7
+ "debugId": "95429F22282564C864756E2164756E21",
9
8
  "names": []
10
9
  }