@barmark/render 0.23.0 → 0.23.2
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 +31 -1
- package/README.md +26 -10
- package/dist/styles.d.ts +2 -0
- package/dist/styles.js +36 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,34 @@ package uses [semantic versioning](https://semver.org/).
|
|
|
6
6
|
|
|
7
7
|
## [Unreleased]
|
|
8
8
|
|
|
9
|
+
## [0.23.2] - 2026-12-02
|
|
10
|
+
|
|
11
|
+
### Changed
|
|
12
|
+
|
|
13
|
+
- The package's npm homepage is its page on barmark.dev,
|
|
14
|
+
<https://www.barmark.dev/packages/render>, which shows this README at the
|
|
15
|
+
version the site installs.
|
|
16
|
+
- README: says Barmark for the project and links it to
|
|
17
|
+
<https://www.barmark.dev>; opens with Install and a first example.
|
|
18
|
+
|
|
19
|
+
## [0.23.1] - 2026-12-01
|
|
20
|
+
|
|
21
|
+
### Fixed
|
|
22
|
+
|
|
23
|
+
- **A system too wide for its box no longer squeezes its chords into each
|
|
24
|
+
other.** A section of several parts' systems (Morning Song's verse, or
|
|
25
|
+
any system whose bars hold long chords) never wrapped, and on a narrow
|
|
26
|
+
screen its bar columns shrank until chords ran over the next bar, and on
|
|
27
|
+
a phone pushed the page sideways too. Now its bars keep their width, its
|
|
28
|
+
parts keep their bar lines together, and the chart scrolls sideways
|
|
29
|
+
inside its own box, and the page itself does not scroll. Text, notes,
|
|
30
|
+
directives and unreadable rows beside or inside a system still wrap at
|
|
31
|
+
the chart's box, and a section whose plain rows are too wide
|
|
32
|
+
wraps as before. A system still does not wrap; the README now says
|
|
33
|
+
so. Charts without systems, and printed charts, are drawn as before,
|
|
34
|
+
and no chart's markup changes: the fix is a few rules at the end of
|
|
35
|
+
`stylesheet`.
|
|
36
|
+
|
|
9
37
|
## [0.23.0] - 2026-11-30
|
|
10
38
|
|
|
11
39
|
### Changed
|
|
@@ -704,7 +732,9 @@ that needs no script or as the `<barmark-chart>` web component. Requires
|
|
|
704
732
|
zoom without sideways scrolling, the element renders and re-renders, and
|
|
705
733
|
a screen reader hears "bar 9: D". Run them with `bun run test:browser`.
|
|
706
734
|
|
|
707
|
-
[Unreleased]: https://github.com/kevinpeckham/barmark/compare/render-v0.23.
|
|
735
|
+
[Unreleased]: https://github.com/kevinpeckham/barmark/compare/render-v0.23.2...HEAD
|
|
736
|
+
[0.23.2]: https://github.com/kevinpeckham/barmark/compare/render-v0.23.1...render-v0.23.2
|
|
737
|
+
[0.23.1]: https://github.com/kevinpeckham/barmark/compare/render-v0.23.0...render-v0.23.1
|
|
708
738
|
[0.23.0]: https://github.com/kevinpeckham/barmark/compare/render-v0.22.3...render-v0.23.0
|
|
709
739
|
[0.22.3]: https://github.com/kevinpeckham/barmark/compare/render-v0.22.2...render-v0.22.3
|
|
710
740
|
[0.22.2]: https://github.com/kevinpeckham/barmark/compare/render-v0.22.1...render-v0.22.2
|
package/README.md
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
# @barmark/render
|
|
2
2
|
|
|
3
|
-
Renders [
|
|
3
|
+
Renders [Barmark](https://www.barmark.dev) chord charts as
|
|
4
4
|
a clean, evenly spaced bar grid that looks the same on any page, follows
|
|
5
5
|
light and dark mode, scales with the reader's text size, and reads to a
|
|
6
6
|
screen reader as music.
|
|
7
7
|
|
|
8
|
+
## Install
|
|
9
|
+
|
|
8
10
|
```
|
|
9
11
|
npm install @barmark/render
|
|
10
12
|
```
|
|
@@ -84,7 +86,7 @@ the element loads, with `<style data-barmark-font>` holding
|
|
|
84
86
|
| `barNumbers` | `bar-numbers="off"` or `"played"` (`barNumbers`) | `true` | bar numbers at the start of each row: `true` the bars counted down the page, a replayed section counted as written again; `false` or `"off"` none; `"played"` numbers in play order (below). Any other attribute value is the default |
|
|
85
87
|
| `rehearsalLetters` | `rehearsal-letters` (`rehearsalLetters`) | `false` | boxed A, B, C… on each section as played; none when the chart writes a rehearsal mark of its own (below) |
|
|
86
88
|
| `numerals` | `numerals` (`numerals`) | none | `"nashville"` (6m⁷) or `"roman"` (vi⁷): each chord as its degree in its bar's key |
|
|
87
|
-
| `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 |
|
|
89
|
+
| `wrap` | `wrap="off"` (`wrap`) | `true` | wrap a section's rows when it is wider than the chart's box (a section of systems does not wrap: it scrolls sideways inside the chart's box instead, see [What it draws](#what-it-draws)); off, rows keep their columns and the chart overflows, for its page to scroll |
|
|
88
90
|
| `melody` | `melody="off"` (`melody`) | `true` | `false` leaves a voice part's singing line out of the grid; its words stay, drawn by beat under the chords. The melody is left out only beside a line that draws its bars; a melody on its own stays, and so does a line with a problem or one that writes chord names, `N.C.` or `?`. A melisma's held place is not drawn where the melody is left out, so the words take the space they would with no melody written. In a one-part lead sheet the chord line then draws as a plain row with no label. `@barmark/score`'s score view still shows it |
|
|
89
91
|
| `columns` | `columns="row"` (`columns`) | `"shared"` | `"shared"`: a section's rows share column tracks, so bar lines line up down the section; `"row"`: each row sizes its own bars (below). Any other value is `"shared"` |
|
|
90
92
|
| `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 |
|
|
@@ -98,7 +100,7 @@ the element loads, with `<style data-barmark-font>` holding
|
|
|
98
100
|
|
|
99
101
|
`rehearsalLetters` letters each section occurrence A, B, C… in play order,
|
|
100
102
|
for a chart that marks no places itself. When any bar in the chart carries
|
|
101
|
-
its own rehearsal mark (`@A`,
|
|
103
|
+
its own rehearsal mark (`@A`, Barmark's grammar 2.5), it adds no letters at
|
|
102
104
|
all: the chart's marks stand alone, so no heading is marked twice, and a
|
|
103
105
|
section the chart leaves unmarked stays unmarked.
|
|
104
106
|
|
|
@@ -263,7 +265,12 @@ and Windows High Contrast keeps bar lines and marks visible.
|
|
|
263
265
|
|
|
264
266
|
- Everything is sized in em from `--barmark-size`, so text size and zoom
|
|
265
267
|
scale the chart; a section too wide for its container wraps its rows
|
|
266
|
-
instead of scrolling sideways.
|
|
268
|
+
instead of scrolling sideways. A system of several parts is the
|
|
269
|
+
exception: a chart holding a system too wide for its box becomes, on
|
|
270
|
+
screen, a region that scrolls sideways. Chromium and Firefox let the
|
|
271
|
+
keyboard reach such a region by default (Tab stops on it, then the
|
|
272
|
+
arrow keys scroll it); Safari does not. The chart adds no `tabindex`
|
|
273
|
+
of its own, since that would change its markup.
|
|
267
274
|
- Every bar has a spoken name built from the parsed chart: "bar 9: A seven
|
|
268
275
|
sus four, hold", "triplet: D, E, F sharp minor", "note E", "C over E".
|
|
269
276
|
Sections are labelled by their headings, and repeats are spoken ("play
|
|
@@ -284,7 +291,7 @@ Bar numbers sit in a gutter at the left edge; section headings, lyrics,
|
|
|
284
291
|
note lines and mid-chart changes start at the first bar line. Chords start
|
|
285
292
|
at the left of their share of the bar. A change written mid-chart names
|
|
286
293
|
itself: `time: 3/4, tempo: 120` draws as "→ Time 3/4 · Tempo ♩ = 120".
|
|
287
|
-
A tempo shows the beat `tempo:` counts (
|
|
294
|
+
A tempo shows the beat `tempo:` counts (Barmark's grammar 2.1), from the
|
|
288
295
|
`time:` in force at the bar it applies to (a `time:` on the next line
|
|
289
296
|
counts): the bottom number in a simple meter
|
|
290
297
|
(♩ in 4/4, 𝅗𝅥 in 2/2, ♪ in 3/8) and the dotted quarter in 6/8, 9/8 and
|
|
@@ -315,15 +322,24 @@ PDF or canvas drawer matches it. A section block's `bars` counts its
|
|
|
315
322
|
widest row's bars (0 when it has none), where `columns` also counts its
|
|
316
323
|
fermata, direction and rehearsal cells.
|
|
317
324
|
|
|
318
|
-
A chart of several parts (
|
|
325
|
+
A chart of several parts (Barmark's grammar 7.4) draws each system as
|
|
319
326
|
stacked rows, one per part in score order, with the part's label in the
|
|
320
327
|
gutter and one bar number on the top row. A part tacet in a system gets
|
|
321
328
|
an empty row that says "tacet" in its first bar, so every system keeps its
|
|
322
329
|
shape; a tutti line is one row. The header lists the parts' names, and
|
|
323
|
-
each part row is announced by name to a screen reader.
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
330
|
+
each part row is announced by name to a screen reader.
|
|
331
|
+
|
|
332
|
+
A system does not wrap. On a screen too narrow for it, its bars keep their
|
|
333
|
+
width, its parts keep their bar lines together, and the chart scrolls
|
|
334
|
+
sideways inside its own box; the page itself does not scroll, and no
|
|
335
|
+
chord runs into the next bar. Text, notes, directives and unreadable
|
|
336
|
+
rows beside or inside a system still wrap at the chart's box. A section
|
|
337
|
+
that also holds a plain row too wide for the box wraps as any section
|
|
338
|
+
does: each bar of its systems then takes a full-width line of its own,
|
|
339
|
+
under its part's label on a line of its own, so the parts no longer line
|
|
340
|
+
up. A printed chart is laid out as before.
|
|
341
|
+
|
|
342
|
+
A voice line (Barmark's grammar 4.3 and 7.7: the line a part sings on,
|
|
327
343
|
such as `Vox.Mel` under a lead sheet's bare `Vox` chord line) draws each
|
|
328
344
|
note as its pitch name (every note of a set, without octaves) and
|
|
329
345
|
under it, in italics, the syllable each verse sings there: verse 1 from
|
package/dist/styles.d.ts
CHANGED
|
@@ -15,6 +15,8 @@ export declare const PALETTES: {
|
|
|
15
15
|
export declare const FIT_STEPS: number[];
|
|
16
16
|
/** The rules only `columns: "row"` uses, at the stylesheet's end. */
|
|
17
17
|
export declare const ROW_COLUMNS_CSS: string;
|
|
18
|
+
/** The system rules, at the stylesheet's very end. */
|
|
19
|
+
export declare const SYSTEM_FIT_CSS: string;
|
|
18
20
|
export declare const PLAYED_CSS: string;
|
|
19
21
|
/**
|
|
20
22
|
* How many chord em the played gutter's minimum is wider than the written
|
package/dist/styles.js
CHANGED
|
@@ -230,6 +230,41 @@ const minify = (text) => text
|
|
|
230
230
|
.replace(/:\s+/g, ":");
|
|
231
231
|
/** The rules only `columns: "row"` uses, at the stylesheet's end. */
|
|
232
232
|
export const ROW_COLUMNS_CSS = minify(rowCss);
|
|
233
|
+
/**
|
|
234
|
+
* A section holding a system (several parts' rows sharing bar columns). A
|
|
235
|
+
* section's fit (`data-fit`) is estimated from its plain rows only, so one
|
|
236
|
+
* made of systems never reaches its wrap and its grid, held to its box by
|
|
237
|
+
* `max-width:100%`, squeezed its columns down to each bar's least width
|
|
238
|
+
* until chords ran into the next bar. Here such a grid keeps its columns at
|
|
239
|
+
* their content's width and, too wide for its box, scrolls inside the
|
|
240
|
+
* chart, its parts' bar lines still together. Where the section does wrap
|
|
241
|
+
* (its plain rows are wider still), it is held to its box again and wraps
|
|
242
|
+
* as before. Only the system's bars may widen the grid: a line spanning
|
|
243
|
+
* it (text, a note, a directive, an unreadable row in the section or among
|
|
244
|
+
* a system's parts) is held to the chart's box, margin and all, as the grid
|
|
245
|
+
* held it, so it wraps where it did. The scrolling chart is positioned, so
|
|
246
|
+
* it holds the spoken spans placed absolutely outside any bar (a repeat
|
|
247
|
+
* count's, an unreadable row's) and they no longer widen the page. On
|
|
248
|
+
* screen only: a printed chart is drawn as it was. Appended after the "row"
|
|
249
|
+
* rules, selecting with `:has()`, so no chart's markup changes and a chart
|
|
250
|
+
* without systems is styled byte for byte as before.
|
|
251
|
+
*/
|
|
252
|
+
const HAS_SYSTEM = ":has(>.bm-system)";
|
|
253
|
+
const WRAPS = '.bm-chart:not([data-wrap="off"])';
|
|
254
|
+
const SPANS = `${WRAPS} .bm-grid${HAS_SYSTEM}>`;
|
|
255
|
+
const systemFitCss = `
|
|
256
|
+
@media screen{
|
|
257
|
+
${WRAPS}:has(.bm-system){overflow-x:auto;position:relative}
|
|
258
|
+
.bm-grid${HAS_SYSTEM}{max-width:none}
|
|
259
|
+
${WRAPS} .bm-grid${HAS_SYSTEM} .bm-error{max-width:100cqi}
|
|
260
|
+
${SPANS}.bm-text{max-width:calc(100cqi - ${at(SIZES.text, GUTTER)})}
|
|
261
|
+
${SPANS}.bm-directive{max-width:calc(100cqi - ${at(SIZES.directive, GUTTER)})}
|
|
262
|
+
${WRAPS}[data-bar-numbers="off"] .bm-grid${HAS_SYSTEM}>:is(.bm-text,.bm-directive){max-width:100cqi}
|
|
263
|
+
${FIT_STEPS.map((w) => `@container bm (max-width:${w}em){${WRAPS} .bm-grid[data-fit="${w}"]${HAS_SYSTEM}{max-width:100%}}`).join("\n")}
|
|
264
|
+
}
|
|
265
|
+
`;
|
|
266
|
+
/** The system rules, at the stylesheet's very end. */
|
|
267
|
+
export const SYSTEM_FIT_CSS = minify(systemFitCss);
|
|
233
268
|
/**
|
|
234
269
|
* `barNumbers: "played"`: the gutter is a track that grows to its numbers
|
|
235
270
|
* (`1 · 5 · 9`, `~101 … ~137`), on one line, and at least as wide as the
|
|
@@ -309,4 +344,4 @@ const diagramsCss = `
|
|
|
309
344
|
`;
|
|
310
345
|
/** The strip's rules, between the shared rules and the row rules, so a chart drawn without it is styled byte for byte as before. */
|
|
311
346
|
export const DIAGRAMS_CSS = minify(diagramsCss);
|
|
312
|
-
export const stylesheet = minify(css) + DIAGRAMS_CSS + ROW_COLUMNS_CSS;
|
|
347
|
+
export const stylesheet = minify(css) + DIAGRAMS_CSS + ROW_COLUMNS_CSS + SYSTEM_FIT_CSS;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@barmark/render",
|
|
3
|
-
"version": "0.23.
|
|
3
|
+
"version": "0.23.2",
|
|
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": {
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
],
|
|
38
38
|
"author": "Kevin Peckham",
|
|
39
39
|
"license": "MIT",
|
|
40
|
-
"homepage": "https://
|
|
40
|
+
"homepage": "https://www.barmark.dev/packages/render",
|
|
41
41
|
"repository": {
|
|
42
42
|
"type": "git",
|
|
43
43
|
"url": "git+https://github.com/kevinpeckham/barmark.git",
|