guidex 0.5.0 → 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 +215 -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-B2SGdROL.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-CjYl2yof.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-BrCQUOhp.js +0 -2616
@@ -27,6 +27,8 @@ export interface PartStyle {
27
27
  smallCaps?: boolean;
28
28
  /** Inline color; absent means inherit (keeps dark mode working) */
29
29
  color?: string;
30
+ /** Drawn underlined (the `u` mark); does not affect width */
31
+ underline?: boolean;
30
32
  /** The run carries the initial class in the DOM (the `*…*` marker) */
31
33
  initial?: boolean;
32
34
  }
@@ -60,9 +62,16 @@ export interface StyleSet {
60
62
  /** Fonts `font:<name>` can name, past the built-in ones: a font stack.
61
63
  * A webfont also belongs in `verifiedFonts`. */
62
64
  fonts?: Record<string, string>;
63
- /** Line-end padding in px: the break marker `*` lands this far past
64
- * the max-width position. Defaults to 0 (the star sits on the edge). */
65
+ /** Line padding in px: the room for the break marker `*` at the end of
66
+ * the line width (and before the notes when a line shows no clef
67
+ * glyph), taken out of it. Defaults to 0. */
65
68
  padding?: number;
69
+ /** How the drawn staff marks the clef's line when a line shows no clef
70
+ * glyph (`clefMark: 'line'`): a color, a thickness multiplier, or both */
71
+ clefLine?: {
72
+ color?: string;
73
+ weight?: number;
74
+ };
66
75
  }
67
76
  export declare const STYLE_SETS: {
68
77
  /** Book Antiqua text with red accents. */
@@ -107,6 +116,9 @@ export declare const STYLE_SETS: {
107
116
  plus: PartStyle;
108
117
  };
109
118
  padding: number;
119
+ clefLine: {
120
+ color: string;
121
+ };
110
122
  };
111
123
  /** Times New Roman text, strictly black and white. */
112
124
  Vesperale: {
@@ -142,6 +154,9 @@ export declare const STYLE_SETS: {
142
154
  plus: PartStyle;
143
155
  };
144
156
  padding: number;
157
+ clefLine: {
158
+ weight: number;
159
+ };
145
160
  };
146
161
  };
147
162
  /** A style set's name: a built-in one, or one `defineStyleSet` added. */
@@ -198,6 +213,12 @@ export declare function drawnText(part: Pick<SyllablePart, 'text' | 'style'>): s
198
213
  * runs in one step (see `resolveSpans`, `resolveTextRuns`). */
199
214
  export declare function resolveSyllableParts(written: string, styleSet: StyleSet, bold: boolean, extra?: MarkDefinitions): SyllablePart[];
200
215
  /** The canvas font shorthand for measuring a run at the text size. */
216
+ /** A font family name as typed, or undefined when it cannot be one: empty,
217
+ * too long, or with quotes or CSS punctuation in it. */
218
+ export declare function cleanFontName(name: string | null | undefined): string | undefined;
219
+ /** The text font stack with `textFont` in front, the style set's own stack
220
+ * after it as the fallback. */
221
+ export declare function textFontStackOf(styleSet: StyleSet, textFont?: string): string;
201
222
  export declare function measurementFont(style: PartStyle, textPx: number, fallbackStack: string): string;
202
223
  /** The inline CSS properties that draw a run, as dash-cased names for
203
224
  * CSSStyleDeclaration.setProperty. */
@@ -1,5 +1,5 @@
1
1
  import { MaxWidth, ScoreWarning } from '../embed/core';
2
- import { StaffFill } from '../chantLayout';
2
+ import { ClefMark, StaffFill } from '../chantLayout';
3
3
  import { StyleSetName, MarkDefinitions } from '../guidoStyles';
4
4
  import { EmptySlots, StanzaStack } from '../stanzas';
5
5
  import { DrawnStaffOptions } from '../drawnStaff';
@@ -21,10 +21,18 @@ export interface GuidexScoreProps extends DrawnStaffOptions {
21
21
  staffFill?: StaffFill;
22
22
  /** With `staffFill: 'longest'`: the distance from the available width within which every line runs to it instead (default 0). */
23
23
  staffFillSnapPx?: number;
24
+ /** The line's padding, px (default: the style set's padding, 12): room for the break star, taken out of the line width. */
25
+ paddingPx?: number;
26
+ /** How a line shows its clef (default `glyph`): `line` leaves the glyph out and marks the clef's staff line, with the padding on the left too (drawn staff only). */
27
+ clefMark?: ClefMark;
28
+ /** The syllable text's font, an installed font by name (default: the style set's). */
29
+ textFont?: string;
24
30
  /** Render a recitation that covers exactly 2 syllables on a line as plain notes of the same pitch (default true). */
25
31
  twoSyllableRecitationsToPlain?: boolean;
26
32
  /** Render 3 or more syllables on one plain note with a reciting glyph on a line as a recitation (default false). */
27
33
  plainRunsToRecitation?: boolean;
34
+ /** Cut an empty slot (`~(…)`) at a line end like a sung group (default true); `false` moves it whole to a fresh line first. */
35
+ cutEmptySlots?: boolean;
28
36
  /** Transpose the score by N diatonic steps. */
29
37
  transpose?: number;
30
38
  /** The stanza sung under the notes (1-based, default 1: the
@@ -48,4 +56,4 @@ export interface GuidexScoreProps extends DrawnStaffOptions {
48
56
  debug?: boolean;
49
57
  className?: string;
50
58
  }
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;
59
+ export declare function GuidexScore({ script, maxWidth, style, bold, textPx, junctionDashes, marks, staffFill, staffFillSnapPx, paddingPx, twoSyllableRecitationsToPlain, plainRunsToRecitation, cutEmptySlots, transpose, stanza, stack, stanzas, emptySlots, onWarnings, debug, className, staff, staffLines, staffColor, staffLineColors, staffPitchColors, staffWeight, staffLineWeights, staffClefLineWeight, staffClefLineColor, clefMark, textFont, staffOverflow, staffSnap, }: GuidexScoreProps): import('react').JSX.Element;
@@ -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-B2SGdROL.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-CKsQxHg5.js";
3
3
  import { useEffect, useRef } from "react";
4
4
  import { jsx } from "react/jsx-runtime";
5
5
  //#region src/react/GuidexScore.tsx
@@ -10,7 +10,7 @@ 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, twoSyllableRecitationsToPlain, plainRunsToRecitation, transpose, stanza, stack, stanzas, emptySlots, onWarnings, debug, className, staff, staffLines, staffColor, staffLineColors, staffPitchColors, staffWeight, staffLineWeights, staffClefLineWeight, staffOverflow, staffSnap }) {
13
+ function GuidexScore({ script, maxWidth, style, bold, textPx, junctionDashes, marks, staffFill, staffFillSnapPx, paddingPx, twoSyllableRecitationsToPlain, plainRunsToRecitation, cutEmptySlots, transpose, stanza, stack, stanzas, emptySlots, onWarnings, debug, className, staff, staffLines, staffColor, staffLineColors, staffPitchColors, staffWeight, staffLineWeights, staffClefLineWeight, staffClefLineColor, clefMark, textFont, staffOverflow, staffSnap }) {
14
14
  const ref = useRef(null);
15
15
  const onWarningsRef = useRef(onWarnings);
16
16
  onWarningsRef.current = onWarnings;
@@ -20,7 +20,8 @@ function GuidexScore({ script, maxWidth, style, bold, textPx, junctionDashes, ma
20
20
  const colorsKey = JSON.stringify([
21
21
  staffColor ?? null,
22
22
  staffLineColors ?? null,
23
- staffPitchColors ?? null
23
+ staffPitchColors ?? null,
24
+ staffClefLineColor ?? null
24
25
  ]);
25
26
  const lineWeightsKey = staffLineWeights === void 0 ? void 0 : JSON.stringify(staffLineWeights);
26
27
  const overflowStart = staffOverflow?.start;
@@ -32,7 +33,7 @@ function GuidexScore({ script, maxWidth, style, bold, textPx, junctionDashes, ma
32
33
  const scoreMarks = marksKey === void 0 ? void 0 : JSON.parse(marksKey);
33
34
  const stanzaTexts = stanzasKey === void 0 ? void 0 : JSON.parse(stanzasKey);
34
35
  const stacked = stackKey === void 0 ? void 0 : JSON.parse(stackKey);
35
- const [color, lineColors, pitchColors] = JSON.parse(colorsKey);
36
+ const [color, lineColors, pitchColors, clefLineColor] = JSON.parse(colorsKey);
36
37
  renderScore(el, script, {
37
38
  maxWidth,
38
39
  style,
@@ -42,8 +43,12 @@ function GuidexScore({ script, maxWidth, style, bold, textPx, junctionDashes, ma
42
43
  junctionDashes,
43
44
  staffFill,
44
45
  staffFillSnapPx,
46
+ paddingPx,
47
+ clefMark,
48
+ textFont,
45
49
  twoSyllableRecitationsToPlain,
46
50
  plainRunsToRecitation,
51
+ cutEmptySlots,
47
52
  transpose,
48
53
  stanza,
49
54
  stack: stacked,
@@ -58,6 +63,7 @@ function GuidexScore({ script, maxWidth, style, bold, textPx, junctionDashes, ma
58
63
  staffPitchColors: pitchColors ?? void 0,
59
64
  staffWeight,
60
65
  staffClefLineWeight,
66
+ staffClefLineColor: clefLineColor ?? void 0,
61
67
  staffOverflow: overflowStart === void 0 && overflowEnd === void 0 ? void 0 : {
62
68
  start: overflowStart,
63
69
  end: overflowEnd
@@ -80,8 +86,12 @@ function GuidexScore({ script, maxWidth, style, bold, textPx, junctionDashes, ma
80
86
  junctionDashes,
81
87
  staffFill,
82
88
  staffFillSnapPx,
89
+ paddingPx,
90
+ clefMark,
91
+ textFont,
83
92
  twoSyllableRecitationsToPlain,
84
93
  plainRunsToRecitation,
94
+ cutEmptySlots,
85
95
  transpose,
86
96
  stanza,
87
97
  stackKey,