guidex 0.2.6 → 0.3.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.
Files changed (46) hide show
  1. package/README.md +235 -0
  2. package/dist/lib/app/ControlsRow.d.ts +1 -0
  3. package/dist/lib/app/Editor.d.ts +1 -0
  4. package/dist/lib/app/EditorContext.d.ts +17 -0
  5. package/dist/lib/app/EditorTextarea.d.ts +1 -0
  6. package/dist/lib/app/ExportSettings.d.ts +1 -0
  7. package/dist/lib/app/FeedbackSpan.d.ts +5 -0
  8. package/dist/lib/app/RenderSettings.d.ts +1 -0
  9. package/dist/lib/app/SamplesRow.d.ts +1 -0
  10. package/dist/lib/app/SettingsMenu.d.ts +1 -0
  11. package/dist/lib/app/SettingsPanel.d.ts +1 -0
  12. package/dist/lib/app/SyllablesTable.d.ts +1 -0
  13. package/dist/lib/app/WordCheckPanel.d.ts +1 -0
  14. package/dist/lib/app/WordCopyControls.d.ts +1 -0
  15. package/dist/lib/app/chantLibrary.d.ts +11 -0
  16. package/dist/lib/app/editorState.d.ts +159 -0
  17. package/dist/lib/app/samples.d.ts +10 -0
  18. package/dist/lib/app/wordCopy.d.ts +30 -0
  19. package/dist/lib/chantLayout-GAfg2iKS.js +1042 -0
  20. package/dist/lib/chantLayout.d.ts +169 -0
  21. package/dist/lib/chantMarkup.d.ts +36 -0
  22. package/dist/lib/editorStorage.d.ts +179 -0
  23. package/dist/lib/embed/index.d.ts +1 -0
  24. package/dist/lib/embed/index.js +2 -2
  25. package/dist/lib/embed/manual.d.ts +16 -4
  26. package/dist/lib/embed/manual.js +315 -2
  27. package/dist/lib/glyphFamilies.d.ts +46 -0
  28. package/dist/lib/guidoRender.d.ts +22 -29
  29. package/dist/lib/guidoScript.d.ts +28 -3
  30. package/dist/lib/guidoScriptTransforms.d.ts +5 -4
  31. package/dist/lib/guidoStyles.d.ts +23 -5
  32. package/dist/lib/main.d.ts +0 -1
  33. package/dist/lib/react/index.d.ts +1 -0
  34. package/dist/lib/react/index.js +2 -2
  35. package/dist/lib/scoreImage-oVBasBX5.js +951 -0
  36. package/dist/lib/scoreImage.d.ts +63 -0
  37. package/dist/lib/word/index.d.ts +17 -0
  38. package/dist/lib/word/index.js +2 -0
  39. package/dist/lib/wordChecker-C3nJrk_j.js +1042 -0
  40. package/dist/lib/wordChecker.d.ts +66 -0
  41. package/dist/lib/wordClipboard.d.ts +25 -0
  42. package/dist/lib/wordExport.d.ts +244 -0
  43. package/dist-embed/guidex-embed.min.js +1 -1
  44. package/package.json +8 -1
  45. package/dist/lib/core-hF6L1EtS.js +0 -1268
  46. package/dist/lib/settingsMenu.d.ts +0 -1
@@ -1,2 +1,315 @@
1
- import { a as version, c as GuidoScript, i as renderScore, l as chantText, n as init, o as DEFAULT_STYLE_SET, r as renderAll, s as STYLE_SETS, t as dispose, u as unescape } from "../core-hF6L1EtS.js";
2
- export { DEFAULT_STYLE_SET, GuidoScript, STYLE_SETS, chantText, dispose, init, renderAll, renderScore, unescape, version };
1
+ 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 { f as GuidoScript, m as unescape, o as DEFAULT_STYLE_SET, p as chantText, s as STYLE_SETS, u as resolveSyllableParts } from "../chantLayout-GAfg2iKS.js";
3
+ import { a as DEFAULT_TAB_INTERVAL_PT, c as toWordHtml, i as DEFAULT_SPACER, l as toWordText, n as copyWordHtml, o as SpacerMeter, r as copyWordPlainText, s as layoutForWord, t as checkWordHtml, u as wordLayoutText } from "../wordChecker-C3nJrk_j.js";
4
+ //#region src/chantMarkup.ts
5
+ /**
6
+ * The marked-up sung text of a chant script, for other applications: the
7
+ * same run resolution the renderer draws, expressed as notation-fixed
8
+ * semantic kinds instead of style-set CSS values. `chantRuns` gives the
9
+ * structured form (words → syllables → runs); `chantHtml` serializes it
10
+ * as HTML spans classed with those kinds (`liturgy`, `rubric`, `star`,
11
+ * `marker`, `plus`, plus `initial`), so a consumer styles the classes
12
+ * with its own CSS.
13
+ */
14
+ var chantRunOf = (part) => {
15
+ const run = { text: part.text };
16
+ if (part.kind !== void 0) run.kind = part.kind;
17
+ if (part.style.initial) run.initial = true;
18
+ return run;
19
+ };
20
+ /** The marked-up sung text of the script: its words, their syllables,
21
+ * and each syllable's runs of notation-fixed kinds. Renders exactly the
22
+ * text a score render would (including the style set's default script
23
+ * transforms) with the style-set presentation stripped; letter case is
24
+ * the raw text's, so a BNS-look consumer uppercases rubrics in CSS. */
25
+ function chantRuns(script, options = {}) {
26
+ const styleSet = STYLE_SETS[options.style ?? "BNS"];
27
+ return new GuidoScript(script, { transforms: styleSet.scriptTransforms ?? [] }).words.map((word) => ({ syllables: word.syllables.map((syl) => ({ runs: resolveSyllableParts(syl.text, styleSet, false, { rawCase: true }).map(chantRunOf) })) }));
28
+ }
29
+ /** The marked-up sung text as an HTML string: one span per kinded or
30
+ * initial run, classed with the kind (and `initial`), bare text
31
+ * otherwise. Syllables of a word concatenate and words join with single
32
+ * spaces — hyphenation is the consumer's job, and `chantRuns` has the
33
+ * syllable boundaries. Text is HTML-escaped. */
34
+ function chantHtml(script, options = {}) {
35
+ return chantRuns(script, options).map((word) => word.syllables.map((syl) => syl.runs.map(runHtml).join("")).join("")).join(" ");
36
+ }
37
+ var runHtml = (run) => {
38
+ const classes = [...run.kind ? [run.kind] : [], ...run.initial ? ["initial"] : []].join(" ");
39
+ return classes ? `<span class="${classes}">${escapeHtml(run.text)}</span>` : escapeHtml(run.text);
40
+ };
41
+ var escapeHtml = (text) => text.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
42
+ //#endregion
43
+ //#region src/glyphFamilies.ts
44
+ /** Base pitch glyph → its variants. Keys are the note glyphs of the
45
+ * first column of `PITCH_ROWS`' notation table. */
46
+ var FAMILIES = {
47
+ ð: {
48
+ smallHead: "~",
49
+ modifyUp: "È",
50
+ cephalicus: "®"
51
+ },
52
+ ñ: {
53
+ virga: "^",
54
+ smallHead: "¯",
55
+ modifyUp: "Ê",
56
+ modifyDown: "÷",
57
+ cephalicus: "−",
58
+ connectOneDown: "Ý"
59
+ },
60
+ "0": {
61
+ virga: "]",
62
+ smallHead: "‚",
63
+ modifyUp: "Ë",
64
+ modifyDown: "ø",
65
+ modifyNatural: "“",
66
+ cephalicus: "§",
67
+ connectOneDown: "Þ"
68
+ },
69
+ "1": {
70
+ virga: "q",
71
+ longa: "Ÿ",
72
+ smallHead: "ƒ",
73
+ modifyUp: "Ì",
74
+ modifyDown: "a",
75
+ modifyNatural: "”",
76
+ cephalicus: "ÿ",
77
+ connectOneDown: "Q",
78
+ connectTwoDown: "×",
79
+ connectThreeDown: "Ø",
80
+ smallPoint: "í"
81
+ },
82
+ "2": {
83
+ virga: "w",
84
+ longa: "¡",
85
+ smallHead: "„",
86
+ modifyUp: "Î",
87
+ modifyDown: "A",
88
+ modifyNatural: "•",
89
+ cephalicus: "\"",
90
+ connectOneDown: "W",
91
+ connectTwoDown: "s",
92
+ connectThreeDown: "Ù",
93
+ connectFourDown: "½"
94
+ },
95
+ "3": {
96
+ virga: "e",
97
+ longa: "¢",
98
+ smallHead: "…",
99
+ modifyUp: "Ï",
100
+ modifyDown: "S",
101
+ modifyNatural: "–",
102
+ cephalicus: "+",
103
+ connectOneDown: "E",
104
+ connectTwoDown: "d",
105
+ connectThreeDown: "D",
106
+ connectFourDown: "°",
107
+ smallPoint: "y"
108
+ },
109
+ "4": {
110
+ virga: "r",
111
+ longa: "£",
112
+ smallHead: "†",
113
+ modifyUp: "Ð",
114
+ modifyDown: "Í",
115
+ modifyNatural: "—",
116
+ cephalicus: "!",
117
+ connectOneDown: "R",
118
+ connectTwoDown: "f",
119
+ connectThreeDown: "F",
120
+ connectFourDown: "±"
121
+ },
122
+ "5": {
123
+ virga: "t",
124
+ longa: "[",
125
+ smallHead: "‡",
126
+ modifyUp: "Ñ",
127
+ modifyDown: "Y",
128
+ modifyNatural: "˜",
129
+ cephalicus: "%",
130
+ connectOneDown: "T",
131
+ connectTwoDown: "g",
132
+ connectThreeDown: "G",
133
+ connectFourDown: "²",
134
+ smallPoint: "x"
135
+ },
136
+ "6": {
137
+ virga: "z",
138
+ longa: "¥",
139
+ smallHead: "ˆ",
140
+ modifyUp: "Ò",
141
+ modifyDown: "X",
142
+ modifyNatural: "™",
143
+ cephalicus: "/",
144
+ connectOneDown: "Z",
145
+ connectTwoDown: "h",
146
+ connectThreeDown: "H",
147
+ connectFourDown: "³"
148
+ },
149
+ "7": {
150
+ virga: "u",
151
+ longa: "¦",
152
+ smallHead: "‰",
153
+ modifyUp: "þ",
154
+ modifyDown: "C",
155
+ modifyNatural: "š",
156
+ cephalicus: "=",
157
+ connectOneDown: "U",
158
+ connectTwoDown: "j",
159
+ connectThreeDown: "J",
160
+ connectFourDown: "´",
161
+ smallPoint: "c"
162
+ },
163
+ "8": {
164
+ virga: "i",
165
+ longa: "©",
166
+ smallHead: "Š",
167
+ modifyUp: "ß",
168
+ modifyDown: "V",
169
+ modifyNatural: "›",
170
+ cephalicus: "(",
171
+ connectOneDown: "I",
172
+ connectTwoDown: "k",
173
+ connectThreeDown: "K",
174
+ connectFourDown: "μ"
175
+ },
176
+ "9": {
177
+ virga: "o",
178
+ longa: "ª",
179
+ smallHead: "‹",
180
+ modifyUp: "ò",
181
+ modifyDown: "B",
182
+ modifyNatural: "œ",
183
+ cephalicus: ")",
184
+ connectOneDown: "O",
185
+ connectTwoDown: "l",
186
+ connectThreeDown: "L",
187
+ connectFourDown: "·",
188
+ smallPoint: "v"
189
+ },
190
+ ö: {
191
+ virga: "p",
192
+ longa: "«",
193
+ smallHead: "Œ",
194
+ modifyUp: "ô",
195
+ modifyDown: "N",
196
+ modifyNatural: "º",
197
+ cephalicus: "Ö",
198
+ connectOneDown: "P",
199
+ connectTwoDown: "é",
200
+ connectThreeDown: "É",
201
+ connectFourDown: "¾"
202
+ },
203
+ ü: {
204
+ virga: "õ",
205
+ longa: "¬",
206
+ smallHead: "‘",
207
+ modifyUp: "ù",
208
+ modifyDown: "$",
209
+ modifyNatural: "»",
210
+ cephalicus: "Ü",
211
+ connectOneDown: "Õ",
212
+ connectTwoDown: "á",
213
+ connectThreeDown: "Á",
214
+ connectFourDown: "¸",
215
+ smallPoint: "b"
216
+ },
217
+ ó: {
218
+ virga: "ú",
219
+ smallHead: "’",
220
+ modifyUp: "ý",
221
+ modifyDown: "m",
222
+ cephalicus: "Ó",
223
+ connectOneDown: "Ú",
224
+ connectTwoDown: "û",
225
+ connectThreeDown: "Û",
226
+ connectFourDown: "¹"
227
+ }
228
+ };
229
+ /** Base pitch glyph → its pitch name in the standard g-clef (the
230
+ * "pitch in standard g-clef" column of the notation table). The last
231
+ * row of that table has no base glyph, so it has no entry here. */
232
+ var G_CLEF_PITCHES = {
233
+ ð: "a",
234
+ ñ: "b",
235
+ "0": "c'",
236
+ "1": "d'",
237
+ "2": "e'",
238
+ "3": "f'",
239
+ "4": "g'",
240
+ "5": "a'",
241
+ "6": "b'",
242
+ "7": "c''",
243
+ "8": "d''",
244
+ "9": "e''",
245
+ ö: "f''",
246
+ ü: "g''",
247
+ ó: "a''"
248
+ };
249
+ /** The standard g-clef pitch name of a base glyph, or of the base of a
250
+ * variant glyph; undefined when the glyph has no pitch. */
251
+ function gClefPitchOf(ch) {
252
+ return G_CLEF_PITCHES[ch] ?? G_CLEF_PITCHES[baseOf(ch)?.base ?? ""];
253
+ }
254
+ /** Reverse lookup: variant glyph → its base glyph and role. Built once;
255
+ * the table has no glyph in two places, so each variant maps to one base. */
256
+ var BASES = /* @__PURE__ */ new Map();
257
+ for (const [base, family] of Object.entries(FAMILIES)) for (const role of Object.keys(family)) BASES.set(family[role], {
258
+ base,
259
+ role
260
+ });
261
+ /** The variant of `ch` in `role`, or undefined when `ch` has none. */
262
+ function variantOf(ch, role) {
263
+ return FAMILIES[ch]?.[role];
264
+ }
265
+ /** The virga (the stemmed form) of a pitch glyph. */
266
+ function toVirga(ch) {
267
+ return variantOf(ch, "virga");
268
+ }
269
+ /** The longa (the double-length form) of a pitch glyph. */
270
+ function toLonga(ch) {
271
+ return variantOf(ch, "longa");
272
+ }
273
+ /** The small head of a pitch glyph. */
274
+ function toSmallHead(ch) {
275
+ return variantOf(ch, "smallHead");
276
+ }
277
+ /** The cephalicus of a pitch glyph. */
278
+ function toCephalicus(ch) {
279
+ return variantOf(ch, "cephalicus");
280
+ }
281
+ /** The connecting form that joins a pitch to the note `steps` rows below
282
+ * it (1 to 4). */
283
+ function toConnectDown(ch, steps) {
284
+ const role = [
285
+ "connectOneDown",
286
+ "connectTwoDown",
287
+ "connectThreeDown",
288
+ "connectFourDown"
289
+ ][steps - 1];
290
+ return variantOf(ch, role);
291
+ }
292
+ /** The small point (the dot that lengthens a note by half) of a pitch glyph. */
293
+ function toSmallPoint(ch) {
294
+ return variantOf(ch, "smallPoint");
295
+ }
296
+ /** The sharp (raised) form of a pitch glyph. */
297
+ function modifyUp(ch) {
298
+ return variantOf(ch, "modifyUp");
299
+ }
300
+ /** The flat (lowered) form of a pitch glyph. */
301
+ function modifyDown(ch) {
302
+ return variantOf(ch, "modifyDown");
303
+ }
304
+ /** The natural sign for a pitch glyph. */
305
+ function modifyNatural(ch) {
306
+ return variantOf(ch, "modifyNatural");
307
+ }
308
+ /** Reverse lookup: the base glyph and role of a variant glyph, or
309
+ * undefined when `ch` is not a variant. */
310
+ function baseOf(ch) {
311
+ const entry = BASES.get(ch);
312
+ return entry ? { ...entry } : void 0;
313
+ }
314
+ //#endregion
315
+ export { DEFAULT_SPACER, DEFAULT_STYLE_SET, DEFAULT_TAB_INTERVAL_PT, GuidoScript, STYLE_SETS, SpacerMeter, baseOf, chantHtml, chantRuns, chantText, checkWordHtml, copyWordHtml, copyWordPlainText, dispose, downloadScorePng, downloadScoreSvg, gClefPitchOf, init, layoutForWord, modifyDown, modifyNatural, modifyUp, renderAll, renderScore, resolveSyllableParts, scorePngBlob, scoreSvg, toCephalicus, toConnectDown, toLonga, toSmallHead, toSmallPoint, toVirga, toWordHtml, toWordText, unescape, variantOf, version, wordLayoutText };
@@ -0,0 +1,46 @@
1
+ /**
2
+ * Glyph families: the variant glyphs of each pitch glyph (issue #76).
3
+ *
4
+ * A pitch glyph has two kinds of variants. Shape variants keep the pitch
5
+ * and change the note form (virga, longa, small head, cephalicus, the
6
+ * connecting forms); accidental variants are the sharp, flat and natural
7
+ * signs written before a note. Each variant is a separate glyph in the
8
+ * Guidohu font.
9
+ *
10
+ * The table is hand-written from the notation reference, not derived from
11
+ * `PITCH_ROWS` offsets: the accidentals do not follow row position (`1`
12
+ * takes its sharp from row 6 and its flat from row 5). A missing entry
13
+ * means the pitch has no such variant, not an untranscribed one.
14
+ */
15
+ /** The variant roles a pitch glyph can carry. */
16
+ export type VariantRole = 'virga' | 'longa' | 'smallHead' | 'cephalicus' | 'connectOneDown' | 'connectTwoDown' | 'connectThreeDown' | 'connectFourDown' | 'smallPoint' | 'modifyUp' | 'modifyDown' | 'modifyNatural';
17
+ /** The standard g-clef pitch name of a base glyph, or of the base of a
18
+ * variant glyph; undefined when the glyph has no pitch. */
19
+ export declare function gClefPitchOf(ch: string): string | undefined;
20
+ /** The variant of `ch` in `role`, or undefined when `ch` has none. */
21
+ export declare function variantOf(ch: string, role: VariantRole): string | undefined;
22
+ /** The virga (the stemmed form) of a pitch glyph. */
23
+ export declare function toVirga(ch: string): string | undefined;
24
+ /** The longa (the double-length form) of a pitch glyph. */
25
+ export declare function toLonga(ch: string): string | undefined;
26
+ /** The small head of a pitch glyph. */
27
+ export declare function toSmallHead(ch: string): string | undefined;
28
+ /** The cephalicus of a pitch glyph. */
29
+ export declare function toCephalicus(ch: string): string | undefined;
30
+ /** The connecting form that joins a pitch to the note `steps` rows below
31
+ * it (1 to 4). */
32
+ export declare function toConnectDown(ch: string, steps: 1 | 2 | 3 | 4): string | undefined;
33
+ /** The small point (the dot that lengthens a note by half) of a pitch glyph. */
34
+ export declare function toSmallPoint(ch: string): string | undefined;
35
+ /** The sharp (raised) form of a pitch glyph. */
36
+ export declare function modifyUp(ch: string): string | undefined;
37
+ /** The flat (lowered) form of a pitch glyph. */
38
+ export declare function modifyDown(ch: string): string | undefined;
39
+ /** The natural sign for a pitch glyph. */
40
+ export declare function modifyNatural(ch: string): string | undefined;
41
+ /** Reverse lookup: the base glyph and role of a variant glyph, or
42
+ * undefined when `ch` is not a variant. */
43
+ export declare function baseOf(ch: string): {
44
+ base: string;
45
+ role: VariantRole;
46
+ } | undefined;
@@ -1,19 +1,6 @@
1
1
  import { GuidoScript } from './guidoScript';
2
2
  import { StyleSetName } from './guidoStyles';
3
- /**
4
- * Score marker characters: they carry no pitch, and when they sit at the
5
- * start or end of a note group (with the adjacent dash) they act as
6
- * whitespace rather than note width.
7
- */
8
- export declare const SCORE_MARKERS = ",.:?'\"+!%/=()\u00D6\u00DC\u00D3;";
9
- /**
10
- * Special reciting notes: when such a note stands alone in a note group it
11
- * marks recited text. The glyph shows at a run's first syllable (the
12
- * previous syllable has different notes) and at every line start; every
13
- * other recited syllable contributes only the staff-line segments filling
14
- * the space above its text, which flows tight after the previous text.
15
- */
16
- export declare const SPECIAL_NOTES = "\u0178\u00A1\u00A2\u00A3[\u00A5\u00A6\u00A9\u00AA\u00AB\u00AC";
3
+ export { NOTE_MODIFIERS, SCORE_MARKERS } from './chantLayout';
17
4
  /** Options for one render. All fields optional; defaults reproduce the
18
5
  * original Book Antiqua look (style set BNS). */
19
6
  export interface RenderOptions {
@@ -32,24 +19,18 @@ export interface RenderOptions {
32
19
  }
33
20
  /**
34
21
  * Renders a GuidoScript into a tidy score: a notes line in the chant font,
35
- * and a text line where each syllable is centered below its notes. The
36
- * dashes of the chant font are pure whitespace: centering ignores them and
37
- * happens under the non-whitespace note characters only. When a syllable's
38
- * text would overlap the previous one, it starts right after it and the
39
- * notes group is padded with extra dashes until it covers the text.
22
+ * and a text line where each syllable is centered below its notes.
40
23
  *
41
- * Appearance comes from a named style set (see guidoStyles.ts): the render
42
- * options reference it by name, together with the bold option and the
43
- * text/notes sizes.
24
+ * The DOM emitter of the shared layout pass (`layoutScore` in
25
+ * chantLayout.ts, which owns every line-breaking and placement decision):
26
+ * `render` turns the laid-out lines into (notes `.guido` div, text `<p>`)
27
+ * pairs — px-measured inline-block spacer spans fake the horizontal gaps.
28
+ * The Word export (wordExport.ts) consumes the same layout with a
29
+ * character-based spacer mechanism instead.
44
30
  */
45
31
  export declare class GuidoRender {
46
32
  private readonly script;
47
33
  constructor(source: GuidoScript | string);
48
- private static ctx;
49
- private static measure;
50
- /** Ink extents of the text relative to the glyph origin (negative left
51
- * means the ink starts left of the origin). */
52
- private static ink;
53
34
  /**
54
35
  * Renders the score into `container` as (notes line, text line) pairs.
55
36
  * When `maxWidthPx` is finite, a new pair starts before any syllable
@@ -58,9 +39,21 @@ export declare class GuidoRender {
58
39
  * unknown or one of its fonts cannot be loaded.
59
40
  */
60
41
  render(container: HTMLElement, options?: RenderOptions): Promise<void>;
42
+ /** Builds a line's notes div: the chant font text plus, on broken
43
+ * lines, the break marker `*` as an inline span (so it shares the
44
+ * text's baseline) shifted right so its right edge lands on the
45
+ * padding-extended max-width position. position: relative keeps the
46
+ * shift out of the flow measurements. */
47
+ private static notesLine;
48
+ /** Builds a line's text paragraph from its segments: spacer spans fake
49
+ * every horizontal gap (lead-in, word gaps, dash connector pads), each
50
+ * syllable is one span of nested runs, and word spaces are their own
51
+ * spans. */
52
+ private static textLine;
61
53
  /** Builds a syllable span from its resolved runs: one nested span per
62
- * run, carrying the run's inline styles; runs marked `initial` by the
63
- * `*…*` marker carry the initial class. */
54
+ * run, carrying the run's inline styles and its notation-fixed kind
55
+ * class (`liturgy`, `rubric`, `star`, `marker`, `plus`); runs marked
56
+ * `initial` by the `*…*` marker carry the initial class. */
64
57
  private static sylSpan;
65
58
  private static spacer;
66
59
  }
@@ -1,12 +1,36 @@
1
1
  import { ScriptTransform } from './guidoScriptTransforms';
2
+ /** One parsed token of the script: a syllable, or a control statement.
3
+ * `spaceBefore` records whether the source had whitespace between the
4
+ * previous group and this token's group — it feeds the previous
5
+ * syllable's `wordEnd` and the `toString()` round-trip. */
6
+ export type ScriptToken = {
7
+ kind: 'syllable';
8
+ text: string;
9
+ notes: string;
10
+ wordEnd: boolean;
11
+ spaceBefore: boolean;
12
+ } | {
13
+ kind: 'break';
14
+ spaceBefore: boolean;
15
+ };
16
+ /** Whether a group's content is a control statement (`@`-keyword,
17
+ * trimmed). Shared with the transforms, which must leave statement
18
+ * groups alone — their keyword characters are pitch glyphs otherwise. */
19
+ export declare function isStatementGroup(content: string): boolean;
2
20
  export declare class GuidoScript {
3
21
  readonly source: string;
4
22
  constructor(source: string, options?: {
5
23
  transforms?: ScriptTransform[];
6
24
  });
7
- /** The starting clef and note modifiers, or undefined when absent. */
25
+ /** The starting clef and note modifiers, or undefined when absent.
26
+ * A leading statement group is not a clef. */
8
27
  get clef(): string | undefined;
9
- /** The script broken into syllables, each with its sung text and notes. */
28
+ /** The script's tokens in source order: syllables interleaved with
29
+ * control statements. Throws on a malformed statement (syllable text
30
+ * attached to one, or an unknown `@` keyword). */
31
+ get tokens(): ScriptToken[];
32
+ /** The script broken into syllables, each with its sung text and
33
+ * notes — the syllable tokens, statements filtered out. */
10
34
  get syllables(): {
11
35
  text: string;
12
36
  notes: string;
@@ -30,7 +54,8 @@ export declare class GuidoScript {
30
54
  notes: string;
31
55
  }[];
32
56
  }[];
33
- /** The script rebuilt from the parsed pieces — a round-trip of the source. */
57
+ /** The script rebuilt from the parsed pieces — a round-trip of the
58
+ * source, statements included. */
34
59
  toString(): string;
35
60
  }
36
61
  /** The sung text of the script: the clef stripped, syllables joined
@@ -4,9 +4,10 @@ export interface ScriptTransform {
4
4
  apply: (source: string) => string;
5
5
  }
6
6
  /** The `startWithInitial` transform: finds the first syllable group with
7
- * actual notes (the clef and no-notes groups don't count) and wraps the
8
- * syllable's first character in the `*…*` initial marker. Already-marked
9
- * text (leading `*`) and syllables without text are left alone. */
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. */
10
11
  declare function startWithInitial(source: string): string;
11
12
  /**
12
13
  * The built-in transformations, keyed by name; pass the ones a feature
@@ -26,7 +27,7 @@ export declare const SCRIPT_TRANSFORMS: {
26
27
  * its row; characters outside every row carry no pitch and stay put.
27
28
  * Rows are searched in order, so a character found in several rows
28
29
  * transposes within the first one. */
29
- export declare const PITCH_ROWS: readonly ["ðñ0123456789öüó", "^]qwertzuiopõú", "ÝÞQWERTZUIOPÕÚ", "×sdfghjkléáû", "ØÙDFGHJKLÉÁÛ", "÷øaASÍYXCVBN$m", "ÈÊËÌÎÏÐÑÒþ¬ßòôùý", "“”•–—˜™š›œº»", "®−§ÿ\"+!%/=()ÖÜÓ", "Ÿ¡¢£[¥¦©ª«¬", "~¯‚ƒ„…†‡ˆ‰Š‹Œ‘’", "àâãäåæçèêëìîï", "½°±²³´μ·¾¸¹"];
30
+ export declare const PITCH_ROWS: readonly ["ðñ0123456789öüó", "^]qwertzuiopõú", "ÝÞQWERTZUIOPÕÚ", "×sdfghjkléáû", "ØÙDFGHJKLÉÁÛ", "÷øaASÍYXCVBN$m", "ÈÊËÌÎÏÐÑÒþßòôùý", "“”•–—˜™š›œº»", "®−§ÿ\"+!%/=()ÖÜÓ", "Ÿ¡¢£[¥¦©ª«¬", "~¯‚ƒ„…†‡ˆ‰Š‹Œ‘’", "àâãäåæçèêëìîï", "½°±²³´μ·¾¸¹"];
30
31
  /** What happens when a shift runs past the end of a pitch row:
31
32
  * `clamp` keeps the first/last available character, `null` emits
32
33
  * `U+0000`, which shows up as a missing glyph in the score. */
@@ -148,11 +148,19 @@ export declare const STYLE_SETS: {
148
148
  };
149
149
  export type StyleSetName = keyof typeof STYLE_SETS;
150
150
  export declare const DEFAULT_STYLE_SET: StyleSetName;
151
- /** One resolved run of syllable text: its (already transformed) string and
152
- * how to draw it. */
151
+ /** What one run of syllable text is, independent of how a style set
152
+ * draws it: the notation-fixed meaning of the markup that produced it.
153
+ * `liturgy` the `__…__` wrapper, `rubric` `_…_`, `star` the whole-syllable
154
+ * `**`, `marker` the pause-marker glyph runs (`*`, `†`), `plus` the `+`
155
+ * of a Liturgy run; absent for plain text. The marked-up text export
156
+ * (chantMarkup.ts) and the renderer's run classes share this vocabulary. */
157
+ export type ChantRunKind = 'liturgy' | 'rubric' | 'star' | 'marker' | 'plus';
158
+ /** One resolved run of syllable text: its (already transformed) string,
159
+ * how to draw it, and what markup produced it. */
153
160
  export interface SyllablePart {
154
161
  text: string;
155
162
  style: PartStyle;
163
+ kind?: ChantRunKind;
156
164
  }
157
165
  /**
158
166
  * Resolves a syllable's raw text into the runs it renders as: the whole-
@@ -162,12 +170,22 @@ export interface SyllablePart {
162
170
  * part of the syllable — even the whole of it — with the initial rule
163
171
  * (`*sam*ple` → "sam" in the initial style, "ple" normal; an unmatched
164
172
  * `*` renders literally), the `bold` option forces weight 700 onto every
165
- * run, and marker-glyph characters split off into runs of their own font.
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).
166
176
  * Inside a Liturgy-font run, `+` gets its own weight-400 runs — the font
167
177
  * is bold-looking by design, so the weight stays normal. The wrapper
168
- * characters themselves are dropped.
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).
169
185
  */
170
- export declare function resolveSyllableParts(text: string, styleSet: StyleSet, bold: boolean): SyllablePart[];
186
+ export declare function resolveSyllableParts(text: string, styleSet: StyleSet, bold: boolean, options?: {
187
+ rawCase?: boolean;
188
+ }): SyllablePart[];
171
189
  /** The canvas font shorthand for measuring a run at the text size. */
172
190
  export declare function measurementFont(style: PartStyle, textPx: number, fallbackStack: string): string;
173
191
  /** The inline CSS properties that draw a run, as dash-cased names for
@@ -1 +0,0 @@
1
- export declare const DEFAULT_SCRIPT = "(MX)Ki(3)r\u00E1ly(3)k\u00E9nt(5) tr\u00F3(7i)nol(7-:) **() az(7i) \u00DAr(5-/) mind(5)\u00F6(4t)r\u00F6k(3)k\u00E9.(3-.)";
@@ -4,4 +4,5 @@
4
4
  */
5
5
  export { GuidexScore, type GuidexScoreProps } from './GuidexScore';
6
6
  export { renderScore, renderAll, init, dispose, version, type EmbedOptions, type MaxWidth } from '../embed/core';
7
+ export { downloadScorePng, downloadScoreSvg, scorePngBlob, scoreSvg, type ScoreDownloadOptions, type ScoreImageOptions, } from '../scoreImage';
7
8
  export type { StyleSetName } from '../guidoStyles';
@@ -1,5 +1,5 @@
1
1
  "use client";
2
- import { a as version, i as renderScore, n as init, r as renderAll, t as dispose } from "../core-hF6L1EtS.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-oVBasBX5.js";
3
3
  import { useEffect, useRef } from "react";
4
4
  import { jsx } from "react/jsx-runtime";
5
5
  //#region src/react/GuidexScore.tsx
@@ -39,4 +39,4 @@ function GuidexScore({ script, maxWidth, style, bold, textPx, transpose, debug,
39
39
  });
40
40
  }
41
41
  //#endregion
42
- export { GuidexScore, dispose, init, renderAll, renderScore, version };
42
+ export { GuidexScore, dispose, downloadScorePng, downloadScoreSvg, init, renderAll, renderScore, scorePngBlob, scoreSvg, version };