@dsebastien/music-notation 0.18.1 → 0.19.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 +5 -0
- package/dist/blocks/captions.d.ts +10 -0
- package/dist/blocks/renderers.d.ts +11 -0
- package/dist/cli.js +1 -1
- package/dist/export/image.d.ts +83 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +3938 -2994
- package/dist/index.js.map +22 -17
- package/dist/music-notation.css +52 -2
- package/dist/music-notation.publish.min.js +88 -35
- package/dist/music-notation.tab.min.js +59 -9
- package/dist/playback/bar-parts.d.ts +8 -0
- package/dist/playback/controls.d.ts +5 -0
- package/dist/playback/copy-image.d.ts +21 -0
- package/dist/publish/auto.d.ts +5 -0
- package/dist/publish/index.js +3901 -3017
- package/dist/publish/index.js.map +22 -17
- package/dist/render/dom.d.ts +8 -0
- package/dist/render/root-mark.d.ts +29 -0
- package/dist/tab/index.js +39 -3
- package/dist/tab/index.js.map +4 -4
- package/dist/theory/formula.d.ts +11 -0
- package/dist/voicings/index.js +1022 -756
- package/dist/voicings/index.js.map +8 -6
- package/package.json +1 -1
package/dist/render/dom.d.ts
CHANGED
|
@@ -27,6 +27,14 @@ export declare const uniqueId: () => string;
|
|
|
27
27
|
* show no hover tooltip for it: the diagram's visible title already says what it is.
|
|
28
28
|
*/
|
|
29
29
|
export declare function svgRoot(doc: Document, width: number, height: number, cls: string, label: string): SVGElement;
|
|
30
|
+
/**
|
|
31
|
+
* Adds a description to a diagram made by `svgRoot` (#14): a `<desc>` in its `<defs>`, pointed at
|
|
32
|
+
* by `aria-describedby`, that says what the drawing shows (screen readers read it after the name).
|
|
33
|
+
* Nothing for an empty text.
|
|
34
|
+
*/
|
|
35
|
+
export declare function describeDiagram(diagram: SVGElement, text: string): void;
|
|
36
|
+
/** A diagram's description (#14), when it has one. */
|
|
37
|
+
export declare function descriptionOf(diagram: Element): string | null;
|
|
30
38
|
/** A diagram's name for screen readers (its `aria-labelledby` text, else its `aria-label`). */
|
|
31
39
|
export declare function accessibleName(el: Element): string | null;
|
|
32
40
|
/** Renames a diagram made by `svgRoot` (or any element named with `aria-label`). */
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export type RootMark = 'color' | 'shape';
|
|
2
|
+
export declare const ROOT_MARKS: readonly RootMark[];
|
|
3
|
+
/** A root mark given by an app (any value): a valid one, else null. */
|
|
4
|
+
export declare function rootMarkOf(value: unknown): RootMark | null;
|
|
5
|
+
/** A block's `root-mark:` value; throws what to write otherwise. */
|
|
6
|
+
export declare function parseRootMark(text: string): RootMark;
|
|
7
|
+
/**
|
|
8
|
+
* A block's `root-mark:` line (the last one wins), taken out of its source so the diagrams never
|
|
9
|
+
* see it; null mark without one. Throws what to write for a wrong value.
|
|
10
|
+
*/
|
|
11
|
+
export declare function rootMarkInBlock(language: string, text: string): {
|
|
12
|
+
text: string;
|
|
13
|
+
mark: RootMark | null;
|
|
14
|
+
};
|
|
15
|
+
/** Draws under a root mark: the renderers called inside `draw` use it. Color again after. */
|
|
16
|
+
export declare function withRootMark<T>(mark: RootMark, draw: () => T): T;
|
|
17
|
+
/** True while drawing roots as shapes. */
|
|
18
|
+
export declare const rootAsShape: () => boolean;
|
|
19
|
+
type Attributes = Record<string, string | number | undefined>;
|
|
20
|
+
/**
|
|
21
|
+
* A note mark: a circle, or (a root, drawing roots as shapes) a rounded square of the circle's
|
|
22
|
+
* area, with the same classes and data attributes plus `mn-root-shape`.
|
|
23
|
+
*/
|
|
24
|
+
export declare function noteMark(doc: Document, root: boolean, { cx, cy, r, class: cls, ...rest }: Attributes & {
|
|
25
|
+
cx: number;
|
|
26
|
+
cy: number;
|
|
27
|
+
r: number;
|
|
28
|
+
}): SVGElement;
|
|
29
|
+
export {};
|
package/dist/tab/index.js
CHANGED
|
@@ -842,6 +842,28 @@ function svgRoot(doc, width, height, cls, label) {
|
|
|
842
842
|
"aria-labelledby": id
|
|
843
843
|
}, [svg(doc, "defs", {}, [title])]);
|
|
844
844
|
}
|
|
845
|
+
function describeDiagram(diagram, text) {
|
|
846
|
+
if (!text)
|
|
847
|
+
return;
|
|
848
|
+
const defs = [...diagram.children].find((c) => c.tagName.toLowerCase() === "defs");
|
|
849
|
+
if (!defs)
|
|
850
|
+
return;
|
|
851
|
+
const id = `${NAME_PREFIX}${++names}`;
|
|
852
|
+
const desc = svg(diagram.ownerDocument, "desc", { class: "mn-desc", id });
|
|
853
|
+
desc.textContent = text;
|
|
854
|
+
defs.appendChild(desc);
|
|
855
|
+
diagram.setAttribute("aria-describedby", id);
|
|
856
|
+
}
|
|
857
|
+
function descriptionOf(diagram) {
|
|
858
|
+
const id = diagram.getAttribute("aria-describedby");
|
|
859
|
+
if (!id)
|
|
860
|
+
return null;
|
|
861
|
+
for (const candidate of diagram.querySelectorAll("desc")) {
|
|
862
|
+
if (candidate.getAttribute("id") === id)
|
|
863
|
+
return candidate.textContent;
|
|
864
|
+
}
|
|
865
|
+
return null;
|
|
866
|
+
}
|
|
845
867
|
var nameElement = (el) => {
|
|
846
868
|
const id = el.getAttribute("aria-labelledby");
|
|
847
869
|
if (!id)
|
|
@@ -1778,9 +1800,10 @@ var ICONS = {
|
|
|
1778
1800
|
all: "M1.5 2.5v11l6.5-5.5zM8 2.5v11l6.5-5.5z",
|
|
1779
1801
|
loop: "M3 8a5 5 0 0 1 8.5-3.5L13 6V2.5M13 8a5 5 0 0 1-8.5 3.5L3 10v3.5",
|
|
1780
1802
|
count: "M5.5 14h5L9 2.5H7zM8 11.5l4.5-7",
|
|
1781
|
-
click: "M3 5v6M8 5v6M13 5v6"
|
|
1803
|
+
click: "M3 5v6M8 5v6M13 5v6",
|
|
1804
|
+
copy: "M2.5 3.5h11v9h-11zM2.5 11l3.5-3.5 3 3 2-2 2.5 2.5M10.5 6.5h.01"
|
|
1782
1805
|
};
|
|
1783
|
-
var STROKED = new Set(["loop", "count", "click"]);
|
|
1806
|
+
var STROKED = new Set(["loop", "count", "click", "copy"]);
|
|
1784
1807
|
function icon(doc, name) {
|
|
1785
1808
|
const root = svg(doc, "svg", {
|
|
1786
1809
|
class: `mn-play-icon mn-play-icon-${name}${STROKED.has(name) ? " mn-play-icon-line" : ""}`,
|
|
@@ -1799,6 +1822,19 @@ function playBar(doc, cls, label) {
|
|
|
1799
1822
|
bar.setAttribute("aria-label", label);
|
|
1800
1823
|
return bar;
|
|
1801
1824
|
}
|
|
1825
|
+
function placeBar(block, last, bar) {
|
|
1826
|
+
if (last.parentElement?.classList.contains("mn-exercise-block")) {
|
|
1827
|
+
last.after(bar);
|
|
1828
|
+
return;
|
|
1829
|
+
}
|
|
1830
|
+
let node = last;
|
|
1831
|
+
while (node.parentElement && node.parentElement !== block)
|
|
1832
|
+
node = node.parentElement;
|
|
1833
|
+
if (node.parentElement === block)
|
|
1834
|
+
node.after(bar);
|
|
1835
|
+
else
|
|
1836
|
+
block.appendChild(bar);
|
|
1837
|
+
}
|
|
1802
1838
|
function iconButton(doc, cls, label, name) {
|
|
1803
1839
|
const button = html(doc, "button", cls);
|
|
1804
1840
|
button.type = "button";
|
|
@@ -2601,5 +2637,5 @@ export {
|
|
|
2601
2637
|
textTabToAlphaTex
|
|
2602
2638
|
};
|
|
2603
2639
|
|
|
2604
|
-
//# debugId=
|
|
2640
|
+
//# debugId=82D97D2BA239548B64756E2164756E21
|
|
2605
2641
|
//# sourceMappingURL=index.js.map
|