@dsebastien/music-notation 0.22.0 → 0.23.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 +1 -1
- package/dist/blocks/renderers.d.ts +8 -1
- package/dist/chord/generate.d.ts +2 -0
- package/dist/chord/words.d.ts +4 -0
- package/dist/export/image.d.ts +2 -0
- package/dist/fretboard/exercise.d.ts +0 -16
- package/dist/fretboard/positions.d.ts +0 -17
- package/dist/i18n/en/diagrams.d.ts +139 -0
- package/dist/i18n/en/index.d.ts +532 -0
- package/dist/i18n/en/parse.d.ts +249 -0
- package/dist/i18n/en/play.d.ts +82 -0
- package/dist/i18n/en/timed.d.ts +75 -0
- package/dist/i18n/fr/diagrams.d.ts +139 -0
- package/dist/i18n/fr/index.d.ts +7 -0
- package/dist/i18n/fr/parse.d.ts +249 -0
- package/dist/i18n/fr/play.d.ts +82 -0
- package/dist/i18n/fr/timed.d.ts +72 -0
- package/dist/i18n/index.d.ts +3 -0
- package/dist/i18n/language.d.ts +543 -0
- package/dist/i18n/messages.d.ts +11 -0
- package/dist/i18n/page.d.ts +7 -0
- package/dist/i18n/translate.d.ts +21 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +2111 -525
- package/dist/index.js.map +66 -52
- package/dist/keyboard/scale-fingering.d.ts +1 -1
- package/dist/music-notation.css +25 -0
- package/dist/music-notation.publish.min.js +62 -37
- package/dist/music-notation.tab.min.js +32 -7
- package/dist/picking/pattern.d.ts +0 -7
- package/dist/playback/bar-parts.d.ts +4 -0
- package/dist/playback/controls.d.ts +23 -2
- package/dist/playback/copy-image.d.ts +6 -5
- package/dist/playback/engine.d.ts +34 -0
- package/dist/publish/auto.d.ts +2 -0
- package/dist/publish/index.js +2080 -527
- package/dist/publish/index.js.map +66 -52
- package/dist/tab/auto.d.ts +2 -0
- package/dist/tab/follow-scroll.d.ts +65 -0
- package/dist/tab/index.d.ts +54 -2
- package/dist/tab/index.js +1586 -76
- package/dist/tab/index.js.map +24 -9
- package/dist/tab/note-names.d.ts +50 -0
- package/dist/voicings/index.js +1323 -79
- package/dist/voicings/index.js.map +23 -10
- package/package.json +1 -1
|
@@ -1,12 +1,29 @@
|
|
|
1
|
+
import { type Language } from '../i18n/language.js';
|
|
1
2
|
import type { Hand } from '../render/layout.js';
|
|
2
3
|
import { type NotePlayer, type PlayKind, type Sound } from './player.js';
|
|
4
|
+
import { type Engine } from './engine.js';
|
|
3
5
|
export interface PlayOptions {
|
|
6
|
+
/**
|
|
7
|
+
* The language of the bars' texts and of the diagrams they redraw (#136): `'en'` or `'fr'`.
|
|
8
|
+
* Inside `renderBlock` the block's language is used; a standalone call defaults to English.
|
|
9
|
+
*/
|
|
10
|
+
language?: Language | (string & {});
|
|
4
11
|
/**
|
|
5
12
|
* Plays the notes: a player, or a function returning one at each play (null for the default),
|
|
6
13
|
* so a soundfont loaded later is used once it's there. The function gets the diagram's window
|
|
7
14
|
* (popouts have their own). The light synthesizer by default.
|
|
8
15
|
*/
|
|
9
16
|
player?: NotePlayer | ((win: Window) => NotePlayer | null | undefined);
|
|
17
|
+
/**
|
|
18
|
+
* The players the host has, by engine (#124): GeneralUser GS samples, the sonivox bank, the
|
|
19
|
+
* light synthesizer (the library's own when left out). Each is a player or a function read
|
|
20
|
+
* at each play (null: not there now). When given, a block plays through the first engine the
|
|
21
|
+
* host has, in this order: the block's `engine:` line, `engine`, then GeneralUser GS, sonivox
|
|
22
|
+
* and light. `player` is then not used. Without it, `player` plays, as before.
|
|
23
|
+
*/
|
|
24
|
+
engines?: Partial<Record<Engine, NotePlayer | ((win: Window) => NotePlayer | null | undefined)>>;
|
|
25
|
+
/** The engine the page or the app chose (a setting): tried first, after a block's own wish. */
|
|
26
|
+
engine?: Engine;
|
|
10
27
|
/** Guitar or piano; by default the diagram's (piano for keyboards and piano chords). */
|
|
11
28
|
sound?: Sound;
|
|
12
29
|
/**
|
|
@@ -77,8 +94,12 @@ export declare const clamp: (n: number | undefined, lo: number, hi: number, fall
|
|
|
77
94
|
export declare function strumsOf(strum: PlayOptions['strum']): Record<Sound, number>;
|
|
78
95
|
export { icon } from './bar-parts.js';
|
|
79
96
|
export declare function lightFor(win: Window): NotePlayer;
|
|
80
|
-
/**
|
|
81
|
-
|
|
97
|
+
/**
|
|
98
|
+
* The player apps passed (read at each play), else the light synthesizer. With `engines` (#124),
|
|
99
|
+
* the first engine the host has: the wish of the block `el` is in, the host's `engine`, then the
|
|
100
|
+
* fallback order; the light synthesizer when it has none.
|
|
101
|
+
*/
|
|
102
|
+
export declare function playerFor(win: Window, options: PlayOptions, el?: Element | null): NotePlayer;
|
|
82
103
|
/** The diagram's own playback data, set by its renderer. */
|
|
83
104
|
export interface DiagramData {
|
|
84
105
|
kind: PlayKind;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
/** What the button says after a click. */
|
|
1
|
+
/** What the button says after a click, in English (the other languages are in the catalog). */
|
|
2
2
|
export declare const COPY_SAID: {
|
|
3
|
-
readonly copied:
|
|
4
|
-
readonly refused:
|
|
5
|
-
readonly unsupported:
|
|
6
|
-
readonly failed:
|
|
3
|
+
readonly copied: string;
|
|
4
|
+
readonly refused: string;
|
|
5
|
+
readonly unsupported: string;
|
|
6
|
+
readonly failed: string;
|
|
7
7
|
};
|
|
8
8
|
/** The image of a block bar's diagram: its captioned figure when it has one, else its wrapper. */
|
|
9
9
|
export declare function diagramImage(wrap: HTMLElement): HTMLElement;
|
|
@@ -22,4 +22,5 @@ export declare function copyImageButton(doc: Document, win: Window, target: (who
|
|
|
22
22
|
export declare function attachCopy(el: HTMLElement, make?: (el: Element) => Promise<Blob>, options?: {
|
|
23
23
|
copy?: boolean;
|
|
24
24
|
fullScreen?: boolean;
|
|
25
|
+
language?: string;
|
|
25
26
|
}): () => void;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Which engine plays the notes (#124): GeneralUser GS samples, alphaTab's small sonivox bank, or
|
|
3
|
+
* the light synthesizer. The reader's side chooses (a page's or an app's `engine`); a block may
|
|
4
|
+
* say `engine:` as a wish. A wish is never a demand: when the host can't give an engine, the next
|
|
5
|
+
* one of the fallback order plays, and the light synthesizer is always there for diagrams.
|
|
6
|
+
*/
|
|
7
|
+
export type Engine = 'generaluser' | 'sonivox' | 'light';
|
|
8
|
+
/** The fallback order, always: the best sound the host has. */
|
|
9
|
+
export declare const ENGINES: readonly Engine[];
|
|
10
|
+
/** An engine's name from a page option, a setting or a block line; null when it isn't one. */
|
|
11
|
+
export declare function engineOf(value: unknown): Engine | null;
|
|
12
|
+
/** The engines to try, in order: the wish first, then the fallback order. */
|
|
13
|
+
export declare function engineOrder(wish?: Engine | null): Engine[];
|
|
14
|
+
/**
|
|
15
|
+
* The first engine of the order that the host has: `has` says so for each one (and may return
|
|
16
|
+
* what plays it). Null when it has none of them.
|
|
17
|
+
*/
|
|
18
|
+
export declare function chooseEngine<T>(wish: Engine | null | undefined, has: (engine: Engine) => T | null | undefined | false): {
|
|
19
|
+
engine: Engine;
|
|
20
|
+
value: T;
|
|
21
|
+
} | null;
|
|
22
|
+
/**
|
|
23
|
+
* A block's `engine:` line (the last one wins; `{engine: …}` in a ChordPro chart), taken out of
|
|
24
|
+
* its source so that no block parser has to know it. Throws a message for the user when the value
|
|
25
|
+
* isn't an engine.
|
|
26
|
+
*/
|
|
27
|
+
export declare function blockEngine(source: string, chart?: boolean): {
|
|
28
|
+
engine: Engine | null;
|
|
29
|
+
source: string;
|
|
30
|
+
};
|
|
31
|
+
/** The wish of the block an element is in (`data-mn-engine`, set from its `engine:` line). */
|
|
32
|
+
export declare function engineWish(el: Element | null | undefined): Engine | null;
|
|
33
|
+
/** A page's engine (`play: { engine }` in `window.musicNotationOptions`), when it names one. */
|
|
34
|
+
export declare function pageEngine(options: unknown): Engine | undefined;
|
package/dist/publish/auto.d.ts
CHANGED
|
@@ -15,6 +15,8 @@ declare global {
|
|
|
15
15
|
musicNotationOptions?: unknown;
|
|
16
16
|
/** Set by the tab bundle once its soundfont is loaded: diagrams play through it. */
|
|
17
17
|
musicNotationSoundfontPlayer?: NotePlayer;
|
|
18
|
+
/** Set by the tab bundle: alphaTab's whole soundfont (sonivox), for the engine choice. */
|
|
19
|
+
musicNotationSonivoxPlayer?: NotePlayer;
|
|
18
20
|
MusicNotation?: typeof api & {
|
|
19
21
|
lookupGuitarVoicing: typeof lookupGuitarVoicing;
|
|
20
22
|
stop: () => void;
|