jpfun 0.9.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 (125) hide show
  1. package/README.md +11 -16
  2. package/dist/diagnostic.d.ts +29 -2
  3. package/dist/diagnostic.js +5 -4
  4. package/dist/functions/arpeggio/index.js +2 -3
  5. package/dist/functions/bar/index.d.ts +3 -0
  6. package/dist/functions/bar/index.js +21 -3
  7. package/dist/functions/beam/layout.js +3 -2
  8. package/dist/functions/box/index.js +1 -0
  9. package/dist/functions/dash/index.js +5 -2
  10. package/dist/functions/default.js +2 -1
  11. package/dist/functions/div/index.d.ts +1 -1
  12. package/dist/functions/div/index.js +4 -2
  13. package/dist/functions/dyn/index.js +1 -0
  14. package/dist/functions/gliss/index.js +85 -9
  15. package/dist/functions/grace/index.d.ts +1 -8
  16. package/dist/functions/grace/index.js +23 -53
  17. package/dist/functions/head/index.js +23 -30
  18. package/dist/functions/key/index.js +5 -7
  19. package/dist/functions/meter/index.d.ts +1 -0
  20. package/dist/functions/meter/index.js +3 -0
  21. package/dist/functions/meter/shape.d.ts +1 -1
  22. package/dist/functions/note/accidentals.d.ts +3 -3
  23. package/dist/functions/note/accidentals.js +29 -16
  24. package/dist/functions/note/index.d.ts +5 -2
  25. package/dist/functions/note/index.js +168 -25
  26. package/dist/functions/note/source-transform.d.ts +23 -2
  27. package/dist/functions/note/source-transform.js +95 -74
  28. package/dist/functions/ottava/index.js +1 -0
  29. package/dist/functions/page/index.d.ts +1 -36
  30. package/dist/functions/page/index.js +8 -7
  31. package/dist/functions/rest/index.js +8 -6
  32. package/dist/functions/set/index.js +2 -2
  33. package/dist/functions/slide/index.js +1 -0
  34. package/dist/functions/stack/index.js +6 -4
  35. package/dist/functions/temporal.d.ts +12 -3
  36. package/dist/functions/temporal.js +15 -2
  37. package/dist/functions/text/index.js +2 -2
  38. package/dist/functions/tie/index.js +28 -4
  39. package/dist/functions/tremolo/index.js +1 -0
  40. package/dist/functions/tuplet/index.js +1 -0
  41. package/dist/functions/up/index.js +12 -12
  42. package/dist/functions/voice/connections.d.ts +1 -1
  43. package/dist/functions/voice/connections.js +2 -2
  44. package/dist/functions/voice/lyrics.d.ts +11 -5
  45. package/dist/functions/voice/lyrics.js +151 -47
  46. package/dist/functions/voice/voice.d.ts +6 -2
  47. package/dist/functions/voice/voice.js +51 -19
  48. package/dist/functions/voice/voices.d.ts +2 -1
  49. package/dist/functions/voice/voices.js +4 -3
  50. package/dist/functions/volta/index.js +1 -0
  51. package/dist/index.d.ts +69 -3
  52. package/dist/index.js +69 -3
  53. package/dist/jpfun.min.js +47 -60
  54. package/dist/layout/engine.d.ts +4 -3
  55. package/dist/layout/engine.js +173 -27
  56. package/dist/layout/model.d.ts +13 -4
  57. package/dist/layout/model.js +15 -7
  58. package/dist/layout/page.js +2 -2
  59. package/dist/layout/path.js +1 -1
  60. package/dist/layout/types.d.ts +12 -3
  61. package/dist/lowering/accidentalMemory.d.ts +33 -0
  62. package/dist/lowering/accidentalMemory.js +84 -0
  63. package/dist/lowering/loweringContext.js +4 -0
  64. package/dist/parser/grammarType.d.ts +8 -3
  65. package/dist/parser/parse-utils/brace-utils.js +7 -17
  66. package/dist/parser/parse-utils/call-utils.d.ts +3 -1
  67. package/dist/parser/parse-utils/call-utils.js +17 -32
  68. package/dist/parser/parse-utils/note-utils.d.ts +4 -0
  69. package/dist/parser/parse-utils/note-utils.js +8 -12
  70. package/dist/parser/parse-utils/string-utils.d.ts +1 -1
  71. package/dist/parser/parse-utils/string-utils.js +1 -1
  72. package/dist/parser/parserContext.d.ts +32 -26
  73. package/dist/parser/parserContext.js +104 -194
  74. package/dist/parser/preprocess.d.ts +7 -0
  75. package/dist/parser/preprocess.js +31 -42
  76. package/dist/parser/syntax.d.ts +9 -0
  77. package/dist/parser/syntax.js +109 -0
  78. package/dist/pipeline.d.ts +1 -1
  79. package/dist/pipeline.js +3 -2
  80. package/dist/playback/compile.js +5 -7
  81. package/dist/playback/event.d.ts +1 -2
  82. package/dist/playback/event.js +2 -3
  83. package/dist/render/canvas.js +50 -35
  84. package/dist/render/index.d.ts +2 -1
  85. package/dist/render/index.js +2 -1
  86. package/dist/render/paint.d.ts +7 -0
  87. package/dist/render/paint.js +70 -20
  88. package/dist/render/recording.d.ts +8 -1
  89. package/dist/render/recording.js +12 -0
  90. package/dist/render/svg.d.ts +5 -1
  91. package/dist/render/svg.js +37 -17
  92. package/dist/render/text.d.ts +2 -2
  93. package/dist/render/text.js +7 -6
  94. package/dist/render/translate.d.ts +3 -1
  95. package/dist/render/translate.js +6 -0
  96. package/dist/render/types.d.ts +9 -0
  97. package/grammar.md +7 -5
  98. package/package.json +8 -18
  99. package/dist/converter/midi/convert.d.ts +0 -42
  100. package/dist/converter/midi/convert.js +0 -682
  101. package/dist/converter/midi/index.d.ts +0 -5
  102. package/dist/converter/midi/index.js +0 -11
  103. package/dist/converter/midi/json.d.ts +0 -38
  104. package/dist/converter/midi/json.js +0 -1
  105. package/dist/converter/midi/triplet.d.ts +0 -30
  106. package/dist/converter/midi/triplet.js +0 -75
  107. package/dist/converter/musicxml/dom.d.ts +0 -25
  108. package/dist/converter/musicxml/dom.js +0 -65
  109. package/dist/converter/musicxml/features.d.ts +0 -114
  110. package/dist/converter/musicxml/features.js +0 -501
  111. package/dist/converter/musicxml/index.d.ts +0 -14
  112. package/dist/converter/musicxml/index.js +0 -1285
  113. package/dist/converter/musicxml/model.d.ts +0 -176
  114. package/dist/converter/musicxml/model.js +0 -1
  115. package/dist/converter/musicxml/resolve.d.ts +0 -10
  116. package/dist/converter/musicxml/resolve.js +0 -152
  117. package/dist/converter/source.d.ts +0 -19
  118. package/dist/converter/source.js +0 -53
  119. package/dist/core.d.ts +0 -24
  120. package/dist/core.js +0 -24
  121. package/dist/functions/voice/index.d.ts +0 -2
  122. package/dist/functions/voice/index.js +0 -2
  123. package/dist/jpfun.core.min.js +0 -132
  124. package/dist/jpfun.from-midi.min.js +0 -9
  125. package/dist/jpfun.from-musicxml.min.js +0 -12
@@ -1,6 +1,6 @@
1
1
  import { ASTFunctionNode, ASTTextNode } from "../ASTtypes.js";
2
2
  import { ErrorDiagnostic, WarningDiagnostic } from "../../diagnostic.js";
3
- import { findClosingQuote, quote } from "../../parser/parse-utils/string-utils.js";
3
+ import { findClosingQuote, quoteSourceString } from "../../parser/parse-utils/string-utils.js";
4
4
  import { ParserContext } from "../../parser/parserContext.js";
5
5
  import { paintRichLine, prepareRichLine } from "../../render/text.js";
6
6
  import { BRACKET_HOOK_COMMANDS, BRACKET_HOOK_DROP, BRACKET_HOOK_REACH, CURVED_BRACE_BOUNDS, CURVED_BRACE_COMMANDS, parseConnections, resolveConnections, serializeConnections, } from "./connections.js";
@@ -91,7 +91,7 @@ N(女低): 1 2 3
91
91
  name: "minGap",
92
92
  namedOnly: true,
93
93
  type: "length",
94
- default: { value: 0.35, unit: "em" },
94
+ default: { value: 0.2, unit: "em" },
95
95
  description: "上方记号借用间距后保留的最小间距",
96
96
  },
97
97
  ],
@@ -272,7 +272,7 @@ N(女低): 1 2 3
272
272
  }
273
273
  toString(source) {
274
274
  const parameters = this.voices.map(voice => `\t${voice.toString(source)}`);
275
- parameters.push(`\tconnect=${quote(serializeConnections(this.connectionSpecs))}`, `\tgap=${this.gap}px`, `\tminGap=${this.minGap}px`);
275
+ parameters.push(`\tconnect=${quoteSourceString(serializeConnections(this.connectionSpecs))}`, `\tgap=${this.gap}px`, `\tminGap=${this.minGap}px`);
276
276
  return `@voices(\n${parameters.join(",\n")}\n)`;
277
277
  }
278
278
  }
@@ -287,6 +287,7 @@ class VoicesBraceAttachment {
287
287
  names;
288
288
  ast;
289
289
  connections;
290
+ kind = "voices";
290
291
  layer = "background";
291
292
  leftWidth = 0;
292
293
  measuredLabels = [];
@@ -90,6 +90,7 @@ class VoltaAttachment {
90
90
  ast;
91
91
  from;
92
92
  to;
93
+ kind = "volta";
93
94
  layer = "foreground";
94
95
  constructor(ast, from, to) {
95
96
  this.ast = ast;
package/dist/index.d.ts CHANGED
@@ -1,3 +1,69 @@
1
- export * from "./core.js";
2
- export * from "./converter/midi/index.js";
3
- export * from "./converter/musicxml/index.js";
1
+ export * from "./pipeline.js";
2
+ export * from "./functions/ASTtypes.js";
3
+ export * from "./functions/temporal.js";
4
+ export * from "./functions/default.js";
5
+ export * from "./functions/adjust/index.js";
6
+ export * from "./functions/arpeggio/index.js";
7
+ export { BarNode } from "./functions/bar/index.js";
8
+ export * from "./functions/beam/index.js";
9
+ export * from "./functions/box/index.js";
10
+ export * from "./functions/br/index.js";
11
+ export * from "./functions/dash/index.js";
12
+ export { DivNode } from "./functions/div/index.js";
13
+ export * from "./functions/dot/index.js";
14
+ export * from "./functions/dyn/index.js";
15
+ export * from "./functions/gliss/index.js";
16
+ export * from "./functions/grace/index.js";
17
+ export * from "./functions/head/index.js";
18
+ export * from "./functions/key/index.js";
19
+ export { MeterNode } from "./functions/meter/index.js";
20
+ export * from "./functions/note/index.js";
21
+ export * from "./functions/note/noteName.js";
22
+ export * from "./functions/note/source-transform.js";
23
+ export * from "./functions/ottava/index.js";
24
+ export * from "./functions/page/index.js";
25
+ export * from "./functions/pagebreak/index.js";
26
+ export * from "./functions/program/index.js";
27
+ export * from "./functions/rest/index.js";
28
+ export * from "./functions/set/index.js";
29
+ export * from "./functions/slide/index.js";
30
+ export * from "./functions/stack/index.js";
31
+ export * from "./functions/symbol/index.js";
32
+ export * from "./functions/tempo/index.js";
33
+ export * from "./functions/text/index.js";
34
+ export * from "./functions/tie/index.js";
35
+ export * from "./functions/tremolo/index.js";
36
+ export * from "./functions/tuplet/index.js";
37
+ export * from "./functions/up/index.js";
38
+ export * from "./functions/voice/voice.js";
39
+ export * from "./functions/voice/voices.js";
40
+ export { parseConnections, resolveConnections, serializeConnections, type ConnectionSpec, type VoiceConnection, } from "./functions/voice/connections.js";
41
+ export * from "./functions/voice/lyrics.js";
42
+ export * from "./functions/volta/index.js";
43
+ export * from "./diagnostic.js";
44
+ export * from "./fraction.js";
45
+ export * from "./parser/types.js";
46
+ export * from "./parser/grammarType.js";
47
+ export { ParserContext, DEFAULT_FONT_SIZE, skipSpaces, skipSpacesBack } from "./parser/parserContext.js";
48
+ export * from "./parser/preprocess.js";
49
+ export * from "./parser/parse-utils/brace-utils.js";
50
+ export * from "./parser/parse-utils/call-utils.js";
51
+ export * from "./parser/parse-utils/label-utils.js";
52
+ export * from "./parser/parse-utils/length-utils.js";
53
+ export * from "./parser/parse-utils/note-utils.js";
54
+ export * from "./parser/parse-utils/string-utils.js";
55
+ export * from "./lowering/types.js";
56
+ export * from "./lowering/loweringContext.js";
57
+ export * from "./lowering/track.js";
58
+ export * from "./lowering/accidentalMemory.js";
59
+ export * from "./playback/types.js";
60
+ export * from "./playback/time.js";
61
+ export * from "./playback/compile.js";
62
+ export * from "./layout/types.js";
63
+ export * from "./layout/model.js";
64
+ export * from "./layout/default.js";
65
+ export { DEFAULT_PAGE_CONFIG, normalizePageConfig, paginateLayoutLines, type DocumentLayoutPage, } from "./layout/page.js";
66
+ export * from "./layout/engine.js";
67
+ export * from "./layout/path.js";
68
+ export * from "./layout/range.js";
69
+ export * from "./render/index.js";
package/dist/index.js CHANGED
@@ -1,3 +1,69 @@
1
- export * from "./core.js";
2
- export * from "./converter/midi/index.js";
3
- export * from "./converter/musicxml/index.js";
1
+ export * from "./pipeline.js";
2
+ export * from "./functions/ASTtypes.js";
3
+ export * from "./functions/temporal.js";
4
+ export * from "./functions/default.js";
5
+ export * from "./functions/adjust/index.js";
6
+ export * from "./functions/arpeggio/index.js";
7
+ export { BarNode } from "./functions/bar/index.js";
8
+ export * from "./functions/beam/index.js";
9
+ export * from "./functions/box/index.js";
10
+ export * from "./functions/br/index.js";
11
+ export * from "./functions/dash/index.js";
12
+ export { DivNode } from "./functions/div/index.js";
13
+ export * from "./functions/dot/index.js";
14
+ export * from "./functions/dyn/index.js";
15
+ export * from "./functions/gliss/index.js";
16
+ export * from "./functions/grace/index.js";
17
+ export * from "./functions/head/index.js";
18
+ export * from "./functions/key/index.js";
19
+ export { MeterNode } from "./functions/meter/index.js";
20
+ export * from "./functions/note/index.js";
21
+ export * from "./functions/note/noteName.js";
22
+ export * from "./functions/note/source-transform.js";
23
+ export * from "./functions/ottava/index.js";
24
+ export * from "./functions/page/index.js";
25
+ export * from "./functions/pagebreak/index.js";
26
+ export * from "./functions/program/index.js";
27
+ export * from "./functions/rest/index.js";
28
+ export * from "./functions/set/index.js";
29
+ export * from "./functions/slide/index.js";
30
+ export * from "./functions/stack/index.js";
31
+ export * from "./functions/symbol/index.js";
32
+ export * from "./functions/tempo/index.js";
33
+ export * from "./functions/text/index.js";
34
+ export * from "./functions/tie/index.js";
35
+ export * from "./functions/tremolo/index.js";
36
+ export * from "./functions/tuplet/index.js";
37
+ export * from "./functions/up/index.js";
38
+ export * from "./functions/voice/voice.js";
39
+ export * from "./functions/voice/voices.js";
40
+ export { parseConnections, resolveConnections, serializeConnections, } from "./functions/voice/connections.js";
41
+ export * from "./functions/voice/lyrics.js";
42
+ export * from "./functions/volta/index.js";
43
+ export * from "./diagnostic.js";
44
+ export * from "./fraction.js";
45
+ export * from "./parser/types.js";
46
+ export * from "./parser/grammarType.js";
47
+ export { ParserContext, DEFAULT_FONT_SIZE, skipSpaces, skipSpacesBack } from "./parser/parserContext.js";
48
+ export * from "./parser/preprocess.js";
49
+ export * from "./parser/parse-utils/brace-utils.js";
50
+ export * from "./parser/parse-utils/call-utils.js";
51
+ export * from "./parser/parse-utils/label-utils.js";
52
+ export * from "./parser/parse-utils/length-utils.js";
53
+ export * from "./parser/parse-utils/note-utils.js";
54
+ export * from "./parser/parse-utils/string-utils.js";
55
+ export * from "./lowering/types.js";
56
+ export * from "./lowering/loweringContext.js";
57
+ export * from "./lowering/track.js";
58
+ export * from "./lowering/accidentalMemory.js";
59
+ export * from "./playback/types.js";
60
+ export * from "./playback/time.js";
61
+ export * from "./playback/compile.js";
62
+ export * from "./layout/types.js";
63
+ export * from "./layout/model.js";
64
+ export * from "./layout/default.js";
65
+ export { DEFAULT_PAGE_CONFIG, normalizePageConfig, paginateLayoutLines, } from "./layout/page.js";
66
+ export * from "./layout/engine.js";
67
+ export * from "./layout/path.js";
68
+ export * from "./layout/range.js";
69
+ export * from "./render/index.js";