guidex 0.3.3 → 0.5.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.
Files changed (36) hide show
  1. package/CHANGELOG.md +68 -0
  2. package/README.md +266 -37
  3. package/dist/lib/app/StaffSettings.d.ts +1 -0
  4. package/dist/lib/app/editorState.d.ts +32 -23
  5. package/dist/lib/app/shareLink.d.ts +2 -3
  6. package/dist/lib/{chantLayout-CVVuJUJl.js → chantLayout-BrCQUOhp.js} +980 -1142
  7. package/dist/lib/chantLayout.d.ts +32 -3
  8. package/dist/lib/chantMarkup.d.ts +63 -20
  9. package/dist/lib/drawnStaff.d.ts +130 -0
  10. package/dist/lib/editorStorage.d.ts +44 -4
  11. package/dist/lib/embed/core.d.ts +26 -4
  12. package/dist/lib/embed/index.js +1 -1
  13. package/dist/lib/embed/manual.d.ts +9 -3
  14. package/dist/lib/embed/manual.js +16 -49
  15. package/dist/lib/fonts/guidohu-staffless.woff2 +0 -0
  16. package/dist/lib/guidex.css +27 -0
  17. package/dist/lib/guidoRender.d.ts +22 -4
  18. package/dist/lib/guidoScript.d.ts +60 -23
  19. package/dist/lib/guidoScriptTransforms.d.ts +0 -18
  20. package/dist/lib/guidoStyles.d.ts +85 -74
  21. package/dist/lib/react/GuidexScore.d.ts +18 -6
  22. package/dist/lib/react/index.d.ts +2 -0
  23. package/dist/lib/react/index.js +47 -4
  24. package/dist/lib/recitationSegments.d.ts +93 -0
  25. package/dist/lib/scoreImage-B2SGdROL.js +8391 -0
  26. package/dist/lib/staffGlyphs.d.ts +12 -0
  27. package/dist/lib/stanzas.d.ts +6 -3
  28. package/dist/lib/textMarkup.d.ts +67 -0
  29. package/dist/lib/word/index.js +1 -1
  30. package/dist/lib/{wordChecker-DG09l_ol.js → wordChecker-CjYl2yof.js} +40 -13
  31. package/dist/lib/wordExport.d.ts +23 -4
  32. package/dist-embed/fonts/guidohu-staffless.woff2 +0 -0
  33. package/dist-embed/guidex-embed.min.css +1 -1
  34. package/dist-embed/guidex-embed.min.js +1 -1
  35. package/package.json +3 -2
  36. package/dist/lib/scoreImage-lvOrTbG-.js +0 -1009
@@ -44,6 +44,14 @@
44
44
  font-display: swap;
45
45
  }
46
46
 
47
+ /* Guido HU without its staff lines (tools/staffless-font): the notes font of
48
+ the drawn staff. Same advances as Guido HU. */
49
+ @font-face {
50
+ font-family: 'Guidohu Staffless';
51
+ src: url('./fonts/guidohu-staffless.woff2') format('woff2');
52
+ font-display: swap;
53
+ }
54
+
47
55
  /* Liturgical display font, used bold-only by the _…_ syllable decoration;
48
56
  declared 700 so the renderer's font check sees a real bold face */
49
57
  @font-face {
@@ -115,6 +123,25 @@
115
123
  white-space: nowrap;
116
124
  }
117
125
 
126
+ /* The drawn staff (render option staff: 'drawn'): one span per stretch of a
127
+ line, behind the staffless notes. A line's color comes from
128
+ --guidex-staff-light / --guidex-staff-dark (set per line by the color
129
+ options, or on any ancestor), else the notes' own color. Dark follows the
130
+ html.dark / html.light theme classes, else the system preference. */
131
+ .guidex-staff-line {
132
+ background-color: var(--guidex-staff-light, currentColor);
133
+ }
134
+
135
+ @media (prefers-color-scheme: dark) {
136
+ :root:not(.light) .guidex-staff-line {
137
+ background-color: var(--guidex-staff-dark, var(--guidex-staff-light, currentColor));
138
+ }
139
+ }
140
+
141
+ :root.dark .guidex-staff-line {
142
+ background-color: var(--guidex-staff-dark, var(--guidex-staff-light, currentColor));
143
+ }
144
+
118
145
  /* The score's text line: margins reset (host pages style p freely) and
119
146
  natural leading, like the app's .score p; never re-wrapped, like the
120
147
  notes line */
@@ -1,11 +1,14 @@
1
- import { StyleSetName } from './guidoStyles';
2
- import { LayoutSource } from './chantLayout';
1
+ import { MarkDefinitions, StyleSetName } from './guidoStyles';
2
+ import { LayoutSource, StaffFill } from './chantLayout';
3
+ import { DrawnStaffOptions } from './drawnStaff';
3
4
  export { NOTE_MODIFIERS, SCORE_MARKERS } from './chantLayout';
4
5
  /** Options for one render. All fields optional; defaults reproduce the
5
6
  * original Book Antiqua look (style set BNS). */
6
- export interface RenderOptions {
7
- /** Named style set from STYLE_SETS (default: BNS) */
7
+ export interface RenderOptions extends DrawnStaffOptions {
8
+ /** Named style set (default: BNS) */
8
9
  style?: StyleSetName;
10
+ /** Marks this score adds to its style set's */
11
+ marks?: MarkDefinitions;
9
12
  /** Render all text bold, measurements included */
10
13
  bold?: boolean;
11
14
  /** Text line size in px (default 18) */
@@ -18,6 +21,17 @@ export interface RenderOptions {
18
21
  maxWidthPx?: number;
19
22
  /** Dashes in a normal junction between note groups, in steps of a third (default 3) */
20
23
  junctionDashes?: number;
24
+ /** How far each staff line runs (default `all-but-last`) */
25
+ staffFill?: StaffFill;
26
+ /** With `staffFill: 'longest'`: the distance from the available width
27
+ * within which every line runs to it instead (default 0) */
28
+ staffFillSnapPx?: number;
29
+ /** Render a recitation that covers exactly 2 syllables on a line as
30
+ * plain notes of the same pitch (default true, issue #21) */
31
+ twoSyllableRecitationsToPlain?: boolean;
32
+ /** Render 3 or more syllables on one plain note with a reciting glyph
33
+ * (`1`–`9`, `ö`, `ü`) on a line as a recitation (default false) */
34
+ plainRunsToRecitation?: boolean;
21
35
  }
22
36
  /**
23
37
  * Renders a GuidoScript into a tidy score: a notes line in the chant font,
@@ -43,6 +57,9 @@ export declare class GuidoRender {
43
57
  * unknown or one of its fonts cannot be loaded.
44
58
  */
45
59
  render(container: HTMLElement, options?: RenderOptions): Promise<void>;
60
+ /** The drawn staff needs the staffless font: a fallback font would draw
61
+ * its own lines, or none at all. Same check as the style set's fonts. */
62
+ private static verifyStaffless;
46
63
  /** Builds a line's notes div: the chant font text plus, on broken
47
64
  * lines, the break marker `*` as an inline span (so it shares the
48
65
  * text's baseline) shifted right so its right edge lands on the
@@ -58,6 +75,7 @@ export declare class GuidoRender {
58
75
  * run, carrying the run's inline styles and its notation-fixed kind
59
76
  * class (`liturgy`, `rubric`, `star`, `marker`, `plus`); runs marked
60
77
  * `initial` by the `*…*` marker carry the initial class. */
78
+ private static dashSpan;
61
79
  private static sylSpan;
62
80
  private static spacer;
63
81
  }
@@ -1,16 +1,30 @@
1
1
  import { ScriptTransform } from './guidoScriptTransforms';
2
+ import { SpanProblem, TextRun } from './textMarkup';
2
3
  /** One parsed token of the script: a syllable, or a control statement.
3
4
  * `spaceBefore` records whether the source had whitespace between the
4
5
  * previous group and this token's group — it feeds the previous
5
6
  * syllable's `wordEnd` and the `toString()` round-trip. */
6
7
  export type ScriptToken = SyllableToken | StatementToken;
8
+ /** What a syllable token is for, independent of its look. `sung` is the
9
+ * text; `label` a heading that is not sung (`V.`, `ANT.`: a wrapped syllable
10
+ * with no pitch); `sign` a singer's sign (`**`, `*`, the cross); `aid` sung
11
+ * but not part of the text (the differentia, inside `(@aid)`). */
12
+ export type SyllableRole = 'sung' | 'label' | 'sign' | 'aid';
7
13
  /** A syllable token. `held` marks a text-less group held by the syllable
8
14
  * before it (its `wordEnd` is that syllable's); `empty` marks an empty
9
15
  * slot (`~`, or a text-less group at the start): notes but no syllable.
10
- * Both flags are only present when set. */
16
+ * Both flags are only present when set. `text` is what it reads, with no
17
+ * markup in it; `runs` what it draws; `source` how it is written, standing
18
+ * on its own, which is what the rewrites write back. `hyphen` is the marks
19
+ * of the hyphen after it, when a `{…}` span runs on into the next syllable.
20
+ * Text fields are empty on a held group and an empty slot. */
11
21
  export type SyllableToken = {
12
22
  kind: 'syllable';
13
23
  text: string;
24
+ source: string;
25
+ runs: TextRun[];
26
+ hyphen?: string[];
27
+ role: SyllableRole;
14
28
  notes: string;
15
29
  wordEnd: boolean;
16
30
  spaceBefore: boolean;
@@ -19,6 +33,11 @@ export type SyllableToken = {
19
33
  };
20
34
  /** A syllable as `GuidoScript.syllables` lists it. */
21
35
  export type Syllable = Pick<SyllableToken, 'text' | 'notes' | 'wordEnd' | 'held' | 'empty'>;
36
+ /** One word of the script (`GuidoScript.words`). */
37
+ export interface Word {
38
+ text: string;
39
+ syllables: Pick<SyllableToken, 'text' | 'source' | 'runs' | 'role' | 'notes'>[];
40
+ }
22
41
  /** Source offsets of one token (see `GuidoScript.tokenSpans`): `start`
23
42
  * is its text's first character (its group's `(` when it has no text),
24
43
  * `notesStart`/`notesEnd` bound its group's content, `end` is just past
@@ -56,12 +75,17 @@ export type StatementToken = {
56
75
  kind: 'unit';
57
76
  on: boolean;
58
77
  spaceBefore: boolean;
78
+ } | {
79
+ kind: 'aid';
80
+ on: boolean;
81
+ spaceBefore: boolean;
59
82
  };
60
83
  /** 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';
84
+ * `tight` spacing, `keep` on one line, `unit` both, and `aid` the syllables
85
+ * that are sung but are not the text (issue #110). */
86
+ export type RunStatementKind = 'tight' | 'keep' | 'unit' | 'aid';
63
87
  /** The run properties a run statement sets. */
64
- export declare function runProperties(kind: RunStatementKind): ('tight' | 'keep')[];
88
+ export declare function runProperties(kind: RunStatementKind): ('tight' | 'keep' | 'aid')[];
65
89
  /** Whether a group's content is a control statement (`@`-keyword,
66
90
  * trimmed). Shared with the transforms, which must leave statement
67
91
  * groups alone — their keyword characters are pitch glyphs otherwise.
@@ -96,6 +120,9 @@ export declare class GuidoScript {
96
120
  * content and just past its group's `)`. The walker
97
121
  * (`scriptSyllables`) reads them. */
98
122
  get tokenSpans(): TokenSpan[];
123
+ /** What is wrong with the script's `{…}` spans: such a span renders
124
+ * plainly instead of failing the score. */
125
+ get spanProblems(): SpanProblem[];
99
126
  private parse;
100
127
  /** The script broken into syllables, each with its sung text and
101
128
  * notes — the syllable tokens, statements filtered out. */
@@ -112,21 +139,18 @@ export declare class GuidoScript {
112
139
  private get normalized();
113
140
  /** The syllables grouped into the words of the text. Held groups and
114
141
  * empty slots sing no syllable of their own, so they are left out. */
115
- get words(): {
116
- text: string;
117
- syllables: {
118
- text: string;
119
- notes: string;
120
- }[];
121
- }[];
142
+ get words(): Word[];
122
143
  /** The script rebuilt from the parsed pieces — a round-trip of the
123
144
  * source, statements and stanzas included. */
124
145
  toString(): string;
125
146
  }
126
- /** One text-bearing syllable of a script (see `scriptSyllables`). */
147
+ /** One syllable of a script (see `scriptSyllables`). */
127
148
  export interface ScriptSyllable {
128
- /** Its text, escapes folded and whitespace trimmed */
149
+ /** The text to read: escapes folded, no markup in it */
129
150
  text: string;
151
+ /** Its text as written, markup and escapes kept */
152
+ source: string;
153
+ role: SyllableRole;
130
154
  /** Its own note group's content, escapes folded */
131
155
  notes: string;
132
156
  /** The groups it holds (issue #83), escapes folded, in order */
@@ -147,17 +171,30 @@ export interface ScriptSyllable {
147
171
  token: number;
148
172
  }
149
173
  /**
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`.
174
+ * The syllables of a script, in order: by default the sung ones, labels and
175
+ * signs left out (`roles` chooses others). Held groups ride on their
176
+ * syllable (`held`); `~` empty slots, statements and `(@stanza …)` are
177
+ * skipped. Word starts and ends are the listed syllables' own, so a word
178
+ * end on a left-out syllable lands on the one before it. Offsets index the
179
+ * script's source; index i is the "syllable i" of `composeScript`'s
180
+ * `from`/`to`.
156
181
  */
157
- export declare function scriptSyllables(script: GuidoScript | string): ScriptSyllable[];
158
- /** The sung text of the script: the clef stripped, syllables joined
159
- * into words, and the words joined with single spaces. */
160
- export declare function chantText(script: string): string;
182
+ export declare function scriptSyllables(script: GuidoScript | string, options?: {
183
+ roles?: readonly SyllableRole[];
184
+ }): ScriptSyllable[];
185
+ /** What `chantText` adds to the sung words, both off by default. */
186
+ export interface ChantTextOptions {
187
+ /** Keep the labels (`V.`, `R.`, `ANT.`) */
188
+ labels?: boolean;
189
+ /** Keep the sung aids (the differentia) */
190
+ aids?: boolean;
191
+ }
192
+ /** The text of the script to read: the sung words joined with single
193
+ * spaces, with no markup, labels, signs or aids in them. Characters the
194
+ * author escaped stay. */
195
+ export declare function chantText(script: string, options?: ChantTextOptions): string;
196
+ /** A syllable's text fields, from text written on its own. */
197
+ export declare function syllableText(written: string): Pick<SyllableToken, 'text' | 'source' | 'runs' | 'hyphen'>;
161
198
  /** Folds backslash escapes into the characters they stand for. Shared
162
199
  * with the transforms module (guidoScriptTransforms.ts). */
163
200
  export declare function unescape(text: string): string;
@@ -5,24 +5,6 @@ export interface ScriptTransform {
5
5
  name: string;
6
6
  apply: (source: string) => string;
7
7
  }
8
- /** The `startWithInitial` transform: finds the first syllable group with
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. */
13
- declare function startWithInitial(source: string): string;
14
- /**
15
- * The built-in transformations, keyed by name; pass the ones a feature
16
- * needs to the GuidoScript constructor.
17
- */
18
- export declare const SCRIPT_TRANSFORMS: {
19
- /** Wraps the first letter of the first syllable that has notes in
20
- * `*…*`, the initial marker of the style marking system. */
21
- startWithInitial: {
22
- name: string;
23
- apply: typeof startWithInitial;
24
- };
25
- };
26
8
  /** The pitch rows of the chant font: every character carrying pitch
27
9
  * information, grouped into rows of neighbouring pitches from low to
28
10
  * high. A transpose shift moves a character this many positions along
@@ -1,4 +1,4 @@
1
- import { ScriptTransform } from './guidoScriptTransforms';
1
+ import { Mark, TextRun } from './textMarkup';
2
2
  /** How one run of syllable text is drawn. Unset fields inherit from the
3
3
  * surrounding text line: the style set's text font stack, its base weight,
4
4
  * and the theme's text color. */
@@ -15,12 +15,16 @@ export interface PartStyle {
15
15
  /** Raised above the baseline by this fraction of the text size; does
16
16
  * not affect width measurement (position: relative, out of flow) */
17
17
  raise?: number;
18
- /** The run's text is uppercased before measuring and rendering: the
19
- * small-caps look is faked as uniformly scaled capitals, which canvas
20
- * measures exactly like the DOM lays out (font-variant: small-caps
21
- * does not — the browser's canvas synthesis measures wider than the
22
- * real smcp glyphs it uses for DOM layout) */
18
+ /** The run draws in capitals, through CSS text-transform; its
19
+ * capitals are measured as they draw, which canvas does exactly like
20
+ * the DOM lays out (font-variant: small-caps does not — the browser's
21
+ * canvas synthesis measures wider than the real smcp glyphs it uses
22
+ * for DOM layout). Display only: the run's text stays as written. */
23
23
  uppercase?: boolean;
24
+ /** True small caps (the `sc` mark): lowercase letters draw as capitals
25
+ * at `SMALL_CAP_SCALE`, in runs of their own, and the rest at full size.
26
+ * On a resolved run, marks the small letters (Word's small-caps run). */
27
+ smallCaps?: boolean;
24
28
  /** Inline color; absent means inherit (keeps dark mode working) */
25
29
  color?: string;
26
30
  /** The run carries the initial class in the DOM (the `*…*` marker) */
@@ -44,24 +48,21 @@ export interface StyleSet {
44
48
  family: string;
45
49
  weight: '400' | '700';
46
50
  }[];
47
- /** Special syllable renderings keyed by their wrapper character:
48
- * `__…__` the Liturgy font, `_…_` rubrics, `*…*` the initial (which
49
- * may also wrap any part of a syllable) */
50
- decorations: Record<string, PartStyle>;
51
- /** The whole-syllable `**` star: rendered as ∗ at the base size,
52
- * raised like the `+`; measured at 95% because no font in the stacks
53
- * has U+2217 and the fallback glyph's advance is wider than the Times
54
- * `*` (0.523 em vs 0.5 em) — the smaller measure size keeps the star's
55
- * footprint at the plain star's. */
56
- specialStarStyle: PartStyle;
51
+ /** The marks this style set draws, by name: the semantic ones the
52
+ * sugar produces (`liturgy` for `__…__`, `rubric` for `_…_`, `initial`
53
+ * for `*…*`, `star` for `**`, `plus` for a Liturgy run's `+`) and any
54
+ * others a script names in a `{…}` span. A consumer's style set extends
55
+ * them; the primitives (`red`, `b`, `i`, `sc`…) always mean the same. */
56
+ marks: Record<string, PartStyle>;
57
+ /** Colors `color:<name>` and a mark's `color` can name, past the
58
+ * built-in palette: a CSS color or a `var(--…)` the Word export knows */
59
+ colors?: Record<string, string>;
60
+ /** Fonts `font:<name>` can name, past the built-in ones: a font stack.
61
+ * A webfont also belongs in `verifiedFonts`. */
62
+ fonts?: Record<string, string>;
57
63
  /** Line-end padding in px: the break marker `*` lands this far past
58
64
  * the max-width position. Defaults to 0 (the star sits on the edge). */
59
65
  padding?: number;
60
- /** Script transforms applied by default when a score renders in this
61
- * style: whoever parses the score's source (embed runtime, editor)
62
- * starts from this list and layers user-requested transforms (e.g.
63
- * transpose) on top. Defaults to no transforms. */
64
- scriptTransforms?: ScriptTransform[];
65
66
  }
66
67
  export declare const STYLE_SETS: {
67
68
  /** Book Antiqua text with red accents. */
@@ -79,36 +80,33 @@ export declare const STYLE_SETS: {
79
80
  family: string;
80
81
  weight: "700";
81
82
  })[];
82
- decorations: {
83
- __: {
83
+ marks: {
84
+ liturgy: {
84
85
  fontFamily: string;
85
86
  weight: "700";
86
87
  color: string;
87
88
  };
88
- _: {
89
+ rubric: {
89
90
  uppercase: true;
90
91
  scale: number;
91
92
  color: string;
92
93
  };
93
- '*': {
94
+ initial: {
94
95
  weight: "700";
95
96
  color: string;
96
97
  initial: true;
97
98
  };
98
- };
99
- specialStarStyle: {
100
- fontFamily: string;
101
- weight: "700";
102
- scale: number;
103
- measureScale: number;
104
- raise: number;
105
- color: string;
99
+ star: {
100
+ fontFamily: string;
101
+ weight: "700";
102
+ scale: number;
103
+ measureScale: number;
104
+ raise: number;
105
+ color: string;
106
+ };
107
+ plus: PartStyle;
106
108
  };
107
109
  padding: number;
108
- scriptTransforms: {
109
- name: string;
110
- apply: (source: string) => string;
111
- }[];
112
110
  };
113
111
  /** Times New Roman text, strictly black and white. */
114
112
  Vesperale: {
@@ -121,33 +119,45 @@ export declare const STYLE_SETS: {
121
119
  family: string;
122
120
  weight: "700";
123
121
  })[];
124
- decorations: {
125
- __: {
122
+ marks: {
123
+ liturgy: {
126
124
  fontFamily: string;
127
125
  weight: "700";
128
126
  };
129
- _: {
127
+ rubric: {
130
128
  scale: number;
131
129
  italic: true;
132
130
  };
133
- '*': {
131
+ initial: {
134
132
  weight: "700";
135
133
  initial: true;
136
134
  };
137
- };
138
- specialStarStyle: {
139
- fontFamily: string;
140
- weight: "700";
141
- scale: number;
142
- measureScale: number;
143
- raise: number;
135
+ star: {
136
+ fontFamily: string;
137
+ weight: "700";
138
+ scale: number;
139
+ measureScale: number;
140
+ raise: number;
141
+ };
142
+ plus: PartStyle;
144
143
  };
145
144
  padding: number;
146
- scriptTransforms: never[];
147
145
  };
148
146
  };
149
- export type StyleSetName = keyof typeof STYLE_SETS;
147
+ /** A style set's name: a built-in one, or one `defineStyleSet` added. */
148
+ export type StyleSetName = keyof typeof STYLE_SETS | (string & {});
150
149
  export declare const DEFAULT_STYLE_SET: StyleSetName;
150
+ /** The style set of that name, built-in or defined. */
151
+ export declare function styleSetOf(name: StyleSetName): StyleSet | undefined;
152
+ /** What a new style set says: the set it extends (default: the default
153
+ * one), and whatever differs from it. `marks`, `colors` and `fonts` merge
154
+ * over the extended set's, the rest replaces it. */
155
+ export type StyleSetDefinition = Partial<StyleSet> & {
156
+ extends?: StyleSetName;
157
+ };
158
+ /** Adds a style set under a name `style` can then give, without patching
159
+ * the package. Returns it. */
160
+ export declare function defineStyleSet(name: string, definition: StyleSetDefinition): StyleSet;
151
161
  /** What one run of syllable text is, independent of how a style set
152
162
  * draws it: the notation-fixed meaning of the markup that produced it.
153
163
  * `liturgy` the `__…__` wrapper, `rubric` `_…_`, `star` the whole-syllable
@@ -162,30 +172,31 @@ export interface SyllablePart {
162
172
  style: PartStyle;
163
173
  kind?: ChantRunKind;
164
174
  }
165
- /**
166
- * Resolves a syllable's raw text into the runs it renders as: the whole-
167
- * syllable `**` star renders as the bold ∗ operator, a `__…__` or `_…_`
168
- * wrapper (the same characters on both ends, content between) picks up
169
- * its decoration rule from the style set, and paired `*` markers wrap any
170
- * part of the syllable — even the whole of it — with the initial rule
171
- * (`*sam*ple` → "sam" in the initial style, "ple" normal; an unmatched
172
- * `*` renders literally), the `bold` option forces weight 700 onto every
173
- * run, and the marker characters (`*`, `†`) split off into runs of their
174
- * own — with the style set's `markerGlyphs` font when one is configured,
175
- * the text font otherwise (always the `marker` kind).
176
- * Inside a Liturgy-font run, `+` gets its own weight-400 runs — the font
177
- * is bold-looking by design, so the weight stays normal. The wrapper
178
- * characters themselves are dropped. Each run also carries `kind`, the
179
- * notation-fixed semantic of its markup (`liturgy`, `rubric`, `star`,
180
- * `marker`, `plus`) — the vocabulary the marked-up text export and the
181
- * renderer's run classes share, identical across style sets. `rawCase`
182
- * skips the BNS rubric uppercasing: uppercasing is presentation, so the
183
- * marked-up text export keeps the raw letter case (a consumer CSS applies
184
- * text-transform instead).
185
- */
186
- export declare function resolveSyllableParts(text: string, styleSet: StyleSet, bold: boolean, options?: {
187
- rawCase?: boolean;
188
- }): SyllablePart[];
175
+ /** How much smaller small capitals draw than the full capitals. */
176
+ export declare const SMALL_CAP_SCALE = 0.75;
177
+ /** The run kind of a run's marks: the last of the notation's own. */
178
+ export declare function kindOf(marks: Mark[]): ChantRunKind | undefined;
179
+ /** Marks a score adds to its style set's. */
180
+ export type MarkDefinitions = Record<string, PartStyle>;
181
+ /** The look of comma-separated marks (`red,sc`), for a host styling prose
182
+ * to match the score. */
183
+ export declare function resolveMarks(marks: string, styleSet: StyleSet, extra?: MarkDefinitions): PartStyle;
184
+ /** The marks of `marks` that neither the primitives, the style set nor
185
+ * `extra` define. */
186
+ export declare function unknownMarks(marks: Mark[], styleSet: StyleSet, extra?: MarkDefinitions): Mark[];
187
+ /** Resolves parsed text runs (`SyllableToken.runs`) into how a style set
188
+ * draws them: each run takes the style of its marks, the `bold` option
189
+ * forces weight 700 onto every run, and `kind` names its notation-fixed
190
+ * semantic (`liturgy`, `rubric`, `star`, `marker`, `plus`), the vocabulary
191
+ * the marked-up text export and the renderer's run classes share. A
192
+ * small-caps run splits into full and small parts. Text stays as written:
193
+ * capitals are the part's display (`drawnText`). */
194
+ export declare function resolveTextRuns(runs: readonly TextRun[], styleSet: StyleSet, bold: boolean, extra?: MarkDefinitions): SyllablePart[];
195
+ /** The characters a part draws, which measuring must see. */
196
+ export declare function drawnText(part: Pick<SyllablePart, 'text' | 'style'>): string;
197
+ /** Parses a syllable as written (`SyllableToken.source`) and resolves its
198
+ * runs in one step (see `resolveSpans`, `resolveTextRuns`). */
199
+ export declare function resolveSyllableParts(written: string, styleSet: StyleSet, bold: boolean, extra?: MarkDefinitions): SyllablePart[];
189
200
  /** The canvas font shorthand for measuring a run at the text size. */
190
201
  export declare function measurementFont(style: PartStyle, textPx: number, fallbackStack: string): string;
191
202
  /** The inline CSS properties that draw a run, as dash-cased names for
@@ -1,7 +1,9 @@
1
- import { MaxWidth } from '../embed/core';
2
- import { StyleSetName } from '../guidoStyles';
3
- import { EmptySlots, StanzaStack, StanzaWarning } from '../stanzas';
4
- export interface GuidexScoreProps {
1
+ import { MaxWidth, ScoreWarning } from '../embed/core';
2
+ import { StaffFill } from '../chantLayout';
3
+ import { StyleSetName, MarkDefinitions } from '../guidoStyles';
4
+ import { EmptySlots, StanzaStack } from '../stanzas';
5
+ import { DrawnStaffOptions } from '../drawnStaff';
6
+ export interface GuidexScoreProps extends DrawnStaffOptions {
5
7
  /** The score source in GuidoScript notation, e.g. `'(M)A(0) di(0q)e(qQ0)bus(1) an(3)ti(1e)quis(qQ0-:)'`. */
6
8
  script: string;
7
9
  /** Line-breaking budget in px, or 'auto' to fit the container (default). */
@@ -13,6 +15,16 @@ export interface GuidexScoreProps {
13
15
  textPx?: number;
14
16
  /** Dashes in a normal junction between note groups, in steps of a third (default 3). */
15
17
  junctionDashes?: number;
18
+ /** Marks this score adds to its style set's */
19
+ marks?: MarkDefinitions;
20
+ /** How far each staff line runs (default `all-but-last`). */
21
+ staffFill?: StaffFill;
22
+ /** With `staffFill: 'longest'`: the distance from the available width within which every line runs to it instead (default 0). */
23
+ staffFillSnapPx?: number;
24
+ /** Render a recitation that covers exactly 2 syllables on a line as plain notes of the same pitch (default true). */
25
+ twoSyllableRecitationsToPlain?: boolean;
26
+ /** Render 3 or more syllables on one plain note with a reciting glyph on a line as a recitation (default false). */
27
+ plainRunsToRecitation?: boolean;
16
28
  /** Transpose the score by N diatonic steps. */
17
29
  transpose?: number;
18
30
  /** The stanza sung under the notes (1-based, default 1: the
@@ -31,9 +43,9 @@ export interface GuidexScoreProps {
31
43
  emptySlots?: EmptySlots;
32
44
  /** Called after each render with the rendered stanzas' count
33
45
  * mismatches (empty when it fits). */
34
- onWarnings?: (warnings: StanzaWarning[]) => void;
46
+ onWarnings?: (warnings: ScoreWarning[]) => void;
35
47
  /** Render measurement debug markers. */
36
48
  debug?: boolean;
37
49
  className?: string;
38
50
  }
39
- export declare function GuidexScore({ script, maxWidth, style, bold, textPx, junctionDashes, transpose, stanza, stack, stanzas, emptySlots, onWarnings, debug, className, }: GuidexScoreProps): import('react').JSX.Element;
51
+ export declare function GuidexScore({ script, maxWidth, style, bold, textPx, junctionDashes, marks, staffFill, staffFillSnapPx, twoSyllableRecitationsToPlain, plainRunsToRecitation, transpose, stanza, stack, stanzas, emptySlots, onWarnings, debug, className, staff, staffLines, staffColor, staffLineColors, staffPitchColors, staffWeight, staffLineWeights, staffClefLineWeight, staffOverflow, staffSnap, }: GuidexScoreProps): import('react').JSX.Element;
@@ -5,5 +5,7 @@
5
5
  export { GuidexScore, type GuidexScoreProps } from './GuidexScore';
6
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
+ export type { StaffFill } from '../chantLayout';
8
9
  export type { StyleSetName } from '../guidoStyles';
10
+ export type { MarkWarning } from '../chantMarkup';
9
11
  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-lvOrTbG-.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-B2SGdROL.js";
3
3
  import { useEffect, useRef } from "react";
4
4
  import { jsx } from "react/jsx-runtime";
5
5
  //#region src/react/GuidexScore.tsx
@@ -10,30 +10,59 @@ 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, junctionDashes, transpose, stanza, stack, stanzas, emptySlots, onWarnings, debug, className }) {
13
+ function GuidexScore({ script, maxWidth, style, bold, textPx, junctionDashes, marks, staffFill, staffFillSnapPx, twoSyllableRecitationsToPlain, plainRunsToRecitation, transpose, stanza, stack, stanzas, emptySlots, onWarnings, debug, className, staff, staffLines, staffColor, staffLineColors, staffPitchColors, staffWeight, staffLineWeights, staffClefLineWeight, staffOverflow, staffSnap }) {
14
14
  const ref = useRef(null);
15
15
  const onWarningsRef = useRef(onWarnings);
16
16
  onWarningsRef.current = onWarnings;
17
17
  const stanzasKey = stanzas === void 0 ? void 0 : JSON.stringify(stanzas);
18
+ const marksKey = marks === void 0 ? void 0 : JSON.stringify(marks);
18
19
  const stackKey = stack === void 0 ? void 0 : JSON.stringify(stack);
20
+ const colorsKey = JSON.stringify([
21
+ staffColor ?? null,
22
+ staffLineColors ?? null,
23
+ staffPitchColors ?? null
24
+ ]);
25
+ const lineWeightsKey = staffLineWeights === void 0 ? void 0 : JSON.stringify(staffLineWeights);
26
+ const overflowStart = staffOverflow?.start;
27
+ const overflowEnd = staffOverflow?.end;
19
28
  useEffect(() => {
20
29
  const el = ref.current;
21
30
  if (!el) return;
22
31
  let live = true;
32
+ const scoreMarks = marksKey === void 0 ? void 0 : JSON.parse(marksKey);
23
33
  const stanzaTexts = stanzasKey === void 0 ? void 0 : JSON.parse(stanzasKey);
24
34
  const stacked = stackKey === void 0 ? void 0 : JSON.parse(stackKey);
35
+ const [color, lineColors, pitchColors] = JSON.parse(colorsKey);
25
36
  renderScore(el, script, {
26
37
  maxWidth,
27
38
  style,
39
+ marks: scoreMarks,
28
40
  bold,
29
41
  textPx,
30
42
  junctionDashes,
43
+ staffFill,
44
+ staffFillSnapPx,
45
+ twoSyllableRecitationsToPlain,
46
+ plainRunsToRecitation,
31
47
  transpose,
32
48
  stanza,
33
49
  stack: stacked,
34
50
  stanzas: stanzaTexts,
35
51
  emptySlots,
36
- debug
52
+ debug,
53
+ staff,
54
+ staffLines,
55
+ staffSnap,
56
+ staffColor: color ?? void 0,
57
+ staffLineColors: lineColors ?? void 0,
58
+ staffPitchColors: pitchColors ?? void 0,
59
+ staffWeight,
60
+ staffClefLineWeight,
61
+ staffOverflow: overflowStart === void 0 && overflowEnd === void 0 ? void 0 : {
62
+ start: overflowStart,
63
+ end: overflowEnd
64
+ },
65
+ staffLineWeights: lineWeightsKey === void 0 ? void 0 : JSON.parse(lineWeightsKey)
37
66
  }).then(({ warnings }) => {
38
67
  if (live) onWarningsRef.current?.(warnings);
39
68
  });
@@ -45,15 +74,29 @@ function GuidexScore({ script, maxWidth, style, bold, textPx, junctionDashes, tr
45
74
  script,
46
75
  maxWidth,
47
76
  style,
77
+ marksKey,
48
78
  bold,
49
79
  textPx,
50
80
  junctionDashes,
81
+ staffFill,
82
+ staffFillSnapPx,
83
+ twoSyllableRecitationsToPlain,
84
+ plainRunsToRecitation,
51
85
  transpose,
52
86
  stanza,
53
87
  stackKey,
54
88
  stanzasKey,
55
89
  emptySlots,
56
- debug
90
+ debug,
91
+ staff,
92
+ staffLines,
93
+ staffSnap,
94
+ colorsKey,
95
+ staffWeight,
96
+ lineWeightsKey,
97
+ staffClefLineWeight,
98
+ overflowStart,
99
+ overflowEnd
57
100
  ]);
58
101
  return /* @__PURE__ */ jsx("div", {
59
102
  ref,