@barmark/render 0.11.0 → 0.13.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 +39 -1
- package/README.md +4 -2
- package/dist/credits.d.ts +3 -0
- package/dist/credits.js +23 -0
- package/dist/element.js +13 -2
- package/dist/html.js +33 -16
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/model.d.ts +3 -1
- package/dist/model.js +10 -5
- package/dist/speech.js +0 -2
- package/dist/styles.js +3 -0
- package/dist/types.d.ts +3 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,42 @@ package uses [semantic versioning](https://semver.org/).
|
|
|
6
6
|
|
|
7
7
|
## [Unreleased]
|
|
8
8
|
|
|
9
|
+
## [0.13.0] - 2026-11-04
|
|
10
|
+
|
|
11
|
+
Needs `barmark` 0.15.0.
|
|
12
|
+
|
|
13
|
+
### Added
|
|
14
|
+
|
|
15
|
+
- **A chart's credits** (barmark's grammar 7.5), as a score sets them:
|
|
16
|
+
"Words and music by …" when the same people wrote both, otherwise
|
|
17
|
+
"Music by …" and "Words by …", then "Arranged by …", under the title
|
|
18
|
+
(`part="credits"`); several names read "A, B and C". The copyright
|
|
19
|
+
lines sit small at the chart's foot (`<footer part="copyright">`).
|
|
20
|
+
`ChartModel.credits` carries them and `creditsText` is exported.
|
|
21
|
+
|
|
22
|
+
## [0.12.0] - 2026-11-03
|
|
23
|
+
|
|
24
|
+
Needs `barmark` 0.14.1.
|
|
25
|
+
|
|
26
|
+
### Changed
|
|
27
|
+
|
|
28
|
+
- **Breaking:** the element's one-part attribute is now `show-part`
|
|
29
|
+
(property `showPart`), not `part`. HTML keeps `part` on every element
|
|
30
|
+
for `::part()` styling, so a page styling `<barmark-chart part="…">`
|
|
31
|
+
got a one-part view by accident, and `el.part` could not return the
|
|
32
|
+
label. `renderChart`'s option stays `part`.
|
|
33
|
+
|
|
34
|
+
### Fixed
|
|
35
|
+
|
|
36
|
+
- A system shows and speaks what its rows share once, on its first drawn
|
|
37
|
+
row: the bar number, "repeat start", the ending's number and ×N. Every
|
|
38
|
+
row still draws its repeat bar lines. A system whose first part's line
|
|
39
|
+
has an error numbers the next row.
|
|
40
|
+
- Tacet rows carry `bm-tacet` in a part's own view too, and a tacet bar
|
|
41
|
+
cut in a `->` replay is marked and spoken as cut.
|
|
42
|
+
- The "no part labelled X" warning is about the whole chart: its line is
|
|
43
|
+
0, and the diagnostics list shows it without a line number.
|
|
44
|
+
|
|
9
45
|
## [0.11.0] - 2026-11-03
|
|
10
46
|
|
|
11
47
|
Needs `barmark` 0.14.0.
|
|
@@ -294,7 +330,9 @@ that needs no script or as the `<barmark-chart>` web component. Requires
|
|
|
294
330
|
zoom without sideways scrolling, the element renders and re-renders, and
|
|
295
331
|
a screen reader hears "bar 9: D". Run them with `bun run test:browser`.
|
|
296
332
|
|
|
297
|
-
[Unreleased]: https://github.com/kevinpeckham/barmark/compare/render-v0.
|
|
333
|
+
[Unreleased]: https://github.com/kevinpeckham/barmark/compare/render-v0.13.0...HEAD
|
|
334
|
+
[0.13.0]: https://github.com/kevinpeckham/barmark/compare/render-v0.12.0...render-v0.13.0
|
|
335
|
+
[0.12.0]: https://github.com/kevinpeckham/barmark/compare/render-v0.11.0...render-v0.12.0
|
|
298
336
|
[0.11.0]: https://github.com/kevinpeckham/barmark/compare/render-v0.10.0...render-v0.11.0
|
|
299
337
|
[0.10.0]: https://github.com/kevinpeckham/barmark/compare/render-v0.9.1...render-v0.10.0
|
|
300
338
|
[0.9.1]: https://github.com/kevinpeckham/barmark/compare/render-v0.9.0...render-v0.9.1
|
package/README.md
CHANGED
|
@@ -48,7 +48,9 @@ The element renders from its `text` property, its `src` URL, or a child
|
|
|
48
48
|
whenever one changes; it fetches a `src` once, and renders once however
|
|
49
49
|
many properties and attributes change together. A chart rendered on the
|
|
50
50
|
server by `renderChart` keeps its music until it has a source of its own,
|
|
51
|
-
and still follows `theme` and `
|
|
51
|
+
and still follows `theme`, `bar-numbers` and `wrap`; a change to
|
|
52
|
+
`numerals`, `rehearsal-letters` or `show-part` needs the chart's text, so
|
|
53
|
+
it waits for a source.
|
|
52
54
|
|
|
53
55
|
For a live editor, set `text`:
|
|
54
56
|
|
|
@@ -77,7 +79,7 @@ the element loads, with `<style data-barmark-font>` holding
|
|
|
77
79
|
| `rehearsalLetters` | `rehearsal-letters` (`rehearsalLetters`) | `false` | boxed A, B, C… on each section as played |
|
|
78
80
|
| `numerals` | `numerals` (`numerals`) | none | `"nashville"` (6m⁷) or `"roman"` (vi⁷): each chord as its degree in its bar's key |
|
|
79
81
|
| `wrap` | `wrap="off"` (`wrap`) | `true` | wrap a section's rows when it is wider than the chart's box; off, rows keep their columns and the chart overflows, for its page to scroll |
|
|
80
|
-
| `part` | `part` (`
|
|
82
|
+
| `part` | `show-part` (`showPart`) | none | draw only the part with this label, as one player reads it: tutti bars, its own bars, and "tacet" where it rests. The attribute isn't `part`, which HTML keeps for `::part()` styling |
|
|
81
83
|
| `diagnostics` | | `false` | list the chart's errors and warnings below it |
|
|
82
84
|
| `fontUrl` | | none | emit Edwin's `@font-face` rule before the chart |
|
|
83
85
|
| (the `text` argument) | (`text`) | `null` | the chart to draw; wins over `src` and the script child |
|
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/element.js
CHANGED
|
@@ -10,7 +10,8 @@ import { loadErrorContent, shadowContent, THEMES } from "./html.js";
|
|
|
10
10
|
export function optionsFromAttributes(el) {
|
|
11
11
|
const theme = el.getAttribute("theme");
|
|
12
12
|
const numerals = NUMERALS.find((n) => n === el.getAttribute("numerals"));
|
|
13
|
-
|
|
13
|
+
// Not `part`: that global attribute names an element for ::part() styling.
|
|
14
|
+
const part = el.getAttribute("show-part");
|
|
14
15
|
return {
|
|
15
16
|
theme: THEMES.find((t) => t === theme) ?? "auto",
|
|
16
17
|
barNumbers: el.getAttribute("bar-numbers") !== "off",
|
|
@@ -58,7 +59,7 @@ function defineElement() {
|
|
|
58
59
|
"rehearsal-letters",
|
|
59
60
|
"numerals",
|
|
60
61
|
"wrap",
|
|
61
|
-
"part",
|
|
62
|
+
"show-part",
|
|
62
63
|
];
|
|
63
64
|
#observer = new MutationObserver(() => this.#schedule());
|
|
64
65
|
#renders = 0;
|
|
@@ -139,6 +140,16 @@ function defineElement() {
|
|
|
139
140
|
else
|
|
140
141
|
this.setAttribute("numerals", v);
|
|
141
142
|
}
|
|
143
|
+
/** The label of the part to draw on its own, or null for the whole chart. */
|
|
144
|
+
get showPart() {
|
|
145
|
+
return this.getAttribute("show-part");
|
|
146
|
+
}
|
|
147
|
+
set showPart(v) {
|
|
148
|
+
if (v === null)
|
|
149
|
+
this.removeAttribute("show-part");
|
|
150
|
+
else
|
|
151
|
+
this.setAttribute("show-part", v);
|
|
152
|
+
}
|
|
142
153
|
/** Every change in one task (an upgrade sets each attribute in turn) renders once. */
|
|
143
154
|
#schedule() {
|
|
144
155
|
if (this.#scheduled)
|
package/dist/html.js
CHANGED
|
@@ -5,9 +5,10 @@
|
|
|
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
|
-
import { layoutChart } from "./model.js";
|
|
11
|
+
import { isTacet as isTacetCell, layoutChart } from "./model.js";
|
|
11
12
|
import { speakBar } from "./speech.js";
|
|
12
13
|
import { FIT_STEPS, MIN_BAR, stylesheet } from "./styles.js";
|
|
13
14
|
export function renderChart(text, options = {}) {
|
|
@@ -22,7 +23,7 @@ function elementAttributes(options) {
|
|
|
22
23
|
options.rehearsalLetters ? " rehearsal-letters" : "",
|
|
23
24
|
numeralsOf(options) ? ` numerals="${numeralsOf(options)}"` : "",
|
|
24
25
|
options.wrap === false ? ' wrap="off"' : "",
|
|
25
|
-
options.part ? ` part="${escapeHtml(options.part)}"` : "",
|
|
26
|
+
options.part ? ` show-part="${escapeHtml(options.part)}"` : "",
|
|
26
27
|
].join("");
|
|
27
28
|
}
|
|
28
29
|
export const THEMES = ["auto", "light", "dark"];
|
|
@@ -52,7 +53,7 @@ function chartHtml(text, options) {
|
|
|
52
53
|
// Every section's left column is as wide as the longest part label, so tutti rows line up with systems.
|
|
53
54
|
const widest = Math.max(0, ...model.parts.map((p) => p.label?.length ?? 0));
|
|
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
|
+
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>`;
|
|
56
57
|
}
|
|
57
58
|
function headerHtml(model) {
|
|
58
59
|
const title = model.title
|
|
@@ -60,9 +61,19 @@ function headerHtml(model) {
|
|
|
60
61
|
: "";
|
|
61
62
|
const names = model.parts.length > 1 ? model.parts.map((p) => p.name).join(", ") : model.part?.name;
|
|
62
63
|
const meta = [names ? escapeHtml(names) : "", metaText(model.header)].filter(Boolean).join(" · ");
|
|
63
|
-
|
|
64
|
+
const credits = creditsText(model.credits)
|
|
65
|
+
.map((c) => `<p class="bm-credits" part="credits">${escapeHtml(c)}</p>`)
|
|
66
|
+
.join("");
|
|
67
|
+
if (!title && !credits && !meta)
|
|
64
68
|
return "";
|
|
65
|
-
return `<header class="bm-header">${title}${meta ? `<p class="bm-meta" part="meta">${meta}</p>` : ""}</header>`;
|
|
69
|
+
return `<header class="bm-header">${title}${credits}${meta ? `<p class="bm-meta" part="meta">${meta}</p>` : ""}</header>`;
|
|
70
|
+
}
|
|
71
|
+
/** The copyright lines, small, at the chart's foot. */
|
|
72
|
+
function copyrightHtml(model) {
|
|
73
|
+
const lines = model.credits.copyright;
|
|
74
|
+
if (lines.length === 0)
|
|
75
|
+
return "";
|
|
76
|
+
return `<footer class="bm-copyright" part="copyright">${lines.map((c) => `<p>${escapeHtml(c)}</p>`).join("")}</footer>`;
|
|
66
77
|
}
|
|
67
78
|
/** "rit. to ♩ = 90", "accel.", "a tempo". */
|
|
68
79
|
function tempoChangeText(c) {
|
|
@@ -171,9 +182,11 @@ function errorHtml(source, messages) {
|
|
|
171
182
|
/** A system: its parts' rows stacked, sharing the section's columns (barmark's grammar 7.4). */
|
|
172
183
|
function systemHtml(item, columns, settings) {
|
|
173
184
|
const names = escapeHtml(item.rows.map((p) => p.name).join(", "));
|
|
185
|
+
// The first drawn row carries what the system shares: its number, ×N, the ending's number.
|
|
186
|
+
const lead = item.rows.findIndex((p) => p.row.kind === "row");
|
|
174
187
|
const rows = item.rows.map((p, i) => p.row.kind === "error"
|
|
175
188
|
? errorHtml(p.row.source, p.row.messages)
|
|
176
|
-
: rowHtml(p.row, columns, settings, { label: p.label, name: p.name, first: i ===
|
|
189
|
+
: rowHtml(p.row, columns, settings, { label: p.label, name: p.name, first: i === lead }));
|
|
177
190
|
return `<div class="bm-system" role="group" aria-label="${names}">${rows.join("")}</div>`;
|
|
178
191
|
}
|
|
179
192
|
/** The left column: the bar number, and in a system the part's label. */
|
|
@@ -186,16 +199,14 @@ function gutterHtml(row, settings, part) {
|
|
|
186
199
|
: "";
|
|
187
200
|
return `<span class="bm-bar-number" part="bar-number" aria-hidden="true">${label}${number}</span>`;
|
|
188
201
|
}
|
|
189
|
-
const isTacetCell = (c) => c.kind === "slots" && c.tacet === true;
|
|
190
202
|
/** A row's cells; a tacet row says "tacet" in its first bar. */
|
|
191
203
|
function rowCells(row, numerals, ending) {
|
|
192
204
|
let n = row.barNumber;
|
|
193
205
|
const firstTacet = row.cells.findIndex(isTacetCell);
|
|
194
206
|
return row.cells.map((cell, i) => {
|
|
195
207
|
const marks = repeatMarks(row, i) + (i === 0 ? ending : "");
|
|
196
|
-
const spoken = `<span class="bm-sr">bar ${n ?? ""}: tacet</span>`;
|
|
197
208
|
const html = isTacetCell(cell)
|
|
198
|
-
? tacetHtml(
|
|
209
|
+
? tacetHtml(cell, n, marks, i === firstTacet)
|
|
199
210
|
: cellHtml(cell, n, marks, numerals);
|
|
200
211
|
if (n !== null && cell.kind === "slots")
|
|
201
212
|
n++;
|
|
@@ -208,7 +219,7 @@ function rowClasses(row, part) {
|
|
|
208
219
|
const classes = ["bm-row"];
|
|
209
220
|
if (part)
|
|
210
221
|
classes.push("bm-part-row");
|
|
211
|
-
if (
|
|
222
|
+
if (row.cells.some(isTacetCell))
|
|
212
223
|
classes.push("bm-tacet");
|
|
213
224
|
if (row.ending)
|
|
214
225
|
classes.push("bm-ending");
|
|
@@ -216,15 +227,17 @@ function rowClasses(row, part) {
|
|
|
216
227
|
}
|
|
217
228
|
/** What a screen reader hears before a row's bars: its part, a repeat start, its ending. */
|
|
218
229
|
function rowOpening(row, part, ending) {
|
|
219
|
-
const opens = row.opens || typeof row.repeat === "number" || row.repeat === "open";
|
|
230
|
+
const opens = leads(part) && (row.opens || typeof row.repeat === "number" || row.repeat === "open");
|
|
220
231
|
return sr(part ? escapeHtml(part.name) : "") + sr(opens ? "repeat start" : "") + sr(ending);
|
|
221
232
|
}
|
|
233
|
+
/** Whether a row says what its system shares: a row on its own, or a system's first drawn row. */
|
|
234
|
+
const leads = (part) => !part || part.first;
|
|
222
235
|
function rowHtml(row, columns, settings, part) {
|
|
223
|
-
const label = row.ending ? endingLabel(row.ending) : null;
|
|
236
|
+
const label = row.ending && leads(part) ? endingLabel(row.ending) : null;
|
|
224
237
|
const cells = rowCells(row, settings.numerals, label ? ` data-ending="${label.shown}"` : "");
|
|
225
238
|
const empty = `<span class="bm-empty" aria-hidden="true"></span>`.repeat(Math.max(0, columns - row.cells.length));
|
|
226
239
|
const said = rowOpening(row, part, label?.spoken ?? "");
|
|
227
|
-
return `<div class="${rowClasses(row, part)}">${said}${gutterHtml(row, settings, part)}${cells.join("")}${empty}<span class="bm-repeat">${rowRepeatHtml(row)}</span></div>`;
|
|
240
|
+
return `<div class="${rowClasses(row, part)}">${said}${gutterHtml(row, settings, part)}${cells.join("")}${empty}<span class="bm-repeat">${leads(part) ? rowRepeatHtml(row) : ""}</span></div>`;
|
|
228
241
|
}
|
|
229
242
|
/** An ending's passes as printed, "1.", "1.–3.", "1., 3.", and spoken, "ending for passes 1 to 3". */
|
|
230
243
|
function endingLabel(passes) {
|
|
@@ -268,8 +281,10 @@ function barBody(cell, view) {
|
|
|
268
281
|
return [`${meter}${slots}${cut}`, end];
|
|
269
282
|
}
|
|
270
283
|
/** A bar where the part rests; the first of a row says so, in its body. */
|
|
271
|
-
function tacetHtml(
|
|
272
|
-
|
|
284
|
+
function tacetHtml(cell, n, marks, first) {
|
|
285
|
+
const cut = cell.kind === "slots" && cell.cut;
|
|
286
|
+
const spoken = `<span class="bm-sr">bar ${n ?? ""}: tacet${cut ? ", cut on this pass" : ""}</span>`;
|
|
287
|
+
return `<div class="bm-bar bm-tacet-bar" part="bar"${marks}${cut ? " data-cut" : ""}>${spoken}<span class="bm-bar-body" aria-hidden="true">${first ? "tacet" : ""}</span></div>`;
|
|
273
288
|
}
|
|
274
289
|
/** A bar's slots, each under any words before it, and the words after the last slot. */
|
|
275
290
|
function slotsWithWords(cell, view) {
|
|
@@ -380,5 +395,7 @@ function notesHtml(record) {
|
|
|
380
395
|
function diagnosticsHtml(model) {
|
|
381
396
|
if (!model.diagnostics.length)
|
|
382
397
|
return "";
|
|
383
|
-
|
|
398
|
+
// Line 0: about the whole chart, not a line of it.
|
|
399
|
+
const at = (line) => (line > 0 ? `line ${line}: ` : "");
|
|
400
|
+
return `<ul class="bm-diagnostics">${model.diagnostics.map((d) => `<li class="bm-${d.severity}">${at(d.line)}${escapeHtml(d.message)}</li>`).join("")}</ul>`;
|
|
384
401
|
}
|
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.d.ts
CHANGED
|
@@ -1,2 +1,4 @@
|
|
|
1
|
-
import type { ChartModel, LayoutOptions } from "./types.js";
|
|
1
|
+
import type { CellModel, ChartModel, LayoutOptions } from "./types.js";
|
|
2
2
|
export declare function layoutChart(text: string, options?: LayoutOptions): ChartModel;
|
|
3
|
+
/** A bar where the part rests, in a system or a part's own view (barmark's grammar 7.4). */
|
|
4
|
+
export declare const isTacet: (c: CellModel) => boolean;
|
package/dist/model.js
CHANGED
|
@@ -34,7 +34,8 @@ function parseFor(text, part) {
|
|
|
34
34
|
return one ?? parseChart(text);
|
|
35
35
|
const whole = parseChart(text);
|
|
36
36
|
const missing = {
|
|
37
|
-
|
|
37
|
+
// Line 0: the warning is about the chart, not one of its lines.
|
|
38
|
+
line: 0,
|
|
38
39
|
severity: "warning",
|
|
39
40
|
message: `no part labelled ${part}`,
|
|
40
41
|
token: part,
|
|
@@ -59,6 +60,7 @@ export function layoutChart(text, options = {}) {
|
|
|
59
60
|
title: parse.title,
|
|
60
61
|
part: parse.part,
|
|
61
62
|
parts: parse.parts,
|
|
63
|
+
credits: parse.credits,
|
|
62
64
|
header,
|
|
63
65
|
blocks,
|
|
64
66
|
diagnostics: parse.diagnostics,
|
|
@@ -87,22 +89,24 @@ function errorsByLine(parse) {
|
|
|
87
89
|
}
|
|
88
90
|
return errors;
|
|
89
91
|
}
|
|
92
|
+
/** Lines that name the chart rather than play it: never part of the body. */
|
|
93
|
+
const NAMING = new Set(["title", "part", "credit"]);
|
|
90
94
|
/** The title line, and the directives before any other content, form the header. */
|
|
91
95
|
function splitHeader(lines) {
|
|
92
96
|
const header = {};
|
|
93
97
|
let i = 0;
|
|
94
98
|
for (; i < lines.length; i++) {
|
|
95
99
|
const l = lines[i];
|
|
96
|
-
if (l
|
|
100
|
+
if (!l || NAMING.has(l.kind))
|
|
97
101
|
continue;
|
|
98
|
-
if (l
|
|
102
|
+
if (l.kind !== "directive")
|
|
99
103
|
break;
|
|
100
104
|
// A new feel replaces the old one whole, its amount included.
|
|
101
105
|
if (l.set.feel)
|
|
102
106
|
delete header.swingPercent;
|
|
103
107
|
Object.assign(header, l.set);
|
|
104
108
|
}
|
|
105
|
-
return { header, body: lines.slice(i).filter((l) =>
|
|
109
|
+
return { header, body: lines.slice(i).filter((l) => !NAMING.has(l.kind)) };
|
|
106
110
|
}
|
|
107
111
|
function groupLines(lines) {
|
|
108
112
|
const groups = [];
|
|
@@ -242,7 +246,8 @@ const lastOfSystem = (item) => {
|
|
|
242
246
|
const first = item.rows.find((p) => p.row.kind === "row" && !p.row.cells.some(isTacet))?.row;
|
|
243
247
|
return first?.kind === "row" ? lastSlots(first.cells) : null;
|
|
244
248
|
};
|
|
245
|
-
|
|
249
|
+
/** A bar where the part rests, in a system or a part's own view (barmark's grammar 7.4). */
|
|
250
|
+
export const isTacet = (c) => c.kind === "slots" && c.tacet === true;
|
|
246
251
|
/** A row per declared part, in score order: its own line, its error, or tacet bars. */
|
|
247
252
|
function layoutSystem(lines, occurrence, previous, ctx) {
|
|
248
253
|
const ref = lines.find((l) => l.kind === "bars" && !ctx.errors.has(l.line));
|
package/dist/speech.js
CHANGED
|
@@ -149,8 +149,6 @@ export function speakBar(barNumber, cell, numerals = false) {
|
|
|
149
149
|
if (cell.kind === "rehearsal")
|
|
150
150
|
return `rehearsal ${cell.label}`;
|
|
151
151
|
const bar = `bar${barNumber === null ? "" : ` ${barNumber}`}`;
|
|
152
|
-
if (cell.tacet)
|
|
153
|
-
return `${bar}: tacet`;
|
|
154
152
|
if (cell.simile)
|
|
155
153
|
return `${bar}: each part repeats its bar before`;
|
|
156
154
|
const meter = cell.meter ? `, in ${cell.meter.n}/${cell.meter.d}` : "";
|
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}
|
package/dist/types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ChartDiagnostic, Direction, Directives, Key, Meter, Part, Repeat, Slot, Words } from "barmark";
|
|
1
|
+
import type { ChartDiagnostic, Credits, Direction, Directives, Key, Meter, Part, 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;
|
|
@@ -11,6 +11,8 @@ export type ChartModel = {
|
|
|
11
11
|
part: Part | null;
|
|
12
12
|
/** Every declared part, in score order (barmark's grammar 7.4). */
|
|
13
13
|
parts: Part[];
|
|
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.13.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.15.0"
|
|
51
51
|
},
|
|
52
52
|
"scripts": {
|
|
53
53
|
"build": "rm -rf dist && tsc -p tsconfig.build.json",
|