guidex 0.3.1 → 0.3.3

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.
Files changed (35) hide show
  1. package/README.md +81 -4
  2. package/dist/lib/app/EditorContext.d.ts +6 -1
  3. package/dist/lib/app/ExactTransposeControls.d.ts +1 -0
  4. package/dist/lib/app/StanzaControls.d.ts +1 -0
  5. package/dist/lib/app/TransposeSettings.d.ts +1 -0
  6. package/dist/lib/app/editorState.d.ts +81 -6
  7. package/dist/lib/app/shareLink.d.ts +22 -0
  8. package/dist/lib/chantLayout-CVVuJUJl.js +2778 -0
  9. package/dist/lib/chantLayout.d.ts +48 -8
  10. package/dist/lib/composeScript.d.ts +71 -0
  11. package/dist/lib/editorStorage.d.ts +11 -0
  12. package/dist/lib/embed/core.d.ts +34 -3
  13. package/dist/lib/embed/index.js +1 -1
  14. package/dist/lib/embed/manual.d.ts +12 -3
  15. package/dist/lib/embed/manual.js +348 -276
  16. package/dist/lib/exactTranspose.d.ts +54 -0
  17. package/dist/lib/glyphFamilies.d.ts +29 -0
  18. package/dist/lib/guidex.css +29 -2
  19. package/dist/lib/guidoRender.d.ts +7 -3
  20. package/dist/lib/guidoScript.d.ts +109 -10
  21. package/dist/lib/guidoScriptTransforms.d.ts +19 -7
  22. package/dist/lib/noteGroups.d.ts +22 -0
  23. package/dist/lib/react/GuidexScore.d.ts +21 -1
  24. package/dist/lib/react/index.d.ts +2 -1
  25. package/dist/lib/react/index.js +25 -3
  26. package/dist/lib/{scoreImage-oVBasBX5.js → scoreImage-lvOrTbG-.js} +111 -53
  27. package/dist/lib/stanzas.d.ts +135 -0
  28. package/dist/lib/word/index.js +1 -1
  29. package/dist/lib/{wordChecker-C3nJrk_j.js → wordChecker-DG09l_ol.js} +99 -46
  30. package/dist/lib/wordClipboard.d.ts +3 -3
  31. package/dist/lib/wordExport.d.ts +11 -5
  32. package/dist-embed/guidex-embed.min.css +1 -1
  33. package/dist-embed/guidex-embed.min.js +1 -1
  34. package/package.json +1 -1
  35. package/dist/lib/chantLayout-GAfg2iKS.js +0 -1042
@@ -44,3 +44,32 @@ export declare function baseOf(ch: string): {
44
44
  base: string;
45
45
  role: VariantRole;
46
46
  } | undefined;
47
+ /** Whether `ch` is a modifier glyph (a sharp, flat or natural sign). */
48
+ export declare function isModifierGlyph(ch: string): boolean;
49
+ /**
50
+ * The length of the bracketed accidental that opens `notes` at `from`:
51
+ * an opening bracket, one or more accidental signs, the matching closing
52
+ * bracket, and the `¨`/`-` spacing right after it (`ÄôŨ¨` in `ÄôŨ¨õ`).
53
+ * 0 when no such unit stands there.
54
+ */
55
+ export declare function bracketedAccidentalLength(notes: string, from?: number): number;
56
+ /** The clef glyphs (issue #49) and the staff line each one sits on,
57
+ * counted from the bottom. The g-clef has two keybindings. */
58
+ export declare const CLEF_GLYPHS: Readonly<Record<string, {
59
+ clef: 'c' | 'f' | 'g';
60
+ line: 1 | 2 | 3 | 4;
61
+ }>>;
62
+ /** Whether `ch` is a clef glyph. */
63
+ export declare function isClefGlyph(ch: string): boolean;
64
+ /** The base pitch glyphs from low to high, one per staff position
65
+ * (spelled out: `Object.keys` would list the digit keys first). The
66
+ * index is the staff position the exact transposition counts with. */
67
+ export declare const STAFF: readonly string[];
68
+ /** The pitch letter (`a`…`g`, octave dropped) of a pitch glyph — a base
69
+ * glyph or any of its variants — under `clef` (a clef glyph; default the
70
+ * standard g-clef). Undefined when the glyph has no pitch or the clef
71
+ * glyph is unknown. */
72
+ export declare function pitchLetterOf(ch: string, clef?: string): string | undefined;
73
+ /** Every base pitch glyph whose pitch letter under `clef` is `letter`,
74
+ * in every octave, low to high. */
75
+ export declare function basesOfLetter(letter: string, clef?: string): string[];
@@ -63,13 +63,34 @@
63
63
 
64
64
  color: var(--text);
65
65
 
66
+ /* The lines keep to one column. A fr track counts as zero under a
67
+ min-content constraint, so the nowrap lines below don't turn into
68
+ the host's minimum width: an 'auto' score in a flex or grid column
69
+ can still shrink and re-lay out. Its max-content size stays the
70
+ longest line, so shrink-to-fit hosts size to the score as before. */
71
+ display: grid;
72
+ grid-template-columns: minmax(0, 1fr);
73
+ align-content: start;
74
+
66
75
  /* Score alignment is precomputed in px; Safari's text inflation on
67
76
  rotation would resize the text but not the baked-in spacers. Host
68
- pages don't necessarily set this, so do it here. */
77
+ pages don't necessarily set this, so do it here.
78
+ iOS Safari reads only the prefixed property, and a host's Autoprefixer
79
+ deletes it when its browserslist omits ios_saf (Next.js's default),
80
+ so it is exempted here. */
81
+ /* autoprefixer: ignore next */
69
82
  -webkit-text-size-adjust: 100%;
70
83
  text-size-adjust: 100%;
71
84
  }
72
85
 
86
+ /* A fixed maxWidth may lay lines out wider than the container. The
87
+ render then grows to its longest line and overflows as one box; the
88
+ host decides whether that scrolls or clips (issue #93). 'auto' leaves
89
+ this off: the render's width is what it measures. */
90
+ .guidex-render[data-fixed-width] {
91
+ min-width: max-content;
92
+ }
93
+
73
94
  @media (prefers-color-scheme: dark) {
74
95
  .guidex-render {
75
96
  --red: #ff4d4d;
@@ -89,13 +110,18 @@
89
110
  color: var(--text-h);
90
111
  padding-block: 0.3em;
91
112
  position: relative;
113
+ /* The layout pass owns every line break; a browser wrap would part
114
+ the syllables from their notes */
115
+ white-space: nowrap;
92
116
  }
93
117
 
94
118
  /* The score's text line: margins reset (host pages style p freely) and
95
- natural leading, like the app's .score p */
119
+ natural leading, like the app's .score p; never re-wrapped, like the
120
+ notes line */
96
121
  .guidex-render p {
97
122
  margin: 0;
98
123
  line-height: normal;
124
+ white-space: nowrap;
99
125
  }
100
126
 
101
127
  /* Host pages often drop-cap paragraphs (::first-letter rules like the
@@ -123,6 +149,7 @@
123
149
  .guidex-render .guidex-error {
124
150
  margin: 0;
125
151
  color: var(--red);
152
+ white-space: normal;
126
153
  font: 14px/1.4 'Book Antiqua', 'Palatino Linotype', Palatino, Georgia, serif;
127
154
  }
128
155
  /*$vite$:1*/
@@ -1,5 +1,5 @@
1
- import { GuidoScript } from './guidoScript';
2
1
  import { StyleSetName } from './guidoStyles';
2
+ import { LayoutSource } from './chantLayout';
3
3
  export { NOTE_MODIFIERS, SCORE_MARKERS } from './chantLayout';
4
4
  /** Options for one render. All fields optional; defaults reproduce the
5
5
  * original Book Antiqua look (style set BNS). */
@@ -16,6 +16,8 @@ export interface RenderOptions {
16
16
  debug?: boolean;
17
17
  /** Maximum notes-line width before a staff break (default: none) */
18
18
  maxWidthPx?: number;
19
+ /** Dashes in a normal junction between note groups, in steps of a third (default 3) */
20
+ junctionDashes?: number;
19
21
  }
20
22
  /**
21
23
  * Renders a GuidoScript into a tidy score: a notes line in the chant font,
@@ -26,11 +28,13 @@ export interface RenderOptions {
26
28
  * `render` turns the laid-out lines into (notes `.guido` div, text `<p>`)
27
29
  * pairs — px-measured inline-block spacer spans fake the horizontal gaps.
28
30
  * The Word export (wordExport.ts) consumes the same layout with a
29
- * character-based spacer mechanism instead.
31
+ * character-based spacer mechanism instead. Given several underlays of
32
+ * one melody (stacked stanzas, issue #84 — see `stackStanzas`), every
33
+ * notes line is followed by one text `<p>` per underlay.
30
34
  */
31
35
  export declare class GuidoRender {
32
36
  private readonly script;
33
- constructor(source: GuidoScript | string);
37
+ constructor(source: LayoutSource);
34
38
  /**
35
39
  * Renders the score into `container` as (notes line, text line) pairs.
36
40
  * When `maxWidthPx` is finite, a new pair starts before any syllable
@@ -3,20 +3,77 @@ import { ScriptTransform } from './guidoScriptTransforms';
3
3
  * `spaceBefore` records whether the source had whitespace between the
4
4
  * previous group and this token's group — it feeds the previous
5
5
  * syllable's `wordEnd` and the `toString()` round-trip. */
6
- export type ScriptToken = {
6
+ export type ScriptToken = SyllableToken | StatementToken;
7
+ /** A syllable token. `held` marks a text-less group held by the syllable
8
+ * before it (its `wordEnd` is that syllable's); `empty` marks an empty
9
+ * slot (`~`, or a text-less group at the start): notes but no syllable.
10
+ * Both flags are only present when set. */
11
+ export type SyllableToken = {
7
12
  kind: 'syllable';
8
13
  text: string;
9
14
  notes: string;
10
15
  wordEnd: boolean;
11
16
  spaceBefore: boolean;
12
- } | {
17
+ held?: true;
18
+ empty?: true;
19
+ };
20
+ /** A syllable as `GuidoScript.syllables` lists it. */
21
+ export type Syllable = Pick<SyllableToken, 'text' | 'notes' | 'wordEnd' | 'held' | 'empty'>;
22
+ /** Source offsets of one token (see `GuidoScript.tokenSpans`): `start`
23
+ * is its text's first character (its group's `(` when it has no text),
24
+ * `notesStart`/`notesEnd` bound its group's content, `end` is just past
25
+ * its `)`. Offsets index `source`; only the typing conveniences
26
+ * (a closing paren or a `()` appended at the end) reach past it. */
27
+ export interface TokenSpan {
28
+ start: number;
29
+ notesStart: number;
30
+ notesEnd: number;
31
+ end: number;
32
+ }
33
+ /** A control statement token. `clef` is the clef glyph of a `(@clef …)`
34
+ * change; `key` is the key's modifier glyphs (empty when cleared). */
35
+ export type StatementToken = {
13
36
  kind: 'break';
14
37
  spaceBefore: boolean;
38
+ } | {
39
+ kind: 'clef';
40
+ clef: string;
41
+ key: string;
42
+ spaceBefore: boolean;
43
+ } | {
44
+ kind: 'key';
45
+ key: string;
46
+ spaceBefore: boolean;
47
+ } | {
48
+ kind: 'tight';
49
+ on: boolean;
50
+ spaceBefore: boolean;
51
+ } | {
52
+ kind: 'keep';
53
+ on: boolean;
54
+ spaceBefore: boolean;
55
+ } | {
56
+ kind: 'unit';
57
+ on: boolean;
58
+ spaceBefore: boolean;
15
59
  };
60
+ /** The statements that open and close a run of syllables (issue #100):
61
+ * `tight` spacing, `keep` on one line, `unit` both. */
62
+ export type RunStatementKind = 'tight' | 'keep' | 'unit';
63
+ /** The run properties a run statement sets. */
64
+ export declare function runProperties(kind: RunStatementKind): ('tight' | 'keep')[];
16
65
  /** Whether a group's content is a control statement (`@`-keyword,
17
66
  * trimmed). Shared with the transforms, which must leave statement
18
- * groups alone — their keyword characters are pitch glyphs otherwise. */
67
+ * groups alone — their keyword characters are pitch glyphs otherwise.
68
+ * A c4 clef group (`@` + modifier glyphs) counts too: the opening one is
69
+ * told apart by `isC4ClefGroup`, and mid-script it is an error. */
19
70
  export declare function isStatementGroup(content: string): boolean;
71
+ /** Whether a group's content has the shape of a c4 clef group: `@`
72
+ * followed by nothing but modifier glyphs. Statement keywords never
73
+ * consist solely of modifier glyphs, so the two cannot collide. */
74
+ export declare function isC4ClefGroup(content: string): boolean;
75
+ /** A statement token written back as its group. */
76
+ export declare function statementSource(tok: StatementToken): string;
20
77
  export declare class GuidoScript {
21
78
  readonly source: string;
22
79
  constructor(source: string, options?: {
@@ -29,13 +86,20 @@ export declare class GuidoScript {
29
86
  * control statements. Throws on a malformed statement (syllable text
30
87
  * attached to one, or an unknown `@` keyword). */
31
88
  get tokens(): ScriptToken[];
89
+ /** The raw text of the `(@stanza …)` statements at the end of the
90
+ * script — stanzas 2, 3, … in order, escapes kept (the stanza text
91
+ * grammar folds them). Throws like `tokens` on a malformed script,
92
+ * and when anything but another stanza follows a stanza statement. */
93
+ get stanzas(): string[];
94
+ /** Where each token stands in the source, parallel to `tokens`:
95
+ * offsets of its text (past leading whitespace), of its group's
96
+ * content and just past its group's `)`. The walker
97
+ * (`scriptSyllables`) reads them. */
98
+ get tokenSpans(): TokenSpan[];
99
+ private parse;
32
100
  /** The script broken into syllables, each with its sung text and
33
101
  * notes — the syllable tokens, statements filtered out. */
34
- get syllables(): {
35
- text: string;
36
- notes: string;
37
- wordEnd: boolean;
38
- }[];
102
+ get syllables(): Syllable[];
39
103
  /**
40
104
  * The source with the typing conveniences folded in, so the parser
41
105
  * itself only ever sees complete scripts:
@@ -46,7 +110,8 @@ export declare class GuidoScript {
46
110
  * renders like a `*()` syllable (text without notes width).
47
111
  */
48
112
  private get normalized();
49
- /** The syllables grouped into the words of the text. */
113
+ /** The syllables grouped into the words of the text. Held groups and
114
+ * empty slots sing no syllable of their own, so they are left out. */
50
115
  get words(): {
51
116
  text: string;
52
117
  syllables: {
@@ -55,12 +120,46 @@ export declare class GuidoScript {
55
120
  }[];
56
121
  }[];
57
122
  /** The script rebuilt from the parsed pieces — a round-trip of the
58
- * source, statements included. */
123
+ * source, statements and stanzas included. */
59
124
  toString(): string;
60
125
  }
126
+ /** One text-bearing syllable of a script (see `scriptSyllables`). */
127
+ export interface ScriptSyllable {
128
+ /** Its text, escapes folded and whitespace trimmed */
129
+ text: string;
130
+ /** Its own note group's content, escapes folded */
131
+ notes: string;
132
+ /** The groups it holds (issue #83), escapes folded, in order */
133
+ held: string[];
134
+ /** Whether it opens a word (the first syllable always does) */
135
+ wordStart: boolean;
136
+ wordEnd: boolean;
137
+ /** Offset of its text's first character in the source */
138
+ start: number;
139
+ /** Offsets of its own group's content (the `(` is at
140
+ * `notesStart - 1`, the `)` at `notesEnd`) */
141
+ notesStart: number;
142
+ notesEnd: number;
143
+ /** Offset just past the last group of its held run (just past its
144
+ * own group when it holds none) */
145
+ end: number;
146
+ /** Its index among the script's tokens (`GuidoScript.tokens`) */
147
+ token: number;
148
+ }
149
+ /**
150
+ * The syllables of a script that carry text, in order — the ones the
151
+ * sung text is made of, so their count and texts match `chantText`
152
+ * (and `GuidoScript.words`). Held groups ride on their syllable
153
+ * (`held`), `~` empty slots, statements and `(@stanza …)` are skipped.
154
+ * Offsets index the script's source; index i is the "syllable i" of
155
+ * `composeScript`'s `from`/`to`.
156
+ */
157
+ export declare function scriptSyllables(script: GuidoScript | string): ScriptSyllable[];
61
158
  /** The sung text of the script: the clef stripped, syllables joined
62
159
  * into words, and the words joined with single spaces. */
63
160
  export declare function chantText(script: string): string;
64
161
  /** Folds backslash escapes into the characters they stand for. Shared
65
162
  * with the transforms module (guidoScriptTransforms.ts). */
66
163
  export declare function unescape(text: string): string;
164
+ /** Turns literal parentheses and backslashes into their escape sequences. */
165
+ export declare function escape(text: string): string;
@@ -1,13 +1,15 @@
1
+ export { STANZA_PLACEHOLDER, padStanza, parseStanza, selectStanza, slotCount, smallHeads, stackStanzas, stackedStanzaNumbers, stanzaCount, stanzaTexts, stanzaWarnings, withStanza, type EmptySlots, type SelectStanzaOptions, type StanzaOptions, type StanzaStack, type StanzaSyllable, type StanzaWarning, } from './stanzas';
2
+ export { KEY_SIGNATURES, parseInterval, transposeExact, transposeScript, TranspositionRangeError, type SpelledInterval, type TranspositionTarget, } from './exactTranspose';
1
3
  /** A named source-to-source rewrite applied to a script before parsing. */
2
4
  export interface ScriptTransform {
3
5
  name: string;
4
6
  apply: (source: string) => string;
5
7
  }
6
8
  /** The `startWithInitial` transform: finds the first syllable group with
7
- * actual notes (the clef, no-notes groups, and control statements don't
8
- * count) and wraps the syllable's first character in the `*…*` initial
9
- * marker. Already-marked text (leading `*`) and syllables without text
10
- * are left alone. */
9
+ * actual notes and text (the clef, no-notes groups, control statements,
10
+ * text-less groups and `~` empty slots don't count) and wraps the
11
+ * syllable's first character in the `*…*` initial marker. Already-marked
12
+ * text (leading `*`) is left alone. */
11
13
  declare function startWithInitial(source: string): string;
12
14
  /**
13
15
  * The built-in transformations, keyed by name; pass the ones a feature
@@ -30,8 +32,19 @@ export declare const SCRIPT_TRANSFORMS: {
30
32
  export declare const PITCH_ROWS: readonly ["ðñ0123456789öüó", "^]qwertzuiopõú", "ÝÞQWERTZUIOPÕÚ", "×sdfghjkléáû", "ØÙDFGHJKLÉÁÛ", "÷øaASÍYXCVBN$m", "ÈÊËÌÎÏÐÑÒþßòôùý", "“”•–—˜™š›œº»", "®−§ÿ\"+!%/=()ÖÜÓ", "Ÿ¡¢£[¥¦©ª«¬", "~¯‚ƒ„…†‡ˆ‰Š‹Œ‘’", "àâãäåæçèêëìîï", "½°±²³´μ·¾¸¹"];
31
33
  /** What happens when a shift runs past the end of a pitch row:
32
34
  * `clamp` keeps the first/last available character, `null` emits
33
- * `U+0000`, which shows up as a missing glyph in the score. */
34
- export type TransposeOverflow = 'clamp' | 'null';
35
+ * `U+0000`, which shows up as a missing glyph in the score, and `error`
36
+ * throws. */
37
+ export type TransposeOverflow = 'clamp' | 'null' | 'error';
38
+ /** Transposes the pitch characters of one note group's content as
39
+ * written in the source (escapes included) — the staff-degree shift
40
+ * `transposeBy` applies to every group. Escape pairs stand for their
41
+ * underlying character (an escaped paren is a pitch glyph of the
42
+ * `®−§ÿ…` row), and a shifted result that is a control character of the
43
+ * group syntax is written escaped. A statement group's content (`@…`) is returned
44
+ * unchanged: its keyword letters are pitch glyphs, but no notes. */
45
+ export declare function transposeNotes(notes: string, shift: number, options?: {
46
+ overflow?: TransposeOverflow;
47
+ }): string;
35
48
  /** The `transposeBy` transform factory: shifts every pitch character of
36
49
  * every notes group `shift` positions along its pitch row. The clef
37
50
  * group and the syllable text are left alone — clef handling is a
@@ -39,4 +52,3 @@ export type TransposeOverflow = 'clamp' | 'null';
39
52
  export declare function transposeBy(shift: number, options?: {
40
53
  overflow?: TransposeOverflow;
41
54
  }): ScriptTransform;
42
- export {};
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Note-group anatomy shared by the layout pass and the exact
3
+ * transposition: the score markers and the split of a group into its
4
+ * leading markers, notes and trailing markers. Kept free of imports, so
5
+ * the transforms can use it without pulling in the style sets.
6
+ */
7
+ /**
8
+ * Score marker characters: they carry no pitch, and when they sit at the
9
+ * start or end of a note group (with the adjacent dash) they act as
10
+ * whitespace rather than note width.
11
+ */
12
+ export declare const SCORE_MARKERS = ",.:?'\"+!%/=()\u00D6\u00DC\u00D3;";
13
+ export declare const MARKER_CHARS: Set<string>;
14
+ export interface NoteGroupParts {
15
+ /** Marker run at the group's start (markers plus their adjacent dash) */
16
+ leading: string;
17
+ /** The notes between the marker runs */
18
+ core: string;
19
+ /** Marker run at the group's end (dash plus markers) */
20
+ trailing: string;
21
+ }
22
+ export declare function splitNoteMarkers(notes: string): NoteGroupParts;
@@ -1,5 +1,6 @@
1
1
  import { MaxWidth } from '../embed/core';
2
2
  import { StyleSetName } from '../guidoStyles';
3
+ import { EmptySlots, StanzaStack, StanzaWarning } from '../stanzas';
3
4
  export interface GuidexScoreProps {
4
5
  /** The score source in GuidoScript notation, e.g. `'(M)A(0) di(0q)e(qQ0)bus(1) an(3)ti(1e)quis(qQ0-:)'`. */
5
6
  script: string;
@@ -10,10 +11,29 @@ export interface GuidexScoreProps {
10
11
  bold?: boolean;
11
12
  /** Text size in px (default 18). */
12
13
  textPx?: number;
14
+ /** Dashes in a normal junction between note groups, in steps of a third (default 3). */
15
+ junctionDashes?: number;
13
16
  /** Transpose the score by N diatonic steps. */
14
17
  transpose?: number;
18
+ /** The stanza sung under the notes (1-based, default 1: the
19
+ * script's own text). */
20
+ stanza?: number;
21
+ /** Stacked stanzas under one staff (issue #84): `'all'`, or the
22
+ * stanza numbers in order. Replaces `stanza` when set. */
23
+ stack?: StanzaStack;
24
+ /** Stanzas 2, 3, … as stanza text, replacing the script's
25
+ * `(@stanza …)` statements. */
26
+ stanzas?: string[];
27
+ /** `'small'` draws the slots the stanza leaves empty while another
28
+ * stanza sings them with small heads (stacked: the slots no stacked
29
+ * stanza sings while another stanza does); `'partial'` every slot
30
+ * some stanza sings and another does not. */
31
+ emptySlots?: EmptySlots;
32
+ /** Called after each render with the rendered stanzas' count
33
+ * mismatches (empty when it fits). */
34
+ onWarnings?: (warnings: StanzaWarning[]) => void;
15
35
  /** Render measurement debug markers. */
16
36
  debug?: boolean;
17
37
  className?: string;
18
38
  }
19
- export declare function GuidexScore({ script, maxWidth, style, bold, textPx, transpose, debug, className, }: GuidexScoreProps): import('react').JSX.Element;
39
+ export declare function GuidexScore({ script, maxWidth, style, bold, textPx, junctionDashes, transpose, stanza, stack, stanzas, emptySlots, onWarnings, debug, className, }: GuidexScoreProps): import('react').JSX.Element;
@@ -3,6 +3,7 @@
3
3
  * a re-export of the imperative embed API for advanced use.
4
4
  */
5
5
  export { GuidexScore, type GuidexScoreProps } from './GuidexScore';
6
- export { renderScore, renderAll, init, dispose, version, type EmbedOptions, type MaxWidth } from '../embed/core';
6
+ export { renderScore, renderAll, init, dispose, version, type EmbedOptions, type MaxWidth, type RenderResult, type RenderScoreOptions, } from '../embed/core';
7
7
  export { downloadScorePng, downloadScoreSvg, scorePngBlob, scoreSvg, type ScoreDownloadOptions, type ScoreImageOptions, } from '../scoreImage';
8
8
  export type { StyleSetName } from '../guidoStyles';
9
+ export type { EmptySlots, StanzaStack, StanzaWarning } from '../stanzas';
@@ -1,5 +1,5 @@
1
1
  "use client";
2
- import { a as dispose, c as renderScore, i as scoreSvg, l as version, n as downloadScoreSvg, o as init, r as scorePngBlob, s as renderAll, t as downloadScorePng } from "../scoreImage-oVBasBX5.js";
2
+ import { a as dispose, c as renderScore, i as scoreSvg, l as version, n as downloadScoreSvg, o as init, r as scorePngBlob, s as renderAll, t as downloadScorePng } from "../scoreImage-lvOrTbG-.js";
3
3
  import { useEffect, useRef } from "react";
4
4
  import { jsx } from "react/jsx-runtime";
5
5
  //#region src/react/GuidexScore.tsx
@@ -10,27 +10,49 @@ import { jsx } from "react/jsx-runtime";
10
10
  * client'` directive marks it for React Server Components (Next.js App
11
11
  * Router); in plain client-side React it is a no-op.
12
12
  */
13
- function GuidexScore({ script, maxWidth, style, bold, textPx, transpose, debug, className }) {
13
+ function GuidexScore({ script, maxWidth, style, bold, textPx, junctionDashes, transpose, stanza, stack, stanzas, emptySlots, onWarnings, debug, className }) {
14
14
  const ref = useRef(null);
15
+ const onWarningsRef = useRef(onWarnings);
16
+ onWarningsRef.current = onWarnings;
17
+ const stanzasKey = stanzas === void 0 ? void 0 : JSON.stringify(stanzas);
18
+ const stackKey = stack === void 0 ? void 0 : JSON.stringify(stack);
15
19
  useEffect(() => {
16
20
  const el = ref.current;
17
21
  if (!el) return;
22
+ let live = true;
23
+ const stanzaTexts = stanzasKey === void 0 ? void 0 : JSON.parse(stanzasKey);
24
+ const stacked = stackKey === void 0 ? void 0 : JSON.parse(stackKey);
18
25
  renderScore(el, script, {
19
26
  maxWidth,
20
27
  style,
21
28
  bold,
22
29
  textPx,
30
+ junctionDashes,
23
31
  transpose,
32
+ stanza,
33
+ stack: stacked,
34
+ stanzas: stanzaTexts,
35
+ emptySlots,
24
36
  debug
37
+ }).then(({ warnings }) => {
38
+ if (live) onWarningsRef.current?.(warnings);
25
39
  });
26
- return () => dispose(el);
40
+ return () => {
41
+ live = false;
42
+ dispose(el);
43
+ };
27
44
  }, [
28
45
  script,
29
46
  maxWidth,
30
47
  style,
31
48
  bold,
32
49
  textPx,
50
+ junctionDashes,
33
51
  transpose,
52
+ stanza,
53
+ stackKey,
54
+ stanzasKey,
55
+ emptySlots,
34
56
  debug
35
57
  ]);
36
58
  return /* @__PURE__ */ jsx("div", {