vexflow 5.2.0 → 5.4.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 +2 -0
- package/build/cjs/vexflow-bravura.js +2 -2
- package/build/cjs/vexflow-bravura.js.map +1 -1
- package/build/cjs/vexflow-core.js +2 -2
- package/build/cjs/vexflow-core.js.map +1 -1
- package/build/cjs/vexflow-debug-with-tests.js +6502 -1708
- package/build/cjs/vexflow-debug-with-tests.js.map +1 -1
- package/build/cjs/vexflow-debug.js +5622 -1618
- package/build/cjs/vexflow-debug.js.map +1 -1
- package/build/cjs/vexflow.js +2 -2
- package/build/cjs/vexflow.js.map +1 -1
- package/build/esm/src/accidental.js +10 -3
- package/build/esm/src/alternatingtremolo.js +68 -0
- package/build/esm/src/annotation.js +19 -3
- package/build/esm/src/articulation.js +28 -6
- package/build/esm/src/beam.js +171 -28
- package/build/esm/src/bend.js +79 -23
- package/build/esm/src/clef.js +3 -0
- package/build/esm/src/continuouslayout.js +681 -0
- package/build/esm/src/continuousspan.js +159 -0
- package/build/esm/src/curve.js +48 -55
- package/build/esm/src/dot.js +13 -4
- package/build/esm/src/easyscore/composition.js +52 -2
- package/build/esm/src/easyscore/policies.js +39 -8
- package/build/esm/src/element.js +4 -0
- package/build/esm/src/engravinggeometry.js +157 -0
- package/build/esm/src/engravingprofile.js +44 -0
- package/build/esm/src/factory.js +31 -11
- package/build/esm/src/font.js +9 -1
- package/build/esm/src/formatter.js +9 -1
- package/build/esm/src/fretdiagram.js +77 -0
- package/build/esm/src/gracenote.js +43 -38
- package/build/esm/src/gracenotegroup.js +53 -56
- package/build/esm/src/guitargesture.js +33 -0
- package/build/esm/src/guitarmodifiers.js +26 -0
- package/build/esm/src/index.js +10 -0
- package/build/esm/src/instrumentprofile.js +123 -0
- package/build/esm/src/keysignature.js +24 -2
- package/build/esm/src/modifiercontext.js +11 -0
- package/build/esm/src/notationspelling.js +73 -0
- package/build/esm/src/note.js +3 -0
- package/build/esm/src/notehead.js +11 -6
- package/build/esm/src/ornament.js +43 -18
- package/build/esm/src/pagebreaks.js +58 -0
- package/build/esm/src/pedalmarking.js +39 -17
- package/build/esm/src/phraselayout.js +503 -0
- package/build/esm/src/phraseribbon.js +28 -0
- package/build/esm/src/proportionalformatter.js +54 -6
- package/build/esm/src/publication.js +402 -0
- package/build/esm/src/publicationview.js +114 -0
- package/build/esm/src/scorenavigation.js +172 -0
- package/build/esm/src/sheet.js +14 -2
- package/build/esm/src/stave.js +33 -16
- package/build/esm/src/stavebarline.js +5 -7
- package/build/esm/src/staveconnector.js +1 -0
- package/build/esm/src/stavehairpin.js +53 -27
- package/build/esm/src/stavenote.js +134 -116
- package/build/esm/src/stavetie.js +66 -9
- package/build/esm/src/stem.js +26 -11
- package/build/esm/src/strokes.js +4 -0
- package/build/esm/src/system.js +19 -4
- package/build/esm/src/systembreaks.js +42 -0
- package/build/esm/src/tabnote.js +6 -1
- package/build/esm/src/textbracket.js +24 -5
- package/build/esm/src/tickcontext.js +19 -0
- package/build/esm/src/timesignature.js +20 -6
- package/build/esm/src/tuplet.js +58 -17
- package/build/esm/src/version.js +3 -3
- package/build/esm/src/vexflow.js +20 -0
- package/build/esm/src/voice.js +7 -3
- package/build/esm/tests/bend_tests.js +14 -1
- package/build/esm/tests/curve_tests.js +14 -4
- package/build/esm/tests/demo_repertoire_tests.js +27 -0
- package/build/esm/tests/demos/drums.js +54 -0
- package/build/esm/tests/demos/electric.js +63 -0
- package/build/esm/tests/demos/greensleeves.js +90 -0
- package/build/esm/tests/demos/joy.js +61 -0
- package/build/esm/tests/demos/kesh.js +80 -0
- package/build/esm/tests/demos/prelude.js +59 -0
- package/build/esm/tests/demos/quartertones.js +50 -0
- package/build/esm/tests/demos/saints.js +65 -0
- package/build/esm/tests/engraving/continuous-studies.mjs +140 -0
- package/build/esm/tests/engraving/instrument-studies.mjs +273 -0
- package/build/esm/tests/engraving/phrase-studies.mjs +63 -0
- package/build/esm/tests/engraving/publication-studies.mjs +87 -0
- package/build/esm/tests/engraving/score-layout.mjs +75 -0
- package/build/esm/tests/engraving/score-persistence.mjs +262 -0
- package/build/esm/tests/engraving/specialist-studies.mjs +347 -0
- package/build/esm/tests/engraving/studies.mjs +367 -0
- package/build/esm/tests/formatter_tests.js +10 -1
- package/build/esm/tests/index.js +1 -0
- package/build/esm/tests/node/audit-dependencies-tests.mjs +42 -0
- package/build/esm/tests/node/continuous-score-tests.mjs +282 -0
- package/build/esm/tests/node/easyscore-tests.mjs +71 -0
- package/build/esm/tests/node/engraving-layout-tests.mjs +449 -0
- package/build/esm/tests/node/instrument-profile-tests.mjs +224 -0
- package/build/esm/tests/node/local-engraving-tests.mjs +128 -0
- package/build/esm/tests/node/phrase-layout-tests.mjs +281 -0
- package/build/esm/tests/node/proportional-spacing-tests.mjs +64 -0
- package/build/esm/tests/node/publication-tests.mjs +219 -0
- package/build/esm/tests/node/rendering-tests.mjs +6 -2
- package/build/esm/tests/threevoice_tests.js +11 -1
- package/build/esm/tests/vexflow_test_helpers.js +19 -10
- package/build/esm/tools/audit-dependencies.mjs +61 -0
- package/build/esm/tools/easyscore-structure.mjs +1 -1
- package/build/esm/tools/explorer/catalog/entries.mjs +2 -1
- package/build/esm/tools/explorer/catalog/expression.mjs +14 -9
- package/build/esm/tools/explorer/catalog/guitar.mjs +238 -0
- package/build/esm/tools/explorer/catalog/layout.mjs +8 -6
- package/build/esm/tools/explorer/catalog/notes.mjs +16 -14
- package/build/esm/tools/explorer/catalog/staves.mjs +12 -6
- package/build/esm/tools/explorer/catalog/strings.mjs +10 -7
- package/build/esm/tools/score-fixtures.mjs +23 -6
- package/build/types/src/accidental.d.ts +4 -0
- package/build/types/src/alternatingtremolo.d.ts +13 -0
- package/build/types/src/annotation.d.ts +9 -0
- package/build/types/src/articulation.d.ts +9 -1
- package/build/types/src/beam.d.ts +16 -0
- package/build/types/src/bend.d.ts +8 -0
- package/build/types/src/clef.d.ts +3 -0
- package/build/types/src/continuouslayout.d.ts +103 -0
- package/build/types/src/continuousspan.d.ts +60 -0
- package/build/types/src/curve.d.ts +20 -0
- package/build/types/src/dot.d.ts +5 -0
- package/build/types/src/easyscore/composition.d.ts +27 -0
- package/build/types/src/easyscore/policies.d.ts +1 -1
- package/build/types/src/element.d.ts +2 -0
- package/build/types/src/engravinggeometry.d.ts +31 -0
- package/build/types/src/engravingprofile.d.ts +20 -0
- package/build/types/src/factory.d.ts +6 -1
- package/build/types/src/formatter.d.ts +3 -3
- package/build/types/src/fretdiagram.d.ts +23 -0
- package/build/types/src/gracenote.d.ts +7 -0
- package/build/types/src/gracenotegroup.d.ts +7 -2
- package/build/types/src/guitargesture.d.ts +26 -0
- package/build/types/src/guitarmodifiers.d.ts +3 -0
- package/build/types/src/index.d.ts +12 -0
- package/build/types/src/instrumentprofile.d.ts +124 -0
- package/build/types/src/keysignature.d.ts +9 -0
- package/build/types/src/modifiercontext.d.ts +4 -0
- package/build/types/src/notationspelling.d.ts +25 -0
- package/build/types/src/note.d.ts +15 -0
- package/build/types/src/notehead.d.ts +5 -0
- package/build/types/src/ornament.d.ts +10 -1
- package/build/types/src/pagebreaks.d.ts +26 -0
- package/build/types/src/pedalmarking.d.ts +9 -0
- package/build/types/src/phraselayout.d.ts +87 -0
- package/build/types/src/phraseribbon.d.ts +7 -0
- package/build/types/src/proportionalformatter.d.ts +11 -2
- package/build/types/src/publication.d.ts +61 -0
- package/build/types/src/publicationview.d.ts +27 -0
- package/build/types/src/scorenavigation.d.ts +33 -0
- package/build/types/src/sheet.d.ts +5 -0
- package/build/types/src/stave.d.ts +13 -0
- package/build/types/src/stavehairpin.d.ts +18 -0
- package/build/types/src/stavenote.d.ts +20 -2
- package/build/types/src/stavetie.d.ts +9 -0
- package/build/types/src/stem.d.ts +10 -1
- package/build/types/src/system.d.ts +8 -1
- package/build/types/src/systembreaks.d.ts +9 -0
- package/build/types/src/textbracket.d.ts +7 -0
- package/build/types/src/tickcontext.d.ts +5 -0
- package/build/types/src/timesignature.d.ts +6 -0
- package/build/types/src/tuplet.d.ts +5 -48
- package/build/types/src/vexflow.d.ts +20 -0
- package/build/types/src/voice.d.ts +2 -0
- package/changelog/CHANGELOG.md +25 -0
- package/package.json +15 -3
- package/tests/all.html +277 -0
- package/tests/demo_petzold_tests.ts +435 -0
- package/tests/demos/drums.ts +55 -0
- package/tests/demos/drums.webp +0 -0
- package/tests/demos/electric.ts +70 -0
- package/tests/demos/electric.webp +0 -0
- package/tests/demos/greensleeves.ts +97 -0
- package/tests/demos/greensleeves.webp +0 -0
- package/tests/demos/joy.ts +65 -0
- package/tests/demos/joy.webp +0 -0
- package/tests/demos/kesh.ts +86 -0
- package/tests/demos/kesh.webp +0 -0
- package/tests/demos/prelude.ts +65 -0
- package/tests/demos/prelude.webp +0 -0
- package/tests/demos/quartertones.ts +51 -0
- package/tests/demos/quartertones.webp +0 -0
- package/tests/demos/saints.ts +70 -0
- package/tests/demos/saints.webp +0 -0
- package/tests/flow.html +550 -239
- package/tests/fonts.css +493 -0
- package/tests/minuet.webp +0 -0
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import assert from 'node:assert/strict';
|
|
11
|
+
import { readFile } from 'node:fs/promises';
|
|
12
|
+
import { test } from 'node:test';
|
|
13
|
+
import puppeteer from 'puppeteer';
|
|
14
|
+
import { publicationStudy } from '../engraving/publication-studies.mjs';
|
|
15
|
+
test('publication views, pagination and portable printing', (t) => __awaiter(void 0, void 0, void 0, function* () {
|
|
16
|
+
const browser = yield puppeteer.launch({ headless: true, args: process.env.CI ? ['--no-sandbox'] : [] });
|
|
17
|
+
try {
|
|
18
|
+
const page = yield browser.newPage();
|
|
19
|
+
yield page.setContent('<main></main><aside></aside>');
|
|
20
|
+
yield page.addScriptTag({ path: 'build/cjs/vexflow-debug.js' });
|
|
21
|
+
yield page.addScriptTag({ path: 'node_modules/opentype.js/dist/opentype.js' });
|
|
22
|
+
yield page.addScriptTag({ content: 'window.study=' + publicationStudy });
|
|
23
|
+
for (const [family, file] of [
|
|
24
|
+
['Bravura', 'bravura'],
|
|
25
|
+
['Academico', 'academico'],
|
|
26
|
+
]) {
|
|
27
|
+
const data = yield readFile('node_modules/@vexflow-fonts/' + file + '/' + file + '.otf');
|
|
28
|
+
yield page.evaluate((_a) => __awaiter(void 0, [_a], void 0, function* ({ family, data }) {
|
|
29
|
+
var _b;
|
|
30
|
+
const bytes = Uint8Array.from(atob(data), (c) => c.charCodeAt(0));
|
|
31
|
+
document.fonts.add(yield new FontFace(family, bytes).load());
|
|
32
|
+
((_b = window.faces) !== null && _b !== void 0 ? _b : (window.faces = [])).push({ family, font: opentype.parse(bytes.buffer) });
|
|
33
|
+
}), { family, data: data.toString('base64') });
|
|
34
|
+
}
|
|
35
|
+
yield page.evaluate(() => VexFlow.setFonts('Bravura', 'Academico'));
|
|
36
|
+
for (const paper of ['A4', 'Letter'])
|
|
37
|
+
for (const part of [false, true]) {
|
|
38
|
+
yield t.test((part ? 'cello' : 'score') + ' on ' + paper, () => __awaiter(void 0, void 0, void 0, function* () {
|
|
39
|
+
var _a;
|
|
40
|
+
const { diagnostics, ranges, media, metadata, ids, boxes, printed, geometry, svg } = yield page.evaluate(({ part, paper }) => {
|
|
41
|
+
const { source, options } = study(part, paper), target = document.querySelector('main');
|
|
42
|
+
const result = new VexFlow.Publication(source).render(target, options);
|
|
43
|
+
const roots = result.pages.map((p) => p.svg);
|
|
44
|
+
const ids = roots.flatMap((s) => [...s.querySelectorAll('[id]')].map((el) => el.id));
|
|
45
|
+
const p = result.pages[0];
|
|
46
|
+
const xml = result.toSVG(1), outlined = result.toSVG(1, faces);
|
|
47
|
+
const parse = (s) => new DOMParser().parseFromString(s, 'image/svg+xml');
|
|
48
|
+
return {
|
|
49
|
+
diagnostics: result.diagnostics,
|
|
50
|
+
ranges: result.pages.map((p) => p.systems.flatMap((s) => s.measures)),
|
|
51
|
+
media: roots.map((el) => [el.getAttribute('width'), el.getAttribute('height')]),
|
|
52
|
+
metadata: roots.map((s) => JSON.parse(s.querySelector('metadata').textContent)),
|
|
53
|
+
ids: ids.length === new Set(ids).size,
|
|
54
|
+
boxes: result.pages.map((p) => p.systems),
|
|
55
|
+
printed: result.toPrintHTML(faces),
|
|
56
|
+
geometry: [...parse(outlined).querySelectorAll('[data-system]')].map((g) => g.getAttribute('transform')),
|
|
57
|
+
svg: {
|
|
58
|
+
transforms: [...p.svg.querySelectorAll('[data-system]')].map((g) => g.getAttribute('transform')),
|
|
59
|
+
source: parse(xml).querySelectorAll('text').length,
|
|
60
|
+
outlined: parse(outlined).querySelectorAll('text').length,
|
|
61
|
+
meta: parse(outlined).querySelector('metadata').textContent ===
|
|
62
|
+
p.svg.querySelector('metadata').textContent,
|
|
63
|
+
},
|
|
64
|
+
};
|
|
65
|
+
}, { part, paper });
|
|
66
|
+
assert.deepEqual(diagnostics, []);
|
|
67
|
+
assert.deepEqual(ranges.flat(), Array.from({ length: 26 }, (_, i) => i + 1));
|
|
68
|
+
assert.deepEqual(ranges.map((r) => r.at(-1)), part ? [16, 26] : paper === 'A4' ? [12, 24, 26] : [8, 20, 26]);
|
|
69
|
+
const [w, h] = paper === 'A4' ? [210, 297] : [215.9, 279.4];
|
|
70
|
+
assert.ok(media.every((m) => m[0] === w + 'mm' && m[1] === h + 'mm'));
|
|
71
|
+
for (const systems of boxes)
|
|
72
|
+
for (const [i, s] of systems.entries()) {
|
|
73
|
+
assert.ok(s.x >= 16 && s.x + s.width <= w - 16 + 0.001);
|
|
74
|
+
assert.ok(s.y >= 15 && s.y + s.height < h - 15);
|
|
75
|
+
if (i)
|
|
76
|
+
assert.ok(s.y >= systems[i - 1].y + systems[i - 1].height + 5.99);
|
|
77
|
+
}
|
|
78
|
+
assert.ok(ids && svg.meta && svg.source > 0 && !svg.outlined);
|
|
79
|
+
assert.deepEqual(geometry, svg.transforms);
|
|
80
|
+
const events = metadata.flatMap((m) => m.events);
|
|
81
|
+
assert.ok(events.some((n) => n.id === 'vc-16-1' && n.rest));
|
|
82
|
+
if (part) {
|
|
83
|
+
const cue = metadata.flatMap((m) => m.regions).find((r) => r.kind === 'cue');
|
|
84
|
+
assert.ok(cue.events.some((e) => e.id === 'fl-16-1' && e.measure === 16 && e.staff === 'fl'));
|
|
85
|
+
assert.ok(events.every((e) => e.staff === 'vc'));
|
|
86
|
+
assert.deepEqual(metadata.flatMap((m) => m.regions).map((r) => [r.kind, r.measure]), [
|
|
87
|
+
['cue', 16],
|
|
88
|
+
['ossia', 21],
|
|
89
|
+
]);
|
|
90
|
+
}
|
|
91
|
+
const print = yield browser.newPage();
|
|
92
|
+
try {
|
|
93
|
+
yield print.setContent(printed);
|
|
94
|
+
const pdf = Buffer.from(yield print.pdf({ preferCSSPageSize: true, printBackground: true }));
|
|
95
|
+
const bytes = pdf.toString('latin1');
|
|
96
|
+
const pages = (_a = bytes.match(/\/Type\s*\/Page\b/g)) !== null && _a !== void 0 ? _a : [];
|
|
97
|
+
assert.equal(pages.length, ranges.length);
|
|
98
|
+
const media = [...bytes.matchAll(/\/MediaBox\s*\[\s*0\s+0\s+([\d.]+)\s+([\d.]+)/g)];
|
|
99
|
+
assert.equal(media.length, ranges.length);
|
|
100
|
+
assert.ok(media.every((m) => Math.abs(Number(m[1]) - (w * 72) / 25.4) < 1 && Math.abs(Number(m[2]) - (h * 72) / 25.4) < 1));
|
|
101
|
+
}
|
|
102
|
+
finally {
|
|
103
|
+
yield print.close();
|
|
104
|
+
}
|
|
105
|
+
}));
|
|
106
|
+
}
|
|
107
|
+
yield t.test('pagination reserves running text at the final page scale', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
108
|
+
const result = yield page.evaluate(() => {
|
|
109
|
+
const style = document.createElement('style');
|
|
110
|
+
style.textContent = 'svg[role="img"] [data-page-furniture] text { font-size: 7px }';
|
|
111
|
+
document.head.append(style);
|
|
112
|
+
try {
|
|
113
|
+
const { source, options } = study(false, 'Letter');
|
|
114
|
+
const book = new VexFlow.Publication(source).render(document.querySelector('main'), options);
|
|
115
|
+
return book.pages.map((p) => {
|
|
116
|
+
const footer = Array.from(p.svg.querySelector('[data-page-furniture]').children).slice(-2);
|
|
117
|
+
const bottom = Math.min(...footer.map((el) => el.getBBox().y));
|
|
118
|
+
const last = p.systems.at(-1);
|
|
119
|
+
return { end: last.measures.at(-1), clearance: bottom - last.y - last.height };
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
finally {
|
|
123
|
+
style.remove();
|
|
124
|
+
}
|
|
125
|
+
});
|
|
126
|
+
assert.deepEqual(result.map((p) => p.end), [8, 16, 24, 26]);
|
|
127
|
+
assert.ok(result.every((p) => p.clearance >= 3.99), 'Every system clears the footer reservation');
|
|
128
|
+
}));
|
|
129
|
+
yield t.test('an extracted cross-staff voice keeps its notes and reports a spanner ending in another part', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
130
|
+
const data = yield page.evaluate(() => {
|
|
131
|
+
const { source } = study(false, 'A4');
|
|
132
|
+
const note = source.staves[0].measures[0].voices[0].notes[0];
|
|
133
|
+
note.stave = 'va';
|
|
134
|
+
note.note.clef = 'alto';
|
|
135
|
+
source.continuous.spans.push({ kind: 'slur', id: 'between', from: 'fl-1-1', to: 'vc-2-2' });
|
|
136
|
+
const registry = new VexFlow.Registry();
|
|
137
|
+
VexFlow.Registry.enableDefaultRegistry(registry);
|
|
138
|
+
try {
|
|
139
|
+
const r = new VexFlow.Publication(source).render(document.querySelector('aside'), { staves: ['fl'] });
|
|
140
|
+
const metadata = JSON.parse(r.pages[0].svg.querySelector('metadata').textContent);
|
|
141
|
+
return {
|
|
142
|
+
notes: metadata.events.filter((n) => n.id === 'fl-1-1'),
|
|
143
|
+
omitted: r.diagnostics.filter((d) => d.code === 'ExcludedAnchor'),
|
|
144
|
+
registry: VexFlow.Registry.getDefaultRegistry() === registry && !registry.getElementById('fl-1-1'),
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
finally {
|
|
148
|
+
VexFlow.Registry.disableDefaultRegistry();
|
|
149
|
+
}
|
|
150
|
+
});
|
|
151
|
+
assert.equal(data.notes[0].staff, 'fl');
|
|
152
|
+
assert.deepEqual(data.omitted, [{ code: 'ExcludedAnchor', measures: [1, 2], detail: 'between' }]);
|
|
153
|
+
assert.ok(data.registry);
|
|
154
|
+
}));
|
|
155
|
+
yield t.test('part-only breaks, forced and forbidden turns, oversize diagnostics and transactional redraw', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
156
|
+
const checks = yield page.evaluate(() => {
|
|
157
|
+
const { source, options } = study(false, 'A4'), part = study(true, 'A4').options;
|
|
158
|
+
const base = JSON.stringify(source), pub = new VexFlow.Publication(source);
|
|
159
|
+
const main = document.querySelector('main'), other = document.querySelector('aside');
|
|
160
|
+
const score = pub.render(main, options), before = main.innerHTML;
|
|
161
|
+
const forced = pub.render(other, Object.assign(Object.assign({}, part), { pageBreaks: [5], forbiddenTurns: [4] }));
|
|
162
|
+
const last = other.innerHTML;
|
|
163
|
+
let invalid = false;
|
|
164
|
+
try {
|
|
165
|
+
pub.render(other, Object.assign(Object.assign({}, part), { regions: [{ kind: 'cue', staff: 'missing', measure: 4, label: 'Cue' }] }));
|
|
166
|
+
}
|
|
167
|
+
catch (_a) {
|
|
168
|
+
invalid = true;
|
|
169
|
+
}
|
|
170
|
+
const intact = other.innerHTML === last;
|
|
171
|
+
const narrow = pub.render(other, Object.assign(Object.assign({}, part), { paper: { width: 130, height: 68 }, title: 'A '.repeat(100) }));
|
|
172
|
+
let refused = false;
|
|
173
|
+
try {
|
|
174
|
+
narrow.toPrintHTML(faces);
|
|
175
|
+
}
|
|
176
|
+
catch (_b) {
|
|
177
|
+
refused = true;
|
|
178
|
+
}
|
|
179
|
+
return {
|
|
180
|
+
invalid,
|
|
181
|
+
intact,
|
|
182
|
+
refused,
|
|
183
|
+
unchanged: before === main.innerHTML && base === JSON.stringify(source),
|
|
184
|
+
turn: forced.diagnostics.filter((d) => d.code === 'ForbiddenTurn').map((d) => d.measures),
|
|
185
|
+
first: forced.pages[1].systems[0].measures[0],
|
|
186
|
+
codes: narrow.diagnostics.map((d) => d.code),
|
|
187
|
+
score: score.pages.length,
|
|
188
|
+
};
|
|
189
|
+
});
|
|
190
|
+
assert.ok(checks.invalid && checks.intact && checks.refused && checks.unchanged);
|
|
191
|
+
assert.equal(checks.first, 5);
|
|
192
|
+
assert.deepEqual(checks.turn, [[4]]);
|
|
193
|
+
assert.ok(checks.codes.includes('PageOverflow') && checks.codes.includes('TextOverflow'));
|
|
194
|
+
}));
|
|
195
|
+
}
|
|
196
|
+
finally {
|
|
197
|
+
yield browser.close();
|
|
198
|
+
}
|
|
199
|
+
}));
|
|
200
|
+
test('equally feasible pages prefer a performing rest and respect a forbidden turn and last-page spacing', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
201
|
+
const { paginate } = yield import('../../build/esm/src/pagebreaks.js');
|
|
202
|
+
const rows = Array.from({ length: 5 }, (_, i) => ({ measures: [i + 1], height: 10, restAtEnd: i === 1 }));
|
|
203
|
+
const rules = {
|
|
204
|
+
firstHeight: 34,
|
|
205
|
+
laterHeight: 34,
|
|
206
|
+
gap: 1,
|
|
207
|
+
maxExtraGap: 8,
|
|
208
|
+
justifyLast: false,
|
|
209
|
+
part: true,
|
|
210
|
+
forceBefore: new Set(),
|
|
211
|
+
preferAfter: new Set(),
|
|
212
|
+
forbidAfter: new Set(),
|
|
213
|
+
};
|
|
214
|
+
const natural = paginate(rows, rules);
|
|
215
|
+
assert.deepEqual(natural.map((p) => p.end), [2, 5]);
|
|
216
|
+
assert.deepEqual(natural[1].offsets, [0, 11, 22]);
|
|
217
|
+
assert.deepEqual(paginate(rows, Object.assign(Object.assign({}, rules), { justifyLast: true }))[1].offsets, [0, 12, 24]);
|
|
218
|
+
assert.deepEqual(paginate(rows, Object.assign(Object.assign({}, rules), { forbidAfter: new Set([2]) })).map((p) => p.end), [3, 5]);
|
|
219
|
+
}));
|
|
@@ -14,7 +14,7 @@ import { join } from 'node:path';
|
|
|
14
14
|
import test from 'node:test';
|
|
15
15
|
import { fileURLToPath } from 'node:url';
|
|
16
16
|
import puppeteer from 'puppeteer';
|
|
17
|
-
import { renderScore } from '../../tools/score-fixtures.mjs';
|
|
17
|
+
import { renderScore, scoreKinds } from '../../tools/score-fixtures.mjs';
|
|
18
18
|
const root = fileURLToPath(new URL('../../', import.meta.url));
|
|
19
19
|
test('jsdom registers fonts, renders PNGs, and exports portable SVG', () => {
|
|
20
20
|
const directory = join(root, 'build/jsdom-smoke');
|
|
@@ -56,14 +56,18 @@ test('score benchmark fixtures render', () => __awaiter(void 0, void 0, void 0,
|
|
|
56
56
|
yield page.setContent('<div id="score"></div>');
|
|
57
57
|
yield page.addScriptTag({ path: join(root, 'build/cjs/vexflow-debug.js') });
|
|
58
58
|
yield page.evaluate(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
59
|
+
yield Promise.all([...document.fonts].map((face) => face.load()));
|
|
59
60
|
yield document.fonts.ready;
|
|
60
61
|
}));
|
|
61
|
-
for (const kind of
|
|
62
|
+
for (const kind of scoreKinds) {
|
|
62
63
|
const result = yield page.evaluate(renderScore, { kind, systems: 1 });
|
|
63
64
|
const expected = {
|
|
64
65
|
chorale: { notes: 48, staves: 8 },
|
|
65
66
|
piano: { notes: 64, staves: 8 },
|
|
66
67
|
chamber: { notes: 144, staves: 12 },
|
|
68
|
+
'lead-sheet': { notes: 32, staves: 4 },
|
|
69
|
+
percussion: { notes: 32, staves: 4 },
|
|
70
|
+
tab: { notes: 32, staves: 4 },
|
|
67
71
|
}[kind];
|
|
68
72
|
assert.deepEqual({ notes: result.notes, staves: result.staves }, expected);
|
|
69
73
|
assert.ok(result.svg.includes('<path'));
|
|
@@ -12,7 +12,7 @@ const ThreeVoicesTests = {
|
|
|
12
12
|
run('Auto Adjust Rest Positions - Three Voices #2', autoRestThreeVoices2);
|
|
13
13
|
},
|
|
14
14
|
};
|
|
15
|
-
function createThreeVoicesTest(noteGroup1, noteGroup2, noteGroup3, setup) {
|
|
15
|
+
function createThreeVoicesTest(noteGroup1, noteGroup2, noteGroup3, setup, check) {
|
|
16
16
|
return (options) => {
|
|
17
17
|
const factory = VexFlowTests.makeFactory(options, 600, 200);
|
|
18
18
|
const stave = factory.Stave().addClef('treble').addTimeSignature('4/4');
|
|
@@ -30,6 +30,7 @@ function createThreeVoicesTest(noteGroup1, noteGroup2, noteGroup3, setup) {
|
|
|
30
30
|
for (let i = 0; i < beams.length; i++) {
|
|
31
31
|
beams[i].setContext(factory.getContext()).drawWithStyle();
|
|
32
32
|
}
|
|
33
|
+
check === null || check === void 0 ? void 0 : check(noteGroups, options.assert);
|
|
33
34
|
options.assert.ok(true);
|
|
34
35
|
};
|
|
35
36
|
}
|
|
@@ -49,6 +50,15 @@ const threeVoices2 = createThreeVoicesTest(['(a4 e5)/16, e5, e5, e5, e5/8, e5, e
|
|
|
49
50
|
.getTickables()[0]
|
|
50
51
|
.addModifier(f.Fingering({ number: '0', position: 'left' }), 0)
|
|
51
52
|
.addModifier(f.Fingering({ number: '4', position: 'left' }), 1);
|
|
53
|
+
}, (groups, assert) => {
|
|
54
|
+
const beam = groups[1][0].checkBeam();
|
|
55
|
+
const first = beam.getNotes()[0];
|
|
56
|
+
const lower = groups[2][1];
|
|
57
|
+
const headTop = lower.noteHeads[0].getBoundingBox().getY();
|
|
58
|
+
for (const x of [lower.getNoteHeadBeginX(), lower.getNoteHeadEndX()]) {
|
|
59
|
+
const edge = beam.getSlopeY(x, first.getStemX(), beam.getBeamYToDraw(), beam.slope);
|
|
60
|
+
assert.ok(edge < headTop, `Middle beam edge at ${edge} clears lower head at ${headTop} (x=${x})`);
|
|
61
|
+
}
|
|
52
62
|
});
|
|
53
63
|
const threeVoices3 = createThreeVoicesTest(['(g4 e5)/4, e5, (g4 e5)/2', { stem: 'up' }], ['c#5/4, b4/8, b4/8/r, a4/4., g4/8', { stem: 'down' }], ['c4/4, b3, a3, g3', { stem: 'down' }], (f, voices) => {
|
|
54
64
|
voices[0]
|
|
@@ -134,10 +134,10 @@ export class VexFlowTests {
|
|
|
134
134
|
static generateTestID(prefix) {
|
|
135
135
|
return prefix + '_' + VexFlowTests.NEXT_TEST_ID++;
|
|
136
136
|
}
|
|
137
|
-
static runTests(name, testFunc, params) {
|
|
138
|
-
VexFlowTests.runCanvasTest(name, testFunc, params);
|
|
139
|
-
VexFlowTests.runSVGTest(name, testFunc, params);
|
|
140
|
-
VexFlowTests.runNodeTest(name, testFunc, params);
|
|
137
|
+
static runTests(name, testFunc, params, fontStacks) {
|
|
138
|
+
VexFlowTests.runCanvasTest(name, testFunc, params, fontStacks);
|
|
139
|
+
VexFlowTests.runSVGTest(name, testFunc, params, fontStacks);
|
|
140
|
+
VexFlowTests.runNodeTest(name, testFunc, params, fontStacks);
|
|
141
141
|
}
|
|
142
142
|
static runTextTests(name, testFunc, params) {
|
|
143
143
|
VexFlowTests.runCanvasText(name, testFunc, params);
|
|
@@ -155,10 +155,13 @@ export class VexFlowTests {
|
|
|
155
155
|
const { elementId, backend } = options;
|
|
156
156
|
return new Factory({ renderer: { elementId, backend, width, height } });
|
|
157
157
|
}
|
|
158
|
-
static runCanvasTest(name, testFunc, params) {
|
|
158
|
+
static runCanvasTest(name, testFunc, params, fontStacks) {
|
|
159
159
|
if (VexFlowTests.RUN_CANVAS_TESTS) {
|
|
160
160
|
const helper = null;
|
|
161
|
-
VexFlowTests.runWithParams(Object.assign(Object.assign({}, CANVAS_TEST_CONFIG), {
|
|
161
|
+
VexFlowTests.runWithParams(Object.assign(Object.assign({}, CANVAS_TEST_CONFIG), { fontStacks: fontStacks !== null && fontStacks !== void 0 ? fontStacks : CANVAS_TEST_CONFIG.fontStacks, name,
|
|
162
|
+
testFunc,
|
|
163
|
+
params,
|
|
164
|
+
helper }));
|
|
162
165
|
}
|
|
163
166
|
}
|
|
164
167
|
static runCanvasText(name, testFunc, params) {
|
|
@@ -167,10 +170,13 @@ export class VexFlowTests {
|
|
|
167
170
|
VexFlowTests.runWithParams(Object.assign(Object.assign({}, CANVAS_TEXT_CONFIG), { name, testFunc, params, helper }));
|
|
168
171
|
}
|
|
169
172
|
}
|
|
170
|
-
static runSVGTest(name, testFunc, params) {
|
|
173
|
+
static runSVGTest(name, testFunc, params, fontStacks) {
|
|
171
174
|
if (VexFlowTests.RUN_SVG_TESTS) {
|
|
172
175
|
const helper = null;
|
|
173
|
-
VexFlowTests.runWithParams(Object.assign(Object.assign({}, SVG_TEST_CONFIG), {
|
|
176
|
+
VexFlowTests.runWithParams(Object.assign(Object.assign({}, SVG_TEST_CONFIG), { fontStacks: fontStacks !== null && fontStacks !== void 0 ? fontStacks : SVG_TEST_CONFIG.fontStacks, name,
|
|
177
|
+
testFunc,
|
|
178
|
+
params,
|
|
179
|
+
helper }));
|
|
174
180
|
}
|
|
175
181
|
}
|
|
176
182
|
static runSVGText(name, testFunc, params) {
|
|
@@ -179,10 +185,13 @@ export class VexFlowTests {
|
|
|
179
185
|
VexFlowTests.runWithParams(Object.assign(Object.assign({}, SVG_TEXT_CONFIG), { name, testFunc, params, helper }));
|
|
180
186
|
}
|
|
181
187
|
}
|
|
182
|
-
static runNodeTest(name, testFunc, params) {
|
|
188
|
+
static runNodeTest(name, testFunc, params, fontStacks) {
|
|
183
189
|
if (VexFlowTests.RUN_NODE_TESTS) {
|
|
184
190
|
const helper = VexFlowTests.runNodeTestHelper;
|
|
185
|
-
VexFlowTests.runWithParams(Object.assign(Object.assign({}, NODE_TEST_CONFIG), {
|
|
191
|
+
VexFlowTests.runWithParams(Object.assign(Object.assign({}, NODE_TEST_CONFIG), { fontStacks: fontStacks !== null && fontStacks !== void 0 ? fontStacks : NODE_TEST_CONFIG.fontStacks, name,
|
|
192
|
+
testFunc,
|
|
193
|
+
params,
|
|
194
|
+
helper }));
|
|
186
195
|
}
|
|
187
196
|
}
|
|
188
197
|
static runNodeTestHelper(fontName, element) {
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { spawnSync } from 'node:child_process';
|
|
2
|
+
import { readFileSync } from 'node:fs';
|
|
3
|
+
const advisory = 'https://github.com/advisories/GHSA-fc5q-39xc-vjpf';
|
|
4
|
+
const reviewedVersions = new Set(['2.3.2', '4.0.5']);
|
|
5
|
+
const expires = Date.parse('2026-12-18T00:00:00Z');
|
|
6
|
+
export function isExcepted(report, packages, now = Date.now()) {
|
|
7
|
+
var _a, _b, _c, _d, _e, _f;
|
|
8
|
+
const findings = Object.entries((_a = report === null || report === void 0 ? void 0 : report.vulnerabilities) !== null && _a !== void 0 ? _a : {});
|
|
9
|
+
if (now >= expires || report.auditReportVersion !== 2 || report.error || !findings.length)
|
|
10
|
+
return false;
|
|
11
|
+
if (((_c = (_b = report.metadata) === null || _b === void 0 ? void 0 : _b.vulnerabilities) === null || _c === void 0 ? void 0 : _c.total) !== findings.length)
|
|
12
|
+
return false;
|
|
13
|
+
const accepted = new Set();
|
|
14
|
+
for (const [name, finding] of findings) {
|
|
15
|
+
if (!((_d = finding.nodes) === null || _d === void 0 ? void 0 : _d.length) || !finding.nodes.every((path) => { var _a; return ((_a = packages[path]) === null || _a === void 0 ? void 0 : _a.dev) === true; }))
|
|
16
|
+
return false;
|
|
17
|
+
if (name === 'picomatch') {
|
|
18
|
+
if (finding.isDirect || finding.fixAvailable === true)
|
|
19
|
+
return false;
|
|
20
|
+
if (!finding.nodes.every((path) => reviewedVersions.has(packages[path].version)))
|
|
21
|
+
return false;
|
|
22
|
+
if (((_e = finding.via) === null || _e === void 0 ? void 0 : _e.length) !== 1 || ((_f = finding.via[0]) === null || _f === void 0 ? void 0 : _f.url) !== advisory)
|
|
23
|
+
return false;
|
|
24
|
+
accepted.add(name);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
let previousSize;
|
|
28
|
+
do {
|
|
29
|
+
previousSize = accepted.size;
|
|
30
|
+
for (const [name, { via }] of findings) {
|
|
31
|
+
if ((via === null || via === void 0 ? void 0 : via.length) && via.every((cause) => accepted.has(cause)))
|
|
32
|
+
accepted.add(name);
|
|
33
|
+
}
|
|
34
|
+
} while (accepted.size > previousSize);
|
|
35
|
+
return accepted.size === findings.length;
|
|
36
|
+
}
|
|
37
|
+
function main() {
|
|
38
|
+
var _a;
|
|
39
|
+
const result = spawnSync(process.execPath, [process.env.npm_execpath, 'audit', '--include=dev', '--audit-level=low', '--json'], {
|
|
40
|
+
encoding: 'utf8',
|
|
41
|
+
stdio: ['ignore', 'pipe', 'inherit'],
|
|
42
|
+
});
|
|
43
|
+
if (result.error)
|
|
44
|
+
throw result.error;
|
|
45
|
+
if (result.status === 0) {
|
|
46
|
+
console.log('npm audit passed.');
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
console.log(result.stdout);
|
|
50
|
+
if (result.status === 1) {
|
|
51
|
+
const report = JSON.parse(result.stdout);
|
|
52
|
+
const lock = JSON.parse(readFileSync(new URL('../package-lock.json', import.meta.url), 'utf8'));
|
|
53
|
+
if (isExcepted(report, lock.packages)) {
|
|
54
|
+
console.log('Accepted the development-only picomatch advisory through 2026-12-17 UTC. See SECURITY.md.');
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
process.exitCode = (_a = result.status) !== null && _a !== void 0 ? _a : 1;
|
|
59
|
+
}
|
|
60
|
+
if (import.meta.main)
|
|
61
|
+
main();
|
|
@@ -12,7 +12,7 @@ export function renderEasyScoreStructure(VF, renderer, kind = 'tab', ink = '#243
|
|
|
12
12
|
marks.push(mark);
|
|
13
13
|
};
|
|
14
14
|
if (tab) {
|
|
15
|
-
notes = [3, 5, 7,
|
|
15
|
+
notes = [3, 5, 7, 8].map((fret) => score.make.tabNote({ positions: [{ str: 2, fret }], duration: 'q' }));
|
|
16
16
|
attach(score.make.clef('tab'));
|
|
17
17
|
if (kind === 'tab') {
|
|
18
18
|
const bend = score.make.bend([
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { expression } from './expression.mjs';
|
|
2
|
+
import { guitar } from './guitar.mjs';
|
|
2
3
|
import { layout } from './layout.mjs';
|
|
3
4
|
import { notes } from './notes.mjs';
|
|
4
5
|
import { staves } from './staves.mjs';
|
|
5
6
|
import { strings } from './strings.mjs';
|
|
6
|
-
export const entries = [...notes, ...staves, ...expression, ...strings, ...layout];
|
|
7
|
+
export const entries = [...notes, ...staves, ...expression, ...strings, ...guitar, ...layout];
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { example as e, number, select, setup, staff, text } from './helpers.mjs';
|
|
2
2
|
const group = 'Marks & expression';
|
|
3
3
|
export const expression = [
|
|
4
|
-
e('annotations', 'Lyrics & annotations', group, 'Align lyrics below notes or annotations above them.', 'Annotation', staff("score.notes('C5/q, E5, G5, C6')",
|
|
4
|
+
e('annotations', 'Lyrics & annotations', group, 'Align lyrics below notes or annotations above them.', 'Annotation', staff("score.notes('C5/q, E5, G5, C6')", `// Pair each word with the note at the same position in the melody.
|
|
5
|
+
params.words.split(' ').slice(0, notes.length).forEach((word, i) => {
|
|
5
6
|
notes[i].addModifier(factory.Annotation({ text: word, vJustify: params.position }), 0);
|
|
6
7
|
});`), [text('words', 'Words', 'One two three four'), select('position', 'Position', 'bottom', ['bottom', 'top'])]),
|
|
7
|
-
e('chord-symbols', 'Chord symbols', group, 'Build harmonic labels from text, accidentals, and superscripts.', 'ChordSymbol', staff("score.notes('C5/h, G4')",
|
|
8
|
+
e('chord-symbols', 'Chord symbols', group, 'Build harmonic labels from text, accidentals, and superscripts.', 'ChordSymbol', staff("score.notes('C5/h, G4')", `// Build the label in reading order. Raise the flat ninth on the second symbol.
|
|
9
|
+
notes[0].addModifier(factory.ChordSymbol().addText(params.root).addGlyphOrText('maj7'), 0);
|
|
8
10
|
notes[1].addModifier(factory.ChordSymbol().addText('G').addGlyphOrText('7').addGlyphOrText('b9', { symbolModifier: VF.ChordSymbol.symbolModifiers.SUPERSCRIPT }), 0);`), [text('root', 'Root', 'C')]),
|
|
9
11
|
e('chord-kerning', 'Chord kerning', group, 'Compare default spacing with opt-in font-specific kerning and stacked scripts.', 'ChordSymbol', `${setup}
|
|
10
12
|
// The two rows use identical notes and chord content. Only the kerning mode changes.
|
|
@@ -46,23 +48,26 @@ if (params.bounds === 'yes') {
|
|
|
46
48
|
select('bounds', 'Chord bounds', 'no', ['no', 'yes']),
|
|
47
49
|
], 'Auto supports regular Academico/Bravura and Petaluma Script/Petaluma. Other font combinations keep the default layout. Set the chord font before formatting.'),
|
|
48
50
|
e('dynamics', 'Dynamics', group, 'From pianissimo to fortissimo, draw music-font dynamic marks.', 'TextDynamics', `${setup}
|
|
51
|
+
// Give each dynamic a beat so the voice can space the markings from softest to loudest.
|
|
49
52
|
const dynamics = ['pp', 'p', 'mp', 'mf', 'f', 'ff'].map(text => factory.TextDynamics({ text, duration: 'q' }));
|
|
50
53
|
const voice = factory.Voice().setMode(VF.Voice.Mode.SOFT).addTickables(dynamics);
|
|
51
54
|
factory.System({ x: 30, y: 55, width: width - 60 }).addStave({ voices: [voice] });
|
|
52
55
|
factory.draw();`),
|
|
53
56
|
e('text-notes', 'Text notes', group, 'Place rhythmically aligned text alongside music.', 'TextNote', `${setup}
|
|
57
|
+
// Each word takes a quarter note of time, even though it has no notehead.
|
|
54
58
|
const notes = ['dolce', 'poco', 'a', 'poco'].map(text => factory.TextNote({ text, duration: 'q', line: params.line }));
|
|
55
59
|
const voice = factory.Voice().addTickables(notes);
|
|
56
60
|
factory.System({ x: 30, y: 65, width: width - 60 }).addStave({ voices: [voice] });
|
|
57
61
|
factory.draw();`, [number('line', 'Text line', 2, -2, 6)]),
|
|
58
|
-
e('ties', 'Ties', group, 'Connect the same pitch across successive notes. Chord ties can select individual keys.', 'StaveTie', staff("score.notes('(C5 E5)/h, (C5 E5)')", '
|
|
59
|
-
e('slurs', 'Slurs & curves', group, 'Connect notes with a slur and adjust its thickness.', 'Curve', staff("score.notes('C5/q, D5, E5, G5')", '
|
|
60
|
-
e('hairpins', 'Hairpins', group, 'Draw crescendo and decrescendo hairpins below the staff.', 'StaveHairpin', staff("score.notes('C5/q, D5, E5, G5')", '',
|
|
62
|
+
e('ties', 'Ties', group, 'Connect the same pitch across successive notes. Chord ties can select individual keys.', 'StaveTie', staff("score.notes('(C5 E5)/h, (C5 E5)')", '// Connect both matching pitches. Leave only index zero on each side to sustain just C.\nfactory.StaveTie({ from: notes[0], to: notes[1], firstIndexes: [0, 1], lastIndexes: [0, 1] });')),
|
|
63
|
+
e('slurs', 'Slurs & curves', group, 'Connect notes with a slur and adjust its thickness.', 'Curve', staff("score.notes('C5/q, D5, E5, G5')", '// The middle two notes belong to the phrase even though only its endpoints are named.\nfactory.Curve({ from: notes[0], to: notes[3], options: { thickness: params.thickness } });'), [number('thickness', 'Thickness', 2, 1, 6, 0.5)]),
|
|
64
|
+
e('hairpins', 'Hairpins', group, 'Draw crescendo and decrescendo hairpins below the staff.', 'StaveHairpin', staff("score.notes('C5/q, D5, E5, G5')", '', `// The opening or closing wedge occupies the space between the first and last attacks.
|
|
65
|
+
new VF.StaveHairpin({ firstNote: notes[0], lastNote: notes[3] }, params.direction === 'crescendo' ? 1 : 2)
|
|
61
66
|
.setPosition(VF.Modifier.Position.BELOW)
|
|
62
67
|
.setStyle({ fillStyle: ink, strokeStyle: ink })
|
|
63
68
|
.setContext(factory.getContext()).drawWithStyle();`), [select('direction', 'Direction', 'crescendo', ['crescendo', 'decrescendo'])]),
|
|
64
|
-
e('pedal', 'Pedal markings', group, 'Choose between text, brackets, and a mixture of the two.', 'PedalMarking', staff("score.notes('C5/q, E5, G5, C6')", '
|
|
65
|
-
e('octaves', 'Octave brackets', group, 'An octave instruction spans a passage without changing its written pitches.', 'TextBracket', staff("score.notes('C5/q, E5, G5, C6')", "
|
|
66
|
-
e('glissando', 'Glissando lines', group, 'Draw a line between selected pitches and add a label.', 'StaveLine', staff("score.notes('C4/h, C6')", "
|
|
67
|
-
e('vibrato-bracket', 'Vibrato brackets', group, 'Draw a vibrato bracket spanning several notes.', 'VibratoBracket', staff("score.notes('C5/q, D5, E5, G5')", '
|
|
69
|
+
e('pedal', 'Pedal markings', group, 'Choose between text, brackets, and a mixture of the two.', 'PedalMarking', staff("score.notes('C5/q, E5, G5, C6')", '// The first note tells the pianist to depress the pedal and the last to release it.\nfactory.PedalMarking({ notes: [notes[0], notes[3]], options: { style: params.style } });'), [select('style', 'Style', 'mixed', ['mixed', 'bracket', 'text'])]),
|
|
70
|
+
e('octaves', 'Octave brackets', group, 'An octave instruction spans a passage without changing its written pitches.', 'TextBracket', staff("score.notes('C5/q, E5, G5, C6')", "// The bracket tells the player to transpose every note under it.\nfactory.TextBracket({ from: notes[0], to: notes[3], text: params.text, options: { superscript: 'va', position: 'top', line: 2 } });"), [select('text', 'Interval', '8', ['8', '15'])]),
|
|
71
|
+
e('glissando', 'Glissando lines', group, 'Draw a line between selected pitches and add a label.', 'StaveLine', staff("score.notes('C4/h, C6')", "// Each index picks the head where the sliding line starts or ends.\nfactory.StaveLine({ from: notes[0], to: notes[1], firstIndexes: [0], lastIndexes: [0], options: { text: 'gliss.' } });")),
|
|
72
|
+
e('vibrato-bracket', 'Vibrato brackets', group, 'Draw a vibrato bracket spanning several notes.', 'VibratoBracket', staff("score.notes('C5/q, D5, E5, G5')", '// The wavy line lasts across the phrase. Its line setting controls its height.\nfactory.VibratoBracket({ from: notes[0], to: notes[3], options: { line: 2 } });')),
|
|
68
73
|
];
|