@k-l-lambda/lilylet 0.1.71 → 0.1.72

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 (104) hide show
  1. package/lib/highlight.d.ts +1 -0
  2. package/lib/highlight.js +1 -0
  3. package/lib/lilylet/highlight.d.ts +29 -0
  4. package/lib/lilylet/highlight.js +145 -0
  5. package/package.json +8 -2
  6. package/source/lilylet/highlight.ts +192 -0
  7. package/lib/source/abc/abc.d.ts +0 -102
  8. package/lib/source/abc/abc.js +0 -25
  9. package/lib/source/abc/parser.d.ts +0 -3
  10. package/lib/source/abc/parser.js +0 -6
  11. package/lib/source/lilylet/abcDecoder.d.ts +0 -25
  12. package/lib/source/lilylet/abcDecoder.js +0 -1035
  13. package/lib/source/lilylet/index.d.ts +0 -10
  14. package/lib/source/lilylet/index.js +0 -10
  15. package/lib/source/lilylet/lilypondDecoder.d.ts +0 -29
  16. package/lib/source/lilylet/lilypondDecoder.js +0 -1223
  17. package/lib/source/lilylet/lilypondEncoder.d.ts +0 -34
  18. package/lib/source/lilylet/lilypondEncoder.js +0 -893
  19. package/lib/source/lilylet/meiEncoder.d.ts +0 -8
  20. package/lib/source/lilylet/meiEncoder.js +0 -1985
  21. package/lib/source/lilylet/musicXmlDecoder.d.ts +0 -20
  22. package/lib/source/lilylet/musicXmlDecoder.js +0 -1195
  23. package/lib/source/lilylet/musicXmlEncoder.d.ts +0 -15
  24. package/lib/source/lilylet/musicXmlEncoder.js +0 -701
  25. package/lib/source/lilylet/musicXmlTypes.d.ts +0 -199
  26. package/lib/source/lilylet/musicXmlTypes.js +0 -7
  27. package/lib/source/lilylet/musicXmlUtils.d.ts +0 -92
  28. package/lib/source/lilylet/musicXmlUtils.js +0 -469
  29. package/lib/source/lilylet/parser.d.ts +0 -14
  30. package/lib/source/lilylet/parser.js +0 -161
  31. package/lib/source/lilylet/serializer.d.ts +0 -11
  32. package/lib/source/lilylet/serializer.js +0 -791
  33. package/lib/source/lilylet/types.d.ts +0 -253
  34. package/lib/source/lilylet/types.js +0 -100
  35. package/lib/tests/abc-abcjs-parse.d.ts +0 -8
  36. package/lib/tests/abc-abcjs-parse.js +0 -90
  37. package/lib/tests/abc-abcjs-svg.d.ts +0 -1
  38. package/lib/tests/abc-abcjs-svg.js +0 -143
  39. package/lib/tests/abc-decoder.d.ts +0 -1
  40. package/lib/tests/abc-decoder.js +0 -67
  41. package/lib/tests/abc-mei-compare.d.ts +0 -1
  42. package/lib/tests/abc-mei-compare.js +0 -525
  43. package/lib/tests/auto-beam.d.ts +0 -9
  44. package/lib/tests/auto-beam.js +0 -151
  45. package/lib/tests/computeMeiHashes.d.ts +0 -1
  46. package/lib/tests/computeMeiHashes.js +0 -87
  47. package/lib/tests/encoder-mutation.d.ts +0 -9
  48. package/lib/tests/encoder-mutation.js +0 -110
  49. package/lib/tests/gpt-review-issues.d.ts +0 -5
  50. package/lib/tests/gpt-review-issues.js +0 -255
  51. package/lib/tests/json-to-lyl.d.ts +0 -1
  52. package/lib/tests/json-to-lyl.js +0 -18
  53. package/lib/tests/lilypond-roundtrip.d.ts +0 -7
  54. package/lib/tests/lilypond-roundtrip.js +0 -558
  55. package/lib/tests/lilypondDecoder.d.ts +0 -6
  56. package/lib/tests/lilypondDecoder.js +0 -95
  57. package/lib/tests/ly-to-lyl.d.ts +0 -1
  58. package/lib/tests/ly-to-lyl.js +0 -12
  59. package/lib/tests/mei.d.ts +0 -1
  60. package/lib/tests/mei.js +0 -278
  61. package/lib/tests/musicxml-decoder.d.ts +0 -4
  62. package/lib/tests/musicxml-decoder.js +0 -61
  63. package/lib/tests/musicxml-detail.d.ts +0 -4
  64. package/lib/tests/musicxml-detail.js +0 -85
  65. package/lib/tests/musicxml-fprod.d.ts +0 -9
  66. package/lib/tests/musicxml-fprod.js +0 -153
  67. package/lib/tests/musicxml-roundtrip.d.ts +0 -7
  68. package/lib/tests/musicxml-roundtrip.js +0 -296
  69. package/lib/tests/musicxml-to-mei.d.ts +0 -6
  70. package/lib/tests/musicxml-to-mei.js +0 -115
  71. package/lib/tests/parser.d.ts +0 -1
  72. package/lib/tests/parser.js +0 -17
  73. package/lib/tests/render-k283.d.ts +0 -1
  74. package/lib/tests/render-k283.js +0 -33
  75. package/lib/tests/render-lyl.d.ts +0 -1
  76. package/lib/tests/render-lyl.js +0 -35
  77. package/lib/tests/unit/afterGraceInsideTuplet.test.d.ts +0 -23
  78. package/lib/tests/unit/afterGraceInsideTuplet.test.js +0 -186
  79. package/lib/tests/unit/changeStaffBeforeTuplet.test.d.ts +0 -21
  80. package/lib/tests/unit/changeStaffBeforeTuplet.test.js +0 -356
  81. package/lib/tests/unit/crossStaffDecoder.test.d.ts +0 -15
  82. package/lib/tests/unit/crossStaffDecoder.test.js +0 -147
  83. package/lib/tests/unit/crossStaffEdgeCases.test.d.ts +0 -1
  84. package/lib/tests/unit/crossStaffEdgeCases.test.js +0 -209
  85. package/lib/tests/unit/crossStaffMultiMeasure.test.d.ts +0 -15
  86. package/lib/tests/unit/crossStaffMultiMeasure.test.js +0 -231
  87. package/lib/tests/unit/fullMeasureRestDecoder.test.d.ts +0 -11
  88. package/lib/tests/unit/fullMeasureRestDecoder.test.js +0 -154
  89. package/lib/tests/unit/gptReviewIssues.test.d.ts +0 -8
  90. package/lib/tests/unit/gptReviewIssues.test.js +0 -240
  91. package/lib/tests/unit/parallelMusicDecoder.test.d.ts +0 -13
  92. package/lib/tests/unit/parallelMusicDecoder.test.js +0 -261
  93. package/lib/tests/unit/partialWarning.test.d.ts +0 -4
  94. package/lib/tests/unit/partialWarning.test.js +0 -65
  95. package/lib/tests/unit/serializerRoundTrip.test.d.ts +0 -8
  96. package/lib/tests/unit/serializerRoundTrip.test.js +0 -263
  97. package/lib/tests/unit/staffInsideTuplet.test.d.ts +0 -25
  98. package/lib/tests/unit/staffInsideTuplet.test.js +0 -133
  99. package/lib/tests/unit/timesFirstNoteEscape.test.d.ts +0 -16
  100. package/lib/tests/unit/timesFirstNoteEscape.test.js +0 -152
  101. package/lib/tests/unit/tupletWithBaseDuration.test.d.ts +0 -17
  102. package/lib/tests/unit/tupletWithBaseDuration.test.js +0 -139
  103. package/lib/tests/unit/voiceStaffParsing.test.d.ts +0 -13
  104. package/lib/tests/unit/voiceStaffParsing.test.js +0 -118
@@ -1,199 +0,0 @@
1
- /**
2
- * MusicXML Intermediate Types
3
- *
4
- * These types represent the parsed MusicXML structure before conversion to LilyletDoc.
5
- * They closely mirror MusicXML elements for easier parsing.
6
- */
7
- export interface MusicXmlPitch {
8
- step: string;
9
- alter?: number;
10
- octave: number;
11
- }
12
- export interface MusicXmlDuration {
13
- divisions: number;
14
- type?: string;
15
- dots: number;
16
- timeModification?: {
17
- actualNotes: number;
18
- normalNotes: number;
19
- };
20
- }
21
- export interface MusicXmlKey {
22
- fifths: number;
23
- mode?: string;
24
- }
25
- export interface MusicXmlTime {
26
- beats: number;
27
- beatType: number;
28
- }
29
- export interface MusicXmlClef {
30
- sign: string;
31
- line?: number;
32
- clefOctaveChange?: number;
33
- }
34
- export interface MusicXmlAttributes {
35
- divisions?: number;
36
- key?: MusicXmlKey;
37
- time?: MusicXmlTime;
38
- clefs?: {
39
- staff: number;
40
- clef: MusicXmlClef;
41
- }[];
42
- staves?: number;
43
- }
44
- export type MusicXmlStemDirection = 'up' | 'down';
45
- export interface MusicXmlNotations {
46
- ties?: {
47
- type: 'start' | 'stop';
48
- }[];
49
- slurs?: {
50
- type: 'start' | 'stop';
51
- number: number;
52
- }[];
53
- beams?: {
54
- type: 'begin' | 'continue' | 'end';
55
- number: number;
56
- }[];
57
- articulations?: string[];
58
- ornaments?: string[];
59
- fermata?: boolean;
60
- arpeggiate?: boolean;
61
- tremolo?: {
62
- type: 'single' | 'start' | 'stop';
63
- value: number;
64
- };
65
- tuplet?: {
66
- type: 'start' | 'stop';
67
- number: number;
68
- };
69
- }
70
- export interface MusicXmlNote {
71
- isChord: boolean;
72
- isRest: boolean;
73
- isGrace: boolean;
74
- pitch?: MusicXmlPitch;
75
- duration: MusicXmlDuration;
76
- voice: number;
77
- staff?: number;
78
- stem?: MusicXmlStemDirection;
79
- notations?: MusicXmlNotations;
80
- fingering?: number;
81
- beams?: {
82
- type: 'begin' | 'continue' | 'end';
83
- number: number;
84
- }[];
85
- }
86
- export interface MusicXmlDynamic {
87
- type: string;
88
- }
89
- export interface MusicXmlWedge {
90
- type: 'crescendo' | 'diminuendo' | 'stop';
91
- number?: number;
92
- }
93
- export interface MusicXmlPedal {
94
- type: 'start' | 'stop' | 'change';
95
- line?: boolean;
96
- }
97
- export interface MusicXmlMetronome {
98
- beatUnit: string;
99
- beatUnitDot?: boolean;
100
- perMinute: number;
101
- }
102
- export interface MusicXmlWords {
103
- text: string;
104
- fontStyle?: string;
105
- fontWeight?: string;
106
- }
107
- export interface MusicXmlOctaveShift {
108
- type: 'up' | 'down' | 'stop';
109
- size?: number;
110
- }
111
- export interface MusicXmlDirection {
112
- placement?: 'above' | 'below';
113
- staff?: number;
114
- dynamics?: MusicXmlDynamic[];
115
- wedge?: MusicXmlWedge;
116
- pedal?: MusicXmlPedal;
117
- metronome?: MusicXmlMetronome;
118
- words?: MusicXmlWords[];
119
- octaveShift?: MusicXmlOctaveShift;
120
- coda?: boolean;
121
- segno?: boolean;
122
- }
123
- export interface MusicXmlBarline {
124
- location?: 'left' | 'right' | 'middle';
125
- barStyle?: string;
126
- repeat?: {
127
- direction: 'forward' | 'backward';
128
- };
129
- ending?: {
130
- type: 'start' | 'stop' | 'discontinue';
131
- number: string;
132
- };
133
- }
134
- export interface MusicXmlHarmony {
135
- root: {
136
- step: string;
137
- alter?: number;
138
- };
139
- kind: string;
140
- bass?: {
141
- step: string;
142
- alter?: number;
143
- };
144
- degrees?: {
145
- value: number;
146
- alter: number;
147
- type: 'add' | 'alter' | 'subtract';
148
- }[];
149
- }
150
- export type MusicXmlMeasureContent = {
151
- type: 'attributes';
152
- data: MusicXmlAttributes;
153
- } | {
154
- type: 'note';
155
- data: MusicXmlNote;
156
- } | {
157
- type: 'direction';
158
- data: MusicXmlDirection;
159
- } | {
160
- type: 'barline';
161
- data: MusicXmlBarline;
162
- } | {
163
- type: 'harmony';
164
- data: MusicXmlHarmony;
165
- } | {
166
- type: 'backup';
167
- duration: number;
168
- } | {
169
- type: 'forward';
170
- duration: number;
171
- };
172
- export interface MusicXmlMeasure {
173
- number: string;
174
- width?: number;
175
- implicit?: boolean;
176
- contents: MusicXmlMeasureContent[];
177
- }
178
- export interface MusicXmlPart {
179
- id: string;
180
- name?: string;
181
- measures: MusicXmlMeasure[];
182
- }
183
- export interface MusicXmlMetadata {
184
- workTitle?: string;
185
- movementTitle?: string;
186
- composer?: string;
187
- arranger?: string;
188
- lyricist?: string;
189
- }
190
- export interface MusicXmlPartInfo {
191
- id: string;
192
- name?: string;
193
- abbreviation?: string;
194
- }
195
- export interface MusicXmlDocument {
196
- metadata: MusicXmlMetadata;
197
- partList: MusicXmlPartInfo[];
198
- parts: MusicXmlPart[];
199
- }
@@ -1,7 +0,0 @@
1
- /**
2
- * MusicXML Intermediate Types
3
- *
4
- * These types represent the parsed MusicXML structure before conversion to LilyletDoc.
5
- * They closely mirror MusicXML elements for easier parsing.
6
- */
7
- export {};
@@ -1,92 +0,0 @@
1
- /**
2
- * MusicXML Utility Functions
3
- *
4
- * Helper functions for parsing MusicXML elements and converting values.
5
- */
6
- import { Clef, StemDirection, ArticulationType, OrnamentType, DynamicType, HairpinType, PedalType, KeySignature, Pitch, Duration, Fraction } from './types';
7
- /**
8
- * Get text content of a child element by tag name
9
- */
10
- export declare const getElementText: (parent: Element, tagName: string) => string | undefined;
11
- /**
12
- * Get numeric content of a child element
13
- */
14
- export declare const getElementNumber: (parent: Element, tagName: string) => number | undefined;
15
- /**
16
- * Get integer content of a child element
17
- */
18
- export declare const getElementInt: (parent: Element, tagName: string) => number | undefined;
19
- /**
20
- * Check if element has a child with given tag name
21
- */
22
- export declare const hasElement: (parent: Element, tagName: string) => boolean;
23
- /**
24
- * Get attribute value from element
25
- */
26
- export declare const getAttribute: (el: Element, name: string) => string | undefined;
27
- /**
28
- * Get numeric attribute value
29
- */
30
- export declare const getAttributeNumber: (el: Element, name: string) => number | undefined;
31
- /**
32
- * Get all child elements with given tag name
33
- */
34
- export declare const getElements: (parent: Element, tagName: string) => Element[];
35
- /**
36
- * Get all direct child elements (xmldom compatible - uses childNodes)
37
- */
38
- export declare const getChildElements: (parent: Element) => Element[];
39
- /**
40
- * Get direct child elements (not nested)
41
- * Note: Uses childNodes instead of children for xmldom compatibility
42
- */
43
- export declare const getDirectChildren: (parent: Element, tagName: string) => Element[];
44
- /**
45
- * Convert MusicXML pitch to Lilylet Pitch
46
- * MusicXML octave 4 = middle C octave = Lilylet octave 0
47
- */
48
- export declare const convertPitch: (step: string, alter: number | undefined, octave: number) => Pitch;
49
- export declare const DIVISIONS = 4;
50
- export declare const TYPE_TO_DIVISION: Record<string, number>;
51
- export declare const DIVISION_TO_TYPE: Record<number, string>;
52
- /**
53
- * Calculate duration in MusicXML divisions.
54
- * Shared by encoder (with DIVISIONS=4) and potentially decoder.
55
- *
56
- * Duration.tuplet is in Lilylet ratio semantics:
57
- * \times 2/3 → {numerator:2, denominator:3} → multiply by 2/3
58
- */
59
- export declare const calculateDuration: (duration: Duration, divisions?: number) => number;
60
- /**
61
- * Convert MusicXML duration to Lilylet Duration
62
- *
63
- * @param divisions - Current divisions value (divisions per quarter note)
64
- * @param duration - Duration value in divisions
65
- * @param type - Note type (quarter, eighth, etc.)
66
- * @param dots - Number of dots
67
- * @param timeModification - Tuplet info
68
- */
69
- export declare const convertDuration: (divisions: number, duration: number, type?: string, dots?: number, timeModification?: {
70
- actualNotes: number;
71
- normalNotes: number;
72
- }) => Duration;
73
- /**
74
- * Convert MusicXML key (fifths, mode) to KeySignature
75
- */
76
- export declare const convertKeySignature: (fifths: number, mode?: string) => KeySignature | undefined;
77
- /**
78
- * Convert MusicXML clef (sign, line) to Lilylet Clef
79
- */
80
- export declare const convertClef: (sign: string, line?: number) => Clef | undefined;
81
- export declare const convertStemDirection: (stem: string) => StemDirection | undefined;
82
- export declare const convertArticulation: (name: string) => ArticulationType | undefined;
83
- export declare const convertOrnament: (name: string) => OrnamentType | undefined;
84
- export declare const convertDynamic: (name: string) => DynamicType | undefined;
85
- export declare const convertWedge: (type: "crescendo" | "diminuendo" | "stop", isStart: boolean) => HairpinType | undefined;
86
- export declare const convertPedal: (type: string) => PedalType | undefined;
87
- export declare const convertBarlineStyle: (barStyle?: string, repeatDirection?: "forward" | "backward") => string;
88
- /**
89
- * Convert MusicXML harmony to chord symbol text
90
- */
91
- export declare const convertHarmonyToText: (rootStep: string, rootAlter: number | undefined, kind: string, bassStep?: string, bassAlter?: number) => string;
92
- export declare const createFraction: (numerator: number, denominator: number) => Fraction;