guidex 0.5.1 → 0.6.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 (86) hide show
  1. package/CHANGELOG.md +200 -0
  2. package/README.md +62 -16
  3. package/dist/lib/app/App.d.ts +1 -0
  4. package/dist/lib/app/AretinoControls.d.ts +35 -0
  5. package/dist/lib/app/CaretBand.d.ts +28 -0
  6. package/dist/lib/app/Developers.d.ts +13 -0
  7. package/dist/lib/app/EditorContext.d.ts +15 -0
  8. package/dist/lib/app/EditorTextarea.d.ts +18 -1
  9. package/dist/lib/app/EditorToolbar.d.ts +13 -0
  10. package/dist/lib/app/ExportSettings.d.ts +20 -1
  11. package/dist/lib/app/Footer.d.ts +1 -0
  12. package/dist/lib/app/GlyphChooser.d.ts +31 -0
  13. package/dist/lib/app/Inspector.d.ts +26 -0
  14. package/dist/lib/app/LiveScore.d.ts +31 -0
  15. package/dist/lib/app/Opening.d.ts +3 -0
  16. package/dist/lib/app/Reference.d.ts +28 -0
  17. package/dist/lib/app/RenderSettings.d.ts +2 -1
  18. package/dist/lib/app/ScriptViews.d.ts +8 -0
  19. package/dist/lib/app/SectionSize.d.ts +33 -0
  20. package/dist/lib/app/StaffSettings.d.ts +4 -0
  21. package/dist/lib/app/StaffedGlyph.d.ts +8 -0
  22. package/dist/lib/app/Tabs.d.ts +15 -0
  23. package/dist/lib/app/TakeItOut.d.ts +1 -0
  24. package/dist/lib/app/ThemeSwitch.d.ts +1 -0
  25. package/dist/lib/app/TopBar.d.ts +6 -0
  26. package/dist/lib/app/WidthControls.d.ts +21 -0
  27. package/dist/lib/app/aretinoCaret.d.ts +47 -0
  28. package/dist/lib/app/aretinoSource.d.ts +46 -0
  29. package/dist/lib/app/caretSync.d.ts +48 -0
  30. package/dist/lib/app/chantLibrary.d.ts +8 -4
  31. package/dist/lib/app/editorSnapshot.d.ts +11 -0
  32. package/dist/lib/app/editorState.d.ts +38 -5
  33. package/dist/lib/app/expandLink.d.ts +19 -0
  34. package/dist/lib/app/glyphData.d.ts +37 -0
  35. package/dist/lib/app/inCode.d.ts +4 -0
  36. package/dist/lib/app/insertAtCaret.d.ts +12 -0
  37. package/dist/lib/app/learn/Learn.d.ts +1 -0
  38. package/dist/lib/app/learn/LessonCard.d.ts +12 -0
  39. package/dist/lib/app/learn/lessons.d.ts +64 -0
  40. package/dist/lib/app/learn/narrowing.d.ts +24 -0
  41. package/dist/lib/app/learn/progress.d.ts +14 -0
  42. package/dist/lib/app/pageEvents.d.ts +14 -0
  43. package/dist/lib/app/previewHighlight.d.ts +44 -0
  44. package/dist/lib/app/samples.d.ts +9 -1
  45. package/dist/lib/app/scriptParts.d.ts +31 -0
  46. package/dist/lib/app/shareLink.d.ts +12 -2
  47. package/dist/lib/app/showcases/Showcases.d.ts +17 -0
  48. package/dist/lib/app/wordCopy.d.ts +4 -0
  49. package/dist/lib/aretino/fromAretino.d.ts +99 -0
  50. package/dist/lib/aretino/index.d.ts +38 -0
  51. package/dist/lib/aretino/index.js +1870 -0
  52. package/dist/lib/aretino/toAretino.d.ts +27 -0
  53. package/dist/lib/chantLayout-BRQ6FYND.js +1345 -0
  54. package/dist/lib/chantLayout.d.ts +101 -6
  55. package/dist/lib/chantMarkup-DX4K86Rv.js +993 -0
  56. package/dist/lib/drawnStaff.d.ts +39 -5
  57. package/dist/lib/editorStorage.d.ts +48 -6
  58. package/dist/lib/embed/core.d.ts +15 -1
  59. package/dist/lib/embed/index.js +1 -1
  60. package/dist/lib/embed/manual.d.ts +5 -4
  61. package/dist/lib/embed/manual.js +6 -4
  62. package/dist/lib/fonts/guidohu-staffless.woff2 +0 -0
  63. package/dist/lib/fonts/guidohu.ttf +0 -0
  64. package/dist/lib/glyphFamilies.d.ts +5 -1
  65. package/dist/lib/guidoRender.d.ts +30 -1
  66. package/dist/lib/guidoScriptTransforms.d.ts +2 -2
  67. package/dist/lib/guidoStyles-CvnACCsk.js +1466 -0
  68. package/dist/lib/guidoStyles.d.ts +23 -2
  69. package/dist/lib/react/GuidexScore.d.ts +10 -2
  70. package/dist/lib/react/index.js +14 -4
  71. package/dist/lib/{scoreImage-DUxsPIm0.js → scoreImage-CKsQxHg5.js} +282 -1026
  72. package/dist/lib/theme.d.ts +13 -0
  73. package/dist/lib/word/index.d.ts +1 -1
  74. package/dist/lib/word/index.js +1 -1
  75. package/dist/lib/{wordChecker-DmjGFR7e.js → wordChecker-BN_9dKAx.js} +133 -20
  76. package/dist/lib/wordChecker.d.ts +18 -1
  77. package/dist/lib/wordExport.d.ts +51 -3
  78. package/dist-embed/demo.html +2 -2
  79. package/dist-embed/fonts/guidohu-staffless.woff2 +0 -0
  80. package/dist-embed/fonts/guidohu.ttf +0 -0
  81. package/dist-embed/guidex-embed.min.js +1 -1
  82. package/package.json +10 -1
  83. package/dist/lib/app/ControlsRow.d.ts +0 -1
  84. package/dist/lib/app/SettingsMenu.d.ts +0 -1
  85. package/dist/lib/app/SettingsPanel.d.ts +0 -1
  86. package/dist/lib/chantLayout-DGWAhg8Q.js +0 -2617
@@ -10,7 +10,7 @@ export { SCORE_MARKERS };
10
10
  * other recited syllable contributes only the staff-line segments filling
11
11
  * the space above its text, which flows tight after the previous text.
12
12
  */
13
- export declare const SPECIAL_NOTES = "\u0178\u00A1\u00A2\u00A3[\u00A5\u00A6\u00A9\u00AA\u00AB\u00AC";
13
+ export declare const SPECIAL_NOTES = "\u20AC\u017D\u017E\u0178\u00A1\u00A2\u00A3[\u00A5\u00A6\u00A9\u00AA\u00AB\u00AC\u00A4";
14
14
  /**
15
15
  * Modifier glyphs: flats, sharps, and naturals. They carry pitch (and
16
16
  * transpose with the melody) but modify the note that follows them, so
@@ -22,6 +22,14 @@ export declare const SPECIAL_NOTES = "\u0178\u00A1\u00A2\u00A3[\u00A5\u00A6\u00A
22
22
  export declare const NOTE_MODIFIERS: string;
23
23
  /** Canvas text measurement, shared with the emitters (the Word export
24
24
  * measures the spacer character's natural advance for the unit width). */
25
+ /**
26
+ * Whether a font family is available to this browser by name (installed,
27
+ * or loaded as a webfont). The browser silently falls back for a missing
28
+ * one, so this measures a test string in the family with each generic
29
+ * font behind it: when every width matches the generic alone, the family
30
+ * is missing. Undefined for a name that cannot be a font family.
31
+ */
32
+ export declare function isFontAvailable(name: string): boolean | undefined;
25
33
  export declare function measure(text: string, font: string): number;
26
34
  /** How far each staff line runs (issue #107). `all-but-last` fills every
27
35
  * line but the last to the available width; `none` stops every line at its
@@ -30,6 +38,17 @@ export declare function measure(text: string, font: string): number;
30
38
  * line to the end of the score's longest line, its text included. */
31
39
  export type StaffFill = 'all-but-last' | 'none' | 'all' | 'longest';
32
40
  export declare const STAFF_FILLS: readonly StaffFill[];
41
+ /** How a line shows its clef: the clef glyph (`glyph`, the default), or
42
+ * no glyph (`line`), the drawn staff marking the clef's own line instead
43
+ * and the line taking the padding on the left too. */
44
+ export type ClefMark = 'glyph' | 'line';
45
+ export declare const CLEF_MARKS: readonly ClefMark[];
46
+ /** A clef taking effect on a notes line: the clef glyph and where, in
47
+ * characters of the line's text (`clefPrefix` + `notesParts`). */
48
+ export interface ClefAt {
49
+ at: number;
50
+ clef: string;
51
+ }
33
52
  /** Options for one layout pass. All fields optional; defaults reproduce the
34
53
  * original Book Antiqua look (style set BNS). */
35
54
  export interface LayoutOptions extends RecitationOptions {
@@ -43,7 +62,9 @@ export interface LayoutOptions extends RecitationOptions {
43
62
  textPx?: number;
44
63
  /** Notes line size in px (default textPx * 2) */
45
64
  notesPx?: number;
46
- /** Maximum notes-line width before a staff break (default: none) */
65
+ /** The line width before a staff break (default: none): the whole
66
+ * line, padding included. The break star's right edge lands on it and
67
+ * the notes break `paddingPx` short of it. */
47
68
  maxWidthPx?: number;
48
69
  /** Dashes in a normal junction between note groups: at least 1, in
49
70
  * steps of a third (default 3; 2.67 reads as 2⅔). Three `¨` are about
@@ -58,6 +79,34 @@ export interface LayoutOptions extends RecitationOptions {
58
79
  * many px of the available width, every line runs to the available
59
80
  * width instead (default 0) */
60
81
  staffFillSnapPx?: number;
82
+ /** The line's padding, px (default: the style set's `padding`, 12 in
83
+ * both built-in sets): the room for the break star at the end of the
84
+ * line width, taken out of it, so the line width never changes. */
85
+ paddingPx?: number;
86
+ /** How a line shows its clef (default `glyph`). With `line` the notes
87
+ * carry no clef glyph (keys stay), the same padding goes on the left
88
+ * too (`LayoutResult.leftPaddingPx`), and `LayoutLine.clefs` say where
89
+ * each clef takes effect, for the drawn staff to mark its line. */
90
+ clefMark?: ClefMark;
91
+ /** The syllable text's font family, an installed font by name (default:
92
+ * the style set's). The style set's stack stays behind it as the
93
+ * fallback; marks with a font of their own keep it. */
94
+ textFont?: string;
95
+ /** Extra advance after every notes character, px (default 0): the
96
+ * Word export's notes letter-spacing, so the text lands under the
97
+ * notes Word draws */
98
+ notesLetterSpacingPx?: number;
99
+ /** Draw a `**()` star that directly follows a group ending in a bar
100
+ * (`,` `:` `;`, doubled or not, then any dashes or `¨`) centred under
101
+ * that bar, as a `mark` segment that moves nothing (default true).
102
+ * `false` sets it between the syllables, like a star after no bar. */
103
+ starUnderBar?: boolean;
104
+ /** Cut an empty slot (`~(…)`, a text-less group at the start) that does
105
+ * not fit at a line end like a sung group: the longest prefix ending
106
+ * on a `-`/`¨` that fits stays, the rest opens the next line (default
107
+ * true). `false` moves it whole to a fresh line first, as held groups
108
+ * always do, and cuts it only when it overflows that line too. */
109
+ cutEmptySlots?: boolean;
61
110
  }
62
111
  /** A horizontal whitespace gap on the text line: the lead-in shared with
63
112
  * the clef, or the gap after a word-ending syllable. Both emitters fake it
@@ -96,6 +145,10 @@ export interface ConnectorSegment {
96
145
  * through with `noNotes`; they have no notes-side numbers. */
97
146
  export interface SylSegment {
98
147
  kind: 'syl';
148
+ /** The syllable's index among the script's syllables (`GuidoScript.syllables`,
149
+ * held groups and empty slots counted), so a host can tie the text
150
+ * back to its source */
151
+ syllable: number;
99
152
  parts: SyllablePart[];
100
153
  /** Ideal absolute px where the text starts */
101
154
  textStart: number;
@@ -139,7 +192,25 @@ export interface LineEndDashSegment {
139
192
  /** The line's text end in px (debug output only) */
140
193
  textEndPx: number;
141
194
  }
142
- export type LayoutSegment = GapSegment | ConnectorSegment | SylSegment | WordSpaceSegment | LineEndDashSegment;
195
+ /** A star drawn under the bar that closes the group before it
196
+ * (`starUnderBar`): it takes no room in the text flow, so nothing around it
197
+ * moves. It stands in the segments where the flow reaches `flowPx` (after
198
+ * the previous syllable's text and word space), and draws at `textStart`:
199
+ * under the bar, kept a word space clear of the text on either side, or
200
+ * centred between them when there is no room for that (`fitMark`). It may
201
+ * draw left of `flowPx`, never left of the text before it. */
202
+ export interface MarkSegment {
203
+ kind: 'mark';
204
+ /** The star syllable's index among the script's syllables */
205
+ syllable: number;
206
+ parts: SyllablePart[];
207
+ /** Ideal absolute px where the star starts */
208
+ textStart: number;
209
+ textWidth: number;
210
+ /** Absolute px of the text flow where the segment stands */
211
+ flowPx: number;
212
+ }
213
+ export type LayoutSegment = GapSegment | ConnectorSegment | SylSegment | WordSpaceSegment | LineEndDashSegment | MarkSegment;
143
214
  /** One text line under a notes line: one underlay's (stanza's) ordered
144
215
  * segments with their ideal absolute positions. */
145
216
  export interface LayoutTextLine {
@@ -184,6 +255,20 @@ export interface LayoutLine {
184
255
  /** The break marker's relative left offset; only set on broken
185
256
  * (non-final) lines, after their staff fill dashes */
186
257
  breakMarkerLeftPx?: number;
258
+ /** The clefs in effect on the line: the opening one at 0, then each
259
+ * inline change (with `clefMark: 'line'` the text has no clef glyphs
260
+ * to read them from). Empty when the script has no clef. */
261
+ clefs: ClefAt[];
262
+ /** Where each syllable's notes stand on the notes line: a syllable
263
+ * index (as `SylSegment.syllable`) and its notes' character range in
264
+ * `clefPrefix + notesParts.join('')` (UTF-16 offsets, junctions left
265
+ * out). A group split across lines has a piece on each; held groups
266
+ * have their own. For a host that ties the score back to its script. */
267
+ groups: {
268
+ syllable: number;
269
+ from: number;
270
+ to: number;
271
+ }[];
187
272
  }
188
273
  export interface LayoutResult {
189
274
  lines: LayoutLine[];
@@ -195,12 +280,22 @@ export interface LayoutResult {
195
280
  textPx: number;
196
281
  notesPx: number;
197
282
  bold: boolean;
198
- /** The maximum width the lines were broken at */
283
+ /** The notes width the lines were broken at: the line width less the
284
+ * padding */
199
285
  maxWidthPx: number;
200
- /** Where the line-end break marker lands: the max width plus the
201
- * style set's padding */
286
+ /** Where the line-end break marker's right edge lands: the line width
287
+ * less the left padding (the notes width plus the padding) */
202
288
  starTarget: number;
203
289
  starWidth: number;
290
+ /** How the lines show their clef */
291
+ clefMark: ClefMark;
292
+ /** The room before every line, px: the padding with `clefMark: 'line'`,
293
+ * else 0. The emitters shift each line by it (layout positions start
294
+ * after it), and the drawn staff runs through it. */
295
+ leftPaddingPx: number;
296
+ /** The text font stack the layout measured with: `textFont` in front
297
+ * of the style set's, else the style set's */
298
+ textFontStack: string;
204
299
  }
205
300
  /** The scripts a layout lays out: one script, or several underlays of
206
301
  * one melody stacked under a shared staff (issue #84) — one text line per