@nodelyra/not-angka 0.0.0-stage → 0.1.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 (251) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +38 -2
  3. package/THIRD_PARTY.md +24 -0
  4. package/dist/esm/cursor/activeChord.d.ts +12 -0
  5. package/dist/esm/cursor/activeChord.js +36 -0
  6. package/dist/esm/cursor/beatDot.d.ts +30 -0
  7. package/dist/esm/cursor/beatDot.js +49 -0
  8. package/dist/esm/cursor/drawnTop.d.ts +9 -0
  9. package/dist/esm/cursor/drawnTop.js +16 -0
  10. package/dist/esm/cursor/pageBoxes.d.ts +28 -0
  11. package/dist/esm/cursor/pageBoxes.js +75 -0
  12. package/dist/esm/cursor/playbackCursor.d.ts +25 -0
  13. package/dist/esm/cursor/playbackCursor.js +42 -0
  14. package/dist/esm/cursor/playingStyle.d.ts +16 -0
  15. package/dist/esm/cursor/playingStyle.js +34 -0
  16. package/dist/esm/cursor/playingTones.d.ts +8 -0
  17. package/dist/esm/cursor/playingTones.js +16 -0
  18. package/dist/esm/cursor/target.d.ts +47 -0
  19. package/dist/esm/cursor/target.js +63 -0
  20. package/dist/esm/export/pageText.d.ts +8 -0
  21. package/dist/esm/export/pageText.js +80 -0
  22. package/dist/esm/export/svgExport.d.ts +46 -0
  23. package/dist/esm/export/svgExport.js +88 -0
  24. package/dist/esm/geometry/metrics.d.ts +42 -0
  25. package/dist/esm/geometry/metrics.js +52 -0
  26. package/dist/esm/geometry/pageSetup.d.ts +61 -0
  27. package/dist/esm/geometry/pageSetup.js +85 -0
  28. package/dist/esm/geometry/paper.d.ts +16 -0
  29. package/dist/esm/geometry/paper.js +16 -0
  30. package/dist/esm/index.d.ts +35 -0
  31. package/dist/esm/index.js +23 -0
  32. package/dist/esm/layout/LayoutEngine.d.ts +64 -0
  33. package/dist/esm/layout/LayoutEngine.js +92 -0
  34. package/dist/esm/layout/arcs.d.ts +20 -0
  35. package/dist/esm/layout/arcs.js +53 -0
  36. package/dist/esm/layout/barlineShapes.d.ts +52 -0
  37. package/dist/esm/layout/barlineShapes.js +71 -0
  38. package/dist/esm/layout/directions.d.ts +48 -0
  39. package/dist/esm/layout/directions.js +122 -0
  40. package/dist/esm/layout/elementBoxes.d.ts +17 -0
  41. package/dist/esm/layout/elementBoxes.js +72 -0
  42. package/dist/esm/layout/floating.d.ts +29 -0
  43. package/dist/esm/layout/floating.js +39 -0
  44. package/dist/esm/layout/keyMarks.d.ts +26 -0
  45. package/dist/esm/layout/keyMarks.js +30 -0
  46. package/dist/esm/layout/lyricAlign.d.ts +6 -0
  47. package/dist/esm/layout/lyricAlign.js +15 -0
  48. package/dist/esm/layout/lyricWords.d.ts +13 -0
  49. package/dist/esm/layout/lyricWords.js +27 -0
  50. package/dist/esm/layout/lyricsLayout.d.ts +55 -0
  51. package/dist/esm/layout/lyricsLayout.js +122 -0
  52. package/dist/esm/layout/markings.d.ts +97 -0
  53. package/dist/esm/layout/markings.js +150 -0
  54. package/dist/esm/layout/measurePlan.d.ts +74 -0
  55. package/dist/esm/layout/measurePlan.js +232 -0
  56. package/dist/esm/layout/measureSegments.d.ts +24 -0
  57. package/dist/esm/layout/measureSegments.js +64 -0
  58. package/dist/esm/layout/notationMetrics.d.ts +110 -0
  59. package/dist/esm/layout/notationMetrics.js +122 -0
  60. package/dist/esm/layout/systemBreaking.d.ts +59 -0
  61. package/dist/esm/layout/systemBreaking.js +137 -0
  62. package/dist/esm/layout/systemLayout.d.ts +138 -0
  63. package/dist/esm/layout/systemLayout.js +266 -0
  64. package/dist/esm/layout/tupletSpacing.d.ts +9 -0
  65. package/dist/esm/layout/tupletSpacing.js +33 -0
  66. package/dist/esm/layout/tuplets.d.ts +30 -0
  67. package/dist/esm/layout/tuplets.js +39 -0
  68. package/dist/esm/model/hiddenParts.d.ts +23 -0
  69. package/dist/esm/model/hiddenParts.js +39 -0
  70. package/dist/esm/model/locate.d.ts +18 -0
  71. package/dist/esm/model/locate.js +31 -0
  72. package/dist/esm/model/lowVoices.d.ts +9 -0
  73. package/dist/esm/model/lowVoices.js +20 -0
  74. package/dist/esm/model/partColors.d.ts +13 -0
  75. package/dist/esm/model/partColors.js +10 -0
  76. package/dist/esm/model/partSpan.d.ts +25 -0
  77. package/dist/esm/model/partSpan.js +49 -0
  78. package/dist/esm/model/rowPresence.d.ts +14 -0
  79. package/dist/esm/model/rowPresence.js +19 -0
  80. package/dist/esm/model/sharedLyrics.d.ts +23 -0
  81. package/dist/esm/model/sharedLyrics.js +68 -0
  82. package/dist/esm/model/textBars.d.ts +12 -0
  83. package/dist/esm/model/textBars.js +21 -0
  84. package/dist/esm/model/tickRanges.d.ts +22 -0
  85. package/dist/esm/model/tickRanges.js +34 -0
  86. package/dist/esm/model/unisons.d.ts +69 -0
  87. package/dist/esm/model/unisons.js +181 -0
  88. package/dist/esm/notation/chords.d.ts +12 -0
  89. package/dist/esm/notation/chords.js +29 -0
  90. package/dist/esm/notation/elision.d.ts +24 -0
  91. package/dist/esm/notation/elision.js +47 -0
  92. package/dist/esm/notation/keys.d.ts +50 -0
  93. package/dist/esm/notation/keys.js +59 -0
  94. package/dist/esm/notation/lyricAlign.d.ts +7 -0
  95. package/dist/esm/notation/lyricAlign.js +15 -0
  96. package/dist/esm/notation/navigation.d.ts +3 -0
  97. package/dist/esm/notation/navigation.js +5 -0
  98. package/dist/esm/notation/pitch.d.ts +39 -0
  99. package/dist/esm/notation/pitch.js +74 -0
  100. package/dist/esm/notation/pitchName.d.ts +2 -0
  101. package/dist/esm/notation/pitchName.js +3 -0
  102. package/dist/esm/notation/profile.d.ts +35 -0
  103. package/dist/esm/notation/profile.js +16 -0
  104. package/dist/esm/notation/rhythm.d.ts +59 -0
  105. package/dist/esm/notation/rhythm.js +116 -0
  106. package/dist/esm/notation/time.d.ts +98 -0
  107. package/dist/esm/notation/time.js +85 -0
  108. package/dist/esm/performance/compilePerformance.d.ts +7 -0
  109. package/dist/esm/performance/compilePerformance.js +8 -0
  110. package/dist/esm/performance/dynamics.d.ts +6 -0
  111. package/dist/esm/performance/dynamics.js +78 -0
  112. package/dist/esm/performance/model.d.ts +56 -0
  113. package/dist/esm/performance/model.js +1 -0
  114. package/dist/esm/performance/playOrder.d.ts +16 -0
  115. package/dist/esm/performance/playOrder.js +64 -0
  116. package/dist/esm/performance/readScore.d.ts +4 -0
  117. package/dist/esm/performance/readScore.js +58 -0
  118. package/dist/esm/performance/timeline.d.ts +10 -0
  119. package/dist/esm/performance/timeline.js +144 -0
  120. package/dist/esm/playback/audioOutput.d.ts +46 -0
  121. package/dist/esm/playback/audioOutput.js +106 -0
  122. package/dist/esm/playback/clock.d.ts +16 -0
  123. package/dist/esm/playback/clock.js +44 -0
  124. package/dist/esm/playback/createPlayerStore.d.ts +79 -0
  125. package/dist/esm/playback/createPlayerStore.js +135 -0
  126. package/dist/esm/playback/cues.d.ts +34 -0
  127. package/dist/esm/playback/cues.js +52 -0
  128. package/dist/esm/playback/errors.d.ts +6 -0
  129. package/dist/esm/playback/errors.js +6 -0
  130. package/dist/esm/playback/metronome.d.ts +13 -0
  131. package/dist/esm/playback/metronome.js +15 -0
  132. package/dist/esm/playback/mix.d.ts +9 -0
  133. package/dist/esm/playback/mix.js +8 -0
  134. package/dist/esm/playback/pass.d.ts +27 -0
  135. package/dist/esm/playback/pass.js +36 -0
  136. package/dist/esm/playback/schedule.d.ts +7 -0
  137. package/dist/esm/playback/schedule.js +12 -0
  138. package/dist/esm/playback/session.d.ts +46 -0
  139. package/dist/esm/playback/session.js +107 -0
  140. package/dist/esm/playback/source.d.ts +6 -0
  141. package/dist/esm/playback/source.js +1 -0
  142. package/dist/esm/playback/start.d.ts +28 -0
  143. package/dist/esm/playback/start.js +38 -0
  144. package/dist/esm/playback/timing.d.ts +14 -0
  145. package/dist/esm/playback/timing.js +11 -0
  146. package/dist/esm/playback/types.d.ts +60 -0
  147. package/dist/esm/playback/types.js +1 -0
  148. package/dist/esm/playback/volume.d.ts +12 -0
  149. package/dist/esm/playback/volume.js +8 -0
  150. package/dist/esm/player/ControlBar.d.ts +22 -0
  151. package/dist/esm/player/ControlBar.js +77 -0
  152. package/dist/esm/player/CursorPainter.d.ts +17 -0
  153. package/dist/esm/player/CursorPainter.js +53 -0
  154. package/dist/esm/player/InfoLine.d.ts +6 -0
  155. package/dist/esm/player/InfoLine.js +23 -0
  156. package/dist/esm/player/PageView.d.ts +10 -0
  157. package/dist/esm/player/PageView.js +16 -0
  158. package/dist/esm/player/actions.d.ts +24 -0
  159. package/dist/esm/player/actions.js +26 -0
  160. package/dist/esm/player/balanceSystems.d.ts +8 -0
  161. package/dist/esm/player/balanceSystems.js +18 -0
  162. package/dist/esm/player/createExcerptPlayer.d.ts +33 -0
  163. package/dist/esm/player/createExcerptPlayer.js +169 -0
  164. package/dist/esm/player/createScorePlayer.d.ts +24 -0
  165. package/dist/esm/player/createScorePlayer.js +118 -0
  166. package/dist/esm/player/dom.d.ts +6 -0
  167. package/dist/esm/player/dom.js +15 -0
  168. package/dist/esm/player/embeddedFonts.d.ts +1 -0
  169. package/dist/esm/player/embeddedFonts.js +3 -0
  170. package/dist/esm/player/exclusivePlayback.d.ts +10 -0
  171. package/dist/esm/player/exclusivePlayback.js +13 -0
  172. package/dist/esm/player/followCursor.d.ts +5 -0
  173. package/dist/esm/player/followCursor.js +16 -0
  174. package/dist/esm/player/icons.d.ts +7 -0
  175. package/dist/esm/player/icons.js +9 -0
  176. package/dist/esm/player/injectFonts.d.ts +8 -0
  177. package/dist/esm/player/injectFonts.js +19 -0
  178. package/dist/esm/player/loadExcerpt.d.ts +21 -0
  179. package/dist/esm/player/loadExcerpt.js +123 -0
  180. package/dist/esm/player/loadScore.d.ts +12 -0
  181. package/dist/esm/player/loadScore.js +12 -0
  182. package/dist/esm/player/mountExcerpts.d.ts +30 -0
  183. package/dist/esm/player/mountExcerpts.js +109 -0
  184. package/dist/esm/player/playhead.d.ts +12 -0
  185. package/dist/esm/player/playhead.js +14 -0
  186. package/dist/esm/player/shadowStyles.d.ts +5 -0
  187. package/dist/esm/player/shadowStyles.js +23 -0
  188. package/dist/esm/player/staticSvg.d.ts +7 -0
  189. package/dist/esm/player/staticSvg.js +10 -0
  190. package/dist/esm/player/styles.d.ts +28 -0
  191. package/dist/esm/player/styles.js +98 -0
  192. package/dist/esm/player/theme.d.ts +8 -0
  193. package/dist/esm/player/theme.js +13 -0
  194. package/dist/esm/player/types.d.ts +76 -0
  195. package/dist/esm/player/types.js +12 -0
  196. package/dist/esm/rendering/SystemRenderer.d.ts +6 -0
  197. package/dist/esm/rendering/SystemRenderer.js +58 -0
  198. package/dist/esm/rendering/accidentalRenderer.d.ts +4 -0
  199. package/dist/esm/rendering/accidentalRenderer.js +41 -0
  200. package/dist/esm/rendering/arcRenderer.d.ts +9 -0
  201. package/dist/esm/rendering/arcRenderer.js +32 -0
  202. package/dist/esm/rendering/barlineRenderer.d.ts +8 -0
  203. package/dist/esm/rendering/barlineRenderer.js +59 -0
  204. package/dist/esm/rendering/directionRenderer.d.ts +4 -0
  205. package/dist/esm/rendering/directionRenderer.js +50 -0
  206. package/dist/esm/rendering/durationLineRenderer.d.ts +9 -0
  207. package/dist/esm/rendering/durationLineRenderer.js +27 -0
  208. package/dist/esm/rendering/dynamicGlyphs.d.ts +25 -0
  209. package/dist/esm/rendering/dynamicGlyphs.js +56 -0
  210. package/dist/esm/rendering/frameRenderer.d.ts +17 -0
  211. package/dist/esm/rendering/frameRenderer.js +252 -0
  212. package/dist/esm/rendering/keyMarkRenderer.d.ts +8 -0
  213. package/dist/esm/rendering/keyMarkRenderer.js +57 -0
  214. package/dist/esm/rendering/lyricsRenderer.d.ts +4 -0
  215. package/dist/esm/rendering/lyricsRenderer.js +44 -0
  216. package/dist/esm/rendering/primitives.d.ts +64 -0
  217. package/dist/esm/rendering/primitives.js +1 -0
  218. package/dist/esm/rendering/sliceRenderer.d.ts +19 -0
  219. package/dist/esm/rendering/sliceRenderer.js +79 -0
  220. package/dist/esm/rendering/textBarRenderer.d.ts +8 -0
  221. package/dist/esm/rendering/textBarRenderer.js +28 -0
  222. package/dist/esm/rendering/tupletRenderer.d.ts +7 -0
  223. package/dist/esm/rendering/tupletRenderer.js +42 -0
  224. package/dist/esm/schema/normalize.d.ts +14 -0
  225. package/dist/esm/schema/normalize.js +123 -0
  226. package/dist/esm/schema/pageMeta.d.ts +11 -0
  227. package/dist/esm/schema/pageMeta.js +1 -0
  228. package/dist/esm/schema/scoreJson.d.ts +59 -0
  229. package/dist/esm/schema/scoreJson.js +1 -0
  230. package/dist/esm/schema/scoreView.d.ts +16 -0
  231. package/dist/esm/schema/scoreView.js +24 -0
  232. package/dist/esm/schema/types.d.ts +339 -0
  233. package/dist/esm/schema/types.js +1 -0
  234. package/dist/esm/text/creditLines.d.ts +12 -0
  235. package/dist/esm/text/creditLines.js +11 -0
  236. package/dist/esm/text/fonts.d.ts +50 -0
  237. package/dist/esm/text/fonts.js +98 -0
  238. package/dist/esm/text/headerFooter.d.ts +13 -0
  239. package/dist/esm/text/headerFooter.js +21 -0
  240. package/dist/esm/text/textLines.d.ts +7 -0
  241. package/dist/esm/text/textLines.js +13 -0
  242. package/dist/index.cjs +65 -0
  243. package/dist/index.cjs.map +1 -0
  244. package/dist/nodelyra-player.global.js +65 -0
  245. package/dist/nodelyra-player.global.js.map +1 -0
  246. package/dist/nodelyra-player.lite.global.js +63 -0
  247. package/dist/nodelyra-player.lite.global.js.map +1 -0
  248. package/examples/blog-excerpt.html +54 -0
  249. package/examples/twinkle.html +23 -0
  250. package/examples/twinkle.json +91 -0
  251. package/package.json +70 -4
@@ -0,0 +1,339 @@
1
+ /**
2
+ * Mirrors backend/apps/scores (score content schema version 2, see apps/scores/schema.py).
3
+ * Time is integer ticks (TICKS_PER_QUARTER per quarter note). Ids are client-generated, stable
4
+ * and opaque; selection, slurs and the SVG refer to them.
5
+ */
6
+ export type Degree = 1 | 2 | 3 | 4 | 5 | 6 | 7;
7
+ export type Accidental = "sharp" | "flat";
8
+ /** Override of the default (by-beat) grouping of duration lines. */
9
+ export type BeamHint = "break" | "join";
10
+ /** How a syllable sits under its note: centred, or lined up with the note's left / right edge. */
11
+ export type LyricAlign = "left" | "center" | "right";
12
+ /**
13
+ * One syllable. `hyphen` draws a hyphen to the next syllable; `join` makes it one word with the
14
+ * next ("ting" + "gal" = "tinggal", written against it); never both. `align` places it under its
15
+ * note and `offset` moves it sideways from there (layout px, dragged on the canvas). `join`,
16
+ * `align` and `offset` may be missing (read as false, "center" and 0).
17
+ */
18
+ export type Lyric = {
19
+ text: string;
20
+ hyphen: boolean;
21
+ extender: boolean;
22
+ join?: boolean;
23
+ align?: LyricAlign;
24
+ offset?: number;
25
+ };
26
+ /**
27
+ * Marks an event as one of a tuplet: `of` notes in the time of `in` (a triplet: 3 in 2). Events
28
+ * of one tuplet share its `id` and sit next to each other in one part's measure.
29
+ */
30
+ export type Tuplet = {
31
+ id: string;
32
+ of: number;
33
+ in: number;
34
+ };
35
+ type EventBase = {
36
+ id: string;
37
+ /** Ticks it sounds; a tuplet note's share of its written value (a triplet eighth: 160). */
38
+ duration: number;
39
+ beam: BeamHint | null;
40
+ /** One of a tuplet (schema version 3); absent or null = a plain note or rest. */
41
+ tuplet?: Tuplet | null;
42
+ };
43
+ export type NoteEvent = EventBase & {
44
+ type: "note";
45
+ degree: Degree;
46
+ /** 0 = middle; +1 = one dot above, -1 = one dot below. */
47
+ octave: number;
48
+ accidental: Accidental | null;
49
+ /** Tied to the next note of the same part. */
50
+ tie: boolean;
51
+ /** One entry per lyric line (verse); null = no syllable on that line. */
52
+ lyrics: (Lyric | null)[];
53
+ };
54
+ export type RestEvent = EventBase & {
55
+ type: "rest";
56
+ octave: 0;
57
+ accidental: null;
58
+ tie: false;
59
+ lyrics: [];
60
+ };
61
+ export type ScoreEvent = NoteEvent | RestEvent;
62
+ export type PartMeasure = {
63
+ events: ScoreEvent[];
64
+ };
65
+ export type Slur = {
66
+ id: string;
67
+ start: string;
68
+ end: string;
69
+ };
70
+ export type PartKind = "vocal";
71
+ /** The color a part's notes are marked with while it plays. Keep in sync with the backend `PART_COLORS`. */
72
+ export type PartColor = "orchid" | "periwinkle" | "sky" | "ivory" | "sage";
73
+ /** The bars a part plays, first to last (score measure ids). */
74
+ export type PartSpan = {
75
+ from: string;
76
+ to: string;
77
+ };
78
+ export type ScorePart = {
79
+ id: string;
80
+ name: string;
81
+ abbreviation: string;
82
+ kind: PartKind;
83
+ visible: boolean;
84
+ /** One entry per score measure, in the same order. */
85
+ measures: PartMeasure[];
86
+ slurs: Slur[];
87
+ /** The bars the part plays (a part joining later); absent or null = the whole score. */
88
+ span?: PartSpan | null;
89
+ /** Its color while it plays; absent or null = the default for its position (`partColorOf`). */
90
+ color?: PartColor | null;
91
+ };
92
+ export type BarlineType = "single" | "double" | "final" | "repeat_end" | "none";
93
+ export type MeasureBreak = "line" | "page";
94
+ /**
95
+ * A jump mark at the end of a bar: "Fine" ends the piece when it is played again after a
96
+ * "D.C. al Fine", which goes back to the start and plays to the Fine (or to the D.C. bar itself
97
+ * when the score has no Fine). Optional; absent or null = none.
98
+ */
99
+ export type Navigation = "fine" | "dc_al_fine";
100
+ /** A note name: the letter of a chord's root or bass (absolute, not a scale degree). */
101
+ export type NoteLetter = "C" | "D" | "E" | "F" | "G" | "A" | "B";
102
+ /** A chord's bass note (the "B" of "G/B"). */
103
+ export type ChordNote = {
104
+ root: NoteLetter;
105
+ accidental: Accidental | null;
106
+ };
107
+ /**
108
+ * A chord symbol above a bar, `at` ticks from the bar's start. Stored by its parts (root,
109
+ * quality as written, optional bass), so transposing can move the root and bass.
110
+ */
111
+ export type Chord = ChordNote & {
112
+ at: number;
113
+ quality: string;
114
+ bass: ChordNote | null;
115
+ };
116
+ /** What a measure is for every part. */
117
+ export type ScoreMeasure = {
118
+ id: string;
119
+ /** Time signature from this measure on; null = the score's. */
120
+ time: string | null;
121
+ /** The bar line at the end of the measure. */
122
+ barline: BarlineType;
123
+ repeat_start: boolean;
124
+ /** Ending number (1st, 2nd time); consecutive measures with the same number share a bracket. */
125
+ volta: number | null;
126
+ /** A section label drawn above the measure ("Intro / Interlude", "Refr", "Coda"). */
127
+ label: string;
128
+ /** A jump mark drawn at the end of the measure: Fine or D.C. al Fine; absent or null = none. */
129
+ navigation?: Navigation | null;
130
+ break_after: MeasureBreak | null;
131
+ /**
132
+ * Width added to (negative: taken from) the measure by dragging its bar line, in layout px at
133
+ * the base note size. Optional: measures saved before it existed have none (0).
134
+ */
135
+ width_adjust?: number;
136
+ /**
137
+ * Where the measure continues on the next system, in ticks from the bar's start (a beat; ADR
138
+ * 0008). Absent or null = never split. Layout only: playback and export ignore it.
139
+ */
140
+ split_at?: number | null;
141
+ /**
142
+ * A bar that writes text across every part instead of notes ("2 bars\ninstr."), standing for
143
+ * `bars` bars of rest (ADR 0009). Absent or null = an ordinary bar. Its parts hold no events.
144
+ */
145
+ text_bar?: TextBar | null;
146
+ /** The key ("1 =") from this measure on, until the next change (ADR 0010); null = the key in force. */
147
+ key?: string | null;
148
+ /**
149
+ * Where in the bar `key` takes over, in ticks from the bar's start, like a note's onset (ADR
150
+ * 0017): notes before it are still in the old key. Absent or 0 = from the bar's start.
151
+ */
152
+ key_at?: number;
153
+ /**
154
+ * The tempo (quarter notes per minute, 30-300) from this measure on, until the next change
155
+ * (schema 4); absent or null = the tempo in force. The score's own tempo is where it starts.
156
+ */
157
+ tempo?: number | null;
158
+ /**
159
+ * At a key change: show the box with each part's last note in the old and the new key ("5 → 3").
160
+ * Absent = shown.
161
+ */
162
+ key_pivot?: boolean;
163
+ /**
164
+ * For a change partway through a bar that starts a new line there (ADR 0017): draw the box at
165
+ * the end of the line above, after the last notes in the old key, instead of opening the new
166
+ * line. Layout only. Absent = it opens the new line.
167
+ */
168
+ key_pivot_above?: boolean;
169
+ /** Dynamics, hairpins and expression text above the system (ADR 0011); absent = none. */
170
+ directions?: Direction[];
171
+ /** Chord symbols, in time order, one per position at most; absent = none (older scores). */
172
+ chords?: Chord[];
173
+ /** Neighbouring parts singing the same notes and lyrics in (part of) this bar (ADR 0012); absent = none. */
174
+ unisons?: Unison[];
175
+ /** Parts left out over (part of) this bar: silent there and drawn without a row (ADR 0013); absent = none. */
176
+ hidden_parts?: HiddenPart[];
177
+ /** Neighbouring parts sharing the bottom one's lyrics over (part of) this bar (ADR 0014); absent = none. */
178
+ shared_lyrics?: SharedLyrics[];
179
+ };
180
+ /**
181
+ * Parts (ids in score order) that sing the lyrics of the last one over ticks `from`..`to` of a bar
182
+ * (`to` null = its end). Each keeps its own copy of the syllables; only the last one's are drawn.
183
+ */
184
+ export type SharedLyrics = {
185
+ parts: string[];
186
+ from: number;
187
+ to: number | null;
188
+ };
189
+ /** A part left out over ticks `from`..`to` of a bar (`to` null = its end); it sings no note there. */
190
+ export type HiddenPart = {
191
+ part: string;
192
+ from: number;
193
+ to: number | null;
194
+ };
195
+ /**
196
+ * Parts drawn as one row ("SA.") over ticks `from`..`to` of a bar (`to` null = the bar's end), ids
197
+ * in score order. Over the whole bar the first part holds the notes and the others none (playback
198
+ * gives them the first one's); over part of a bar each keeps its own notes, the same inside it.
199
+ */
200
+ export type Unison = {
201
+ parts: string[];
202
+ from: number;
203
+ to: number | null;
204
+ };
205
+ /** How loud a dynamic mark says to play, softest first (the backend's `DYNAMIC_LEVELS`). */
206
+ export type DynamicLevel = "ppp" | "pp" | "p" | "mp" | "mf" | "f" | "ff" | "fff";
207
+ export type HairpinShape = "cresc" | "dim";
208
+ /**
209
+ * Written above the system at `at` ticks into its bar (ADR 0011): a dynamic ("mp"), expression
210
+ * text ("sotto voce"), or a hairpin that runs to `end` (a bar and tick, the same bar or later).
211
+ */
212
+ export type Direction = {
213
+ type: "dynamic";
214
+ at: number;
215
+ level: DynamicLevel;
216
+ } | {
217
+ type: "text";
218
+ at: number;
219
+ text: string;
220
+ } | {
221
+ type: "hairpin";
222
+ at: number;
223
+ shape: HairpinShape;
224
+ end: {
225
+ measure: string;
226
+ at: number;
227
+ };
228
+ };
229
+ export type DirectionType = Direction["type"];
230
+ /** Text written across a bar's parts in place of notes; it lasts `bars` bars (1-99). */
231
+ export type TextBar = {
232
+ text: string;
233
+ bars: number;
234
+ };
235
+ /** The musical content of a score. */
236
+ export type ScoreMusic = {
237
+ measures: ScoreMeasure[];
238
+ parts: ScorePart[];
239
+ };
240
+ export type PaperSize = "a4" | "letter" | "f4" | "legal";
241
+ export type Orientation = "portrait" | "landscape";
242
+ /** Millimetres. */
243
+ export type PageMargins = {
244
+ top: number;
245
+ right: number;
246
+ bottom: number;
247
+ left: number;
248
+ };
249
+ /** Text may use {page}, {pages} and {title}. */
250
+ export type HeaderFooterText = {
251
+ left: string;
252
+ center: string;
253
+ right: string;
254
+ };
255
+ export type TextAlign = "left" | "center" | "right";
256
+ /** Keep in sync with the backend `FONTS`. */
257
+ export type ScoreFont = "default" | "arial" | "times" | "georgia" | "verdana" | "courier";
258
+ /** Display faces for title-block text only (keep in sync with the backend `DISPLAY_FONTS`). */
259
+ export type DisplayFont = "quintessential" | "alegreya_sans_sc" | "libre_baskerville" | "basic";
260
+ /** The title, subtitle, info and credits fonts: "inherit" (the score font), a score font or a display face. */
261
+ export type HeadingFont = ScoreFont | DisplayFont | "inherit";
262
+ /** The notation digits' font: "inherit" (the score font) or another score font. */
263
+ export type NotesFont = ScoreFont | "inherit";
264
+ /** Keep in sync with the backend `LYRICS_FONTS`. */
265
+ export type LyricsFont = "sofia_sans_extra_condensed" | "sofia_sans_condensed" | "roboto_condensed" | "saira_condensed" | "barlow_condensed" | "indie_flower" | "comic_neue" | "pt_sans_narrow" | "unbounded" | "salsa" | "rosario" | "basic" | "baskervville" | "times_new_roman";
266
+ /** A right-hand title-block line. An empty label shows the value alone. */
267
+ export type Credit = {
268
+ label: string;
269
+ value: string;
270
+ };
271
+ export type PageLayout = {
272
+ orientation: Orientation;
273
+ /** Font of the whole score. */
274
+ font: ScoreFont;
275
+ /** Font of the title only; "inherit" = same as `font`. */
276
+ title_font: HeadingFont;
277
+ subtitle_font: HeadingFont;
278
+ info_font: HeadingFont;
279
+ credits_font: HeadingFont;
280
+ notes_font: NotesFont;
281
+ /** Font of the lyrics, independent of `font`. */
282
+ lyrics_font: LyricsFont;
283
+ /** Digit size in px; the whole notation (lines, dots, bar lines, spacing) scales with it. */
284
+ note_size: number;
285
+ /** Lyric size in px, independent of `note_size`. */
286
+ lyric_size: number;
287
+ /** Space between systems (lines of bars), in px at the base note size: it scales with `note_size`. */
288
+ system_spacing: number;
289
+ /** Whether the bracket joining a system's parts is drawn at its left. */
290
+ system_bracket: boolean;
291
+ /**
292
+ * Draw the tenor, countertenor, baritone and bass parts one octave higher than their notes
293
+ * (their octave dots shift by one), as numbered scores written for the F clef usually do. Only
294
+ * the drawing changes: the saved notes, the sound and the exports of the notes do not.
295
+ * Absent = true.
296
+ */
297
+ low_voices_octave_up: boolean;
298
+ margins: PageMargins;
299
+ header: HeaderFooterText & {
300
+ title_block: boolean;
301
+ title_align: TextAlign;
302
+ title_italic: boolean;
303
+ subtitle_italic: boolean;
304
+ /** Title and subtitle font sizes in px. */
305
+ title_size: number;
306
+ subtitle_size: number;
307
+ /** Space between the title block and the first system, in px (page 1). */
308
+ title_gap: number;
309
+ /** Left-hand lines under the title; may use {key}, {time}, {tempo}. */
310
+ info: string[];
311
+ credits: Credit[];
312
+ /** How the credit lines align inside their block. */
313
+ credits_align: TextAlign;
314
+ credits_italic: boolean;
315
+ };
316
+ footer: HeaderFooterText;
317
+ };
318
+ export type ScoreSettings = {
319
+ key: string;
320
+ time: string;
321
+ tempo: number;
322
+ tempo_marking: string;
323
+ /** Ticks the first bar holds when the music starts after beat one; 0 or absent = none. */
324
+ pickup?: number;
325
+ paper: PaperSize;
326
+ /** The harmonization style the score was last harmonized in (an id such as "jazz"); a review judges by it. */
327
+ style_profile?: string | null;
328
+ page: PageLayout;
329
+ };
330
+ /**
331
+ * A whole score as JSON: the document the renderer, the player and the backend all read and
332
+ * write (the backend's create/update body, a published snapshot, or a file you write by hand).
333
+ */
334
+ export type ScoreInput = ScoreMusic & {
335
+ title: string;
336
+ subtitle: string;
337
+ settings: ScoreSettings;
338
+ };
339
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,12 @@
1
+ import type { Credit } from "../schema/types.js";
2
+ /** One drawn credit line. `label` is set on a credit's first line only; `labeled` on all of them. */
3
+ export type CreditRow = {
4
+ label: string;
5
+ text: string;
6
+ labeled: boolean;
7
+ };
8
+ /** Every line a credit list draws, in order. Placeholders are filled by the caller. */
9
+ export declare function creditRows(credits: Credit[]): CreditRow[];
10
+ /** The rows as plain text: "Label : first line", then continuation lines as they are. */
11
+ export declare const creditLines: (credits: Credit[]) => string[];
12
+ export declare const creditLineCount: (credits: Credit[]) => number;
@@ -0,0 +1,11 @@
1
+ /** Every line a credit list draws, in order. Placeholders are filled by the caller. */
2
+ export function creditRows(credits) {
3
+ return credits.flatMap(({ label, value }) => value.split("\n").map((text, index) => ({
4
+ label: index === 0 ? label : "",
5
+ text,
6
+ labeled: label !== "",
7
+ })));
8
+ }
9
+ /** The rows as plain text: "Label : first line", then continuation lines as they are. */
10
+ export const creditLines = (credits) => creditRows(credits).map((r) => (r.label ? `${r.label} : ${r.text}` : r.text));
11
+ export const creditLineCount = (credits) => creditLines(credits).length;
@@ -0,0 +1,50 @@
1
+ import type { HeadingFont, LyricsFont, NotesFont, PageLayout, ScoreFont } from "../schema/types.js";
2
+ type FontDefinition = {
3
+ label: string;
4
+ /** CSS font-family for notation digits. */
5
+ notes: string;
6
+ /** CSS font-family for words: title block, header and footer. */
7
+ text: string;
8
+ };
9
+ type LyricsFontDefinition = {
10
+ label: string;
11
+ /** CSS font-family: the web font next/font loads (its variable) or a system font, then fallbacks. */
12
+ stack: string;
13
+ /** How wide the face sets text compared with a regular sans (spacing under the notes). */
14
+ widthScale: number;
15
+ };
16
+ /**
17
+ * The lyrics fonts, independent of the score font (keep ids in sync with the backend
18
+ * `LYRICS_FONTS`; each is loaded by next/font in `app/layout.tsx` under its CSS variable).
19
+ */
20
+ export declare const LYRICS_FONTS: Record<LyricsFont, LyricsFontDefinition>;
21
+ export declare const LYRICS_FONT_OPTIONS: LyricsFont[];
22
+ export declare const DEFAULT_LYRICS_FONT: LyricsFont;
23
+ /** Keep ids in sync with the backend (`FONTS` in apps/scores/serializers.py). */
24
+ export declare const FONTS: Record<ScoreFont, FontDefinition>;
25
+ export declare const FONT_OPTIONS: ScoreFont[];
26
+ export declare const NOTES_FONT_OPTIONS: NotesFont[];
27
+ type TextFontDefinition = Pick<FontDefinition, "label" | "text">;
28
+ /** Every font the title, subtitle, info or credits may have besides "inherit": the score fonts, then the display faces. */
29
+ export declare const HEADING_FONTS: Record<Exclude<HeadingFont, "inherit">, TextFontDefinition>;
30
+ export declare const HEADING_FONT_OPTIONS: HeadingFont[];
31
+ export declare const DEFAULT_FONT: ScoreFont;
32
+ /** Ending numerals (I, II) over the repeat brackets: Times New Roman whatever the score font. */
33
+ export declare const VOLTA_FONT = "\"Times New Roman\", Times, serif";
34
+ export type ResolvedFonts = {
35
+ notes: string;
36
+ text: string;
37
+ lyrics: string;
38
+ volta: string;
39
+ title: string;
40
+ subtitle: string;
41
+ info: string;
42
+ credits: string;
43
+ };
44
+ type FontChoices = Pick<PageLayout, "font" | "notes_font" | "title_font" | "subtitle_font" | "info_font" | "credits_font" | "lyrics_font">;
45
+ /**
46
+ * CSS font stacks for a page layout. The score font sets the digits and every text; the notes,
47
+ * title, subtitle, info and credits each follow it unless they have their own font.
48
+ */
49
+ export declare function resolveFonts(layout: FontChoices): ResolvedFonts;
50
+ export {};
@@ -0,0 +1,98 @@
1
+ // Print-safe stacks: the browser prints with whatever the viewer has installed, so each one ends
2
+ // in a generic family. "default" is the app look: Plus Jakarta Sans (loaded by next/font), monospace digits.
3
+ const DEFAULT_TEXT = 'var(--font-jakarta-sans), "Plus Jakarta Sans", ui-sans-serif, system-ui, sans-serif';
4
+ // Faces by name too: the player library bundles Geist Mono, Plus Jakarta Sans and Sofia Sans Extra Condensed, so a stack without the app's CSS variable still finds them.
5
+ const DEFAULT_NOTES = 'var(--font-geist-mono), "Geist Mono", ui-monospace, monospace';
6
+ const lyricsFont = (label, variable, family, fallback, widthScale) => ({
7
+ label,
8
+ stack: `var(${variable}), "${family}", ${fallback}`,
9
+ widthScale,
10
+ });
11
+ const NARROW = '"Arial Narrow", sans-serif';
12
+ /**
13
+ * The lyrics fonts, independent of the score font (keep ids in sync with the backend
14
+ * `LYRICS_FONTS`; each is loaded by next/font in `app/layout.tsx` under its CSS variable).
15
+ */
16
+ export const LYRICS_FONTS = {
17
+ sofia_sans_extra_condensed: lyricsFont("Sofia Sans Extra Condensed", "--font-lyrics-sofia-xc", "Sofia Sans Extra Condensed", NARROW, 0.7),
18
+ sofia_sans_condensed: lyricsFont("Sofia Sans Condensed", "--font-lyrics-sofia-c", "Sofia Sans Condensed", NARROW, 0.8),
19
+ roboto_condensed: lyricsFont("Roboto Condensed", "--font-lyrics-roboto-c", "Roboto Condensed", NARROW, 0.85),
20
+ saira_condensed: lyricsFont("Saira Condensed", "--font-lyrics-saira-c", "Saira Condensed", NARROW, 0.8),
21
+ barlow_condensed: lyricsFont("Barlow Condensed", "--font-lyrics-barlow-c", "Barlow Condensed", NARROW, 0.8),
22
+ indie_flower: lyricsFont("Indie Flower", "--font-lyrics-indie-flower", "Indie Flower", "cursive", 1),
23
+ comic_neue: lyricsFont("Comic Neue", "--font-lyrics-comic-neue", "Comic Neue", '"Comic Sans MS", cursive', 0.95),
24
+ pt_sans_narrow: lyricsFont("PT Sans Narrow", "--font-lyrics-pt-sans-narrow", "PT Sans Narrow", NARROW, 0.85),
25
+ // A wide display face: it needs far more room per syllable.
26
+ unbounded: lyricsFont("Unbounded", "--font-lyrics-unbounded", "Unbounded", "sans-serif", 1.3),
27
+ salsa: lyricsFont("Salsa", "--font-lyrics-salsa", "Salsa", "cursive", 1),
28
+ rosario: lyricsFont("Rosario", "--font-lyrics-rosario", "Rosario", "sans-serif", 0.95),
29
+ basic: lyricsFont("Basic", "--font-lyrics-basic", "Basic", "sans-serif", 1),
30
+ baskervville: lyricsFont("Baskerville", "--font-lyrics-baskervville", "Baskervville", "Baskerville, serif", 0.95),
31
+ // A system font: nothing to load, so no CSS variable.
32
+ times_new_roman: { label: "Times New Roman", stack: '"Times New Roman", Times, serif', widthScale: 0.9 },
33
+ };
34
+ export const LYRICS_FONT_OPTIONS = Object.keys(LYRICS_FONTS);
35
+ export const DEFAULT_LYRICS_FONT = "sofia_sans_extra_condensed";
36
+ const same = (label, stack) => ({
37
+ label,
38
+ notes: stack,
39
+ text: stack,
40
+ });
41
+ /** Keep ids in sync with the backend (`FONTS` in apps/scores/serializers.py). */
42
+ export const FONTS = {
43
+ default: {
44
+ label: "Default (Plus Jakarta Sans)",
45
+ notes: DEFAULT_NOTES,
46
+ text: DEFAULT_TEXT,
47
+ },
48
+ arial: same("Arial", '"Arial", "Helvetica Neue", Helvetica, sans-serif'),
49
+ times: same("Times New Roman", '"Times New Roman", Times, serif'),
50
+ georgia: same("Georgia", 'Georgia, "Times New Roman", serif'),
51
+ verdana: same("Verdana", "Verdana, Geneva, sans-serif"),
52
+ courier: same("Courier New", '"Courier New", Courier, monospace'),
53
+ };
54
+ export const FONT_OPTIONS = Object.keys(FONTS);
55
+ export const NOTES_FONT_OPTIONS = ["inherit", ...FONT_OPTIONS];
56
+ /**
57
+ * Display faces for title-block text (keep ids in sync with the backend `DISPLAY_FONTS`; each is
58
+ * loaded by next/font under its CSS variable: `app/displayFonts.ts`, Basic in `app/lyricsFonts.ts`).
59
+ */
60
+ const DISPLAY_FONTS = {
61
+ quintessential: { label: "Quintessential", text: 'var(--font-display-quintessential), "Quintessential", cursive' },
62
+ alegreya_sans_sc: {
63
+ label: "Alegreya Sans SC",
64
+ text: 'var(--font-display-alegreya-sans-sc), "Alegreya Sans SC", sans-serif',
65
+ },
66
+ libre_baskerville: {
67
+ label: "Libre Baskerville",
68
+ text: 'var(--font-display-libre-baskerville), "Libre Baskerville", Baskerville, serif',
69
+ },
70
+ basic: { label: "Basic", text: 'var(--font-lyrics-basic), "Basic", sans-serif' },
71
+ };
72
+ /** Every font the title, subtitle, info or credits may have besides "inherit": the score fonts, then the display faces. */
73
+ export const HEADING_FONTS = { ...FONTS, ...DISPLAY_FONTS };
74
+ export const HEADING_FONT_OPTIONS = [
75
+ "inherit",
76
+ ...Object.keys(HEADING_FONTS),
77
+ ];
78
+ export const DEFAULT_FONT = "default";
79
+ /** Ending numerals (I, II) over the repeat brackets: Times New Roman whatever the score font. */
80
+ export const VOLTA_FONT = '"Times New Roman", Times, serif';
81
+ /**
82
+ * CSS font stacks for a page layout. The score font sets the digits and every text; the notes,
83
+ * title, subtitle, info and credits each follow it unless they have their own font.
84
+ */
85
+ export function resolveFonts(layout) {
86
+ const score = FONTS[layout.font];
87
+ const heading = (font) => (font === "inherit" ? score.text : HEADING_FONTS[font].text);
88
+ return {
89
+ notes: layout.notes_font === "inherit" ? score.notes : FONTS[layout.notes_font].notes,
90
+ text: score.text,
91
+ lyrics: LYRICS_FONTS[layout.lyrics_font].stack,
92
+ volta: VOLTA_FONT,
93
+ title: heading(layout.title_font),
94
+ subtitle: heading(layout.subtitle_font),
95
+ info: heading(layout.info_font),
96
+ credits: heading(layout.credits_font),
97
+ };
98
+ }
@@ -0,0 +1,13 @@
1
+ export type TextContext = {
2
+ page: number;
3
+ pages: number;
4
+ title: string;
5
+ key: string;
6
+ time: string;
7
+ /** Already formatted: the BPM plus the optional marking, e.g. "75 Adagio". */
8
+ tempo: string;
9
+ };
10
+ /** Fill {page}, {pages}, {title}, {key}, {time}, {tempo}; anything else in braces stays as typed. */
11
+ export declare function renderHeaderFooterText(template: string, ctx: TextContext): string;
12
+ /** The tempo as shown in text: the BPM, then the optional wording ("75 Adagio"). */
13
+ export declare function formatTempo(bpm: number, marking: string): string;
@@ -0,0 +1,21 @@
1
+ const PLACEHOLDERS = {
2
+ page: "{page}",
3
+ pages: "{pages}",
4
+ title: "{title}",
5
+ key: "{key}",
6
+ time: "{time}",
7
+ tempo: "{tempo}",
8
+ };
9
+ /** Fill {page}, {pages}, {title}, {key}, {time}, {tempo}; anything else in braces stays as typed. */
10
+ export function renderHeaderFooterText(template, ctx) {
11
+ let text = template;
12
+ for (const name of Object.keys(PLACEHOLDERS)) {
13
+ text = text.replaceAll(PLACEHOLDERS[name], String(ctx[name]));
14
+ }
15
+ return text;
16
+ }
17
+ /** The tempo as shown in text: the BPM, then the optional wording ("75 Adagio"). */
18
+ export function formatTempo(bpm, marking) {
19
+ const words = marking.trim();
20
+ return words ? `${bpm} ${words}` : String(bpm);
21
+ }
@@ -0,0 +1,7 @@
1
+ /** Helpers for text that may span several lines (title, subtitle, credit values). */
2
+ /** Number of lines in `text`; 0 for an empty string. */
3
+ export declare function textLineCount(text: string): number;
4
+ /** The text on one line, for places that cannot show breaks (tab label, header and footer). */
5
+ export declare function singleLine(text: string): string;
6
+ /** Keep at most `maxLines` lines and `maxLength` characters (what the backend accepts). */
7
+ export declare function limitText(text: string, maxLines: number, maxLength: number): string;
@@ -0,0 +1,13 @@
1
+ /** Helpers for text that may span several lines (title, subtitle, credit values). */
2
+ /** Number of lines in `text`; 0 for an empty string. */
3
+ export function textLineCount(text) {
4
+ return text === "" ? 0 : text.split("\n").length;
5
+ }
6
+ /** The text on one line, for places that cannot show breaks (tab label, header and footer). */
7
+ export function singleLine(text) {
8
+ return text.replace(/\s*\n\s*/g, " ").trim();
9
+ }
10
+ /** Keep at most `maxLines` lines and `maxLength` characters (what the backend accepts). */
11
+ export function limitText(text, maxLines, maxLength) {
12
+ return text.split("\n").slice(0, maxLines).join("\n").slice(0, maxLength);
13
+ }