@dsebastien/music-notation 0.18.1 → 0.19.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.
@@ -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 {};
@@ -9,7 +9,7 @@ import type * as AT from '@coderline/alphatab';
9
9
  import type { NotePlayer } from '../playback/player.js';
10
10
  export type AlphaTabModule = typeof AT;
11
11
  /** The alphaTab release these blocks are made for (Publish loads it from jsDelivr). */
12
- export declare const ALPHATAB_VERSION = "1.8.4";
12
+ export declare const ALPHATAB_VERSION = "1.9.0";
13
13
  /** jsDelivr URLs of alphaTab's script, music font and soundfont, for web pages. */
14
14
  export declare const alphaTabCdn: (version?: string) => {
15
15
  script: string;
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";
@@ -1964,7 +2000,7 @@ function chordSheetToChordPro(text) {
1964
2000
  }
1965
2001
 
1966
2002
  // src/tab/index.ts
1967
- var ALPHATAB_VERSION = "1.8.4";
2003
+ var ALPHATAB_VERSION = "1.9.0";
1968
2004
  var alphaTabCdn = (version = ALPHATAB_VERSION) => {
1969
2005
  const base = `https://cdn.jsdelivr.net/npm/@coderline/alphatab@${version}/dist`;
1970
2006
  return {
@@ -2330,7 +2366,8 @@ function renderTab(language, source, host, options) {
2330
2366
  },
2331
2367
  player: {
2332
2368
  playerMode: at.PlayerMode.Disabled,
2333
- enableUserInteraction: true,
2369
+ enableSeekToClick: true,
2370
+ enablePlaybackRangeSelection: true,
2334
2371
  scrollMode: at.ScrollMode.Off
2335
2372
  }
2336
2373
  };
@@ -2390,7 +2427,7 @@ function renderTab(language, source, host, options) {
2390
2427
  try {
2391
2428
  bytes = options.resolveFile ? await options.resolveFile(parsed.file) : null;
2392
2429
  } catch (e) {
2393
- throw new Error(`Couldn't read "${parsed.file}": ${e instanceof Error ? e.message : String(e)}`);
2430
+ throw new Error(`Couldn't read "${parsed.file}": ${e instanceof Error ? e.message : String(e)}`, { cause: e });
2394
2431
  }
2395
2432
  if (gone)
2396
2433
  return;
@@ -2601,5 +2638,5 @@ export {
2601
2638
  textTabToAlphaTex
2602
2639
  };
2603
2640
 
2604
- //# debugId=F0BE008A00DBAFB664756E2164756E21
2641
+ //# debugId=0EBAB5FCB977CF5664756E2164756E21
2605
2642
  //# sourceMappingURL=index.js.map