vexflow 5.2.0 → 5.3.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.
Files changed (114) hide show
  1. package/build/cjs/vexflow-bravura.js +2 -2
  2. package/build/cjs/vexflow-bravura.js.map +1 -1
  3. package/build/cjs/vexflow-core.js +2 -2
  4. package/build/cjs/vexflow-core.js.map +1 -1
  5. package/build/cjs/vexflow-debug-with-tests.js +2759 -1382
  6. package/build/cjs/vexflow-debug-with-tests.js.map +1 -1
  7. package/build/cjs/vexflow-debug.js +1814 -1227
  8. package/build/cjs/vexflow-debug.js.map +1 -1
  9. package/build/cjs/vexflow.js +2 -2
  10. package/build/cjs/vexflow.js.map +1 -1
  11. package/build/esm/src/accidental.js +10 -3
  12. package/build/esm/src/articulation.js +24 -6
  13. package/build/esm/src/beam.js +158 -28
  14. package/build/esm/src/bend.js +24 -19
  15. package/build/esm/src/curve.js +27 -53
  16. package/build/esm/src/dot.js +13 -4
  17. package/build/esm/src/easyscore/composition.js +40 -1
  18. package/build/esm/src/easyscore/policies.js +34 -6
  19. package/build/esm/src/element.js +4 -0
  20. package/build/esm/src/engravinggeometry.js +150 -0
  21. package/build/esm/src/engravingprofile.js +44 -0
  22. package/build/esm/src/factory.js +15 -7
  23. package/build/esm/src/formatter.js +9 -1
  24. package/build/esm/src/gracenote.js +43 -38
  25. package/build/esm/src/gracenotegroup.js +53 -56
  26. package/build/esm/src/index.js +2 -0
  27. package/build/esm/src/keysignature.js +1 -1
  28. package/build/esm/src/modifiercontext.js +11 -0
  29. package/build/esm/src/notehead.js +11 -6
  30. package/build/esm/src/ornament.js +38 -18
  31. package/build/esm/src/proportionalformatter.js +54 -6
  32. package/build/esm/src/stavenote.js +128 -115
  33. package/build/esm/src/stavetie.js +39 -7
  34. package/build/esm/src/stem.js +26 -11
  35. package/build/esm/src/tickcontext.js +19 -0
  36. package/build/esm/src/timesignature.js +5 -0
  37. package/build/esm/src/tuplet.js +57 -17
  38. package/build/esm/src/version.js +3 -3
  39. package/build/esm/src/vexflow.js +4 -0
  40. package/build/esm/tests/bend_tests.js +14 -1
  41. package/build/esm/tests/curve_tests.js +14 -4
  42. package/build/esm/tests/demo_repertoire_tests.js +27 -0
  43. package/build/esm/tests/demos/drums.js +54 -0
  44. package/build/esm/tests/demos/electric.js +63 -0
  45. package/build/esm/tests/demos/greensleeves.js +90 -0
  46. package/build/esm/tests/demos/joy.js +61 -0
  47. package/build/esm/tests/demos/kesh.js +80 -0
  48. package/build/esm/tests/demos/prelude.js +59 -0
  49. package/build/esm/tests/demos/quartertones.js +50 -0
  50. package/build/esm/tests/demos/saints.js +65 -0
  51. package/build/esm/tests/engraving/score-layout.mjs +75 -0
  52. package/build/esm/tests/engraving/score-persistence.mjs +262 -0
  53. package/build/esm/tests/engraving/studies.mjs +279 -0
  54. package/build/esm/tests/formatter_tests.js +10 -1
  55. package/build/esm/tests/index.js +1 -0
  56. package/build/esm/tests/node/audit-dependencies-tests.mjs +42 -0
  57. package/build/esm/tests/node/easyscore-tests.mjs +71 -0
  58. package/build/esm/tests/node/engraving-layout-tests.mjs +449 -0
  59. package/build/esm/tests/node/local-engraving-tests.mjs +128 -0
  60. package/build/esm/tests/node/proportional-spacing-tests.mjs +64 -0
  61. package/build/esm/tests/node/rendering-tests.mjs +6 -2
  62. package/build/esm/tests/threevoice_tests.js +11 -1
  63. package/build/esm/tests/vexflow_test_helpers.js +19 -10
  64. package/build/esm/tools/audit-dependencies.mjs +61 -0
  65. package/build/esm/tools/score-fixtures.mjs +23 -6
  66. package/build/types/src/accidental.d.ts +4 -0
  67. package/build/types/src/articulation.d.ts +6 -1
  68. package/build/types/src/beam.d.ts +14 -0
  69. package/build/types/src/curve.d.ts +9 -0
  70. package/build/types/src/dot.d.ts +5 -0
  71. package/build/types/src/easyscore/composition.d.ts +19 -0
  72. package/build/types/src/easyscore/policies.d.ts +1 -1
  73. package/build/types/src/element.d.ts +2 -0
  74. package/build/types/src/engravinggeometry.d.ts +31 -0
  75. package/build/types/src/engravingprofile.d.ts +20 -0
  76. package/build/types/src/factory.d.ts +6 -1
  77. package/build/types/src/formatter.d.ts +3 -3
  78. package/build/types/src/gracenote.d.ts +7 -0
  79. package/build/types/src/gracenotegroup.d.ts +7 -2
  80. package/build/types/src/index.d.ts +2 -0
  81. package/build/types/src/modifiercontext.d.ts +4 -0
  82. package/build/types/src/notehead.d.ts +5 -0
  83. package/build/types/src/ornament.d.ts +7 -0
  84. package/build/types/src/proportionalformatter.d.ts +11 -2
  85. package/build/types/src/stavenote.d.ts +20 -2
  86. package/build/types/src/stavetie.d.ts +4 -0
  87. package/build/types/src/stem.d.ts +10 -1
  88. package/build/types/src/tickcontext.d.ts +5 -0
  89. package/build/types/src/timesignature.d.ts +2 -0
  90. package/build/types/src/tuplet.d.ts +5 -48
  91. package/build/types/src/vexflow.d.ts +4 -0
  92. package/changelog/CHANGELOG.md +17 -0
  93. package/package.json +7 -2
  94. package/tests/all.html +277 -0
  95. package/tests/demo_petzold_tests.ts +435 -0
  96. package/tests/demos/drums.ts +55 -0
  97. package/tests/demos/drums.webp +0 -0
  98. package/tests/demos/electric.ts +70 -0
  99. package/tests/demos/electric.webp +0 -0
  100. package/tests/demos/greensleeves.ts +97 -0
  101. package/tests/demos/greensleeves.webp +0 -0
  102. package/tests/demos/joy.ts +65 -0
  103. package/tests/demos/joy.webp +0 -0
  104. package/tests/demos/kesh.ts +86 -0
  105. package/tests/demos/kesh.webp +0 -0
  106. package/tests/demos/prelude.ts +65 -0
  107. package/tests/demos/prelude.webp +0 -0
  108. package/tests/demos/quartertones.ts +51 -0
  109. package/tests/demos/quartertones.webp +0 -0
  110. package/tests/demos/saints.ts +70 -0
  111. package/tests/demos/saints.webp +0 -0
  112. package/tests/flow.html +550 -239
  113. package/tests/fonts.css +493 -0
  114. package/tests/minuet.webp +0 -0
package/tests/flow.html CHANGED
@@ -1,266 +1,577 @@
1
1
  <!doctype html>
2
- <html>
2
+ <html lang="en">
3
3
  <head>
4
- <meta charset="UTF-8" />
5
- <!--
6
- IMPORTANT: Always declare the character encoding as UTF-8. Otherwise VexFlow scores may show weird symbols instead of music symbols.
7
- -->
8
- <title>VexFlow Tests</title>
9
- <!-- fonts.css defines the music fonts via @font-face rules. -->
10
- <link rel="stylesheet" href="fonts.css" type="text/css" media="screen" />
11
- <link rel="stylesheet" href="qunit/qunit.css" />
12
- <script src="qunit/qunit.js"></script>
4
+ <!-- Static gallery index. Only the runner loads QUnit, test bundles, and music fonts. -->
5
+ <meta charset="utf-8" />
6
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
7
+ <title>Visual test gallery · VexFlow</title>
8
+ <script>
9
+ // Preserve old runner links, including QUnit filters, sharded jobs, and score anchors.
10
+ const runner = new URL('all.html', location.href);
11
+ const query = new URLSearchParams(location.search);
12
+ const fragment = new URLSearchParams(location.hash.slice(1));
13
+ const buildOptions = new Set(['ver', 'esm']);
14
+ const runOptions = ['module', 'filter', 'moduleId', 'testId', 'jobs', 'job', 'seed', 'hidepassed'];
15
+ const isRunOption = (key) => runOptions.includes(key);
16
+ if ([...query.keys(), ...fragment.keys()].some(isRunOption) || /^#(?:svg|canvas)_/.test(location.hash)) {
17
+ runner.search = location.search;
18
+ runner.hash = location.hash;
19
+ location.replace(runner.href);
20
+ }
21
+ </script>
13
22
  <style>
14
- body {
23
+ :root {
15
24
  font-family: system-ui, sans-serif;
16
- font-size: 12px;
17
- color: #17283c;
18
- background: #f4f6f9;
19
- margin: 0px;
20
- padding: 0px;
21
- height: 80%;
25
+ color: #172d3c;
26
+ background: white;
22
27
  }
23
-
24
- a.button {
25
- color: #204e78;
26
- background: #edf4fb;
27
- text-decoration: none;
28
- padding: 5px;
29
- margin: 2px;
30
- border: 1px solid #c8d8e8;
31
- border-radius: 6px;
28
+ * {
29
+ box-sizing: border-box;
32
30
  }
33
-
34
- div#error {
35
- width: 60%;
36
- padding: 10px;
37
- color: red;
38
- background: #faa;
39
- border: 15px solid #d99;
31
+ body {
32
+ max-width: 84rem;
33
+ margin: auto;
34
+ padding: 0 clamp(1rem, 4vw, 4rem) 3rem;
40
35
  }
41
-
42
- div.testcanvas {
43
- font-size: 18px;
44
- color: #17283c;
45
- background: white;
46
- border: 1px solid #dce3ed;
47
- border-radius: 8px;
48
- margin: 16px;
49
- padding: 16px;
50
- overflow-x: auto;
36
+ header,
37
+ .module-heading {
38
+ display: flex;
39
+ align-items: baseline;
40
+ justify-content: space-between;
41
+ gap: 1rem;
51
42
  }
52
-
53
- div.testcanvas .vex-tabdiv {
43
+ header {
44
+ padding: 1.3rem 0;
45
+ border-bottom: 1px solid #cbd4d7;
46
+ }
47
+ header strong {
48
+ font-size: 1.25rem;
49
+ }
50
+ a {
51
+ color: #155875;
52
+ text-underline-offset: 0.18em;
53
+ }
54
+ a:hover {
55
+ color: #863d22;
56
+ }
57
+ a:focus-visible {
58
+ outline: 2px solid currentColor;
59
+ outline-offset: 3px;
60
+ }
61
+ main {
62
+ margin-top: 2rem;
63
+ }
64
+ h1,
65
+ h2,
66
+ p {
67
+ margin: 0;
68
+ }
69
+ h1 {
70
+ font:
71
+ 500 clamp(2.3rem, 5vw, 4.5rem)/1.1 Georgia,
72
+ serif;
73
+ letter-spacing: -0.035em;
74
+ }
75
+ main {
76
+ padding-bottom: 2rem;
77
+ }
78
+ .collection {
79
+ margin-top: 1.6rem;
80
+ }
81
+ .score-nav {
82
+ display: flex;
83
+ align-items: center;
84
+ gap: 0.5rem;
85
+ padding: 0.8rem 0;
86
+ border-top: 2px solid #213b3e;
87
+ }
88
+ .score-nav[hidden] {
89
+ display: none;
90
+ }
91
+ #counter {
92
+ margin-right: auto;
93
+ font-size: 0.9rem;
94
+ font-variant-numeric: tabular-nums;
95
+ }
96
+ .sr-only {
97
+ position: absolute;
98
+ width: 1px;
99
+ height: 1px;
100
+ overflow: hidden;
101
+ clip-path: inset(50%);
102
+ }
103
+ .score-nav button {
104
+ white-space: nowrap;
54
105
  background: white;
106
+ color: #154857;
107
+ border: 1px solid #a2b4b4;
108
+ border-radius: 0.35rem;
109
+ min-height: 44px;
110
+ padding: 0.4rem 0.85rem;
111
+ font: inherit;
112
+ cursor: pointer;
55
113
  }
56
-
57
- div.testcanvas .name {
58
- font-size: 18px;
59
- color: #204e78;
114
+ .score-nav button:hover {
115
+ background: #edf3f2;
60
116
  }
61
-
62
- p.vf-footer {
63
- font-size: 14px;
117
+ .score-nav button:focus-visible {
118
+ outline: 2px solid #155875;
119
+ outline-offset: 2px;
64
120
  }
65
- </style>
66
- </head>
67
- <body>
68
- <div style="text-align: center">
69
- <div id="qunit"></div>
70
- <div id="qunit-fixture"></div>
71
- <div>
72
- <h2>[ <a href="https://vexflow.com">Home</a> ] [ <a href="https://github.com/vexflow/vexflow">GitHub</a> ]</h2>
73
- <h3>
74
- See the: <a id="vex-src" target="_blank"></a>. Don't forget to run the
75
- <a href="https://github.com/0xfe/vexflow/wiki/Visual-Regression-Tests">Visual Regression Tests</a>!
76
- </h3>
77
- </div>
78
- <p>&nbsp;</p>
79
- <p>&nbsp;</p>
80
- <p class="vf-footer">
81
- [ <a href="https://vexflow.com">Home</a> ] [ <a href="https://github.com/vexflow/vexflow">GitHub</a> ]
82
- </p>
83
- </div>
84
- <div id="font-preload">
85
- <!--
86
- Preload fonts and styles for testing.
87
- The empty tags <b></b>, <i></i>, and <span style="font-weight: xxx"></span> are for loading different font weights/styles.
88
- -->
89
- <span style="font-family: Academico"><b></b></span>
90
- <span style="font-family: Bravura"></span>
91
- <span style="font-family: Edwin">
92
- <b></b><i></i><b><i></i></b>
93
- </span>
94
- <span style="font-family: Finale Ash"></span>
95
- <span style="font-family: Finale Ash Text"></span>
96
- <span style="font-family: Finale Broadway"></span>
97
- <span style="font-family: Finale Broadway Text"></span>
98
- <span style="font-family: Finale Jazz"></span>
99
- <span style="font-family: Finale Jazz Text"></span>
100
- <span style="font-family: Finale Maestro"></span>
101
- <span style="font-family: Finale Maestro Text">
102
- <b></b><i></i><b><i></i></b>
103
- </span>
104
- <span style="font-family: Gonville"></span>
105
- <span style="font-family: Gootville"></span>
106
- <span style="font-family: Leipzig"></span>
107
- <span style="font-family: Leland"></span>
108
- <span style="font-family: MuseJazz"></span>
109
- <span style="font-family: MuseJazz Text"></span>
110
- <span style="font-family: Nepomuk">
111
- <b></b><i></i><b><i></i></b>
112
- </span>
113
- <span style="font-family: Petaluma"></span>
114
- <span style="font-family: Petaluma Script"></span>
115
- <span style="font-family: Roboto Slab">
116
- <span style="font-weight: 500"></span><span style="font-weight: 700"></span>
117
- </span>
118
- <span style="font-family: Sebastian"></span>
119
- </div>
120
- <script type="module">
121
- QUnit.config.autostart = false;
122
-
123
- const queryParams = new URLSearchParams(location.search);
124
- // When flow.html is hosted on unpkg.com, the query string is not available.
125
- // Allow the user to specify params via the # fragment identifier.
126
- const hashParams = new URLSearchParams(location.hash.substr(1));
127
- // Static deployments supply a local, fingerprinted bundle. Keep all test filters available.
128
- const bundledSource = document.querySelector('meta[name="vexflow-test-bundle"]')?.content;
129
-
130
- // Optional: Specify the QUnit module or filter in the query params or fragment identifier.
131
- let QUnitModule = queryParams.get('module') ?? hashParams.get('module');
132
- let QUnitFilter = queryParams.get('filter') ?? hashParams.get('filter');
133
-
134
- // The `ver` query param chooses which VexFlow version to load. If omitted, `ver` defaults to 'build'.
135
- const ver = bundledSource ? 'bundled build' : (queryParams.get('ver') ?? hashParams.get('ver') ?? 'build');
136
- let useESM = !bundledSource && (queryParams.get('esm') === 'true' || hashParams.get('esm') === 'true');
137
- const isFileProtocol = location.protocol === 'file:';
138
-
139
- // Determine if we are loading VexFlow from a CDN.
140
- let cdnURLPath;
141
- if (ver.includes('unpkg')) {
142
- cdnURLPath = 'https://unpkg.com/';
143
- } else if (ver.includes('jsdelivr')) {
144
- cdnURLPath = 'https://cdn.jsdelivr.net/npm/';
145
- }
146
- const useCDN = typeof cdnURLPath !== 'undefined';
147
-
148
- checkESM_WarnIfNecessary();
149
-
150
- const pathCJSorESM = (useESM ? 'esm/entry' : 'cjs') + '/vexflow-debug-with-tests.js';
151
-
152
- let vexPlusTestsURL;
153
- if (bundledSource) {
154
- vexPlusTestsURL = bundledSource;
155
- } else if (useCDN) {
156
- // `ver` can specify a version hosted on the unpkg.com / jsdelivr.com CDN. We only support VexFlow 4 or newer:
157
- // ver=unpkg@4.2.3 => https://unpkg.com/vexflow@4.2.3/build/cjs/vexflow-debug-with-tests.js
158
- // ver=unpkg@alpha => https://unpkg.com/vexflow@alpha/build/cjs/vexflow-debug-with-tests.js
159
- // ver=jsdelivr@4.2.3 => https://cdn.jsdelivr.net/npm/vexflow@4.2.3/build/cjs/vexflow-debug-with-tests.js
160
- const versionNumber = ver.split('@')[1];
161
- vexPlusTestsURL = `${cdnURLPath}vexflow@${versionNumber}/build/${pathCJSorESM}`;
162
- } else {
163
- // We are NOT loading from a CDN. Instead, we are loading from the local filesystem.
164
- // ver=build => vexflow/build/
165
- // ver=reference => vexflow/reference/
166
- // ver=releases/4.2.3 => vexflow/releases/4.2.3/
167
- vexPlusTestsURL = `../${ver}/${pathCJSorESM}`;
121
+ figure {
122
+ display: grid;
123
+ grid-template-columns: minmax(15rem, 0.8fr) minmax(0, 2fr);
124
+ margin: 0;
125
+ border: 1px solid #c9d3d0;
126
+ border-radius: 0.5rem;
127
+ overflow: hidden;
168
128
  }
169
-
170
- showVexFlowVersion();
171
-
172
- let loadVexFlow;
173
-
174
- if (useESM && !isFileProtocol) {
175
- console.log('LOADING ESM: ' + vexPlusTestsURL);
176
- loadVexFlow = async () => {
177
- const module = await import(vexPlusTestsURL);
178
- window.VexFlow = module.VexFlow;
179
- return VexFlow;
180
- };
181
- } else {
182
- console.log('LOADING CJS: ' + vexPlusTestsURL);
183
- loadVexFlow = async () => {
184
- await loadScript(vexPlusTestsURL);
185
- return VexFlow;
186
- };
129
+ figcaption {
130
+ background: #f3f4eb;
131
+ padding: clamp(1.2rem, 2.4vw, 2rem);
187
132
  }
188
-
189
- // Load deployed faces before tests measure them, even when the preload spans are empty.
190
- if (bundledSource) await Promise.all([...document.fonts].map((face) => face.load()));
191
- const fontFaceSet = await document.fonts.ready;
192
-
193
- showFontLoadingStatus();
194
-
195
- const VF = await loadVexFlow();
196
- if (bundledSource) await document.fonts.ready;
197
-
198
- // If you did not load the fonts via the div#font-preload above, you can load them with this API:
199
- // await VF.loadFonts(); // Load all web fonts that VexFlow knows about (Font.FILES).
200
- // await VF.loadFonts('Bravura', 'Academico'); // Load only the specified fonts.
201
-
202
- if (QUnitModule) {
203
- QUnit.urlParams.module = QUnitModule;
133
+ .instrument {
134
+ color: #80502f;
135
+ font-weight: 650;
136
+ font-size: 0.85rem;
204
137
  }
205
-
206
- if (QUnitFilter) {
207
- QUnit.config.filter = QUnitFilter;
138
+ figcaption h2 {
139
+ font:
140
+ 500 clamp(2rem, 3.6vw, 3.4rem)/1.02 Georgia,
141
+ serif;
142
+ letter-spacing: -0.03em;
143
+ margin: 0.6rem 0;
208
144
  }
209
-
210
- // Show only failed tests.
211
- QUnit.config.hidepassed = true;
212
- QUnit.config.noglobals = true;
213
- VF.Test.run();
214
- QUnit.start();
215
-
216
- function loadScript(url) {
217
- return new Promise((resolve, reject) => {
218
- const script = document.createElement('script');
219
- script.onload = resolve;
220
- script.onerror = reject;
221
- script.src = url;
222
- document.getElementsByTagName('head')[0].appendChild(script);
223
- });
145
+ .composer {
146
+ font-size: 1.05rem;
224
147
  }
225
-
226
- // Display which VexFlow version we loaded.
227
- function showVexFlowVersion() {
228
- const srcLink = document.getElementById('vex-src');
229
- srcLink.href = vexPlusTestsURL;
230
- srcLink.innerText = `VexFlow Source [${ver}]`;
148
+ .details {
149
+ margin: 1.4rem 0 0.6rem;
150
+ font-size: 0.9rem;
151
+ font-weight: 650;
231
152
  }
232
-
233
- // ESM version only works if flow.html is accessed from a web server: e.g., `npx http-server` and browse to http://127.0.0.1:8080/tests/flow.html
234
- function checkESM_WarnIfNecessary() {
235
- if (useESM) {
236
- if (!useCDN && isFileProtocol) {
237
- prompt(
238
- 'ES modules require a web server for testing!\n\n' +
239
- 'Try `npx http-server` and browse to http://127.0.0.1:8080/tests/flow.html?esm=true\n\n' +
240
- 'We will fall back to CJS for now.',
241
- 'npx http-server'
242
- );
243
- useESM = false;
244
- }
153
+ .description {
154
+ line-height: 1.5;
155
+ }
156
+ .score-links {
157
+ display: flex;
158
+ flex-wrap: wrap;
159
+ gap: 0.5rem 1rem;
160
+ margin-top: 1rem;
161
+ font-size: 0.9rem;
162
+ }
163
+ .sheet-image {
164
+ align-self: center;
165
+ min-width: 0;
166
+ cursor: zoom-in;
167
+ }
168
+ figure img {
169
+ align-self: center;
170
+ width: 100%;
171
+ height: auto;
172
+ max-height: 29rem;
173
+ object-fit: contain;
174
+ padding: 0.75rem;
175
+ }
176
+ #modules {
177
+ margin-top: 2rem;
178
+ }
179
+ .module-heading {
180
+ border-top: 2px solid #233e49;
181
+ padding-top: 0.8rem;
182
+ flex-wrap: wrap;
183
+ }
184
+ h2 {
185
+ font-size: 1.2rem;
186
+ }
187
+ ul {
188
+ padding: 0;
189
+ columns: 4 12rem;
190
+ column-gap: 1.2rem;
191
+ list-style: none;
192
+ }
193
+ li {
194
+ break-inside: avoid;
195
+ border-bottom: 1px solid #e4eaec;
196
+ }
197
+ li a {
198
+ display: block;
199
+ padding: 0.4rem 0;
200
+ overflow-wrap: anywhere;
201
+ }
202
+ @media (max-width: 700px) {
203
+ figure {
204
+ grid-template-columns: 1fr;
245
205
  }
246
206
  }
207
+ </style>
208
+ </head>
209
+ <body>
210
+ <header><strong>VexFlow</strong><a href="https://vexflow.com/">VexFlow home</a></header>
211
+ <main>
212
+ <h1>Visual test gallery</h1>
213
+ <section class="collection" aria-label="Featured scores" aria-roledescription="carousel">
214
+ <div class="score-nav" hidden>
215
+ <span id="counter" role="status" aria-live="polite" aria-atomic="true"
216
+ >Score 1 of 9<span class="sr-only"> · Minuet in G major</span></span
217
+ >
218
+ <button type="button" id="previous" aria-controls="score-slide" aria-label="Previous score">
219
+ ← Previous
220
+ </button>
221
+ <button type="button" id="next" aria-controls="score-slide" aria-label="Next score">Next →</button>
222
+ </div>
223
+ <div id="score-slide">
224
+ <figure data-piece="petzold">
225
+ <figcaption>
226
+ <p class="instrument">Keyboard</p>
227
+ <h2>Minuet in G major</h2>
228
+ <p class="composer">Christian Petzold</p>
229
+ <p class="details">G major · 3/4</p>
230
+ <p class="description">
231
+ From the Notebook for Anna Magdalena Bach. Two independent keyboard voices share a grand staff, with
232
+ fingering and phrasing marked above the melody.
233
+ </p>
234
+ <p class="score-links">
235
+ <a href="all.html?module=Demo%20-%20Petzold">Open live score</a
236
+ ><a href="demo_petzold_tests.ts">View code</a>
237
+ </p>
238
+ </figcaption>
239
+ <a class="sheet-image" aria-label="Enlarge Minuet in G major" href="minuet.webp"
240
+ ><img
241
+ src="minuet.webp"
242
+ width="1102"
243
+ height="705"
244
+ alt="Minuet in G major, keyboard notation. From the Notebook for Anna Magdalena Bach. Two independent keyboard voices share a grand staff, with fingering and phrasing marked above the melody."
245
+ /></a>
246
+ </figure>
247
+ </div>
248
+ <template id="other-scores"
249
+ ><figure data-piece="saints">
250
+ <figcaption>
251
+ <p class="instrument">Jazz lead sheet</p>
252
+ <h2>When the Saints Go Marching In</h2>
253
+ <p class="composer">Traditional African American spiritual</p>
254
+ <p class="details">C major · 4/4</p>
255
+ <p class="description">
256
+ Follow the original words through a new set of changes. The ii–V leads to F, then the final D in the
257
+ melody becomes the flat ninth of D♭7 before resolving to C.
258
+ </p>
259
+ <p class="score-links">
260
+ <a href="all.html?module=Demo%20-%20When%20the%20Saints%20Go%20Marching%20In">Open live score</a
261
+ ><a href="demos/saints.ts">View code</a
262
+ ><a
263
+ href="https://www.carnegiehall.org/Education/Programs/Link-Up/National-Program/The-Orchestra-Swings/When-the-Saints-Go-Marching-In"
264
+ >About the tune</a
265
+ >
266
+ <a href="https://online.berklee.edu/takenote/reharmonization-simple-substitution/"
267
+ >About reharmonization</a
268
+ >
269
+ </p>
270
+ </figcaption>
271
+ <a class="sheet-image" aria-label="Enlarge When the Saints Go Marching In" href="demos/saints.webp"
272
+ ><img
273
+ src="demos/saints.webp"
274
+ width="900"
275
+ height="540"
276
+ alt="Petaluma lead sheet with sixteen bars of extended chords, a three-note pickup, and lyrics beneath each phrase."
277
+ /></a>
278
+ </figure>
279
+ <figure data-piece="greensleeves">
280
+ <figcaption>
281
+ <p class="instrument">Guitar tablature</p>
282
+ <h2>Greensleeves</h2>
283
+ <p class="composer">Traditional English air</p>
284
+ <p class="details">A minor · 3/4</p>
285
+ <p class="description">
286
+ Follow the chord names above the melody. Dm/F puts F in the bass, and the closing E5 voicing uses just E
287
+ and B. Roll that last chord from bass to treble.
288
+ </p>
289
+ <p class="score-links">
290
+ <a href="all.html?module=Demo%20-%20Greensleeves">Open live score</a
291
+ ><a href="demos/greensleeves.ts">View code</a
292
+ ><a href="https://natunelist.net/greensleeves/">About the tune</a>
293
+ </p>
294
+ </figcaption>
295
+ <a class="sheet-image" aria-label="Enlarge Greensleeves" href="demos/greensleeves.webp"
296
+ ><img
297
+ src="demos/greensleeves.webp"
298
+ width="900"
299
+ height="486"
300
+ alt="First-position chord melody with chord symbols in standard notation with aligned six-line guitar tab and left-hand fingerings."
301
+ /></a>
302
+ </figure>
303
+ <figure data-piece="prelude">
304
+ <figcaption>
305
+ <p class="instrument">Keyboard</p>
306
+ <h2>Prelude in C major</h2>
307
+ <p class="composer">Johann Sebastian Bach</p>
308
+ <p class="details">BWV 846 · C major · 4/4</p>
309
+ <p class="description">
310
+ Follow each arpeggio across the two staves. The editorial tempo and dynamics suggest one way to shape
311
+ the phrase. Lean into the accented F, then release onto E.
312
+ </p>
313
+ <p class="score-links">
314
+ <a href="all.html?module=Demo%20-%20Prelude%20in%20C%20major">Open live score</a
315
+ ><a href="demos/prelude.ts">View code</a
316
+ ><a href="https://www.bachvereniging.nl/en/bwv/bwv-846">About the tune</a>
317
+ </p>
318
+ </figcaption>
319
+ <a class="sheet-image" aria-label="Enlarge Prelude in C major" href="demos/prelude.webp"
320
+ ><img
321
+ src="demos/prelude.webp"
322
+ width="900"
323
+ height="525"
324
+ alt="Cross-staff arpeggios marked Andante at 72 beats per minute, with a crescendo to mezzo forte and a return to piano."
325
+ /></a>
326
+ </figure>
327
+ <figure data-piece="kesh">
328
+ <figcaption>
329
+ <p class="instrument">Fiddle</p>
330
+ <h2>The Kesh Jig</h2>
331
+ <p class="composer">Traditional Irish jig</p>
332
+ <p class="details">G major · 6/8</p>
333
+ <p class="description">
334
+ Play A twice, then B twice, following the chord names above the fiddle line. On the first pass, take
335
+ ending 1 and repeat. On the second pass, take ending 2.
336
+ </p>
337
+ <p class="score-links">
338
+ <a href="all.html?module=Demo%20-%20The%20Kesh%20Jig">Open live score</a
339
+ ><a href="demos/kesh.ts">View code</a
340
+ ><a href="https://blog.mcneelamusic.com/the-kesh-jig/">About the tune</a>
341
+ </p>
342
+ </figcaption>
343
+ <a class="sheet-image" aria-label="Enlarge The Kesh Jig" href="demos/kesh.webp"
344
+ ><img
345
+ src="demos/kesh.webp"
346
+ width="900"
347
+ height="580"
348
+ alt="Two fiddle strains with boxed A and B labels, chord changes and numbered first and second endings."
349
+ /></a>
350
+ </figure>
351
+ <figure data-piece="joy">
352
+ <figcaption>
353
+ <p class="instrument">Cello duet</p>
354
+ <h2>Ode to Joy</h2>
355
+ <p class="composer">Ludwig van Beethoven</p>
356
+ <p class="details">Symphony No. 9 · D major · 4/4</p>
357
+ <p class="description">
358
+ Two cellos trade weight across the phrase. Give the opening note its full length, then follow the
359
+ crescendo into each cadence.
360
+ </p>
361
+ <p class="score-links">
362
+ <a href="all.html?module=Demo%20-%20Ode%20to%20Joy">Open live score</a
363
+ ><a href="demos/joy.ts">View code</a
364
+ ><a
365
+ href="https://www.carnegiehall.org/Education/Programs/All-Together-A-Global-Ode-to-Joy/Texts-and-Translations/German"
366
+ >About the tune</a
367
+ >
368
+ </p>
369
+ </figcaption>
370
+ <a class="sheet-image" aria-label="Enlarge Ode to Joy" href="demos/joy.webp"
371
+ ><img
372
+ src="demos/joy.webp"
373
+ width="900"
374
+ height="435"
375
+ alt="Bracketed bass-clef staves with two cello parts, tenuto marks, crescendos, and slurred cadences."
376
+ /></a>
377
+ </figure>
378
+ <figure data-piece="electric">
379
+ <figcaption>
380
+ <p class="instrument">Electric guitar</p>
381
+ <h2>High Wire</h2>
382
+ <p class="composer">Example piece</p>
383
+ <p class="details">A minor pentatonic · 4/4</p>
384
+ <p class="description">
385
+ Strike the low power chord, then answer it with a full bend and release. On the next line, hammer to
386
+ fret 8, tap fret 12 with the picking hand and pull off on the way down.
387
+ </p>
388
+ <p class="score-links">
389
+ <a href="all.html?module=Demo%20-%20High%20Wire">Open live score</a
390
+ ><a href="demos/electric.ts">View code</a>
391
+ <a href="https://www.fender.com/articles/techniques/master-hammer-ons-and-pull-offs"
392
+ >Legato technique</a
393
+ >
394
+ </p>
395
+ </figcaption>
396
+ <a class="sheet-image" aria-label="Enlarge High Wire" href="demos/electric.webp">
397
+ <img
398
+ src="demos/electric.webp"
399
+ width="900"
400
+ height="380"
401
+ alt="Rhythmic electric guitar tab with H, T and P legato marks, a bend arrow, a slide and vibrato."
402
+ /></a>
403
+ </figure>
404
+ <figure data-piece="drums">
405
+ <figcaption>
406
+ <p class="instrument">Drum set</p>
407
+ <h2>Pocket Change</h2>
408
+ <p class="composer">Example piece</p>
409
+ <p class="details">Funk · 4/4</p>
410
+ <p class="description">
411
+ The hi-hat keeps eighths while the kick shifts underneath. Play the snare notes in parentheses quietly.
412
+ Two descending triplets lead back to the downbeat.
413
+ </p>
414
+ <p class="score-links">
415
+ <a href="all.html?module=Demo%20-%20Pocket%20Change">Open live score</a
416
+ ><a href="demos/drums.ts">View code</a>
417
+ <a href="https://ae.vicfirth.com/wp-content/uploads/Lesson-32.pdf">Drum notation key</a>
418
+ </p>
419
+ </figcaption>
420
+ <a class="sheet-image" aria-label="Enlarge Pocket Change" href="demos/drums.webp">
421
+ <img
422
+ src="demos/drums.webp"
423
+ width="900"
424
+ height="350"
425
+ alt="Two-voice kit groove with cross-shaped hi-hat heads, ghosted and accented snare hits, and a tom fill."
426
+ /></a>
427
+ </figure>
428
+ <figure data-piece="quartertones">
429
+ <figcaption>
430
+ <p class="instrument">Solo viola</p>
431
+ <h2>Narrow Steps</h2>
432
+ <p class="composer">Example piece</p>
433
+ <p class="details">24-tone equal temperament · 5/8</p>
434
+ <p class="description">
435
+ Shade the repeated D a quarter tone sharp, halfway to D♯. The phrase climbs and turns back, approaching
436
+ the final D natural from a quarter tone below.
437
+ </p>
438
+ <p class="score-links">
439
+ <a href="all.html?module=Demo%20-%20Narrow%20Steps">Open live score</a
440
+ ><a href="demos/quartertones.ts">View code</a>
441
+ <a href="https://w3c.github.io/smufl/latest/tables/stein-zimmermann-accidentals-24-edo.html"
442
+ >Accidental key</a
443
+ >
444
+ </p>
445
+ </figcaption>
446
+ <a class="sheet-image" aria-label="Enlarge Narrow Steps" href="demos/quartertones.webp">
447
+ <img
448
+ src="demos/quartertones.webp"
449
+ width="900"
450
+ height="340"
451
+ alt="Alto-clef viola melody, beamed in groups of three, with half-sharps, reversed flats, hairpins and a closing fermata."
452
+ /></a>
453
+ </figure>
454
+ </template>
455
+ </section>
456
+ <nav id="modules" aria-labelledby="modules-heading">
457
+ <div class="module-heading">
458
+ <h2 id="modules-heading">Test modules</h2>
459
+ <a href="all.html">Run all tests</a>
460
+ </div>
461
+ <ul>
462
+ <li><a href="all.html?module=Accidental">Accidental</a></li>
463
+ <li><a href="all.html?module=Annotation">Annotation</a></li>
464
+ <li><a href="all.html?module=Articulation">Articulation</a></li>
465
+ <li><a href="all.html?module=Auto-Beaming">Auto-Beaming</a></li>
466
+ <li><a href="all.html?module=Barline">Barline</a></li>
467
+ <li><a href="all.html?module=Beam">Beam</a></li>
468
+ <li><a href="all.html?module=Bend">Bend</a></li>
469
+ <li><a href="all.html?module=BoundingBox">BoundingBox</a></li>
470
+ <li><a href="all.html?module=ChordSymbol">ChordSymbol</a></li>
471
+ <li><a href="all.html?module=Clef">Clef</a></li>
472
+ <li><a href="all.html?module=Clef%20Keys">Clef Keys</a></li>
473
+ <li><a href="all.html?module=CrossBeam">CrossBeam</a></li>
474
+ <li><a href="all.html?module=Curve">Curve</a></li>
475
+ <li><a href="all.html?module=Demo%20-%20Greensleeves">Demo - Greensleeves</a></li>
476
+ <li><a href="all.html?module=Demo%20-%20High%20Wire">Demo - High Wire</a></li>
477
+ <li><a href="all.html?module=Demo%20-%20Narrow%20Steps">Demo - Narrow Steps</a></li>
478
+ <li><a href="all.html?module=Demo%20-%20Ode%20to%20Joy">Demo - Ode to Joy</a></li>
479
+ <li><a href="all.html?module=Demo%20-%20Petzold">Demo - Petzold</a></li>
480
+ <li><a href="all.html?module=Demo%20-%20Pocket%20Change">Demo - Pocket Change</a></li>
481
+ <li><a href="all.html?module=Demo%20-%20Prelude%20in%20C%20major">Demo - Prelude in C major</a></li>
482
+ <li><a href="all.html?module=Demo%20-%20The%20Kesh%20Jig">Demo - The Kesh Jig</a></li>
483
+ <li>
484
+ <a href="all.html?module=Demo%20-%20When%20the%20Saints%20Go%20Marching%20In"
485
+ >Demo - When the Saints Go Marching In</a
486
+ >
487
+ </li>
488
+ <li><a href="all.html?module=Dot">Dot</a></li>
489
+ <li><a href="all.html?module=EasyScore">EasyScore</a></li>
490
+ <li><a href="all.html?module=Factory">Factory</a></li>
491
+ <li><a href="all.html?module=Font">Font</a></li>
492
+ <li><a href="all.html?module=Formatter">Formatter</a></li>
493
+ <li><a href="all.html?module=Fraction">Fraction</a></li>
494
+ <li><a href="all.html?module=GhostNote">GhostNote</a></li>
495
+ <li><a href="all.html?module=GlyphNote">GlyphNote</a></li>
496
+ <li><a href="all.html?module=Grace%20Notes">Grace Notes</a></li>
497
+ <li><a href="all.html?module=Grace%20Tab%20Notes">Grace Tab Notes</a></li>
498
+ <li><a href="all.html?module=KeyManager">KeyManager</a></li>
499
+ <li><a href="all.html?module=KeySignature">KeySignature</a></li>
500
+ <li><a href="all.html?module=ModifierContext">ModifierContext</a></li>
501
+ <li><a href="all.html?module=MultiMeasureRest">MultiMeasureRest</a></li>
502
+ <li><a href="all.html?module=MusicTests">MusicTests</a></li>
503
+ <li><a href="all.html?module=NoteHead">NoteHead</a></li>
504
+ <li><a href="all.html?module=NoteSubGroup">NoteSubGroup</a></li>
505
+ <li><a href="all.html?module=OffscreenCanvas">OffscreenCanvas</a></li>
506
+ <li><a href="all.html?module=Ornament">Ornament</a></li>
507
+ <li><a href="all.html?module=Parser">Parser</a></li>
508
+ <li><a href="all.html?module=PedalMarking">PedalMarking</a></li>
509
+ <li><a href="all.html?module=Percussion">Percussion</a></li>
510
+ <li><a href="all.html?module=Registry">Registry</a></li>
511
+ <li><a href="all.html?module=Renderer">Renderer</a></li>
512
+ <li><a href="all.html?module=Rests">Rests</a></li>
513
+ <li><a href="all.html?module=Rhythm">Rhythm</a></li>
514
+ <li><a href="all.html?module=Stave">Stave</a></li>
515
+ <li><a href="all.html?module=StaveConnector">StaveConnector</a></li>
516
+ <li><a href="all.html?module=StaveHairpin">StaveHairpin</a></li>
517
+ <li><a href="all.html?module=StaveLine">StaveLine</a></li>
518
+ <li><a href="all.html?module=StaveModifier">StaveModifier</a></li>
519
+ <li><a href="all.html?module=StaveNote">StaveNote</a></li>
520
+ <li><a href="all.html?module=StaveTie">StaveTie</a></li>
521
+ <li><a href="all.html?module=StringNumber">StringNumber</a></li>
522
+ <li><a href="all.html?module=Strokes">Strokes</a></li>
523
+ <li><a href="all.html?module=Style">Style</a></li>
524
+ <li><a href="all.html?module=TabNote">TabNote</a></li>
525
+ <li><a href="all.html?module=TabSlide">TabSlide</a></li>
526
+ <li><a href="all.html?module=TabStave">TabStave</a></li>
527
+ <li><a href="all.html?module=TabTie">TabTie</a></li>
528
+ <li><a href="all.html?module=TextBracket">TextBracket</a></li>
529
+ <li><a href="all.html?module=TextNote">TextNote</a></li>
530
+ <li><a href="all.html?module=Three%20Voice%20Rests">Three Voice Rests</a></li>
531
+ <li><a href="all.html?module=TickContext">TickContext</a></li>
532
+ <li><a href="all.html?module=TimeSignature">TimeSignature</a></li>
533
+ <li><a href="all.html?module=Tremolo">Tremolo</a></li>
534
+ <li><a href="all.html?module=Tuning">Tuning</a></li>
535
+ <li><a href="all.html?module=Tuplet">Tuplet</a></li>
536
+ <li><a href="all.html?module=TypeGuard">TypeGuard</a></li>
537
+ <li><a href="all.html?module=Unison">Unison</a></li>
538
+ <li><a href="all.html?module=VF.%2A%20API">VF.* API</a></li>
539
+ <li><a href="all.html?module=Vibrato">Vibrato</a></li>
540
+ <li><a href="all.html?module=VibratoBracket">VibratoBracket</a></li>
541
+ <li><a href="all.html?module=Voice">Voice</a></li>
542
+ </ul>
543
+ </nav>
544
+ </main>
545
+ <script>
546
+ // Inert templates keep unvisited scores off the network. Navigation stays outside the
547
+ // changing slide so keyboard focus remains on the pressed button.
548
+ const slide = document.getElementById('score-slide');
549
+ const pieces = [slide.firstElementChild, ...document.getElementById('other-scores').content.children];
550
+ let selected = 0;
247
551
 
248
- // Show font loading status in the console.
249
- function showFontLoadingStatus() {
250
- const fontFaces = [...fontFaceSet];
251
- for (const fontFace of fontFaces) {
252
- const fontInfo = fontFace.family + ' / ' + fontFace.weight + ' / ' + fontFace.style;
253
- if (fontFace.status === 'loaded') {
254
- console.log(fontInfo + ' loaded!');
255
- } else if (fontFace.status === 'unloaded') {
256
- console.warn('*** ' + fontInfo + ' IS NOT LOADED! ***');
257
- } else if (fontFace.status === 'error') {
258
- console.error(fontInfo + ' ERROR');
259
- } else {
260
- console.log(fontInfo + ' has status: ' + fontFace.status);
552
+ // Retain build selection for both module links and live examples opened from a slide.
553
+ for (const root of [document, ...pieces.slice(1)]) {
554
+ for (const link of root.querySelectorAll('a[href^="all.html"]')) {
555
+ const target = new URL(link.getAttribute('href'), location.href);
556
+ for (const key of buildOptions) {
557
+ const value = query.get(key) ?? fragment.get(key);
558
+ if (value) target.searchParams.set(key, value);
261
559
  }
560
+ link.href = target.href;
262
561
  }
263
562
  }
563
+ function move(offset) {
564
+ selected = (selected + offset + pieces.length) % pieces.length;
565
+ const piece = pieces[selected];
566
+ slide.replaceChildren(piece);
567
+ const title = piece.querySelector('h2').textContent;
568
+ const counter = document.getElementById('counter');
569
+ counter.firstChild.textContent = `Score ${selected + 1} of ${pieces.length}`;
570
+ counter.querySelector('.sr-only').textContent = ' · ' + title;
571
+ }
572
+ document.getElementById('previous').onclick = () => move(-1);
573
+ document.getElementById('next').onclick = () => move(1);
574
+ document.querySelector('.score-nav').hidden = false;
264
575
  </script>
265
576
  </body>
266
577
  </html>