@dsebastien/music-notation 0.22.1 → 0.23.1
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 +2107 -525
- package/dist/index.js.map +66 -52
- package/dist/keyboard/scale-fingering.d.ts +1 -1
- package/dist/music-notation.css +21 -0
- package/dist/music-notation.publish.min.js +58 -37
- package/dist/music-notation.tab.min.js +28 -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
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/** The keys of the catalog, and the parameters each one's English text asks for. */
|
|
2
|
+
import type { en } from './en/index.js';
|
|
3
|
+
export type English = typeof en;
|
|
4
|
+
export type MessageKey = keyof English;
|
|
5
|
+
/** The `{name}` placeholders of a string. */
|
|
6
|
+
type Names<S extends string> = S extends `${string}{${infer N}}${infer Rest}` ? N | Names<Rest> : never;
|
|
7
|
+
/** The parameters of a key: none for a plain text, an object with its placeholders otherwise. */
|
|
8
|
+
export type MessageParams<K extends MessageKey> = [Names<English[K]>] extends [never] ? [] : [params: {
|
|
9
|
+
[N in Names<English[K]>]: string | number;
|
|
10
|
+
}];
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type Language } from './language.js';
|
|
2
|
+
/**
|
|
3
|
+
* The language of a web page's blocks (#136): `language` of `window.musicNotationOptions` when it
|
|
4
|
+
* names one the library has, else the page's own (`<html lang>`), else English. A value the
|
|
5
|
+
* library has no table for is not an error: the next choice applies.
|
|
6
|
+
*/
|
|
7
|
+
export declare function pageLanguage(options: unknown, doc: Document): Language;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Texts in the language of the drawing in progress (#136). Like note naming (`withNaming`), a draw
|
|
3
|
+
* runs under a language (`withLanguage`) and the parsers and renderers call `t`. Code that runs
|
|
4
|
+
* later (a click, a player's state change) must not read the current language then: it takes a
|
|
5
|
+
* `translator()` when its bar or control is built, and uses that one.
|
|
6
|
+
*/
|
|
7
|
+
import { type Language } from './language.js';
|
|
8
|
+
import type { MessageKey, MessageParams } from './messages.js';
|
|
9
|
+
/** The language of the drawing in progress (English outside `withLanguage`). */
|
|
10
|
+
export declare const currentLanguage: () => Language;
|
|
11
|
+
/** Runs `fn` with `language` as the current one; the one before is back after, even on a throw. */
|
|
12
|
+
export declare function withLanguage<T>(language: Language | null | undefined, fn: () => T): T;
|
|
13
|
+
/** The language an option names, else the one in progress (a standalone call: English). */
|
|
14
|
+
export declare const languageFrom: (value: unknown) => Language;
|
|
15
|
+
export type Translator = <K extends MessageKey>(key: K, ...params: MessageParams<K>) => string;
|
|
16
|
+
/** A translator tied to `language`. A key a language lacks reads as English. */
|
|
17
|
+
export declare function translatorFor(language: Language): Translator;
|
|
18
|
+
/** A translator tied to the language in progress now: keep it for what runs later. */
|
|
19
|
+
export declare const translator: () => Translator;
|
|
20
|
+
/** The text of `key` in the language in progress. */
|
|
21
|
+
export declare const t: Translator;
|
package/dist/index.d.ts
CHANGED
|
@@ -9,6 +9,7 @@ export { sequenceOf, scaleRun, lengthOf, lightPlayer, pluckedString, pianoTone,
|
|
|
9
9
|
export { sampledPlayer, type SampledOptions } from './playback/sampled.js';
|
|
10
10
|
export { pageInstruments, type InstrumentSource } from './tab/instruments.js';
|
|
11
11
|
export { attachPlayback, type PlayOptions, type TimedBar } from './playback/controls.js';
|
|
12
|
+
export { ENGINES, chooseEngine, engineOf, engineOrder, pageEngine, type Engine } from './playback/engine.js';
|
|
12
13
|
export { volumeChanged } from './playback/live-volume.js';
|
|
13
14
|
export { attachCopy } from './playback/copy-image.js';
|
|
14
15
|
export { toSvgString, toPng, type ExportTheme, type SvgExportOptions, type PngExportOptions } from './export/image.js';
|
|
@@ -20,6 +21,8 @@ export { renderKeyboard, parseKeyRange, keyRangeOf, type KeyboardOptions } from
|
|
|
20
21
|
export { pianoVoicing, pianoPitches, triadFingering, type PianoVoicing, type PianoVoicingOptions, type PianoVoicingStyle, type PianoHands, type RootlessForm, type ShellForm } from './keyboard/piano-chord.js';
|
|
21
22
|
export { standardScaleFingering, scaleFingers, type ScaleHand } from './keyboard/scale-fingering.js';
|
|
22
23
|
export { renderFretboard, type FretboardOptions } from './fretboard/fretboard.js';
|
|
24
|
+
export { languageOf, LANGUAGES_OF_TEXTS, type Language } from './i18n/language.js';
|
|
25
|
+
export { withLanguage } from './i18n/translate.js';
|
|
23
26
|
export { NAMINGS, parseNaming, namingOf, toLetters, lettersInBlock, quoteAsWritten, noteInNaming, chordInNaming, shownText, withNaming, type Naming, type BlockReading } from './theory/naming.js';
|
|
24
27
|
export { ROOT_MARKS, rootMarkOf, parseRootMark, withRootMark, type RootMark } from './render/root-mark.js';
|
|
25
28
|
export { chordFormula, scaleFormula } from './theory/formula.js';
|