@dsebastien/music-notation 0.3.0 → 0.5.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 +26 -2
- package/dist/blocks/block-source.d.ts +5 -0
- package/dist/blocks/renderers.d.ts +3 -0
- package/dist/chord/generate.d.ts +71 -0
- package/dist/chord/guitar.d.ts +4 -0
- package/dist/chord/transitions.d.ts +46 -0
- package/dist/chord/triads.d.ts +43 -0
- package/dist/convert/chord-sheet.d.ts +2 -0
- package/dist/convert/text-tab.d.ts +5 -0
- package/dist/fretboard/fretboard.d.ts +2 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +1884 -17
- package/dist/index.js.map +18 -11
- package/dist/keyboard/keyboard.d.ts +2 -0
- package/dist/music-notation.css +216 -0
- package/dist/music-notation.publish.min.js +239 -11
- package/dist/music-notation.tab.min.js +527 -0
- package/dist/playback/controls.d.ts +21 -0
- package/dist/playback/player.d.ts +50 -0
- package/dist/publish/auto.d.ts +3 -0
- package/dist/publish/index.js +1491 -16
- package/dist/publish/index.js.map +16 -11
- package/dist/tab/auto.d.ts +16 -0
- package/dist/tab/index.d.ts +97 -0
- package/dist/tab/index.js +1043 -0
- package/dist/tab/index.js.map +19 -0
- package/dist/voicings/index.js +3 -2
- package/dist/voicings/index.js.map +3 -3
- package/package.json +21 -2
|
@@ -10,6 +10,8 @@ export interface KeyboardOptions {
|
|
|
10
10
|
/** Horizontal (default) or vertical: low notes at the bottom, black keys on the left. */
|
|
11
11
|
orientation?: Orientation;
|
|
12
12
|
marks?: NoteMarks;
|
|
13
|
+
/** How playback plays the highlighted keys: together (a chord) or one by one (a scale). */
|
|
14
|
+
playAs?: 'chord' | 'scale';
|
|
13
15
|
}
|
|
14
16
|
/** "C3-B4" → MIDI range; null when invalid. */
|
|
15
17
|
export declare function parseKeyRange(text: string): [number, number] | null;
|
package/dist/music-notation.css
CHANGED
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
--mn-muted: var(--text-muted, #8a8a8a);
|
|
7
7
|
--mn-faint: var(--background-modifier-border, #d0d0d0);
|
|
8
8
|
--mn-accent: var(--interactive-accent, #7c3aed);
|
|
9
|
+
--mn-bg: var(--background-primary, #fff);
|
|
9
10
|
--mn-on-accent: var(--text-on-accent, #fff);
|
|
10
11
|
/* Dark enough for white labels in light and dark themes. */
|
|
11
12
|
--mn-root: #c2410c;
|
|
@@ -66,6 +67,221 @@
|
|
|
66
67
|
stroke-width: 2;
|
|
67
68
|
}
|
|
68
69
|
|
|
70
|
+
/* Playback: a compact strip at the bottom of the diagram, shown on hover, keyboard focus or a
|
|
71
|
+
tap. Host styles (Obsidian's buttons, selects and sliders) are reset inside it. */
|
|
72
|
+
.mn-playable {
|
|
73
|
+
position: relative;
|
|
74
|
+
display: inline-block;
|
|
75
|
+
max-width: 100%;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.mn-play {
|
|
79
|
+
position: absolute;
|
|
80
|
+
left: 2px;
|
|
81
|
+
right: 2px;
|
|
82
|
+
bottom: 2px;
|
|
83
|
+
display: flex;
|
|
84
|
+
flex-wrap: wrap;
|
|
85
|
+
align-items: center;
|
|
86
|
+
justify-content: center;
|
|
87
|
+
gap: 2px 6px;
|
|
88
|
+
padding: 2px 4px;
|
|
89
|
+
font-size: 10px;
|
|
90
|
+
line-height: 1;
|
|
91
|
+
color: var(--mn-fg);
|
|
92
|
+
background: color-mix(in srgb, var(--mn-bg) 85%, transparent);
|
|
93
|
+
border: 1px solid var(--mn-faint);
|
|
94
|
+
border-radius: 6px;
|
|
95
|
+
opacity: 0;
|
|
96
|
+
pointer-events: none;
|
|
97
|
+
transition: opacity 120ms ease;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
.mn-playable:hover .mn-play,
|
|
101
|
+
.mn-playable:focus-within .mn-play,
|
|
102
|
+
.mn-playable.mn-play-open .mn-play {
|
|
103
|
+
opacity: 1;
|
|
104
|
+
pointer-events: auto;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
.mn-play button,
|
|
108
|
+
.mn-play select {
|
|
109
|
+
all: unset;
|
|
110
|
+
box-sizing: border-box;
|
|
111
|
+
display: inline-flex;
|
|
112
|
+
align-items: center;
|
|
113
|
+
justify-content: center;
|
|
114
|
+
height: 18px;
|
|
115
|
+
min-width: 18px;
|
|
116
|
+
padding: 0 3px;
|
|
117
|
+
font-size: 10px;
|
|
118
|
+
color: inherit;
|
|
119
|
+
border-radius: 4px;
|
|
120
|
+
cursor: pointer;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
.mn-play button:hover,
|
|
124
|
+
.mn-play select:hover,
|
|
125
|
+
.mn-play button:focus-visible,
|
|
126
|
+
.mn-play select:focus-visible {
|
|
127
|
+
background: color-mix(in srgb, var(--mn-fg) 12%, transparent);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
.mn-play button.mn-on {
|
|
131
|
+
background: var(--mn-accent);
|
|
132
|
+
color: var(--mn-on-accent);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
.mn-play-icon {
|
|
136
|
+
fill: currentColor;
|
|
137
|
+
stroke: none;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
.mn-play-icon-loop,
|
|
141
|
+
.mn-play-icon-volume {
|
|
142
|
+
fill: none;
|
|
143
|
+
stroke: currentColor;
|
|
144
|
+
stroke-width: 1.6;
|
|
145
|
+
stroke-linecap: round;
|
|
146
|
+
stroke-linejoin: round;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
.mn-play-field {
|
|
150
|
+
display: inline-flex;
|
|
151
|
+
align-items: center;
|
|
152
|
+
gap: 2px;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
.mn-play-label {
|
|
156
|
+
display: inline-flex;
|
|
157
|
+
opacity: 0.8;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
.mn-play input[type='range'] {
|
|
161
|
+
all: unset;
|
|
162
|
+
appearance: none;
|
|
163
|
+
width: 44px;
|
|
164
|
+
/* The input is the track: WebKit then centers the thumb on it. */
|
|
165
|
+
height: 3px;
|
|
166
|
+
margin: 0;
|
|
167
|
+
border-radius: 2px;
|
|
168
|
+
background: var(--mn-faint);
|
|
169
|
+
cursor: pointer;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
.mn-play input[type='range']::-webkit-slider-runnable-track {
|
|
173
|
+
height: 3px;
|
|
174
|
+
border: none;
|
|
175
|
+
background: transparent;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
.mn-play input[type='range']::-webkit-slider-thumb {
|
|
179
|
+
appearance: none;
|
|
180
|
+
width: 9px;
|
|
181
|
+
height: 9px;
|
|
182
|
+
margin-top: 0;
|
|
183
|
+
border: none;
|
|
184
|
+
border-radius: 50%;
|
|
185
|
+
background: var(--mn-accent);
|
|
186
|
+
box-shadow: none;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
.mn-play input[type='range']::-moz-range-track {
|
|
190
|
+
height: 3px;
|
|
191
|
+
border: none;
|
|
192
|
+
border-radius: 2px;
|
|
193
|
+
background: var(--mn-faint);
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
.mn-play input[type='range']::-moz-range-thumb {
|
|
197
|
+
width: 9px;
|
|
198
|
+
height: 9px;
|
|
199
|
+
border: none;
|
|
200
|
+
border-radius: 50%;
|
|
201
|
+
background: var(--mn-accent);
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
.mn-playable [data-midi] {
|
|
205
|
+
cursor: pointer;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
/* A finger number or note name over a dot or key lets the click reach it. */
|
|
209
|
+
.mn-playable .mn-svg text {
|
|
210
|
+
pointer-events: none;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
/* The bar's empty space lets clicks through to the dots under it; its controls take them. */
|
|
214
|
+
.mn-playable:hover .mn-play,
|
|
215
|
+
.mn-playable:focus-within .mn-play,
|
|
216
|
+
.mn-playable.mn-play-open .mn-play {
|
|
217
|
+
pointer-events: none;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
.mn-playable:hover .mn-play > *,
|
|
221
|
+
.mn-playable:focus-within .mn-play > *,
|
|
222
|
+
.mn-playable.mn-play-open .mn-play > * {
|
|
223
|
+
pointer-events: auto;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
/* Touch screens: hover sticks after a tap, so only a tap opens the bar. */
|
|
227
|
+
@media (hover: none) {
|
|
228
|
+
.mn-playable:hover:not(.mn-play-open) .mn-play {
|
|
229
|
+
opacity: 0;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
.mn-playable:hover:not(.mn-play-open) .mn-play > * {
|
|
233
|
+
pointer-events: none;
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
/* Tabs and scores: the player bar stays at the bottom of the screen while the score scrolls. */
|
|
238
|
+
.mn-tab {
|
|
239
|
+
position: relative;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
.mn-tab .mn-tab-bar {
|
|
243
|
+
position: sticky;
|
|
244
|
+
left: auto;
|
|
245
|
+
right: auto;
|
|
246
|
+
bottom: 6px;
|
|
247
|
+
width: fit-content;
|
|
248
|
+
max-width: 100%;
|
|
249
|
+
margin: 4px auto 0;
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
.mn-tab:hover .mn-tab-bar,
|
|
253
|
+
.mn-tab:focus-within .mn-tab-bar,
|
|
254
|
+
.mn-tab.mn-play-open .mn-tab-bar {
|
|
255
|
+
opacity: 1;
|
|
256
|
+
pointer-events: auto;
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
.mn-tab-time {
|
|
260
|
+
font-variant-numeric: tabular-nums;
|
|
261
|
+
opacity: 0.8;
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
.mn-tab-hidden {
|
|
265
|
+
position: absolute;
|
|
266
|
+
width: 1px;
|
|
267
|
+
height: 1px;
|
|
268
|
+
overflow: hidden;
|
|
269
|
+
left: -9999px;
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
/* Chord transitions: a finger that stays (anchor) gets a ring, one that slides (guide) a dashed
|
|
273
|
+
ring, so the marks don't rest on color alone. */
|
|
274
|
+
.mn-svg .mn-dot.mn-anchor {
|
|
275
|
+
stroke: var(--mn-fg);
|
|
276
|
+
stroke-width: 3;
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
.mn-svg .mn-dot.mn-guide {
|
|
280
|
+
stroke: var(--mn-fg);
|
|
281
|
+
stroke-width: 2.5;
|
|
282
|
+
stroke-dasharray: 3 2;
|
|
283
|
+
}
|
|
284
|
+
|
|
69
285
|
/* Notes that differ from a compared scale: outlined. */
|
|
70
286
|
.mn-svg .mn-dot.mn-diff,
|
|
71
287
|
.mn-svg .mn-key-white.mn-diff,
|