guidex 0.4.0 → 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.
- package/CHANGELOG.md +68 -0
- package/README.md +161 -3
- package/dist/lib/app/StaffSettings.d.ts +1 -0
- package/dist/lib/app/editorState.d.ts +11 -1
- package/dist/lib/{chantLayout-g_xuQ9nD.js → chantLayout-BrCQUOhp.js} +299 -32
- package/dist/lib/chantLayout.d.ts +2 -1
- package/dist/lib/drawnStaff.d.ts +130 -0
- package/dist/lib/editorStorage.d.ts +35 -0
- package/dist/lib/embed/core.d.ts +10 -1
- package/dist/lib/embed/index.js +1 -1
- package/dist/lib/embed/manual.d.ts +3 -0
- package/dist/lib/embed/manual.js +4 -4
- package/dist/lib/fonts/guidohu-staffless.woff2 +0 -0
- package/dist/lib/guidex.css +27 -0
- package/dist/lib/guidoRender.d.ts +11 -1
- package/dist/lib/react/GuidexScore.d.ts +7 -2
- package/dist/lib/react/index.js +39 -4
- package/dist/lib/recitationSegments.d.ts +93 -0
- package/dist/lib/{scoreImage-Dz3c55Zi.js → scoreImage-B2SGdROL.js} +6417 -11
- package/dist/lib/staffGlyphs.d.ts +12 -0
- package/dist/lib/word/index.js +1 -1
- package/dist/lib/{wordChecker-B_9vyTt6.js → wordChecker-CjYl2yof.js} +4 -2
- package/dist/lib/wordExport.d.ts +6 -0
- package/dist-embed/fonts/guidohu-staffless.woff2 +0 -0
- package/dist-embed/guidex-embed.min.css +1 -1
- package/dist-embed/guidex-embed.min.js +1 -1
- package/package.json +3 -2
|
@@ -14,6 +14,8 @@
|
|
|
14
14
|
* `chantTextStyle`, `markupWarnings`,
|
|
15
15
|
* plus the raw run resolver `resolveSyllableParts`), the style-set
|
|
16
16
|
* registry (`STYLE_SETS`, `DEFAULT_STYLE_SET`), the
|
|
17
|
+
* drawn staff helpers (`snapStaff`, `chooseStaffLines`, `staffSpans`, the
|
|
18
|
+
* staff color parsers), the
|
|
17
19
|
* Word-compatible export (`toWordHtml`, `toWordText`, `layoutForWord`,
|
|
18
20
|
* `wordLayoutText` — also available alone as `guidex/word`, `copyWordHtml`,
|
|
19
21
|
* `copyWordPlainText`, `checkWordHtml`), and the image export
|
|
@@ -29,6 +31,7 @@ export type { Mark, SpanProblem, TextRun } from '../textMarkup';
|
|
|
29
31
|
export { KEY_SIGNATURES, PITCH_ROWS, STANZA_PLACEHOLDER, padStanza, parseInterval, parseStanza, selectStanza, slotCount, smallHeads, stackStanzas, stackedStanzaNumbers, stanzaCount, stanzaTexts, stanzaWarnings, transposeBy, transposeExact, transposeNotes, transposeScript, TranspositionRangeError, withStanza, type EmptySlots, type SelectStanzaOptions, type ScriptTransform, type StanzaOptions, type StanzaStack, type StanzaSyllable, type StanzaWarning, type SpelledInterval, type TransposeOverflow, type TranspositionTarget, } from '../guidoScriptTransforms';
|
|
30
32
|
export type { StyleSetName, SyllablePart, PartStyle, ChantRunKind } from '../guidoStyles';
|
|
31
33
|
export type { StaffFill } from '../chantLayout';
|
|
34
|
+
export { chooseStaffLines, formatStaffColor, parseStaffColor, parseStaffLineColors, parseStaffLineWeights, parseStaffPitchColors, parseStaffWeight, snapStaff, staffLineColor, staffLineWeight, staffSpans, STAFFLESS_FONT_FAMILY, type DrawnStaffOptions, type PitchLetter, type StaffColor, type StaffLineRange, type StaffMode, type StaffOverflow, type StaffSpan, } from '../drawnStaff';
|
|
32
35
|
export type { ChantRun, ChantSyllable, ChantWord, ChantMarkupOptions } from '../chantMarkup';
|
|
33
36
|
export { DEFAULT_SPACER, DEFAULT_TAB_INTERVAL_PT, SpacerMeter, layoutForWord, toWordHtml, toWordText, wordLayoutText, type SpacerChar, type SpacerConfig, type SpacerWidth, type WordExportOptions, type WordLayout, type WordLine, type WordRun, type WordStyleNames, type WordTextPiece, } from '../wordExport';
|
|
34
37
|
export { baseOf, gClefPitchOf, modifyDown, modifyNatural, modifyUp, toCephalicus, toConnectDown, toLonga, toSmallHead, toSmallPoint, toVirga, variantOf, type VariantRole, } from '../glyphFamilies';
|
package/dist/lib/embed/manual.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { A as
|
|
2
|
-
import { B as
|
|
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-
|
|
1
|
+
import { A as TranspositionRangeError, B as slotCount, C as chantRuns, D as transposeBy, E as PITCH_ROWS, F as STANZA_PLACEHOLDER, G as stanzaTexts, H as stackStanzas, I as isSlot, K as stanzaWarnings, L as padStanza, M as sameKeyGlyphs, N as transposeExact, O as transposeNotes, P as transposeScript, R as parseStanza, S as chantHtml, T as markupWarnings, U as stackedStanzaNumbers, V as smallHeads, W as stanzaCount, _ as parseStaffWeight, a as dispose, b as staffLineWeight, c as renderScore, d as chooseStaffLines, f as formatStaffColor, g as parseStaffPitchColors, h as parseStaffLineWeights, i as scoreSvg, j as parseInterval, k as KEY_SIGNATURES, l as version, m as parseStaffLineColors, n as downloadScoreSvg, o as init, p as parseStaffColor, q as withStanza, r as scorePngBlob, s as renderAll, t as downloadScorePng, u as STAFFLESS_FONT_FAMILY, v as snapStaff, w as chantTextStyle, x as staffSpans, y as staffLineColor, z as selectStanza } from "../scoreImage-B2SGdROL.js";
|
|
2
|
+
import { B as toCephalicus, C as scriptSyllables, E as unescape, G as toVirga, H as toLonga, I as modifyDown, K as variantOf, L as modifyNatural, M as baseOf, N as gClefPitchOf, O as SCORE_MARKERS, P as isClefGlyph, R as modifyUp, S as runProperties, T as syllableText, U as toSmallHead, V as toConnectDown, W as toSmallPoint, _ as GuidoScript, a as DEFAULT_STYLE_SET, c as defineStyleSet, k as splitNoteMarkers, p as resolveSyllableParts, s as STYLE_SETS, v as chantText, w as statementSource, y as escape } from "../chantLayout-BrCQUOhp.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-CjYl2yof.js";
|
|
4
4
|
//#region src/composeScript.ts
|
|
5
5
|
/**
|
|
6
6
|
* Combining scripts (issue #71): one GuidoScript built from parts of
|
|
@@ -351,4 +351,4 @@ function composeScript(parts, options = {}) {
|
|
|
351
351
|
return clefGroup(opening) + writeTokens(out) + stanzas.join("");
|
|
352
352
|
}
|
|
353
353
|
//#endregion
|
|
354
|
-
export { DEFAULT_SPACER, DEFAULT_STYLE_SET, DEFAULT_TAB_INTERVAL_PT, GuidoScript, KEY_SIGNATURES, PITCH_ROWS, SCORE_MARKERS, STANZA_PLACEHOLDER, STYLE_SETS, SpacerMeter, TranspositionRangeError, baseOf, chantHtml, chantRuns, chantText, chantTextStyle, checkWordHtml, composeScript, copyWordHtml, copyWordPlainText, defineStyleSet, dispose, downloadScorePng, downloadScoreSvg, gClefPitchOf, init, layoutForWord, markupWarnings, modifyDown, modifyNatural, modifyUp, padStanza, parseInterval, parseStanza, renderAll, renderScore, resolveSyllableParts, scorePngBlob, scoreSvg, scriptSyllables, selectStanza, slotCount, smallHeads, splitNoteMarkers, stackStanzas, stackedStanzaNumbers, stanzaCount, stanzaTexts, stanzaWarnings, toCephalicus, toConnectDown, toLonga, toSmallHead, toSmallPoint, toVirga, toWordHtml, toWordText, transposeBy, transposeExact, transposeNotes, transposeScript, unescape, variantOf, version, withStanza, wordLayoutText };
|
|
354
|
+
export { DEFAULT_SPACER, DEFAULT_STYLE_SET, DEFAULT_TAB_INTERVAL_PT, GuidoScript, KEY_SIGNATURES, PITCH_ROWS, SCORE_MARKERS, STAFFLESS_FONT_FAMILY, STANZA_PLACEHOLDER, STYLE_SETS, SpacerMeter, TranspositionRangeError, baseOf, chantHtml, chantRuns, chantText, chantTextStyle, checkWordHtml, chooseStaffLines, composeScript, copyWordHtml, copyWordPlainText, defineStyleSet, dispose, downloadScorePng, downloadScoreSvg, formatStaffColor, gClefPitchOf, init, layoutForWord, markupWarnings, modifyDown, modifyNatural, modifyUp, padStanza, parseInterval, parseStaffColor, parseStaffLineColors, parseStaffLineWeights, parseStaffPitchColors, parseStaffWeight, parseStanza, renderAll, renderScore, resolveSyllableParts, scorePngBlob, scoreSvg, scriptSyllables, selectStanza, slotCount, smallHeads, snapStaff, splitNoteMarkers, stackStanzas, stackedStanzaNumbers, staffLineColor, staffLineWeight, staffSpans, stanzaCount, stanzaTexts, stanzaWarnings, toCephalicus, toConnectDown, toLonga, toSmallHead, toSmallPoint, toVirga, toWordHtml, toWordText, transposeBy, transposeExact, transposeNotes, transposeScript, unescape, variantOf, version, withStanza, wordLayoutText };
|
|
Binary file
|
package/dist/lib/guidex.css
CHANGED
|
@@ -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,9 +1,10 @@
|
|
|
1
1
|
import { MarkDefinitions, StyleSetName } from './guidoStyles';
|
|
2
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
|
+
export interface RenderOptions extends DrawnStaffOptions {
|
|
7
8
|
/** Named style set (default: BNS) */
|
|
8
9
|
style?: StyleSetName;
|
|
9
10
|
/** Marks this score adds to its style set's */
|
|
@@ -25,6 +26,12 @@ export interface RenderOptions {
|
|
|
25
26
|
/** With `staffFill: 'longest'`: the distance from the available width
|
|
26
27
|
* within which every line runs to it instead (default 0) */
|
|
27
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;
|
|
28
35
|
}
|
|
29
36
|
/**
|
|
30
37
|
* Renders a GuidoScript into a tidy score: a notes line in the chant font,
|
|
@@ -50,6 +57,9 @@ export declare class GuidoRender {
|
|
|
50
57
|
* unknown or one of its fonts cannot be loaded.
|
|
51
58
|
*/
|
|
52
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;
|
|
53
63
|
/** Builds a line's notes div: the chant font text plus, on broken
|
|
54
64
|
* lines, the break marker `*` as an inline span (so it shares the
|
|
55
65
|
* text's baseline) shifted right so its right edge lands on the
|
|
@@ -2,7 +2,8 @@ import { MaxWidth, ScoreWarning } from '../embed/core';
|
|
|
2
2
|
import { StaffFill } from '../chantLayout';
|
|
3
3
|
import { StyleSetName, MarkDefinitions } from '../guidoStyles';
|
|
4
4
|
import { EmptySlots, StanzaStack } from '../stanzas';
|
|
5
|
-
|
|
5
|
+
import { DrawnStaffOptions } from '../drawnStaff';
|
|
6
|
+
export interface GuidexScoreProps extends DrawnStaffOptions {
|
|
6
7
|
/** The score source in GuidoScript notation, e.g. `'(M)A(0) di(0q)e(qQ0)bus(1) an(3)ti(1e)quis(qQ0-:)'`. */
|
|
7
8
|
script: string;
|
|
8
9
|
/** Line-breaking budget in px, or 'auto' to fit the container (default). */
|
|
@@ -20,6 +21,10 @@ export interface GuidexScoreProps {
|
|
|
20
21
|
staffFill?: StaffFill;
|
|
21
22
|
/** With `staffFill: 'longest'`: the distance from the available width within which every line runs to it instead (default 0). */
|
|
22
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;
|
|
23
28
|
/** Transpose the score by N diatonic steps. */
|
|
24
29
|
transpose?: number;
|
|
25
30
|
/** The stanza sung under the notes (1-based, default 1: the
|
|
@@ -43,4 +48,4 @@ export interface GuidexScoreProps {
|
|
|
43
48
|
debug?: boolean;
|
|
44
49
|
className?: string;
|
|
45
50
|
}
|
|
46
|
-
export declare function GuidexScore({ script, maxWidth, style, bold, textPx, junctionDashes, marks, staffFill, staffFillSnapPx, 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;
|
package/dist/lib/react/index.js
CHANGED
|
@@ -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-
|
|
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,13 +10,21 @@ 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, marks, staffFill, staffFillSnapPx, 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
18
|
const marksKey = marks === void 0 ? void 0 : JSON.stringify(marks);
|
|
19
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;
|
|
20
28
|
useEffect(() => {
|
|
21
29
|
const el = ref.current;
|
|
22
30
|
if (!el) return;
|
|
@@ -24,6 +32,7 @@ function GuidexScore({ script, maxWidth, style, bold, textPx, junctionDashes, ma
|
|
|
24
32
|
const scoreMarks = marksKey === void 0 ? void 0 : JSON.parse(marksKey);
|
|
25
33
|
const stanzaTexts = stanzasKey === void 0 ? void 0 : JSON.parse(stanzasKey);
|
|
26
34
|
const stacked = stackKey === void 0 ? void 0 : JSON.parse(stackKey);
|
|
35
|
+
const [color, lineColors, pitchColors] = JSON.parse(colorsKey);
|
|
27
36
|
renderScore(el, script, {
|
|
28
37
|
maxWidth,
|
|
29
38
|
style,
|
|
@@ -33,12 +42,27 @@ function GuidexScore({ script, maxWidth, style, bold, textPx, junctionDashes, ma
|
|
|
33
42
|
junctionDashes,
|
|
34
43
|
staffFill,
|
|
35
44
|
staffFillSnapPx,
|
|
45
|
+
twoSyllableRecitationsToPlain,
|
|
46
|
+
plainRunsToRecitation,
|
|
36
47
|
transpose,
|
|
37
48
|
stanza,
|
|
38
49
|
stack: stacked,
|
|
39
50
|
stanzas: stanzaTexts,
|
|
40
51
|
emptySlots,
|
|
41
|
-
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)
|
|
42
66
|
}).then(({ warnings }) => {
|
|
43
67
|
if (live) onWarningsRef.current?.(warnings);
|
|
44
68
|
});
|
|
@@ -56,12 +80,23 @@ function GuidexScore({ script, maxWidth, style, bold, textPx, junctionDashes, ma
|
|
|
56
80
|
junctionDashes,
|
|
57
81
|
staffFill,
|
|
58
82
|
staffFillSnapPx,
|
|
83
|
+
twoSyllableRecitationsToPlain,
|
|
84
|
+
plainRunsToRecitation,
|
|
59
85
|
transpose,
|
|
60
86
|
stanza,
|
|
61
87
|
stackKey,
|
|
62
88
|
stanzasKey,
|
|
63
89
|
emptySlots,
|
|
64
|
-
debug
|
|
90
|
+
debug,
|
|
91
|
+
staff,
|
|
92
|
+
staffLines,
|
|
93
|
+
staffSnap,
|
|
94
|
+
colorsKey,
|
|
95
|
+
staffWeight,
|
|
96
|
+
lineWeightsKey,
|
|
97
|
+
staffClefLineWeight,
|
|
98
|
+
overflowStart,
|
|
99
|
+
overflowEnd
|
|
65
100
|
]);
|
|
66
101
|
return /* @__PURE__ */ jsx("div", {
|
|
67
102
|
ref,
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { ScriptToken } from './guidoScript';
|
|
2
|
+
export interface RecitationOptions {
|
|
3
|
+
/** Render a line segment of exactly 2 syllables of a reciting glyph as
|
|
4
|
+
* plain notes of the same pitch (default true) */
|
|
5
|
+
twoSyllableRecitationsToPlain?: boolean;
|
|
6
|
+
/** Render a line segment of 3 or more syllables on one plain note that
|
|
7
|
+
* has a reciting glyph (`1`–`9`, `ö`, `ü`) as a recitation (default
|
|
8
|
+
* false) */
|
|
9
|
+
plainRunsToRecitation?: boolean;
|
|
10
|
+
}
|
|
11
|
+
/** A note group sung on a reciting pitch. */
|
|
12
|
+
export interface RecitationPitch {
|
|
13
|
+
/** The accidental sign before the note, or '' */
|
|
14
|
+
sign: string;
|
|
15
|
+
/** The plain note (`7`) */
|
|
16
|
+
plain: string;
|
|
17
|
+
/** The reciting glyph (`¦`) */
|
|
18
|
+
glyph: string;
|
|
19
|
+
/** Which of the two the group is written with */
|
|
20
|
+
written: 'glyph' | 'plain';
|
|
21
|
+
}
|
|
22
|
+
/** The reciting pitch of a note group: one reciting glyph, or one plain
|
|
23
|
+
* note that has one, optionally after one accidental sign; null for any
|
|
24
|
+
* other group. */
|
|
25
|
+
export declare function recitationPitch(notes: string): RecitationPitch | null;
|
|
26
|
+
/** How a syllable of a run renders: as a recitation, as plain notes, or as
|
|
27
|
+
* written. */
|
|
28
|
+
export type RecitationMode = 'recite' | 'plain' | 'written';
|
|
29
|
+
/** The notes a group renders with in a mode. */
|
|
30
|
+
export declare function notesInMode(notes: string, mode: RecitationMode): string;
|
|
31
|
+
/** One syllable as the decisions see it, indexed like the layout's
|
|
32
|
+
* syllables (the script's syllable tokens, in order). */
|
|
33
|
+
export interface RunSyllable {
|
|
34
|
+
/** The group's notes as written ('' for a syllable without notes) */
|
|
35
|
+
notes: string;
|
|
36
|
+
/** Some underlay sings text on it (not every one holds it or leaves
|
|
37
|
+
* the slot empty) */
|
|
38
|
+
counted: boolean;
|
|
39
|
+
}
|
|
40
|
+
/** The decisions' view of a script: its syllables, and where a clef or key
|
|
41
|
+
* statement stands (a run never continues across one). */
|
|
42
|
+
export declare function runSyllables(underlays: readonly (readonly ScriptToken[])[]): {
|
|
43
|
+
syllables: RunSyllable[];
|
|
44
|
+
/** Syllable indices a clef or key statement stands right before */
|
|
45
|
+
pitchBreaks: Set<number>;
|
|
46
|
+
};
|
|
47
|
+
/**
|
|
48
|
+
* The mode each member is first laid out in: a recitation when its run in
|
|
49
|
+
* the script counts 3 or more syllables (so the line segments are counted
|
|
50
|
+
* with the recitation's widths), else as written (a run of 2 or fewer can
|
|
51
|
+
* only ever need its pair converted).
|
|
52
|
+
*/
|
|
53
|
+
export declare function trialModes(syllables: readonly RunSyllable[], pitchBreaks: ReadonlySet<number>, options: Required<RecitationOptions>): Map<number, RecitationMode>;
|
|
54
|
+
/** Whether a script has anything for the decisions to do. */
|
|
55
|
+
export declare function hasCandidates(syllables: readonly RunSyllable[], options: Required<RecitationOptions>): boolean;
|
|
56
|
+
/** A segment whose form the last step changed, still to be checked on
|
|
57
|
+
* its line. */
|
|
58
|
+
interface Pending {
|
|
59
|
+
members: number[];
|
|
60
|
+
/** The line its decision counted it on */
|
|
61
|
+
line: number;
|
|
62
|
+
}
|
|
63
|
+
/** The decision state carried from pass to pass. */
|
|
64
|
+
export interface DecisionState {
|
|
65
|
+
/** Final modes, by syllable */
|
|
66
|
+
decided: Map<number, RecitationMode>;
|
|
67
|
+
/** Syllables that open a fresh line: a changed segment that opened its
|
|
68
|
+
* line, and a member that no longer fits its line in the new form */
|
|
69
|
+
breakBefore: Set<number>;
|
|
70
|
+
/** The segment changed in the last step */
|
|
71
|
+
pending: Pending | null;
|
|
72
|
+
}
|
|
73
|
+
export declare function initialState(): DecisionState;
|
|
74
|
+
/** The mode each member renders with in the next pass. */
|
|
75
|
+
export declare function passModes(trial: ReadonlyMap<number, RecitationMode>, state: DecisionState): Map<number, RecitationMode>;
|
|
76
|
+
/**
|
|
77
|
+
* One step of the decisions over a laid-out pass, from the left: checks the
|
|
78
|
+
* segment changed in the previous step, then decides segments in order while
|
|
79
|
+
* the pass already rendered them as decided, and stops at the first one
|
|
80
|
+
* whose decision changes what the pass rendered. Returns whether another
|
|
81
|
+
* pass is needed.
|
|
82
|
+
*
|
|
83
|
+
* Every pass lays the score out left to right, so a decision only moves
|
|
84
|
+
* what comes after it: the segments decided before it stay where they
|
|
85
|
+
* were. A segment is counted on the line the pass put it on, and a change
|
|
86
|
+
* keeps it there: one that opened its line still opens it (as plain notes
|
|
87
|
+
* it might fit the line before), and a member that no longer fits its line
|
|
88
|
+
* in the new form (a pair turned plain is wider than its recitation) opens
|
|
89
|
+
* the next one and is decided again there, the members before it keeping
|
|
90
|
+
* their written form.
|
|
91
|
+
*/
|
|
92
|
+
export declare function decideStep(syllables: readonly RunSyllable[], placedNotes: readonly (string | undefined)[], sylLines: readonly (number | undefined)[], modes: ReadonlyMap<number, RecitationMode>, state: DecisionState, options: Required<RecitationOptions>): boolean;
|
|
93
|
+
export {};
|