vexflow-native 0.2.0 → 1.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 (259) hide show
  1. package/README.md +267 -37
  2. package/lib/module/base/FontManager.js +139 -0
  3. package/lib/module/base/FontManager.js.map +1 -0
  4. package/lib/module/base/TextMeasureContext.js +46 -0
  5. package/lib/module/base/TextMeasureContext.js.map +1 -0
  6. package/lib/module/base/VexflowCanvas.js +48 -0
  7. package/lib/module/base/VexflowCanvas.js.map +1 -0
  8. package/lib/module/base/VexflowColorScheme.js +16 -0
  9. package/lib/module/base/VexflowColorScheme.js.map +1 -0
  10. package/lib/module/base/VexflowRecordingContext.js +487 -0
  11. package/lib/module/base/VexflowRecordingContext.js.map +1 -0
  12. package/lib/module/base/VexflowRecordingReplay.js +214 -0
  13. package/lib/module/base/VexflowRecordingReplay.js.map +1 -0
  14. package/lib/module/base/VexflowRecordingTypes.js +4 -0
  15. package/lib/module/base/VexflowRecordingTypes.js.map +1 -0
  16. package/lib/module/base/index.js +9 -0
  17. package/lib/module/base/index.js.map +1 -0
  18. package/lib/module/base/setupVexflowReactNative.js +96 -0
  19. package/lib/module/base/setupVexflowReactNative.js.map +1 -0
  20. package/lib/module/base/types.js +4 -0
  21. package/lib/module/base/types.js.map +1 -0
  22. package/lib/module/base/utils.js +18 -0
  23. package/lib/module/base/utils.js.map +1 -0
  24. package/lib/module/musicxml/MusicXmlParser/InternalTypes.js +4 -0
  25. package/lib/module/musicxml/MusicXmlParser/InternalTypes.js.map +1 -0
  26. package/lib/module/musicxml/MusicXmlParser/MeasureParser.js +269 -0
  27. package/lib/module/musicxml/MusicXmlParser/MeasureParser.js.map +1 -0
  28. package/lib/module/musicxml/MusicXmlParser/MusicXmlDirections.js +62 -0
  29. package/lib/module/musicxml/MusicXmlParser/MusicXmlDirections.js.map +1 -0
  30. package/lib/module/musicxml/MusicXmlParser/MusicXmlTiming.js +124 -0
  31. package/lib/module/musicxml/MusicXmlParser/MusicXmlTiming.js.map +1 -0
  32. package/lib/module/musicxml/MusicXmlParser/PartParser.js +41 -0
  33. package/lib/module/musicxml/MusicXmlParser/PartParser.js.map +1 -0
  34. package/lib/module/musicxml/MusicXmlParser/Spanners.js +149 -0
  35. package/lib/module/musicxml/MusicXmlParser/Spanners.js.map +1 -0
  36. package/lib/module/musicxml/MusicXmlParser/XmlOrder.js +106 -0
  37. package/lib/module/musicxml/MusicXmlParser/XmlOrder.js.map +1 -0
  38. package/lib/module/musicxml/MusicXmlParser/index.js +110 -0
  39. package/lib/module/musicxml/MusicXmlParser/index.js.map +1 -0
  40. package/lib/module/musicxml/MusicXmlParser/mappers.js +312 -0
  41. package/lib/module/musicxml/MusicXmlParser/mappers.js.map +1 -0
  42. package/lib/module/musicxml/MusicXmlParser/types.js +10 -0
  43. package/lib/module/musicxml/MusicXmlParser/types.js.map +1 -0
  44. package/lib/module/musicxml/index.js +4 -0
  45. package/lib/module/musicxml/index.js.map +1 -0
  46. package/lib/module/musicxml/testfiles/lg-8102429.xml +79620 -0
  47. package/lib/module/renderer/Layout/DocumentLayout.js +156 -0
  48. package/lib/module/renderer/Layout/DocumentLayout.js.map +1 -0
  49. package/lib/module/renderer/Layout/LayoutMetrics.js +13 -0
  50. package/lib/module/renderer/Layout/LayoutMetrics.js.map +1 -0
  51. package/lib/module/renderer/Layout/VerticalSpacing.js +69 -0
  52. package/lib/module/renderer/Layout/VerticalSpacing.js.map +1 -0
  53. package/lib/module/renderer/ScoreRenderer/ScoreRenderer.js +277 -0
  54. package/lib/module/renderer/ScoreRenderer/ScoreRenderer.js.map +1 -0
  55. package/lib/module/renderer/ScoreRenderer/ScoreScrollbar.js +108 -0
  56. package/lib/module/renderer/ScoreRenderer/ScoreScrollbar.js.map +1 -0
  57. package/lib/module/renderer/ScoreRenderer/index.js +7 -0
  58. package/lib/module/renderer/ScoreRenderer/index.js.map +1 -0
  59. package/lib/module/renderer/ScoreRenderer/types.js +4 -0
  60. package/lib/module/renderer/ScoreRenderer/types.js.map +1 -0
  61. package/lib/module/renderer/ScoreRenderer/useScoreScroll.js +77 -0
  62. package/lib/module/renderer/ScoreRenderer/useScoreScroll.js.map +1 -0
  63. package/lib/module/renderer/colorScheme.js +17 -0
  64. package/lib/module/renderer/colorScheme.js.map +1 -0
  65. package/lib/module/renderer/constants.js +18 -0
  66. package/lib/module/renderer/constants.js.map +1 -0
  67. package/lib/module/renderer/index.js +6 -0
  68. package/lib/module/renderer/index.js.map +1 -0
  69. package/lib/module/renderer/layout.js +153 -0
  70. package/lib/module/renderer/layout.js.map +1 -0
  71. package/lib/module/renderer/measure.js +202 -0
  72. package/lib/module/renderer/measure.js.map +1 -0
  73. package/lib/module/renderer/render.js +184 -0
  74. package/lib/module/renderer/render.js.map +1 -0
  75. package/lib/module/renderer/scoreParsing.js +230 -0
  76. package/lib/module/renderer/scoreParsing.js.map +1 -0
  77. package/lib/module/renderer/types.js +4 -0
  78. package/lib/module/renderer/types.js.map +1 -0
  79. package/lib/module/renderer/useScoreRecording.js +112 -0
  80. package/lib/module/renderer/useScoreRecording.js.map +1 -0
  81. package/lib/module/renderer/viewport.js +26 -0
  82. package/lib/module/renderer/viewport.js.map +1 -0
  83. package/lib/module/shared/Logger.js +67 -0
  84. package/lib/module/shared/Logger.js.map +1 -0
  85. package/lib/module/state/index.js +4 -0
  86. package/lib/module/state/index.js.map +1 -0
  87. package/lib/module/state/types.js +2 -0
  88. package/lib/module/state/types.js.map +1 -0
  89. package/lib/module/types.js +7 -0
  90. package/lib/module/types.js.map +1 -1
  91. package/lib/module/utils.js +42 -77
  92. package/lib/module/utils.js.map +1 -1
  93. package/lib/typescript/src/base/FontManager.d.ts +23 -0
  94. package/lib/typescript/src/base/FontManager.d.ts.map +1 -0
  95. package/lib/typescript/src/base/TextMeasureContext.d.ts +22 -0
  96. package/lib/typescript/src/base/TextMeasureContext.d.ts.map +1 -0
  97. package/lib/typescript/src/base/VexflowCanvas.d.ts +5 -0
  98. package/lib/typescript/src/base/VexflowCanvas.d.ts.map +1 -0
  99. package/lib/typescript/src/base/VexflowColorScheme.d.ts +7 -0
  100. package/lib/typescript/src/base/VexflowColorScheme.d.ts.map +1 -0
  101. package/lib/typescript/src/base/VexflowRecordingContext.d.ts +103 -0
  102. package/lib/typescript/src/base/VexflowRecordingContext.d.ts.map +1 -0
  103. package/lib/typescript/src/base/VexflowRecordingReplay.d.ts +12 -0
  104. package/lib/typescript/src/base/VexflowRecordingReplay.d.ts.map +1 -0
  105. package/lib/typescript/src/base/VexflowRecordingTypes.d.ts +146 -0
  106. package/lib/typescript/src/base/VexflowRecordingTypes.d.ts.map +1 -0
  107. package/lib/typescript/src/base/index.d.ts +7 -0
  108. package/lib/typescript/src/base/index.d.ts.map +1 -0
  109. package/lib/typescript/src/base/setupVexflowReactNative.d.ts +11 -0
  110. package/lib/typescript/src/base/setupVexflowReactNative.d.ts.map +1 -0
  111. package/lib/typescript/src/base/types.d.ts +13 -0
  112. package/lib/typescript/src/base/types.d.ts.map +1 -0
  113. package/lib/typescript/src/base/utils.d.ts +2 -0
  114. package/lib/typescript/src/base/utils.d.ts.map +1 -0
  115. package/lib/typescript/src/musicxml/MusicXmlParser/InternalTypes.d.ts +30 -0
  116. package/lib/typescript/src/musicxml/MusicXmlParser/InternalTypes.d.ts.map +1 -0
  117. package/lib/typescript/src/musicxml/MusicXmlParser/MeasureParser.d.ts +4 -0
  118. package/lib/typescript/src/musicxml/MusicXmlParser/MeasureParser.d.ts.map +1 -0
  119. package/lib/typescript/src/musicxml/MusicXmlParser/MusicXmlDirections.d.ts +5 -0
  120. package/lib/typescript/src/musicxml/MusicXmlParser/MusicXmlDirections.d.ts.map +1 -0
  121. package/lib/typescript/src/musicxml/MusicXmlParser/MusicXmlTiming.d.ts +6 -0
  122. package/lib/typescript/src/musicxml/MusicXmlParser/MusicXmlTiming.d.ts.map +1 -0
  123. package/lib/typescript/src/musicxml/MusicXmlParser/PartParser.d.ts +8 -0
  124. package/lib/typescript/src/musicxml/MusicXmlParser/PartParser.d.ts.map +1 -0
  125. package/lib/typescript/src/musicxml/MusicXmlParser/Spanners.d.ts +4 -0
  126. package/lib/typescript/src/musicxml/MusicXmlParser/Spanners.d.ts.map +1 -0
  127. package/lib/typescript/src/musicxml/MusicXmlParser/XmlOrder.d.ts +20 -0
  128. package/lib/typescript/src/musicxml/MusicXmlParser/XmlOrder.d.ts.map +1 -0
  129. package/lib/typescript/src/musicxml/MusicXmlParser/index.d.ts +5 -0
  130. package/lib/typescript/src/musicxml/MusicXmlParser/index.d.ts.map +1 -0
  131. package/lib/typescript/src/musicxml/MusicXmlParser/mappers.d.ts +15 -0
  132. package/lib/typescript/src/musicxml/MusicXmlParser/mappers.d.ts.map +1 -0
  133. package/lib/typescript/src/musicxml/MusicXmlParser/types.d.ts +13 -0
  134. package/lib/typescript/src/musicxml/MusicXmlParser/types.d.ts.map +1 -0
  135. package/lib/typescript/src/musicxml/index.d.ts +2 -0
  136. package/lib/typescript/src/musicxml/index.d.ts.map +1 -0
  137. package/lib/typescript/src/renderer/Layout/DocumentLayout.d.ts +10 -0
  138. package/lib/typescript/src/renderer/Layout/DocumentLayout.d.ts.map +1 -0
  139. package/lib/typescript/src/renderer/Layout/LayoutMetrics.d.ts +6 -0
  140. package/lib/typescript/src/renderer/Layout/LayoutMetrics.d.ts.map +1 -0
  141. package/lib/typescript/src/renderer/Layout/VerticalSpacing.d.ts +9 -0
  142. package/lib/typescript/src/renderer/Layout/VerticalSpacing.d.ts.map +1 -0
  143. package/lib/typescript/src/renderer/ScoreRenderer/ScoreRenderer.d.ts +15 -0
  144. package/lib/typescript/src/renderer/ScoreRenderer/ScoreRenderer.d.ts.map +1 -0
  145. package/lib/typescript/src/renderer/ScoreRenderer/ScoreScrollbar.d.ts +24 -0
  146. package/lib/typescript/src/renderer/ScoreRenderer/ScoreScrollbar.d.ts.map +1 -0
  147. package/lib/typescript/src/renderer/ScoreRenderer/index.d.ts +5 -0
  148. package/lib/typescript/src/renderer/ScoreRenderer/index.d.ts.map +1 -0
  149. package/lib/typescript/src/renderer/ScoreRenderer/types.d.ts +12 -0
  150. package/lib/typescript/src/renderer/ScoreRenderer/types.d.ts.map +1 -0
  151. package/lib/typescript/src/renderer/ScoreRenderer/useScoreScroll.d.ts +13 -0
  152. package/lib/typescript/src/renderer/ScoreRenderer/useScoreScroll.d.ts.map +1 -0
  153. package/lib/typescript/src/renderer/colorScheme.d.ts +9 -0
  154. package/lib/typescript/src/renderer/colorScheme.d.ts.map +1 -0
  155. package/lib/typescript/src/renderer/constants.d.ts +5 -0
  156. package/lib/typescript/src/renderer/constants.d.ts.map +1 -0
  157. package/lib/typescript/src/renderer/index.d.ts +4 -0
  158. package/lib/typescript/src/renderer/index.d.ts.map +1 -0
  159. package/lib/typescript/src/renderer/layout.d.ts +56 -0
  160. package/lib/typescript/src/renderer/layout.d.ts.map +1 -0
  161. package/lib/typescript/src/renderer/measure.d.ts +23 -0
  162. package/lib/typescript/src/renderer/measure.d.ts.map +1 -0
  163. package/lib/typescript/src/renderer/render.d.ts +9 -0
  164. package/lib/typescript/src/renderer/render.d.ts.map +1 -0
  165. package/lib/typescript/src/renderer/scoreParsing.d.ts +76 -0
  166. package/lib/typescript/src/renderer/scoreParsing.d.ts.map +1 -0
  167. package/lib/typescript/src/renderer/types.d.ts +56 -0
  168. package/lib/typescript/src/renderer/types.d.ts.map +1 -0
  169. package/lib/typescript/src/renderer/useScoreRecording.d.ts +21 -0
  170. package/lib/typescript/src/renderer/useScoreRecording.d.ts.map +1 -0
  171. package/lib/typescript/src/renderer/viewport.d.ts +3 -0
  172. package/lib/typescript/src/renderer/viewport.d.ts.map +1 -0
  173. package/lib/typescript/src/shared/Logger.d.ts +18 -0
  174. package/lib/typescript/src/shared/Logger.d.ts.map +1 -0
  175. package/lib/typescript/src/state/index.d.ts +2 -0
  176. package/lib/typescript/src/state/index.d.ts.map +1 -0
  177. package/lib/typescript/src/state/types.d.ts +190 -0
  178. package/lib/typescript/src/state/types.d.ts.map +1 -0
  179. package/lib/typescript/src/types.d.ts +0 -6
  180. package/lib/typescript/src/types.d.ts.map +1 -1
  181. package/lib/typescript/src/utils.d.ts +0 -6
  182. package/lib/typescript/src/utils.d.ts.map +1 -1
  183. package/package.json +41 -14
  184. package/src/base/FontManager.ts +206 -0
  185. package/src/base/TextMeasureContext.ts +59 -0
  186. package/src/base/VexflowCanvas.tsx +60 -0
  187. package/src/base/VexflowColorScheme.ts +32 -0
  188. package/src/base/VexflowRecordingContext.ts +545 -0
  189. package/src/base/VexflowRecordingReplay.ts +327 -0
  190. package/src/base/VexflowRecordingTypes.ts +169 -0
  191. package/src/base/index.ts +7 -0
  192. package/src/base/setupVexflowReactNative.ts +124 -0
  193. package/src/base/types.ts +17 -0
  194. package/src/base/utils.ts +21 -0
  195. package/src/musicxml/MusicXmlParser/InternalTypes.ts +41 -0
  196. package/src/musicxml/MusicXmlParser/MeasureParser.ts +469 -0
  197. package/src/musicxml/MusicXmlParser/MusicXmlDirections.ts +84 -0
  198. package/src/musicxml/MusicXmlParser/MusicXmlTiming.ts +153 -0
  199. package/src/musicxml/MusicXmlParser/PartParser.ts +69 -0
  200. package/src/musicxml/MusicXmlParser/Spanners.ts +215 -0
  201. package/src/musicxml/MusicXmlParser/XmlOrder.ts +170 -0
  202. package/src/musicxml/MusicXmlParser/index.ts +144 -0
  203. package/src/musicxml/MusicXmlParser/mappers.ts +307 -0
  204. package/src/musicxml/MusicXmlParser/types.ts +24 -0
  205. package/src/musicxml/index.ts +5 -0
  206. package/src/musicxml/testfiles/lg-8102429.xml +79620 -0
  207. package/src/renderer/Layout/DocumentLayout.ts +240 -0
  208. package/src/renderer/Layout/LayoutMetrics.ts +21 -0
  209. package/src/renderer/Layout/VerticalSpacing.ts +122 -0
  210. package/src/renderer/ScoreRenderer/ScoreRenderer.tsx +384 -0
  211. package/src/renderer/ScoreRenderer/ScoreScrollbar.tsx +231 -0
  212. package/src/renderer/ScoreRenderer/index.ts +13 -0
  213. package/src/renderer/ScoreRenderer/types.ts +14 -0
  214. package/src/renderer/ScoreRenderer/useScoreScroll.ts +146 -0
  215. package/src/renderer/colorScheme.ts +28 -0
  216. package/src/renderer/constants.ts +19 -0
  217. package/src/renderer/index.ts +3 -0
  218. package/src/renderer/layout.ts +309 -0
  219. package/src/renderer/measure.tsx +304 -0
  220. package/src/renderer/render.tsx +308 -0
  221. package/src/renderer/scoreParsing.tsx +352 -0
  222. package/src/renderer/types.ts +65 -0
  223. package/src/renderer/useScoreRecording.ts +177 -0
  224. package/src/renderer/viewport.ts +45 -0
  225. package/src/shared/Logger.ts +85 -0
  226. package/src/state/index.ts +1 -0
  227. package/src/state/types.ts +295 -0
  228. package/src/types.ts +6 -6
  229. package/src/utils.tsx +32 -98
  230. package/lib/module/SkiaVexflowContext.js +0 -285
  231. package/lib/module/SkiaVexflowContext.js.map +0 -1
  232. package/lib/module/VexflowCanvas.js +0 -103
  233. package/lib/module/VexflowCanvas.js.map +0 -1
  234. package/lib/module/colorUtils.js +0 -34
  235. package/lib/module/colorUtils.js.map +0 -1
  236. package/lib/module/colorUtils.test.js +0 -37
  237. package/lib/module/colorUtils.test.js.map +0 -1
  238. package/lib/module/constants.js +0 -30
  239. package/lib/module/constants.js.map +0 -1
  240. package/lib/module/index.js +0 -8
  241. package/lib/module/index.js.map +0 -1
  242. package/lib/typescript/src/SkiaVexflowContext.d.ts +0 -101
  243. package/lib/typescript/src/SkiaVexflowContext.d.ts.map +0 -1
  244. package/lib/typescript/src/VexflowCanvas.d.ts +0 -17
  245. package/lib/typescript/src/VexflowCanvas.d.ts.map +0 -1
  246. package/lib/typescript/src/colorUtils.d.ts +0 -2
  247. package/lib/typescript/src/colorUtils.d.ts.map +0 -1
  248. package/lib/typescript/src/colorUtils.test.d.ts +0 -2
  249. package/lib/typescript/src/colorUtils.test.d.ts.map +0 -1
  250. package/lib/typescript/src/constants.d.ts +0 -21
  251. package/lib/typescript/src/constants.d.ts.map +0 -1
  252. package/lib/typescript/src/index.d.ts +0 -7
  253. package/lib/typescript/src/index.d.ts.map +0 -1
  254. package/src/SkiaVexflowContext.ts +0 -462
  255. package/src/VexflowCanvas.tsx +0 -145
  256. package/src/colorUtils.test.ts +0 -52
  257. package/src/colorUtils.ts +0 -55
  258. package/src/constants.tsx +0 -34
  259. package/src/index.ts +0 -8
@@ -0,0 +1,110 @@
1
+ "use strict";
2
+
3
+ import { XMLParser } from 'fast-xml-parser';
4
+ import { parsePart } from "./PartParser.js";
5
+ import { MusicXmlParseError } from "./types.js";
6
+ import { attr, childText, childrenNamed, firstChild, normalizeOrderedXml, optionalChild, textOf } from "./XmlOrder.js";
7
+ const xmlParser = new XMLParser({
8
+ attributeNamePrefix: '@_',
9
+ ignoreAttributes: false,
10
+ ignoreDeclaration: true,
11
+ ignorePiTags: true,
12
+ parseAttributeValue: false,
13
+ parseTagValue: false,
14
+ preserveOrder: true,
15
+ textNodeName: '#text',
16
+ trimValues: true
17
+ });
18
+ export function parseMusicXmlToScore(xml, options = {}) {
19
+ const root = findRoot(normalizeOrderedXml(xmlParser.parse(xml)));
20
+ const scoreId = options.scoreId ?? 'musicxml-score';
21
+ const partInfos = parsePartList(root);
22
+ const state = {
23
+ scoreId,
24
+ divisions: 1,
25
+ defaults: {
26
+ meter: {
27
+ beats: 4,
28
+ beatUnit: 4
29
+ }
30
+ },
31
+ attachments: [],
32
+ ties: [],
33
+ slurs: [],
34
+ tuplets: [],
35
+ pendingDynamics: new Map(),
36
+ activeTies: new Map(),
37
+ activeSlurs: new Map(),
38
+ activeTuplets: new Map()
39
+ };
40
+ const staves = [];
41
+ const staffGroups = [];
42
+ childrenNamed(root, 'part').forEach((part, partIndex) => {
43
+ const partId = attr(part, 'id') ?? `P${(partIndex + 1).toString()}`;
44
+ const partInfo = partInfos.get(partId) ?? {
45
+ id: partId
46
+ };
47
+ const parsedPart = parsePart(part, partInfo, staves.length, state);
48
+ staves.push(...parsedPart.staves);
49
+ staffGroups.push(...parsedPart.staffGroups);
50
+ });
51
+ validateClosedSpanners(state);
52
+ return {
53
+ id: scoreId,
54
+ metadata: parseMetadata(root),
55
+ defaults: state.defaults,
56
+ staves,
57
+ staffGroups: staffGroups.length ? staffGroups : undefined,
58
+ attachments: state.attachments.length ? state.attachments : undefined,
59
+ ties: state.ties.length ? state.ties : undefined,
60
+ slurs: state.slurs.length ? state.slurs : undefined,
61
+ tuplets: state.tuplets.length ? state.tuplets : undefined
62
+ };
63
+ }
64
+ function findRoot(elements) {
65
+ const root = elements.find(element => element.name === 'score-partwise');
66
+ if (!root) {
67
+ if (elements.some(element => element.name === 'score-timewise')) {
68
+ throw new MusicXmlParseError('MusicXML timewise scores are unsupported');
69
+ }
70
+ throw new MusicXmlParseError('Missing <score-partwise> root');
71
+ }
72
+ return root;
73
+ }
74
+ function parseMetadata(root) {
75
+ const identification = optionalChild(root, 'identification');
76
+ const workTitle = childText(optionalChild(root, 'work') ?? root, 'work-title');
77
+ const movementTitle = childText(root, 'movement-title');
78
+ const credits = childrenNamed(root, 'credit').map(credit => childrenNamed(credit, 'credit-words').map(textOf).join('').replace(/\s+/g, ' ').trim());
79
+ const creators = childrenNamed(identification ?? root, 'creator');
80
+ const composer = creators.find(creator => attr(creator, 'type') === 'composer');
81
+ const metadata = {
82
+ title: workTitle ?? movementTitle ?? credits[0],
83
+ subtitle: workTitle && movementTitle ? movementTitle : credits[1],
84
+ composer: composer ? textOf(composer) : credits[2],
85
+ copyright: identification ? childText(identification, 'rights') : undefined
86
+ };
87
+ return Object.values(metadata).some(Boolean) ? metadata : undefined;
88
+ }
89
+ function parsePartList(root) {
90
+ const parts = new Map();
91
+ const partList = firstChild(root, 'part-list');
92
+ childrenNamed(partList, 'score-part').forEach(part => {
93
+ const id = attr(part, 'id');
94
+ if (!id) {
95
+ throw new MusicXmlParseError('Missing score-part id');
96
+ }
97
+ parts.set(id, {
98
+ id,
99
+ name: childText(part, 'part-name')
100
+ });
101
+ });
102
+ return parts;
103
+ }
104
+ function validateClosedSpanners(state) {
105
+ if (state.activeTuplets.size) {
106
+ state.activeTuplets.clear();
107
+ }
108
+ }
109
+ export { MusicXmlParseError } from "./types.js";
110
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["XMLParser","parsePart","MusicXmlParseError","attr","childText","childrenNamed","firstChild","normalizeOrderedXml","optionalChild","textOf","xmlParser","attributeNamePrefix","ignoreAttributes","ignoreDeclaration","ignorePiTags","parseAttributeValue","parseTagValue","preserveOrder","textNodeName","trimValues","parseMusicXmlToScore","xml","options","root","findRoot","parse","scoreId","partInfos","parsePartList","state","divisions","defaults","meter","beats","beatUnit","attachments","ties","slurs","tuplets","pendingDynamics","Map","activeTies","activeSlurs","activeTuplets","staves","staffGroups","forEach","part","partIndex","partId","toString","partInfo","get","id","parsedPart","length","push","validateClosedSpanners","metadata","parseMetadata","undefined","elements","find","element","name","some","identification","workTitle","movementTitle","credits","map","credit","join","replace","trim","creators","composer","creator","title","subtitle","copyright","Object","values","Boolean","parts","partList","set","size","clear"],"sourceRoot":"../../../../src","sources":["musicxml/MusicXmlParser/index.ts"],"mappings":";;AAAA,SAASA,SAAS,QAAQ,iBAAiB;AAI3C,SAASC,SAAS,QAAQ,iBAAc;AACxC,SAASC,kBAAkB,QAAmC,YAAS;AACvE,SACEC,IAAI,EACJC,SAAS,EACTC,aAAa,EACbC,UAAU,EACVC,mBAAmB,EACnBC,aAAa,EACbC,MAAM,QAED,eAAY;AAEnB,MAAMC,SAAS,GAAG,IAAIV,SAAS,CAAC;EAC9BW,mBAAmB,EAAE,IAAI;EACzBC,gBAAgB,EAAE,KAAK;EACvBC,iBAAiB,EAAE,IAAI;EACvBC,YAAY,EAAE,IAAI;EAClBC,mBAAmB,EAAE,KAAK;EAC1BC,aAAa,EAAE,KAAK;EACpBC,aAAa,EAAE,IAAI;EACnBC,YAAY,EAAE,OAAO;EACrBC,UAAU,EAAE;AACd,CAAC,CAAC;AAEF,OAAO,SAASC,oBAAoBA,CAClCC,GAAW,EACXC,OAA6B,GAA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,MAAM6D,KAAK,GAAG,IAAI5C,GAAG,CAAmB,CAAC;EACzC,MAAM6C,QAAQ,GAAG/E,UAAU,CAACiB,IAAI,EAAE,WAAW,CAAC;EAE9ClB,aAAa,CAACgF,QAAQ,EAAE,YAAY,CAAC,CAACvC,OAAO,CAAEC,IAAI,IAAK;IACtD,MAAMM,EAAE,GAAGlD,IAAI,CAAC4C,IAAI,EAAE,IAAI,CAAC;IAE3B,IAAI,CAACM,EAAE,EAAE;MACP,MAAM,IAAInD,kBAAkB,CAAC,uBAAuB,CAAC;IACvD;IAEAkF,KAAK,CAACE,GAAG,CAACjC,EAAE,EAAE;MACZA,EAAE;MACFW,IAAI,EAAE5D,SAAS,CAAC2C,IAAI,EAAE,WAAW;IACnC,CAAC,CAAC;EACJ,CAAC,CAAC;EAEF,OAAOqC,KAAK;AACd;AAEA,SAAS3B,sBAAsBA,CAAC5B,KAAkB,EAAE;EAClD,IAAIA,KAAK,CAACc,aAAa,CAAC4C,IAAI,EAAE;IAC5B1D,KAAK,CAACc,aAAa,CAAC6C,KAAK,CAAC,CAAC;EAC7B;AACF;AAEA,SAAStF,kBAAkB,QAAmC,YAAS","ignoreList":[]}
@@ -0,0 +1,312 @@
1
+ "use strict";
2
+
3
+ import { MusicXmlParseError } from "./types.js";
4
+ import { childText, childrenNamed, hasChild, requiredChildText } from "./XmlOrder.js";
5
+ const MAJOR_KEYS = {
6
+ '-7': {
7
+ tonic: 'C',
8
+ accidental: 'b'
9
+ },
10
+ '-6': {
11
+ tonic: 'G',
12
+ accidental: 'b'
13
+ },
14
+ '-5': {
15
+ tonic: 'D',
16
+ accidental: 'b'
17
+ },
18
+ '-4': {
19
+ tonic: 'A',
20
+ accidental: 'b'
21
+ },
22
+ '-3': {
23
+ tonic: 'E',
24
+ accidental: 'b'
25
+ },
26
+ '-2': {
27
+ tonic: 'B',
28
+ accidental: 'b'
29
+ },
30
+ '-1': {
31
+ tonic: 'F'
32
+ },
33
+ '0': {
34
+ tonic: 'C'
35
+ },
36
+ '1': {
37
+ tonic: 'G'
38
+ },
39
+ '2': {
40
+ tonic: 'D'
41
+ },
42
+ '3': {
43
+ tonic: 'A'
44
+ },
45
+ '4': {
46
+ tonic: 'E'
47
+ },
48
+ '5': {
49
+ tonic: 'B'
50
+ },
51
+ '6': {
52
+ tonic: 'F',
53
+ accidental: '#'
54
+ },
55
+ '7': {
56
+ tonic: 'C',
57
+ accidental: '#'
58
+ }
59
+ };
60
+ const MINOR_KEYS = {
61
+ '-7': {
62
+ tonic: 'A',
63
+ accidental: 'b'
64
+ },
65
+ '-6': {
66
+ tonic: 'E',
67
+ accidental: 'b'
68
+ },
69
+ '-5': {
70
+ tonic: 'B',
71
+ accidental: 'b'
72
+ },
73
+ '-4': {
74
+ tonic: 'F'
75
+ },
76
+ '-3': {
77
+ tonic: 'C'
78
+ },
79
+ '-2': {
80
+ tonic: 'G'
81
+ },
82
+ '-1': {
83
+ tonic: 'D'
84
+ },
85
+ '0': {
86
+ tonic: 'A'
87
+ },
88
+ '1': {
89
+ tonic: 'E'
90
+ },
91
+ '2': {
92
+ tonic: 'B'
93
+ },
94
+ '3': {
95
+ tonic: 'F',
96
+ accidental: '#'
97
+ },
98
+ '4': {
99
+ tonic: 'C',
100
+ accidental: '#'
101
+ },
102
+ '5': {
103
+ tonic: 'G',
104
+ accidental: '#'
105
+ },
106
+ '6': {
107
+ tonic: 'D',
108
+ accidental: '#'
109
+ },
110
+ '7': {
111
+ tonic: 'A',
112
+ accidental: '#'
113
+ }
114
+ };
115
+ const DYNAMICS = ['ppp', 'pp', 'p', 'mp', 'mf', 'f', 'ff', 'fff', 'sfz'];
116
+ export function mapClef(clef) {
117
+ const sign = requiredChildText(clef, 'sign');
118
+ const line = childText(clef, 'line');
119
+ if (sign === 'G' && line === '2') {
120
+ return 'treble';
121
+ }
122
+ if (sign === 'F' && line === '4') {
123
+ return 'bass';
124
+ }
125
+ if (sign === 'C' && line === '3') {
126
+ return 'alto';
127
+ }
128
+ if (sign === 'C' && line === '4') {
129
+ return 'tenor';
130
+ }
131
+ if (sign === 'percussion') {
132
+ return 'percussion';
133
+ }
134
+ throw new MusicXmlParseError(`Unsupported clef ${sign}/${line ?? ''}`);
135
+ }
136
+ export function mapKeySignature(fifths, mode = 'major') {
137
+ const normalizedMode = normalizeMode(mode);
138
+ const key = normalizedMode === 'minor' ? MINOR_KEYS[fifths] : MAJOR_KEYS[fifths];
139
+ if (!key) {
140
+ throw new MusicXmlParseError(`Unsupported key fifths ${fifths.toString()}`);
141
+ }
142
+ return {
143
+ ...key,
144
+ mode: normalizedMode
145
+ };
146
+ }
147
+ export function mapDurationType(type) {
148
+ switch (type) {
149
+ case 'long':
150
+ return 'long';
151
+ case 'breve':
152
+ return 'breve';
153
+ case 'whole':
154
+ return 'w';
155
+ case 'half':
156
+ return 'h';
157
+ case 'quarter':
158
+ return 'q';
159
+ case 'eighth':
160
+ return '8';
161
+ case '16th':
162
+ return '16';
163
+ case '32nd':
164
+ return '32';
165
+ case '64th':
166
+ return '64';
167
+ case '128th':
168
+ return '128';
169
+ default:
170
+ throw new MusicXmlParseError(`Unsupported note duration type "${type}"`);
171
+ }
172
+ }
173
+ export function mapPitch(pitch, accidental) {
174
+ const step = requiredChildText(pitch, 'step');
175
+ if (!isStep(step)) {
176
+ throw new MusicXmlParseError(`Unsupported pitch step "${step}"`);
177
+ }
178
+ return {
179
+ step,
180
+ octave: Number(requiredChildText(pitch, 'octave')),
181
+ accidental: mapAccidental(childText(pitch, 'alter'), accidental)
182
+ };
183
+ }
184
+ export function mapStemDirection(value) {
185
+ if (!value || value === 'none') {
186
+ return undefined;
187
+ }
188
+ if (value === 'up' || value === 'down') {
189
+ return value;
190
+ }
191
+ throw new MusicXmlParseError(`Unsupported stem direction "${value}"`);
192
+ }
193
+ export function mapBarline(barline) {
194
+ const location = barline.attributes.location === 'left' ? 'left' : 'right';
195
+ const repeat = barline.children.find(child => child.name === 'repeat');
196
+ const barStyle = childText(barline, 'bar-style');
197
+ if (repeat?.attributes.direction === 'forward') {
198
+ return {
199
+ location,
200
+ value: 'repeat-begin'
201
+ };
202
+ }
203
+ if (repeat?.attributes.direction === 'backward') {
204
+ return {
205
+ location,
206
+ value: 'repeat-end'
207
+ };
208
+ }
209
+ if (barStyle === 'light-light') {
210
+ return {
211
+ location,
212
+ value: 'double'
213
+ };
214
+ }
215
+ if (barStyle === 'light-heavy') {
216
+ return {
217
+ location,
218
+ value: 'end'
219
+ };
220
+ }
221
+ if (barStyle === 'regular') {
222
+ return {
223
+ location,
224
+ value: 'single'
225
+ };
226
+ }
227
+ if (!barStyle && hasChild(barline, 'ending')) {
228
+ return undefined;
229
+ }
230
+ throw new MusicXmlParseError(`Unsupported barline "${barStyle ?? 'unknown'}"`);
231
+ }
232
+ export function dynamicsFromElement(dynamics) {
233
+ return dynamics.children.map(child => child.name).filter(name => DYNAMICS.includes(name));
234
+ }
235
+ export function otherDynamicsText(dynamics) {
236
+ return childText(dynamics, 'other-dynamics');
237
+ }
238
+ export function articulationsFromNotations(notations) {
239
+ if (!notations) {
240
+ return [];
241
+ }
242
+ const articulations = childrenNamed(notations, 'articulations').flatMap(group => group.children.map(child => mapArticulation(child.name)));
243
+ if (hasChild(notations, 'fermata')) {
244
+ articulations.push('fermata');
245
+ }
246
+ return articulations.filter(item => item !== undefined);
247
+ }
248
+ function mapArticulation(name) {
249
+ switch (name) {
250
+ case 'staccato':
251
+ case 'tenuto':
252
+ case 'accent':
253
+ case 'staccatissimo':
254
+ return name;
255
+ case 'strong-accent':
256
+ return 'marcato';
257
+ default:
258
+ throw new MusicXmlParseError(`Unsupported articulation "${name}"`);
259
+ }
260
+ }
261
+ function mapAccidental(alter, accidental) {
262
+ if (accidental) {
263
+ switch (accidental) {
264
+ case 'flat-flat':
265
+ return 'bb';
266
+ case 'flat':
267
+ return 'b';
268
+ case 'natural':
269
+ return 'n';
270
+ case 'sharp':
271
+ return '#';
272
+ case 'double-sharp':
273
+ return '##';
274
+ case 'quarter-flat':
275
+ return 'quarter-flat';
276
+ case 'quarter-sharp':
277
+ return 'quarter-sharp';
278
+ default:
279
+ throw new MusicXmlParseError(`Unsupported accidental "${accidental}"`);
280
+ }
281
+ }
282
+ if (alter === undefined) {
283
+ return undefined;
284
+ }
285
+ switch (Number(alter)) {
286
+ case -2:
287
+ return 'bb';
288
+ case -1:
289
+ return 'b';
290
+ case 0:
291
+ return 'n';
292
+ case 1:
293
+ return '#';
294
+ case 2:
295
+ return '##';
296
+ default:
297
+ throw new MusicXmlParseError(`Unsupported pitch alter "${alter}"`);
298
+ }
299
+ }
300
+ function normalizeMode(mode) {
301
+ if (mode === 'major' || mode === '') {
302
+ return 'major';
303
+ }
304
+ if (mode === 'minor') {
305
+ return 'minor';
306
+ }
307
+ throw new MusicXmlParseError(`Unsupported key mode "${mode}"`);
308
+ }
309
+ function isStep(value) {
310
+ return ['C', 'D', 'E', 'F', 'G', 'A', 'B'].includes(value);
311
+ }
312
+ //# sourceMappingURL=mappers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["MusicXmlParseError","childText","childrenNamed","hasChild","requiredChildText","MAJOR_KEYS","tonic","accidental","MINOR_KEYS","DYNAMICS","mapClef","clef","sign","line","mapKeySignature","fifths","mode","normalizedMode","normalizeMode","key","toString","mapDurationType","type","mapPitch","pitch","step","isStep","octave","Number","mapAccidental","mapStemDirection","value","undefined","mapBarline","barline","location","attributes","repeat","children","find","child","name","barStyle","direction","dynamicsFromElement","dynamics","map","filter","includes","otherDynamicsText","articulationsFromNotations","notations","articulations","flatMap","group","mapArticulation","push","item","alter"],"sourceRoot":"../../../../src","sources":["musicxml/MusicXmlParser/mappers.ts"],"mappings":";;AAYA,SAASA,kBAAkB,QAAQ,YAAS;AAC5C,SACEC,SAAS,EACTC,aAAa,EACbC,QAAQ,EACRC,iBAAiB,QAEZ,eAAY;AAEnB,MAAMC,UAAwC,GAAG;EAC/C,IAAI,EAAE;IAAEC,KAAK,EAAE,GAAG;IAAEC,UAAU,EAAE;EAAI,CAAC;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A,IAAIA,IAAI,KAAK,OAAO,EAAE;IACpB,OAAO,OAAO;EAChB;EAEA,MAAM,IAAIhB,kBAAkB,CAAC,yBAAyBgB,IAAI,GAAG,CAAC;AAChE;AAEA,SAASU,MAAMA,CAACK,KAAa,EAAiB;EAC5C,OAAO,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAACiB,QAAQ,CAACjB,KAAK,CAAC;AAC5D","ignoreList":[]}
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+
3
+ export class MusicXmlParseError extends Error {
4
+ constructor(message, context) {
5
+ super(context?.path ? `${message} at ${context.path}` : message);
6
+ this.name = 'MusicXmlParseError';
7
+ this.path = context?.path;
8
+ }
9
+ }
10
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["MusicXmlParseError","Error","constructor","message","context","path","name"],"sourceRoot":"../../../../src","sources":["musicxml/MusicXmlParser/types.ts"],"mappings":";;AAeA,OAAO,MAAMA,kBAAkB,SAASC,KAAK,CAAC;EAG5CC,WAAWA,CAACC,OAAe,EAAEC,OAA8B,EAAE;IAC3D,KAAK,CAACA,OAAO,EAAEC,IAAI,GAAG,GAAGF,OAAO,OAAOC,OAAO,CAACC,IAAI,EAAE,GAAGF,OAAO,CAAC;IAChE,IAAI,CAACG,IAAI,GAAG,oBAAoB;IAChC,IAAI,CAACD,IAAI,GAAGD,OAAO,EAAEC,IAAI;EAC3B;AACF","ignoreList":[]}
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+
3
+ export { MusicXmlParseError, parseMusicXmlToScore } from "./MusicXmlParser/index.js";
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["MusicXmlParseError","parseMusicXmlToScore"],"sourceRoot":"../../../src","sources":["musicxml/index.ts"],"mappings":";;AAAA,SACEA,kBAAkB,EAClBC,oBAAoB,QAEf,2BAAkB","ignoreList":[]}