@dsebastien/music-notation 0.12.0 → 0.14.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/cli.js +1 -1
- package/dist/fretboard/tuning.d.ts +5 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1173 -455
- package/dist/index.js.map +18 -14
- package/dist/keyboard/piano-chord.d.ts +12 -0
- package/dist/keyboard/scale-fingering.d.ts +9 -0
- package/dist/music-notation.css +126 -50
- package/dist/music-notation.publish.min.js +155 -78
- package/dist/music-notation.tab.min.js +127 -51
- package/dist/playback/bar-parts.d.ts +46 -0
- package/dist/playback/block-bar.d.ts +80 -0
- package/dist/playback/controls.d.ts +32 -9
- package/dist/playback/progression-bar.d.ts +3 -2
- package/dist/playback/strum-bar.d.ts +4 -4
- package/dist/publish/index.js +1043 -405
- package/dist/publish/index.js.map +18 -14
- package/dist/render/dom.d.ts +2 -0
- package/dist/tab/index.js +17 -1
- package/dist/tab/index.js.map +4 -4
- package/dist/theory/harmonize.d.ts +57 -0
- package/dist/voicings/index.js +2 -1
- package/dist/voicings/index.js.map +3 -3
- package/package.json +1 -1
|
@@ -60,6 +60,18 @@ export declare function pianoVoicing(symbol: string, options?: PianoVoicingOptio
|
|
|
60
60
|
* else.
|
|
61
61
|
*/
|
|
62
62
|
export declare function triadFingering(voicing: PianoVoicing): Map<number, string> | null;
|
|
63
|
+
/**
|
|
64
|
+
* Fingers for a rootless or shell voicing (`fingering: auto`), by its spacing as spacedFingers
|
|
65
|
+
* gives them. Without `hands`, the hand that plays it where it sits: the left hand below middle C
|
|
66
|
+
* (the comping register: Dm7 rootless A F3 A3 C4 E4 is 5 3 2 1), else the right (1 2 3 5). With
|
|
67
|
+
* both hands, the left hand's root gets 5 and the right hand its notes (two notes: 1 and 5, 4, 3
|
|
68
|
+
* or 2 by their span). Null for a hand that would span more than an octave (a shell R-7, C B E).
|
|
69
|
+
*/
|
|
70
|
+
/**
|
|
71
|
+
* The hand `fingering: auto` gives a rootless or shell voicing without `hands` (#53 captions):
|
|
72
|
+
* the left below middle C, else the right. Null for other voicings, or when `hands` names them.
|
|
73
|
+
*/
|
|
74
|
+
export declare function autoVoicingHand(voicing: PianoVoicing): 'left' | 'right' | null;
|
|
63
75
|
/** Piano voicing of a chord as a note set: close root position from octave 4, a slash chord's bass in octave 3. */
|
|
64
76
|
export declare function pianoPitches(symbol: string, options?: PianoVoicingOptions): NoteSet;
|
|
65
77
|
/**
|
|
@@ -38,4 +38,13 @@ export declare function parseFingerList(text: string): string[];
|
|
|
38
38
|
* `fingering: auto` and its hands: "auto", "auto left", "left hand", "right"… The hand, or null
|
|
39
39
|
* when the value is a list of fingers.
|
|
40
40
|
*/
|
|
41
|
+
/**
|
|
42
|
+
* True for a fingering asking for both hands' standard fingering (#49): `auto both`, `both`,
|
|
43
|
+
* `both hands`, `auto (both hands)`. A keyboard block with it draws two keyboards.
|
|
44
|
+
*/
|
|
45
|
+
export declare function isBothHandsFingering(text: string): boolean;
|
|
46
|
+
/** The message for `fingering: auto` on something other than a scale. */
|
|
47
|
+
export declare const AUTO_FINGERING_NEEDS_SCALE = "fingering: auto goes with a major or minor scale (scale: G major): write one finger per note, e.g. fingering: 1 2 3 4 5";
|
|
48
|
+
/** The message for `fingering: auto` on a scale without a standard fingering. */
|
|
49
|
+
export declare const autoFingeringUnknown: (scale: string) => string;
|
|
41
50
|
export declare function autoFingeringHand(text: string): ScaleHand | null;
|
package/dist/music-notation.css
CHANGED
|
@@ -84,14 +84,38 @@
|
|
|
84
84
|
stroke-width: 2;
|
|
85
85
|
}
|
|
86
86
|
|
|
87
|
-
/* Playback: a
|
|
88
|
-
|
|
87
|
+
/* Playback (#58): a playable diagram is a button (a click plays it); one bar below the block
|
|
88
|
+
plays its diagrams. Host styles (Obsidian's buttons, selects and sliders) are reset inside the
|
|
89
|
+
bars. */
|
|
89
90
|
.mn-playable {
|
|
90
91
|
position: relative;
|
|
91
92
|
display: inline-block;
|
|
93
|
+
/* No line-box gap under the drawing, before the bar. */
|
|
94
|
+
vertical-align: top;
|
|
92
95
|
max-width: 100%;
|
|
96
|
+
border-radius: 6px;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/* The selected diagram of a row (the one the bar plays and names) and the focused one: outlines
|
|
100
|
+
drawn inside the edge (the block's scroll box, overflow-x, never cuts them) and over the
|
|
101
|
+
drawing (keys and chips reach the edge), kept in forced-colors mode. */
|
|
102
|
+
.mn-playable.mn-selected {
|
|
103
|
+
outline: 2px solid color-mix(in srgb, var(--mn-accent) 45%, transparent);
|
|
104
|
+
outline-offset: -2px;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
.mn-playable:focus-visible {
|
|
108
|
+
outline: 2px solid var(--mn-accent);
|
|
109
|
+
outline-offset: -2px;
|
|
93
110
|
}
|
|
94
111
|
|
|
112
|
+
/* A mouse click focuses the diagram too: only the selection shows then. */
|
|
113
|
+
.mn-playable:focus:not(:focus-visible):not(.mn-selected) {
|
|
114
|
+
outline: none;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/* The tab and score bar (#82 gives it the block bar's look): a strip at the bottom of the score,
|
|
118
|
+
shown on hover, keyboard focus or a tap. */
|
|
95
119
|
.mn-play {
|
|
96
120
|
position: absolute;
|
|
97
121
|
left: 2px;
|
|
@@ -114,13 +138,6 @@
|
|
|
114
138
|
transition: opacity 120ms ease;
|
|
115
139
|
}
|
|
116
140
|
|
|
117
|
-
.mn-playable:hover .mn-play,
|
|
118
|
-
.mn-playable:focus-within .mn-play,
|
|
119
|
-
.mn-playable.mn-play-open .mn-play {
|
|
120
|
-
opacity: 1;
|
|
121
|
-
pointer-events: auto;
|
|
122
|
-
}
|
|
123
|
-
|
|
124
141
|
.mn-play button,
|
|
125
142
|
.mn-play select {
|
|
126
143
|
all: unset;
|
|
@@ -134,6 +151,22 @@
|
|
|
134
151
|
font-size: 10px;
|
|
135
152
|
color: inherit;
|
|
136
153
|
border-radius: 4px;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
/* The hand on everything that plays or sets something (#81), with a class in every selector so it
|
|
157
|
+
outranks host element rules such as Obsidian's `button { cursor: var(--cursor) }`, and again
|
|
158
|
+
under `.mn-block` for hosts with class rules; no !important. Without playback there is no
|
|
159
|
+
.mn-playable: diagrams and notes keep the arrow. */
|
|
160
|
+
.mn-playable,
|
|
161
|
+
.mn-playable *,
|
|
162
|
+
.mn-play button,
|
|
163
|
+
.mn-play select,
|
|
164
|
+
.mn-play input[type='range'],
|
|
165
|
+
.mn-block .mn-playable,
|
|
166
|
+
.mn-block .mn-playable *,
|
|
167
|
+
.mn-block .mn-play button,
|
|
168
|
+
.mn-block .mn-play select,
|
|
169
|
+
.mn-block .mn-play input[type='range'] {
|
|
137
170
|
cursor: pointer;
|
|
138
171
|
}
|
|
139
172
|
|
|
@@ -162,7 +195,7 @@
|
|
|
162
195
|
}
|
|
163
196
|
|
|
164
197
|
.mn-play-icon-loop,
|
|
165
|
-
.mn-play-icon-
|
|
198
|
+
.mn-play-icon-line {
|
|
166
199
|
fill: none;
|
|
167
200
|
stroke: currentColor;
|
|
168
201
|
stroke-width: 1.6;
|
|
@@ -176,11 +209,34 @@
|
|
|
176
209
|
gap: 2px;
|
|
177
210
|
}
|
|
178
211
|
|
|
212
|
+
.mn-play-field[hidden] {
|
|
213
|
+
display: none;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
/* The tab bar's glyph before a slider. */
|
|
179
217
|
.mn-play-label {
|
|
180
218
|
display: inline-flex;
|
|
181
219
|
opacity: 0.8;
|
|
182
220
|
}
|
|
183
221
|
|
|
222
|
+
/* A slider's value after it ("90 BPM", "12 ms"), in digits of one width so the bar doesn't move
|
|
223
|
+
while it changes. */
|
|
224
|
+
.mn-play-value {
|
|
225
|
+
min-width: 7ch;
|
|
226
|
+
font-variant-numeric: tabular-nums;
|
|
227
|
+
white-space: nowrap;
|
|
228
|
+
opacity: 0.85;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
/* The selected diagram's name on the bar of a row. */
|
|
232
|
+
.mn-play-name {
|
|
233
|
+
max-width: 16ch;
|
|
234
|
+
overflow: hidden;
|
|
235
|
+
text-overflow: ellipsis;
|
|
236
|
+
white-space: nowrap;
|
|
237
|
+
font-weight: 600;
|
|
238
|
+
}
|
|
239
|
+
|
|
184
240
|
.mn-play input[type='range'] {
|
|
185
241
|
all: unset;
|
|
186
242
|
appearance: none;
|
|
@@ -190,7 +246,6 @@
|
|
|
190
246
|
height: 9px;
|
|
191
247
|
margin: 0;
|
|
192
248
|
background: linear-gradient(var(--mn-faint), var(--mn-faint)) center / 100% 3px no-repeat;
|
|
193
|
-
cursor: pointer;
|
|
194
249
|
}
|
|
195
250
|
|
|
196
251
|
.mn-play input[type='range']::-webkit-slider-runnable-track {
|
|
@@ -233,11 +288,6 @@
|
|
|
233
288
|
background: var(--mn-accent);
|
|
234
289
|
}
|
|
235
290
|
|
|
236
|
-
.mn-playable [data-midi],
|
|
237
|
-
.mn-playable .mn-hit {
|
|
238
|
-
cursor: pointer;
|
|
239
|
-
}
|
|
240
|
-
|
|
241
291
|
/* A playable mark's hit area: invisible, but it takes clicks and taps (an open string's circle is
|
|
242
292
|
only a ring), centered on the mark. */
|
|
243
293
|
.mn-svg .mn-hit {
|
|
@@ -251,30 +301,6 @@
|
|
|
251
301
|
pointer-events: none;
|
|
252
302
|
}
|
|
253
303
|
|
|
254
|
-
/* The bar's empty space lets clicks through to the dots under it; its controls take them. */
|
|
255
|
-
.mn-playable:hover .mn-play,
|
|
256
|
-
.mn-playable:focus-within .mn-play,
|
|
257
|
-
.mn-playable.mn-play-open .mn-play {
|
|
258
|
-
pointer-events: none;
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
.mn-playable:hover .mn-play > *,
|
|
262
|
-
.mn-playable:focus-within .mn-play > *,
|
|
263
|
-
.mn-playable.mn-play-open .mn-play > * {
|
|
264
|
-
pointer-events: auto;
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
/* Touch screens: hover sticks after a tap, so only a tap opens the bar. */
|
|
268
|
-
@media (hover: none) {
|
|
269
|
-
.mn-playable:hover:not(.mn-play-open) .mn-play {
|
|
270
|
-
opacity: 0;
|
|
271
|
-
}
|
|
272
|
-
|
|
273
|
-
.mn-playable:hover:not(.mn-play-open) .mn-play > * {
|
|
274
|
-
pointer-events: none;
|
|
275
|
-
}
|
|
276
|
-
}
|
|
277
|
-
|
|
278
304
|
/* Tabs and scores: the player bar stays at the bottom of the screen while the score scrolls. */
|
|
279
305
|
.mn-tab {
|
|
280
306
|
position: relative;
|
|
@@ -516,6 +542,31 @@
|
|
|
516
542
|
stroke: var(--mn-fg);
|
|
517
543
|
}
|
|
518
544
|
|
|
545
|
+
/* Fingering in words (#53): a short paragraph under the diagram, at most a little wider than a
|
|
546
|
+
chord diagram, so a row of captioned chords stays a row. */
|
|
547
|
+
.mn-block .mn-captioned {
|
|
548
|
+
display: flex;
|
|
549
|
+
flex-direction: column;
|
|
550
|
+
/* The diagram centered over its words, which can be wider than a chord diagram. */
|
|
551
|
+
align-items: center;
|
|
552
|
+
gap: 0.35em;
|
|
553
|
+
margin: 0;
|
|
554
|
+
}
|
|
555
|
+
|
|
556
|
+
.mn-block .mn-fingering[hidden] {
|
|
557
|
+
display: none;
|
|
558
|
+
}
|
|
559
|
+
|
|
560
|
+
.mn-block .mn-fingering {
|
|
561
|
+
max-width: 16em;
|
|
562
|
+
margin: 0;
|
|
563
|
+
font-size: 0.85em;
|
|
564
|
+
line-height: 1.4;
|
|
565
|
+
/* Obsidian's muted text; elsewhere the page's own text color, readable on any background
|
|
566
|
+
(the grey fallback of --mn-muted is too light for small text on white). */
|
|
567
|
+
color: var(--text-muted, currentColor);
|
|
568
|
+
}
|
|
569
|
+
|
|
519
570
|
/* Several diagrams in one block: a row that wraps, or a grid of at most `columns` columns that
|
|
520
571
|
also wraps on narrow screens rather than shrinking diagrams to nothing. */
|
|
521
572
|
.mn-block .mn-row {
|
|
@@ -793,12 +844,12 @@
|
|
|
793
844
|
|
|
794
845
|
/* Following a strumming pattern: the slot that plays gets a band and its strum the playing
|
|
795
846
|
color (the band keeps it visible for a muted strum and in any theme). */
|
|
796
|
-
.mn-
|
|
847
|
+
.mn-timed .mn-svg .mn-strum-slot.mn-playing .mn-strum-cell {
|
|
797
848
|
fill: color-mix(in srgb, var(--mn-playing) 35%, transparent);
|
|
798
849
|
}
|
|
799
850
|
|
|
800
|
-
.mn-
|
|
801
|
-
.mn-
|
|
851
|
+
.mn-timed .mn-svg .mn-strum-slot.mn-playing .mn-strum-arrow,
|
|
852
|
+
.mn-timed .mn-svg .mn-strum-slot.mn-playing .mn-strum-mute {
|
|
802
853
|
stroke: var(--mn-fg);
|
|
803
854
|
stroke-width: 3;
|
|
804
855
|
}
|
|
@@ -862,6 +913,14 @@
|
|
|
862
913
|
margin-bottom: 0.3em;
|
|
863
914
|
}
|
|
864
915
|
|
|
916
|
+
/* Degrees a harmonized scale leaves out (#43). */
|
|
917
|
+
.mn-progression-note {
|
|
918
|
+
color: var(--mn-muted);
|
|
919
|
+
font-size: 0.8em;
|
|
920
|
+
font-style: italic;
|
|
921
|
+
margin-bottom: 0.3em;
|
|
922
|
+
}
|
|
923
|
+
|
|
865
924
|
.mn-block .mn-progression-chord {
|
|
866
925
|
display: flex;
|
|
867
926
|
flex-direction: column;
|
|
@@ -984,16 +1043,33 @@
|
|
|
984
1043
|
white-space: pre-wrap;
|
|
985
1044
|
}
|
|
986
1045
|
|
|
987
|
-
/*
|
|
1046
|
+
/* Every bar but the tab bar (#58): below what it plays, in the flow, always shown, at the left
|
|
1047
|
+
of the block even when a wide row scrolls. */
|
|
988
1048
|
.mn-play.mn-play-static {
|
|
989
|
-
position:
|
|
990
|
-
|
|
1049
|
+
position: sticky;
|
|
1050
|
+
left: 0;
|
|
1051
|
+
right: auto;
|
|
1052
|
+
bottom: auto;
|
|
1053
|
+
display: flex;
|
|
1054
|
+
width: fit-content;
|
|
1055
|
+
max-width: 100%;
|
|
1056
|
+
box-sizing: border-box;
|
|
991
1057
|
justify-content: flex-start;
|
|
992
|
-
|
|
1058
|
+
gap: 4px 8px;
|
|
1059
|
+
margin: 6px 0 0;
|
|
1060
|
+
padding: 3px 6px;
|
|
1061
|
+
font-size: 11px;
|
|
993
1062
|
opacity: 1;
|
|
994
1063
|
pointer-events: auto;
|
|
995
1064
|
}
|
|
996
1065
|
|
|
1066
|
+
.mn-timed {
|
|
1067
|
+
display: inline-flex;
|
|
1068
|
+
flex-direction: column;
|
|
1069
|
+
align-items: flex-start;
|
|
1070
|
+
max-width: 100%;
|
|
1071
|
+
}
|
|
1072
|
+
|
|
997
1073
|
.mn-progression-chord.mn-playing {
|
|
998
1074
|
border-radius: 6px;
|
|
999
1075
|
background: color-mix(in srgb, var(--mn-playing) 22%, transparent);
|
|
@@ -1042,15 +1118,15 @@
|
|
|
1042
1118
|
stroke: none;
|
|
1043
1119
|
}
|
|
1044
1120
|
|
|
1045
|
-
.mn-
|
|
1121
|
+
.mn-timed .mn-svg .mn-picking-slot.mn-playing .mn-picking-cell {
|
|
1046
1122
|
fill: color-mix(in srgb, var(--mn-playing) 35%, transparent);
|
|
1047
1123
|
}
|
|
1048
1124
|
|
|
1049
|
-
.mn-
|
|
1125
|
+
.mn-timed .mn-svg .mn-picking-slot.mn-playing .mn-picking-gap {
|
|
1050
1126
|
fill: var(--mn-playing);
|
|
1051
1127
|
}
|
|
1052
1128
|
|
|
1053
|
-
.mn-
|
|
1129
|
+
.mn-timed .mn-svg .mn-picking-slot.mn-playing .mn-picking-fret {
|
|
1054
1130
|
fill: var(--mn-on-playing);
|
|
1055
1131
|
}
|
|
1056
1132
|
|