@dsebastien/music-notation 0.14.0 → 0.15.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.
@@ -14,6 +14,11 @@ export interface KeyboardOptions {
14
14
  playAs?: 'chord' | 'scale';
15
15
  /** Which hand plays each key (MIDI → left or right): a bracket and LH or RH under each hand's keys. */
16
16
  hands?: Map<number, 'left' | 'right'>;
17
+ /**
18
+ * The pick layer (Music Practice #73): every key is a target with its note and pitch, drawn
19
+ * above the keys and labels; `attachPick` makes it live. Off by default.
20
+ */
21
+ pick?: boolean;
17
22
  }
18
23
  /** "C3-B4" → MIDI range; null when invalid. */
19
24
  export declare function parseKeyRange(text: string): [number, number] | null;
@@ -22,6 +22,10 @@
22
22
  mid-grey black key, in every theme. */
23
23
  --mn-key-white-faint: #d4d4d8;
24
24
  --mn-key-black-faint: #8c8c8c;
25
+ /* Marks of the pick layer (Music Practice #73): right and wrong, dark enough for a white check
26
+ or cross in light and dark themes; the shape tells them apart too. */
27
+ --mn-right: #15803d;
28
+ --mn-wrong: #b91c1c;
25
29
  font-family: var(--font-interface, system-ui, sans-serif);
26
30
  }
27
31
 
@@ -162,6 +166,8 @@
162
166
  .mn-play button,
163
167
  .mn-play select,
164
168
  .mn-play input[type='range'],
169
+ .mn-svg .mn-pick[role='button'],
170
+ .mn-block .mn-pick[role='button'],
165
171
  .mn-block .mn-playable,
166
172
  .mn-block .mn-playable *,
167
173
  .mn-block .mn-play button,
@@ -170,6 +176,59 @@
170
176
  cursor: pointer;
171
177
  }
172
178
 
179
+ /* The pick layer (Music Practice #73): a live target (role button, set by attachPick) shows only
180
+ when hovered (a faint fill) or focused by the keyboard (a ring inside its cell); white-key
181
+ targets sit under the black keys, so neither covers a black key. Marks are a disc with a check
182
+ or a cross. */
183
+ .mn-svg .mn-pick[role='button'] {
184
+ outline: none;
185
+ }
186
+
187
+ .mn-svg .mn-pick[role='button']:hover {
188
+ fill: color-mix(in srgb, var(--mn-accent) 16%, transparent);
189
+ }
190
+
191
+ .mn-svg .mn-pick[role='button']:focus-visible {
192
+ fill: color-mix(in srgb, var(--mn-accent) 20%, transparent);
193
+ outline: 2px solid var(--mn-accent);
194
+ outline-offset: -2px;
195
+ }
196
+
197
+ .mn-svg .mn-pick-disc {
198
+ stroke: var(--mn-bg);
199
+ stroke-width: 1.5;
200
+ }
201
+
202
+ .mn-svg .mn-pick-right .mn-pick-disc {
203
+ fill: var(--mn-right);
204
+ }
205
+
206
+ .mn-svg .mn-pick-wrong .mn-pick-disc {
207
+ fill: var(--mn-wrong);
208
+ }
209
+
210
+ .mn-svg .mn-pick-check,
211
+ .mn-svg .mn-pick-cross {
212
+ stroke: #fff;
213
+ }
214
+
215
+ @media (forced-colors: active) {
216
+ .mn-svg .mn-pick[role='button']:focus-visible {
217
+ outline-color: Highlight;
218
+ }
219
+
220
+ .mn-svg .mn-pick-right .mn-pick-disc,
221
+ .mn-svg .mn-pick-wrong .mn-pick-disc {
222
+ fill: Canvas;
223
+ stroke: CanvasText;
224
+ }
225
+
226
+ .mn-svg .mn-pick-check,
227
+ .mn-svg .mn-pick-cross {
228
+ stroke: CanvasText;
229
+ }
230
+ }
231
+
173
232
  /* The opened list is a native popup on the page's background, not the bar's: its options take
174
233
  the page's colors, not the bar's inherited text color (light text on white in dark themes). */
175
234
  .mn-play select option {