@barmark/render 0.12.0 → 0.14.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/CHANGELOG.md +35 -1
- package/dist/credits.d.ts +3 -0
- package/dist/credits.js +23 -0
- package/dist/html.js +52 -12
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/model.js +32 -16
- package/dist/speech.js +13 -3
- package/dist/styles.js +7 -0
- package/dist/types.d.ts +6 -4
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,38 @@ package uses [semantic versioning](https://semver.org/).
|
|
|
6
6
|
|
|
7
7
|
## [Unreleased]
|
|
8
8
|
|
|
9
|
+
## [0.14.0] - 2026-11-04
|
|
10
|
+
|
|
11
|
+
Needs `barmark` 0.16.0.
|
|
12
|
+
|
|
13
|
+
### Added
|
|
14
|
+
|
|
15
|
+
- **Part lines** (barmark's grammar 7.6): a system draws a row per line a
|
|
16
|
+
part writes, labelled `Pno.RH`, `Pno.LH`, in score order; a part with no
|
|
17
|
+
line there keeps its tacet row, and `part: "Pno"` draws both hands. The
|
|
18
|
+
label column is as wide as the widest line label. A screen reader
|
|
19
|
+
hears each row as its part and line: "Piano RH". `parts` in the model
|
|
20
|
+
are barmark's `DeclaredPart`, with `lines`.
|
|
21
|
+
- **Pedal marks** (grammar 2.9): "Ped." under a press and "✱" under a
|
|
22
|
+
release, the slot marked `data-pedal`; a bar with one makes room below.
|
|
23
|
+
Spoken as "pedal G" and "pedal up C".
|
|
24
|
+
- **Dotted figures** (grammar 2.2): a dotted group draws no tuplet number
|
|
25
|
+
and puts a dot after its dotted member (`data-dotted` on the group);
|
|
26
|
+
spoken "C dotted, D".
|
|
27
|
+
|
|
28
|
+
## [0.13.0] - 2026-11-04
|
|
29
|
+
|
|
30
|
+
Needs `barmark` 0.15.0.
|
|
31
|
+
|
|
32
|
+
### Added
|
|
33
|
+
|
|
34
|
+
- **A chart's credits** (barmark's grammar 7.5), as a score sets them:
|
|
35
|
+
"Words and music by …" when the same people wrote both, otherwise
|
|
36
|
+
"Music by …" and "Words by …", then "Arranged by …", under the title
|
|
37
|
+
(`part="credits"`); several names read "A, B and C". The copyright
|
|
38
|
+
lines sit small at the chart's foot (`<footer part="copyright">`).
|
|
39
|
+
`ChartModel.credits` carries them and `creditsText` is exported.
|
|
40
|
+
|
|
9
41
|
## [0.12.0] - 2026-11-03
|
|
10
42
|
|
|
11
43
|
Needs `barmark` 0.14.1.
|
|
@@ -317,7 +349,9 @@ that needs no script or as the `<barmark-chart>` web component. Requires
|
|
|
317
349
|
zoom without sideways scrolling, the element renders and re-renders, and
|
|
318
350
|
a screen reader hears "bar 9: D". Run them with `bun run test:browser`.
|
|
319
351
|
|
|
320
|
-
[Unreleased]: https://github.com/kevinpeckham/barmark/compare/render-v0.
|
|
352
|
+
[Unreleased]: https://github.com/kevinpeckham/barmark/compare/render-v0.14.0...HEAD
|
|
353
|
+
[0.14.0]: https://github.com/kevinpeckham/barmark/compare/render-v0.13.0...render-v0.14.0
|
|
354
|
+
[0.13.0]: https://github.com/kevinpeckham/barmark/compare/render-v0.12.0...render-v0.13.0
|
|
321
355
|
[0.12.0]: https://github.com/kevinpeckham/barmark/compare/render-v0.11.0...render-v0.12.0
|
|
322
356
|
[0.11.0]: https://github.com/kevinpeckham/barmark/compare/render-v0.10.0...render-v0.11.0
|
|
323
357
|
[0.10.0]: https://github.com/kevinpeckham/barmark/compare/render-v0.9.1...render-v0.10.0
|
package/dist/credits.js
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/** "A", "A and B", "A, B and C". */
|
|
2
|
+
function names(list) {
|
|
3
|
+
if (list.length < 2)
|
|
4
|
+
return list.join("");
|
|
5
|
+
return `${list.slice(0, -1).join(", ")} and ${list.at(-1)}`;
|
|
6
|
+
}
|
|
7
|
+
const same = (a, b) => a.length === b.length && a.every((x, i) => x === b[i]);
|
|
8
|
+
/** The header's credit lines, as a score sets them; the copyright goes to the foot. */
|
|
9
|
+
export function creditsText(credits) {
|
|
10
|
+
const { composer, lyricist, arranger } = credits;
|
|
11
|
+
const lines = [];
|
|
12
|
+
if (composer.length > 0 && same(composer, lyricist))
|
|
13
|
+
lines.push(`Words and music by ${names(composer)}`);
|
|
14
|
+
else {
|
|
15
|
+
if (composer.length > 0)
|
|
16
|
+
lines.push(`Music by ${names(composer)}`);
|
|
17
|
+
if (lyricist.length > 0)
|
|
18
|
+
lines.push(`Words by ${names(lyricist)}`);
|
|
19
|
+
}
|
|
20
|
+
if (arranger.length > 0)
|
|
21
|
+
lines.push(`Arranged by ${names(arranger)}`);
|
|
22
|
+
return lines;
|
|
23
|
+
}
|
package/dist/html.js
CHANGED
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import { printDirection, printPasses, } from "barmark";
|
|
7
7
|
import { glyphs, NUMERALS, splitPitch, typesetChord, typesetNumeral, } from "./chord.js";
|
|
8
|
+
import { creditsText } from "./credits.js";
|
|
8
9
|
import { escapeHtml } from "./escape.js";
|
|
9
10
|
import { fontFaceCss } from "./font.js";
|
|
10
11
|
import { isTacet as isTacetCell, layoutChart } from "./model.js";
|
|
@@ -43,26 +44,43 @@ function chartHtml(text, options) {
|
|
|
43
44
|
...(options.part && { part: options.part }),
|
|
44
45
|
});
|
|
45
46
|
const barNumbers = options.barNumbers ?? true;
|
|
46
|
-
const parts = model
|
|
47
|
+
const parts = labelled(model);
|
|
47
48
|
const settings = {
|
|
48
49
|
barNumbers,
|
|
49
50
|
gutter: barNumbers || parts,
|
|
50
51
|
numerals: numeralsOf(options),
|
|
51
52
|
};
|
|
52
53
|
// Every section's left column is as wide as the longest part label, so tutti rows line up with systems.
|
|
53
|
-
const widest = Math.max(0, ...model.parts.map((
|
|
54
|
+
const widest = Math.max(0, ...model.parts.flatMap(rowLabelsOf).map((l) => l.length));
|
|
54
55
|
const gutter = parts ? ` data-parts style="--bm-label-chars:${widest}"` : "";
|
|
55
|
-
return `<div class="bm-chart" data-theme="${themeOf(options)}"${gutter}${settings.barNumbers ? "" : ' data-bar-numbers="off"'}${options.wrap === false ? ' data-wrap="off"' : ""}>${headerHtml(model)}${model.blocks.map((b) => blockHtml(b, settings)).join("")}${options.diagnostics ? diagnosticsHtml(model) : ""}</div>`;
|
|
56
|
-
}
|
|
56
|
+
return `<div class="bm-chart" data-theme="${themeOf(options)}"${gutter}${settings.barNumbers ? "" : ' data-bar-numbers="off"'}${options.wrap === false ? ' data-wrap="off"' : ""}>${headerHtml(model)}${model.blocks.map((b) => blockHtml(b, settings)).join("")}${copyrightHtml(model)}${options.diagnostics ? diagnosticsHtml(model) : ""}</div>`;
|
|
57
|
+
}
|
|
58
|
+
/** Whether systems have labelled rows: several parts, or one part writing lines (barmark's grammar 7.6). */
|
|
59
|
+
const labelled = (model) => model.parts.length > 1 || model.parts.some((p) => (p.lines?.length ?? 0) > 0);
|
|
60
|
+
/** A part's row labels: its own, and one per line it writes (barmark's grammar 7.6). */
|
|
61
|
+
const rowLabelsOf = (p) => [
|
|
62
|
+
p.label ?? "",
|
|
63
|
+
...(p.lines ?? []).map((n) => `${p.label ?? ""}.${n}`),
|
|
64
|
+
];
|
|
57
65
|
function headerHtml(model) {
|
|
58
66
|
const title = model.title
|
|
59
67
|
? `<h2 class="bm-title" part="title">${escapeHtml(model.title)}</h2>`
|
|
60
68
|
: "";
|
|
61
69
|
const names = model.parts.length > 1 ? model.parts.map((p) => p.name).join(", ") : model.part?.name;
|
|
62
70
|
const meta = [names ? escapeHtml(names) : "", metaText(model.header)].filter(Boolean).join(" · ");
|
|
63
|
-
|
|
71
|
+
const credits = creditsText(model.credits)
|
|
72
|
+
.map((c) => `<p class="bm-credits" part="credits">${escapeHtml(c)}</p>`)
|
|
73
|
+
.join("");
|
|
74
|
+
if (!title && !credits && !meta)
|
|
75
|
+
return "";
|
|
76
|
+
return `<header class="bm-header">${title}${credits}${meta ? `<p class="bm-meta" part="meta">${meta}</p>` : ""}</header>`;
|
|
77
|
+
}
|
|
78
|
+
/** The copyright lines, small, at the chart's foot. */
|
|
79
|
+
function copyrightHtml(model) {
|
|
80
|
+
const lines = model.credits.copyright;
|
|
81
|
+
if (lines.length === 0)
|
|
64
82
|
return "";
|
|
65
|
-
return `<
|
|
83
|
+
return `<footer class="bm-copyright" part="copyright">${lines.map((c) => `<p>${escapeHtml(c)}</p>`).join("")}</footer>`;
|
|
66
84
|
}
|
|
67
85
|
/** "rit. to ♩ = 90", "accel.", "a tempo". */
|
|
68
86
|
function tempoChangeText(c) {
|
|
@@ -319,21 +337,43 @@ const FERMATA = `<svg class="bm-fermata-glyph" viewBox="0 0 24 14" width="1.4em"
|
|
|
319
337
|
/** `‹` for an eighth push, `«` for a sixteenth. */
|
|
320
338
|
const PUSH_MARK = { eighth: "‹", sixteenth: "«" };
|
|
321
339
|
const ARTICULATION_MARK = { accent: ">", hit: "^" };
|
|
340
|
+
/** The piano score's marks: Ped. under a press, ✱ under a release (barmark's grammar 2.9). */
|
|
341
|
+
const PEDAL_MARK = { press: "Ped.", release: "✱" };
|
|
322
342
|
const marksOf = (slot) => ({
|
|
323
343
|
push: "push" in slot ? (slot.push ?? null) : null,
|
|
324
344
|
articulation: slot.kind === "chord" ? (slot.articulation ?? null) : null,
|
|
345
|
+
pedal: slot.kind === "chord" ? (slot.pedal ?? null) : null,
|
|
325
346
|
});
|
|
326
|
-
|
|
347
|
+
const dataOf = (marks) => Object.entries(marks)
|
|
348
|
+
.map(([k, v]) => (v ? ` data-${k}="${v}"` : ""))
|
|
349
|
+
.join("");
|
|
350
|
+
/** A slot with its push mark before it, its accent or hit above it and its pedal mark below. */
|
|
327
351
|
function slotHtml(slot, view) {
|
|
328
352
|
const body = unmarkedSlotHtml(slot, view);
|
|
329
|
-
const
|
|
330
|
-
|
|
353
|
+
const marks = marksOf(slot);
|
|
354
|
+
const { push, articulation, pedal } = marks;
|
|
355
|
+
if (!push && !articulation && !pedal)
|
|
331
356
|
return body;
|
|
332
|
-
const
|
|
357
|
+
const before = push ? `<span class="bm-push" aria-hidden="true">${PUSH_MARK[push]}</span>` : "";
|
|
333
358
|
const above = articulation
|
|
334
359
|
? `<span class="bm-artic">${ARTICULATION_MARK[articulation]}</span>`
|
|
335
360
|
: "";
|
|
336
|
-
|
|
361
|
+
const below = pedal
|
|
362
|
+
? `<span class="bm-pedal" aria-hidden="true">${PEDAL_MARK[pedal]}</span>`
|
|
363
|
+
: "";
|
|
364
|
+
return `<span class="bm-marked"${dataOf(marks)}>${before}${above}${body}${below}</span>`;
|
|
365
|
+
}
|
|
366
|
+
/** A group: a tuplet number over equal members, or a dotted figure with its dot (barmark's grammar 2.2). */
|
|
367
|
+
function groupHtml(members, view) {
|
|
368
|
+
const dotted = members.some((m) => m.dotted);
|
|
369
|
+
const inner = members
|
|
370
|
+
.map((m) => m.dotted
|
|
371
|
+
? `<span class="bm-dotted">${slotHtml(m, view)}<span class="bm-dot" aria-hidden="true">.</span></span>`
|
|
372
|
+
: slotHtml(m, view))
|
|
373
|
+
.join("");
|
|
374
|
+
if (dotted)
|
|
375
|
+
return `<span class="bm-group" data-count="${members.length}" data-dotted>${inner}</span>`;
|
|
376
|
+
return `<span class="bm-group" data-count="${members.length}"><span class="bm-tuplet">${members.length}</span>${inner}</span>`;
|
|
337
377
|
}
|
|
338
378
|
function unmarkedSlotHtml(slot, view) {
|
|
339
379
|
switch (slot.kind) {
|
|
@@ -348,7 +388,7 @@ function unmarkedSlotHtml(slot, view) {
|
|
|
348
388
|
case "unknown":
|
|
349
389
|
return `<span class="bm-unknown">?</span>`;
|
|
350
390
|
case "group":
|
|
351
|
-
return
|
|
391
|
+
return groupHtml(slot.members, view);
|
|
352
392
|
}
|
|
353
393
|
}
|
|
354
394
|
function chordHtml(record, view) {
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export type { Numerals } from "./chord.js";
|
|
2
|
+
export { creditsText } from "./credits.js";
|
|
2
3
|
export { FONT_FAMILY, fontFaceCss } from "./font.js";
|
|
3
4
|
export { type RenderOptions, renderChart, renderChartUnwrapped } from "./html.js";
|
|
4
5
|
export { layoutChart } from "./model.js";
|
package/dist/index.js
CHANGED
package/dist/model.js
CHANGED
|
@@ -10,17 +10,19 @@ const playedApart = (b, line) => {
|
|
|
10
10
|
const own = (b.parts ?? []).filter((p) => p?.line === line).map((p) => JSON.stringify(p?.slots));
|
|
11
11
|
return new Set(own).size > 1;
|
|
12
12
|
};
|
|
13
|
-
/**
|
|
13
|
+
/** What each line written plays in a bar: each part's share, or each of its lines' (barmark's grammar 7.4, 7.6). */
|
|
14
|
+
const sharesOf = (b) => b.lines ?? (b.parts ?? []).flatMap((p) => p?.lines ?? [p]);
|
|
15
|
+
/** Each part's bars on its own lines, and each line's; a tutti bar once (barmark's grammar 7.4, 7.6). */
|
|
14
16
|
function barsByLine(parse) {
|
|
15
|
-
if (parse.parts.length < 2)
|
|
17
|
+
if (parse.parts.length < 2 && !parse.parts.some((p) => p.lines))
|
|
16
18
|
return parse.bars;
|
|
17
19
|
const seen = new Set();
|
|
18
|
-
return parse.bars.flatMap((b) => (b
|
|
20
|
+
return parse.bars.flatMap((b) => sharesOf(b).flatMap((p) => {
|
|
19
21
|
const key = `${b.index}:${p?.line}`;
|
|
20
22
|
if (!p || seen.has(key))
|
|
21
23
|
return [];
|
|
22
24
|
seen.add(key);
|
|
23
|
-
const { words: _w, parts: _p, tacet: _t, ...shared } = b;
|
|
25
|
+
const { words: _w, parts: _p, tacet: _t, lines: _l, ...shared } = b;
|
|
24
26
|
const apart = playedApart(b, p.line) ? { perPart: true } : {};
|
|
25
27
|
return [
|
|
26
28
|
{ ...shared, ...apart, line: p.line, slots: p.slots, ...(p.words && { words: p.words }) },
|
|
@@ -60,6 +62,7 @@ export function layoutChart(text, options = {}) {
|
|
|
60
62
|
title: parse.title,
|
|
61
63
|
part: parse.part,
|
|
62
64
|
parts: parse.parts,
|
|
65
|
+
credits: parse.credits,
|
|
63
66
|
header,
|
|
64
67
|
blocks,
|
|
65
68
|
diagnostics: parse.diagnostics,
|
|
@@ -88,22 +91,24 @@ function errorsByLine(parse) {
|
|
|
88
91
|
}
|
|
89
92
|
return errors;
|
|
90
93
|
}
|
|
94
|
+
/** Lines that name the chart rather than play it: never part of the body. */
|
|
95
|
+
const NAMING = new Set(["title", "part", "credit"]);
|
|
91
96
|
/** The title line, and the directives before any other content, form the header. */
|
|
92
97
|
function splitHeader(lines) {
|
|
93
98
|
const header = {};
|
|
94
99
|
let i = 0;
|
|
95
100
|
for (; i < lines.length; i++) {
|
|
96
101
|
const l = lines[i];
|
|
97
|
-
if (l
|
|
102
|
+
if (!l || NAMING.has(l.kind))
|
|
98
103
|
continue;
|
|
99
|
-
if (l
|
|
104
|
+
if (l.kind !== "directive")
|
|
100
105
|
break;
|
|
101
106
|
// A new feel replaces the old one whole, its amount included.
|
|
102
107
|
if (l.set.feel)
|
|
103
108
|
delete header.swingPercent;
|
|
104
109
|
Object.assign(header, l.set);
|
|
105
110
|
}
|
|
106
|
-
return { header, body: lines.slice(i).filter((l) =>
|
|
111
|
+
return { header, body: lines.slice(i).filter((l) => !NAMING.has(l.kind)) };
|
|
107
112
|
}
|
|
108
113
|
function groupLines(lines) {
|
|
109
114
|
const groups = [];
|
|
@@ -245,20 +250,31 @@ const lastOfSystem = (item) => {
|
|
|
245
250
|
};
|
|
246
251
|
/** A bar where the part rests, in a system or a part's own view (barmark's grammar 7.4). */
|
|
247
252
|
export const isTacet = (c) => c.kind === "slots" && c.tacet === true;
|
|
248
|
-
/** A
|
|
253
|
+
/** A part's lines in a system, in score order: its bare line, then its lines (barmark's grammar 7.6). */
|
|
254
|
+
function ownLines(lines, p) {
|
|
255
|
+
const order = (l) => l.lineName === undefined ? -1 : (p.lines ?? []).indexOf(l.lineName);
|
|
256
|
+
return lines.filter((l) => l.part === p.label).sort((a, b) => order(a) - order(b));
|
|
257
|
+
}
|
|
258
|
+
/** A row's spoken name: the part's, and its line's (barmark's grammar 7.6): "Piano RH". */
|
|
259
|
+
const spokenOf = (p, l) => l.lineName === undefined ? p.name : `${p.name} ${l.lineName}`;
|
|
260
|
+
/** A system row's label: the part's, and its line's name (`Pno.RH`). */
|
|
261
|
+
const labelOf = (l) => `${l.part ?? ""}${l.lineName === undefined ? "" : `.${l.lineName}`}`;
|
|
262
|
+
/** A row per declared part, or per line it writes, in score order: its own line, its error, or tacet bars. */
|
|
249
263
|
function layoutSystem(lines, occurrence, previous, ctx) {
|
|
250
264
|
const ref = lines.find((l) => l.kind === "bars" && !ctx.errors.has(l.line));
|
|
251
265
|
const reference = ref
|
|
252
266
|
? layoutRow(ref, playedOn(ref.line, occurrence, ctx.bars), previous, ctx)
|
|
253
267
|
: null;
|
|
254
|
-
const
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
268
|
+
const ownRow = (own) => ctx.errors.has(own.line) || own.kind !== "bars"
|
|
269
|
+
? errorItem(own.line, ctx)
|
|
270
|
+
: layoutRow(own, playedOn(own.line, occurrence, ctx.bars), previous, ctx);
|
|
271
|
+
const rows = ctx.parse.parts.flatMap((p) => {
|
|
272
|
+
const own = ownLines(lines, p);
|
|
273
|
+
if (!own.length)
|
|
274
|
+
return [
|
|
275
|
+
{ label: p.label ?? "", name: p.name, row: tacetRow(reference, lines[0]?.line ?? 0) },
|
|
276
|
+
];
|
|
277
|
+
return own.map((l) => ({ label: labelOf(l), name: spokenOf(p, l), row: ownRow(l) }));
|
|
262
278
|
});
|
|
263
279
|
return {
|
|
264
280
|
kind: "system",
|
package/dist/speech.js
CHANGED
|
@@ -114,9 +114,19 @@ function speakChordSlot(slot, key) {
|
|
|
114
114
|
return `accented ${voiced}`;
|
|
115
115
|
return slot.articulation === "hit" ? `${voiced} short hit` : voiced;
|
|
116
116
|
}
|
|
117
|
+
const PEDALLED = { press: "pedal", release: "pedal up" };
|
|
117
118
|
export function speakSlot(slot, key) {
|
|
118
|
-
const
|
|
119
|
-
|
|
119
|
+
const unpushed = speakUnpushed(slot, key);
|
|
120
|
+
const said = "push" in slot && slot.push ? `${unpushed} ${PUSHED[slot.push]}` : unpushed;
|
|
121
|
+
const dotted = "dotted" in slot && slot.dotted ? `${said} dotted` : said;
|
|
122
|
+
return slot.kind === "chord" && slot.pedal ? `${PEDALLED[slot.pedal]} ${dotted}` : dotted;
|
|
123
|
+
}
|
|
124
|
+
/** "triplet: C, D, E"; a dotted figure is its members: "C dotted, D". */
|
|
125
|
+
function speakGroup(members, key) {
|
|
126
|
+
const said = members.map((m) => speakSlot(m, key)).join(", ");
|
|
127
|
+
if (members.some((m) => m.dotted))
|
|
128
|
+
return said;
|
|
129
|
+
return `${GROUPS[members.length] ?? `group of ${members.length}`}: ${said}`;
|
|
120
130
|
}
|
|
121
131
|
function speakUnpushed(slot, key) {
|
|
122
132
|
switch (slot.kind) {
|
|
@@ -131,7 +141,7 @@ function speakUnpushed(slot, key) {
|
|
|
131
141
|
case "unknown":
|
|
132
142
|
return "unknown chord";
|
|
133
143
|
case "group":
|
|
134
|
-
return
|
|
144
|
+
return speakGroup(slot.members, key);
|
|
135
145
|
}
|
|
136
146
|
}
|
|
137
147
|
/** "segno", "to coda", "dal segno al coda", "da capo al fine". */
|
package/dist/styles.js
CHANGED
|
@@ -75,6 +75,9 @@ const css = `
|
|
|
75
75
|
.bm-sr{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}
|
|
76
76
|
.bm-header{margin-bottom:.8em}
|
|
77
77
|
.bm-title{font-size:${em(SIZES.title)};font-weight:normal;margin:0 0 .15em}
|
|
78
|
+
.bm-credits{font-family:${LABEL};font-size:${em(SIZES.meta)};margin:0 0 .15em}
|
|
79
|
+
.bm-copyright{font-family:${LABEL};font-size:${em(SIZES.meta)};color:var(--bm-muted);margin-top:1.5em}
|
|
80
|
+
.bm-copyright p{margin:0}
|
|
78
81
|
.bm-meta{font-family:${LABEL};font-size:${em(SIZES.meta)};color:var(--bm-muted);margin:0}
|
|
79
82
|
.bm-directive{grid-column:1/-1;display:flex;align-items:baseline;gap:.4em;margin:.9em 0 .3em ${at(SIZES.directive, GUTTER)};font-family:${LABEL};font-size:${em(SIZES.directive)};color:var(--barmark-directive,var(--bm-muted))}
|
|
80
83
|
.bm-directive::after{content:"";flex:1;align-self:center;margin-left:.4em;border-top:.06em solid var(--bm-rule);opacity:.6}
|
|
@@ -133,6 +136,10 @@ const css = `
|
|
|
133
136
|
.bm-push{font:700 .8em/1 system-ui,sans-serif;color:var(--bm-muted);margin-right:.08em}
|
|
134
137
|
.bm-artic{position:absolute;left:50%;top:-.95em;transform:translateX(-50%);font:700 .7em/1 system-ui,sans-serif;color:var(--bm-ink)}
|
|
135
138
|
.bm-marked[data-push]>.bm-artic{left:calc(50% + .25em)}
|
|
139
|
+
.bm-pedal{position:absolute;left:0;bottom:-1.05em;font:italic 600 .62em/1 Georgia,serif;color:var(--bm-muted);white-space:nowrap}
|
|
140
|
+
.bm-dotted{display:inline-flex;align-items:baseline}
|
|
141
|
+
.bm-dot{font-weight:700;margin-left:.05em}
|
|
142
|
+
.bm-bar:has(.bm-pedal){padding-bottom:1.05em}
|
|
136
143
|
.bm-words{position:absolute;left:0;top:-1.05em;font:italic .62em/1 Georgia,serif;color:var(--bm-muted);white-space:nowrap}
|
|
137
144
|
.bm-bar>.bm-words-end{left:auto;right:.5em;top:.15em}
|
|
138
145
|
.bm-bar[data-ending]::after{content:attr(data-ending);position:absolute;left:.45em;top:.2em;font:italic .75em/1 Georgia,serif;color:var(--bm-muted)}
|
package/dist/types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ChartDiagnostic, Direction, Directives, Key, Meter,
|
|
1
|
+
import type { ChartDiagnostic, Credits, DeclaredPart, Direction, Directives, Key, Meter, Repeat, Slot, Words } from "barmark";
|
|
2
2
|
/** `part`: draw only the part with this label (barmark's grammar 7.4), as a single-part chart. */
|
|
3
3
|
export type LayoutOptions = {
|
|
4
4
|
rehearsalLetters?: boolean;
|
|
@@ -8,9 +8,11 @@ export type LayoutOptions = {
|
|
|
8
8
|
export type ChartModel = {
|
|
9
9
|
title: string | null;
|
|
10
10
|
/** What `part:` names in a single-part chart; null when the chart names none or several. */
|
|
11
|
-
part:
|
|
12
|
-
/** Every declared part, in score order (barmark's grammar 7.4). */
|
|
13
|
-
parts:
|
|
11
|
+
part: DeclaredPart | null;
|
|
12
|
+
/** Every declared part, in score order (barmark's grammar 7.4), with its lines (7.6). */
|
|
13
|
+
parts: DeclaredPart[];
|
|
14
|
+
/** The chart's credit lines (barmark's grammar 7.5). */
|
|
15
|
+
credits: Credits;
|
|
14
16
|
/** Directives before the first heading, bar line or text line. */
|
|
15
17
|
header: Directives;
|
|
16
18
|
blocks: SectionBlock[];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@barmark/render",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.14.0",
|
|
4
4
|
"description": "Render barmark chord charts as a clean, accessible bar grid: HTML with Declarative Shadow DOM, or the <barmark-chart> web component.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"url": "https://github.com/kevinpeckham/barmark/issues"
|
|
48
48
|
},
|
|
49
49
|
"dependencies": {
|
|
50
|
-
"barmark": "^0.
|
|
50
|
+
"barmark": "^0.16.0"
|
|
51
51
|
},
|
|
52
52
|
"scripts": {
|
|
53
53
|
"build": "rm -rf dist && tsc -p tsconfig.build.json",
|