@barmark/render 0.23.0 → 0.23.1

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 CHANGED
@@ -6,6 +6,24 @@ package uses [semantic versioning](https://semver.org/).
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [0.23.1] - 2026-12-01
10
+
11
+ ### Fixed
12
+
13
+ - **A system too wide for its box no longer squeezes its chords into each
14
+ other.** A section of several parts' systems (Morning Song's verse, or
15
+ any system whose bars hold long chords) never wrapped, and on a narrow
16
+ screen its bar columns shrank until chords ran over the next bar, and on
17
+ a phone pushed the page sideways too. Now its bars keep their width, its
18
+ parts keep their bar lines together, and the chart scrolls sideways
19
+ inside its own box, and the page itself does not scroll. Text, notes,
20
+ directives and unreadable rows beside or inside a system still wrap at
21
+ the chart's box, and a section whose plain rows are too wide
22
+ wraps as before. A system still does not wrap; the README now says
23
+ so. Charts without systems, and printed charts, are drawn as before,
24
+ and no chart's markup changes: the fix is a few rules at the end of
25
+ `stylesheet`.
26
+
9
27
  ## [0.23.0] - 2026-11-30
10
28
 
11
29
  ### Changed
@@ -704,7 +722,8 @@ that needs no script or as the `<barmark-chart>` web component. Requires
704
722
  zoom without sideways scrolling, the element renders and re-renders, and
705
723
  a screen reader hears "bar 9: D". Run them with `bun run test:browser`.
706
724
 
707
- [Unreleased]: https://github.com/kevinpeckham/barmark/compare/render-v0.23.0...HEAD
725
+ [Unreleased]: https://github.com/kevinpeckham/barmark/compare/render-v0.23.1...HEAD
726
+ [0.23.1]: https://github.com/kevinpeckham/barmark/compare/render-v0.23.0...render-v0.23.1
708
727
  [0.23.0]: https://github.com/kevinpeckham/barmark/compare/render-v0.22.3...render-v0.23.0
709
728
  [0.22.3]: https://github.com/kevinpeckham/barmark/compare/render-v0.22.2...render-v0.22.3
710
729
  [0.22.2]: https://github.com/kevinpeckham/barmark/compare/render-v0.22.1...render-v0.22.2
package/README.md CHANGED
@@ -84,7 +84,7 @@ the element loads, with `<style data-barmark-font>` holding
84
84
  | `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
85
  | `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
86
  | `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 |
87
+ | `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
88
  | `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
89
  | `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
90
  | `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 |
@@ -263,7 +263,12 @@ and Windows High Contrast keeps bar lines and marks visible.
263
263
 
264
264
  - Everything is sized in em from `--barmark-size`, so text size and zoom
265
265
  scale the chart; a section too wide for its container wraps its rows
266
- instead of scrolling sideways.
266
+ instead of scrolling sideways. A system of several parts is the
267
+ exception: a chart holding a system too wide for its box becomes, on
268
+ screen, a region that scrolls sideways. Chromium and Firefox let the
269
+ keyboard reach such a region by default (Tab stops on it, then the
270
+ arrow keys scroll it); Safari does not. The chart adds no `tabindex`
271
+ of its own, since that would change its markup.
267
272
  - Every bar has a spoken name built from the parsed chart: "bar 9: A seven
268
273
  sus four, hold", "triplet: D, E, F sharp minor", "note E", "C over E".
269
274
  Sections are labelled by their headings, and repeats are spoken ("play
@@ -320,8 +325,17 @@ stacked rows, one per part in score order, with the part's label in the
320
325
  gutter and one bar number on the top row. A part tacet in a system gets
321
326
  an empty row that says "tacet" in its first bar, so every system keeps its
322
327
  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. On a screen too
324
- narrow for a section, its rows wrap one by one, as any row does.
328
+ each part row is announced by name to a screen reader.
329
+
330
+ A system does not wrap. On a screen too narrow for it, its bars keep their
331
+ width, its parts keep their bar lines together, and the chart scrolls
332
+ sideways inside its own box; the page itself does not scroll, and no
333
+ chord runs into the next bar. Text, notes, directives and unreadable
334
+ rows beside or inside a system still wrap at the chart's box. A section
335
+ that also holds a plain row too wide for the box wraps as any section
336
+ does: each bar of its systems then takes a full-width line of its own,
337
+ under its part's label on a line of its own, so the parts no longer line
338
+ up. A printed chart is laid out as before.
325
339
 
326
340
  A voice line (barmark's grammar 4.3 and 7.7: the line a part sings on,
327
341
  such as `Vox.Mel` under a lead sheet's bare `Vox` chord line) draws each
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.0",
3
+ "version": "0.23.1",
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": {