@dsebastien/music-notation 0.11.0 → 0.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -3
- package/dist/chord/fingering-words.d.ts +31 -0
- package/dist/chords/chart.d.ts +51 -1
- package/dist/cli.js +1 -1
- package/dist/fretboard/exercise.d.ts +6 -0
- package/dist/fretboard/tuning.d.ts +5 -0
- package/dist/index.d.ts +5 -3
- package/dist/index.js +1011 -104
- package/dist/index.js.map +23 -20
- package/dist/keyboard/piano-chord.d.ts +12 -0
- package/dist/keyboard/scale-fingering.d.ts +9 -0
- package/dist/music-notation.css +50 -0
- package/dist/music-notation.publish.min.js +78 -27
- package/dist/music-notation.tab.min.js +51 -1
- package/dist/playback/app-bar.d.ts +8 -0
- package/dist/playback/controls.d.ts +27 -0
- package/dist/playback/progression.d.ts +18 -5
- package/dist/playback/strum-bar.d.ts +2 -0
- package/dist/publish/index.js +949 -102
- package/dist/publish/index.js.map +23 -20
- package/dist/render/layout.d.ts +35 -0
- package/dist/tab/index.js +16 -1
- package/dist/tab/index.js.map +3 -3
- package/dist/theory/harmonize.d.ts +57 -0
- package/dist/voicings/index.js +107 -12
- package/dist/voicings/index.js.map +4 -4
- package/package.json +1 -1
package/dist/render/layout.d.ts
CHANGED
|
@@ -18,6 +18,41 @@ export declare function parseHand(text: string): Hand;
|
|
|
18
18
|
export declare function layoutDefaults(value: unknown): LayoutDefaults;
|
|
19
19
|
/** Width a title needs (14px semi-bold), so a narrow diagram doesn't clip it. Errs on the wide side. */
|
|
20
20
|
export declare function titleWidth(title?: string): number;
|
|
21
|
+
/** Most lines a diagram's title takes (#74); a longer title squeezes its last line. */
|
|
22
|
+
export declare const MAX_TITLE_LINES = 3;
|
|
23
|
+
/** Distance between two lines of a title. */
|
|
24
|
+
export declare const TITLE_LINE = 17;
|
|
25
|
+
export interface TitleLine {
|
|
26
|
+
text: string;
|
|
27
|
+
/** Set when the line is wider than the diagram even alone: squeeze it to this length. */
|
|
28
|
+
textLength: number | null;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* The width of a line of a title at 14px semibold, closer than `titleWidth` (spaces and punctuation
|
|
32
|
+
* are narrow), with the same 8 of padding; for line breaks (#74).
|
|
33
|
+
*/
|
|
34
|
+
export declare function titleLineWidth(text: string): number;
|
|
35
|
+
/**
|
|
36
|
+
* A title's lines on a diagram `width` units wide (#74): the title never widens the diagram. It
|
|
37
|
+
* stays on one line when it fits (`titleLineWidth`); else it wraps into lines that fit, at most
|
|
38
|
+
* `MAX_TITLE_LINES`, breaking first after a comma or before a parenthesis, then at spaces; a word
|
|
39
|
+
* wider than the diagram, or the rest of a title that needs more lines, is squeezed (`textLength`,
|
|
40
|
+
* the padding left out).
|
|
41
|
+
*/
|
|
42
|
+
export declare function titleLines(title: string, width: number): TitleLine[];
|
|
43
|
+
/**
|
|
44
|
+
* Draws a diagram's title centered at `x`, its first baseline at `y` (#74): one `<text class=
|
|
45
|
+
* "mn-title">`, a `<tspan>` per line when it wraps (lines after the first start with a space, so
|
|
46
|
+
* the text reads as the title). Sets `data-mn-title-lines` on `root` for `alignTitleLines`.
|
|
47
|
+
*/
|
|
48
|
+
export declare function drawTitle(doc: Document, root: Element, lines: TitleLine[], x: number, y: number): Element;
|
|
49
|
+
/**
|
|
50
|
+
* Gives every diagram of a set the room of the set's longest title (#74), so their necks line up
|
|
51
|
+
* in a row: a diagram whose title takes fewer lines moves down by the missing lines (its content
|
|
52
|
+
* in a `<g class="mn-title-pad">`, its viewBox and height grown). Diagrams without
|
|
53
|
+
* `data-mn-title-lines` (no title) count as one line when another one has a title.
|
|
54
|
+
*/
|
|
55
|
+
export declare function alignTitleLines(diagrams: Iterable<Element>): void;
|
|
21
56
|
export interface NeckLayout {
|
|
22
57
|
orientation: Orientation;
|
|
23
58
|
hand: Hand;
|
package/dist/tab/index.js
CHANGED
|
@@ -191,6 +191,21 @@ function parseTuning(text) {
|
|
|
191
191
|
}
|
|
192
192
|
return midis;
|
|
193
193
|
}
|
|
194
|
+
function tuningNames(text) {
|
|
195
|
+
const trimmed = text.trim();
|
|
196
|
+
const named = NAMED.get(trimmed.toLowerCase().replace(/\s*\(.*\)$/, ""));
|
|
197
|
+
if (named)
|
|
198
|
+
return tuningNames(named);
|
|
199
|
+
if (!parseTuning(trimmed))
|
|
200
|
+
return null;
|
|
201
|
+
const spaced = trimmed.split(/[\s,]+/).filter(Boolean);
|
|
202
|
+
const names = spaced.length > 1 ? spaced : trimmed.match(/[A-G][#♯b♭]?|[a-g][#♯♭]?/g) ?? [];
|
|
203
|
+
return names.map((n) => {
|
|
204
|
+
const letter = n.charAt(0).toUpperCase();
|
|
205
|
+
const accidental = n.slice(1).replace(/-?\d+$/, "").replace("♯", "#").replace("♭", "b");
|
|
206
|
+
return letter + accidental;
|
|
207
|
+
});
|
|
208
|
+
}
|
|
194
209
|
|
|
195
210
|
// src/convert/text-tab.ts
|
|
196
211
|
var STRING_PREFIX = /^\s*([A-Ga-g][#b]?|[1-8](?=\s*[|:]))?\s*[|:]?/;
|
|
@@ -2090,5 +2105,5 @@ export {
|
|
|
2090
2105
|
textTabToAlphaTex
|
|
2091
2106
|
};
|
|
2092
2107
|
|
|
2093
|
-
//# debugId=
|
|
2108
|
+
//# debugId=E85AD092947E6FCA64756E2164756E21
|
|
2094
2109
|
//# sourceMappingURL=index.js.map
|