abcjs 6.0.0-beta.35 → 6.0.0-beta.39

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 (73) hide show
  1. package/LICENSE.md +1 -1
  2. package/README.md +15 -6
  3. package/RELEASE.md +74 -0
  4. package/dist/abcjs-basic-min.js +2 -2
  5. package/dist/abcjs-basic-min.js.LICENSE +2 -2
  6. package/dist/abcjs-basic.js +2599 -328
  7. package/dist/abcjs-basic.js.map +1 -1
  8. package/dist/abcjs-plugin-min.js +2 -2
  9. package/dist/abcjs-plugin-min.js.LICENSE +2 -2
  10. package/dist/report-basic.html +37 -0
  11. package/dist/report-before-glyph-compress.html +37 -0
  12. package/dist/report-brown-ts-target-es5.html +37 -0
  13. package/dist/report-dev-orig-no-babel.html +37 -0
  14. package/dist/report-synth.html +37 -0
  15. package/docker-build.sh +1 -0
  16. package/glyphs.json +1 -0
  17. package/index.js +23 -1
  18. package/license.js +1 -1
  19. package/package.json +2 -1
  20. package/plugin.js +23 -1
  21. package/src/api/abc_tablatures.js +144 -0
  22. package/src/api/abc_tunebook.js +10 -1
  23. package/src/api/abc_tunebook_svg.js +18 -6
  24. package/src/data/abc_tune.js +26 -24
  25. package/src/edit/abc_editor.js +29 -11
  26. package/src/parse/abc_parse.js +4 -2
  27. package/src/parse/abc_parse_directive.js +12 -6
  28. package/src/parse/tune-builder.js +1 -1
  29. package/src/synth/abc_midi_flattener.js +11 -2
  30. package/src/synth/abc_midi_sequencer.js +4 -1
  31. package/src/synth/create-synth.js +105 -34
  32. package/src/synth/load-note.js +34 -65
  33. package/src/synth/place-note.js +63 -59
  34. package/src/tablatures/instruments/guitar/guitar-fonts.js +19 -0
  35. package/src/tablatures/instruments/guitar/guitar-patterns.js +23 -0
  36. package/src/tablatures/instruments/guitar/tab-guitar.js +50 -0
  37. package/src/tablatures/instruments/string-patterns.js +277 -0
  38. package/src/tablatures/instruments/string-tablature.js +56 -0
  39. package/src/tablatures/instruments/tab-note.js +282 -0
  40. package/src/tablatures/instruments/tab-notes.js +41 -0
  41. package/src/tablatures/instruments/violin/tab-violin.js +47 -0
  42. package/src/tablatures/instruments/violin/violin-fonts.js +19 -0
  43. package/src/tablatures/instruments/violin/violin-patterns.js +23 -0
  44. package/src/tablatures/tab-absolute-elements.js +310 -0
  45. package/src/tablatures/tab-common.js +29 -0
  46. package/src/tablatures/tab-renderer.js +243 -0
  47. package/src/tablatures/transposer.js +110 -0
  48. package/src/test/abc_parser_lint.js +3 -0
  49. package/src/write/abc_absolute_element.js +2 -2
  50. package/src/write/abc_engraver_controller.js +19 -11
  51. package/src/write/abc_glyphs.js +2 -0
  52. package/src/write/abc_relative_element.js +5 -3
  53. package/src/write/abc_renderer.js +5 -1
  54. package/src/write/draw/absolute.js +5 -1
  55. package/src/write/draw/draw.js +5 -6
  56. package/src/write/draw/non-music.js +3 -1
  57. package/src/write/draw/print-line.js +24 -0
  58. package/src/write/draw/relative.js +14 -2
  59. package/src/write/draw/selectables.js +9 -6
  60. package/src/write/draw/staff-group.js +44 -8
  61. package/src/write/draw/staff-line.js +3 -19
  62. package/src/write/draw/staff.js +15 -2
  63. package/src/write/draw/tab-line.js +40 -0
  64. package/src/write/draw/text.js +3 -0
  65. package/src/write/draw/voice.js +9 -1
  66. package/src/write/format-jazz-chord.js +2 -2
  67. package/src/write/layout/staffGroup.js +23 -1
  68. package/src/write/layout/voice.js +2 -1
  69. package/src/write/svg.js +2 -1
  70. package/temp.txt +0 -0
  71. package/test.js +23 -0
  72. package/types/index.d.ts +73 -25
  73. package/version.js +1 -1
package/src/write/svg.js CHANGED
@@ -193,8 +193,9 @@ Svg.prototype.text = function(text, attr, target) {
193
193
  line.appendChild(ts2);
194
194
  }
195
195
  if (parts[2]) {
196
+ var dist = parts[1] ? "0.4em" : "0.1em";
196
197
  var ts3 = document.createElementNS(svgNS, 'tspan');
197
- ts3.setAttribute("dy", "0.1em");
198
+ ts3.setAttribute("dy", dist);
198
199
  ts3.setAttribute("style", "font-size:0.7em");
199
200
  ts3.textContent = parts[2];
200
201
  line.appendChild(ts3);
package/temp.txt ADDED
File without changes
package/test.js CHANGED
@@ -1,3 +1,26 @@
1
+ /**!
2
+ Copyright (c) 2009-2022 Paul Rosen and Gregory Dyke
3
+
4
+ Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ of this software and associated documentation files (the "Software"), to deal
6
+ in the Software without restriction, including without limitation the rights
7
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ copies of the Software, and to permit persons to whom the Software is
9
+ furnished to do so, subject to the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be included in
12
+ all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20
+ THE SOFTWARE.
21
+
22
+ **This text is from: http://opensource.org/licenses/MIT**
23
+ !**/
1
24
  var abcjs = require('./index');
2
25
  var version = require('./version');
3
26
  var Parse = require('./src/parse/abc_parse');
package/types/index.d.ts CHANGED
@@ -48,7 +48,7 @@ declare module 'abcjs' {
48
48
 
49
49
  export type FormatAttributes = "titlefont" | "gchordfont" | "composerfont" | "footerfont" | "headerfont" | "historyfont" | "infofont" |
50
50
  "measurefont" | "partsfont" | "repeatfont" | "subtitlefont" | "tempofont" | "textfont" | "voicefont" | "tripletfont" | "vocalfont" |
51
- "wordsfont" | "annotationfont" | "scale" | "partsbox" | "freegchord" | "fontboxpadding" | "stretchlast";
51
+ "wordsfont" | "annotationfont" | "scale" | "partsbox" | "freegchord" | "fontboxpadding" | "stretchlast" | "tablabelfont" | "tabnumberfont" | "tabgracefont";
52
52
 
53
53
  export type MidiCommands = "nobarlines" | "barlines" | "beataccents" | "nobeataccents" | "droneon" | "droneoff" | "noportamento" | "channel" | "c" |
54
54
  "drumon" | "drumoff" | "fermatafixed" | "fermataproportional" | "gchordon" | "gchordoff" | "bassvol" | "chordvol" |
@@ -274,7 +274,7 @@ declare module 'abcjs' {
274
274
  fadeLength?: number;
275
275
  sequenceCallback?: (sequence: Array<NoteMapTrack>, context: any) => Array<NoteMapTrack>;
276
276
  callbackContext?: any; // Anything is ok. It is just passed back in the callback
277
- onEnded?: () => void;
277
+ onEnded?: (context: any) => void;
278
278
  pan?: Array<number>;
279
279
  voicesOff?: boolean | Array<number>;
280
280
  drum?: string;
@@ -291,11 +291,11 @@ declare module 'abcjs' {
291
291
  }
292
292
 
293
293
  export interface SynthVisualOptions {
294
- displayLoop: boolean | false
295
- displayRestart: boolean | false
296
- displayPlay: boolean | false
297
- displayProgress: boolean | false
298
- displayWarp: boolean | false
294
+ displayLoop?: boolean;
295
+ displayRestart?: boolean;
296
+ displayPlay?: boolean;
297
+ displayProgress?: boolean;
298
+ displayWarp?: boolean;
299
299
  }
300
300
 
301
301
  export type DownloadLabelFn = (visualObj: TuneObject, index: number) => string;
@@ -352,6 +352,11 @@ declare module 'abcjs' {
352
352
  measureStart?: boolean;
353
353
  }
354
354
 
355
+ export interface PercMapElement {
356
+ sound: number;
357
+ noteHead: NoteHeadType;
358
+ }
359
+
355
360
  export interface Formatting {
356
361
  alignbars?: number;
357
362
  aligncomposer?: Alignment;
@@ -407,7 +412,7 @@ declare module 'abcjs' {
407
412
  drone?: MidiParam;
408
413
  droneoff?: MidiParam;
409
414
  droneon?: MidiParam;
410
- drum: MidiParam;
415
+ drum?: MidiParam;
411
416
  drumbars?: MidiParam;
412
417
  drummap: MidiParam;
413
418
  drumoff?: MidiParam;
@@ -415,7 +420,7 @@ declare module 'abcjs' {
415
420
  expand?: MidiParam;
416
421
  fermatafixed?: MidiParam;
417
422
  fermataproportional?: MidiParam;
418
- gchord: MidiParam;
423
+ gchord?: MidiParam;
419
424
  gchordon?: MidiParam;
420
425
  gchordoff?: MidiParam;
421
426
  grace?: MidiParam;
@@ -445,7 +450,7 @@ declare module 'abcjs' {
445
450
  parskipfac?: number;
446
451
  partsbox?: boolean;
447
452
  partsspace?: number;
448
- percmap?: any; // TODO
453
+ percmap?: Array<PercMapElement>;
449
454
  playtempo?: string;
450
455
  rightmargin?: number;
451
456
  scale?: number;
@@ -485,6 +490,9 @@ declare module 'abcjs' {
485
490
  partsfont: Font;
486
491
  repeatfont: Font;
487
492
  subtitlefont: Font;
493
+ tabgracefont: Font;
494
+ tablabelfont: Font;
495
+ tabnumberfont: Font;
488
496
  tempofont: Font;
489
497
  textfont: Font;
490
498
  titlefont: Font;
@@ -728,7 +736,31 @@ declare module 'abcjs' {
728
736
 
729
737
  export type TuneObjectArray = [TuneObject]
730
738
 
731
- export type AbcElem = any // TODO
739
+ export interface AbcElem {
740
+ el_type: string //TODO enumerate these
741
+ abselem: any;
742
+ beambr?: number;
743
+ chord?: Array<any>
744
+ decoration: Array<any>
745
+ duration: number
746
+ endBeam?: boolean
747
+ endSlur?: number
748
+ endTriplet?: true
749
+ gracenotes?: Array<any>
750
+ lyric?: Array<any>
751
+ noStem?: boolean
752
+ pitches?: Array<any>
753
+ positioning?: any
754
+ rest?: any
755
+ startBeam?: boolean
756
+ startTriplet?: number
757
+ tripletMultiplier?: number
758
+ tripletR?: number
759
+ stemConnectsToAbove?: true
760
+ style?: NoteHeadType
761
+ startChar: number
762
+ endChar: number
763
+ }
732
764
 
733
765
  export interface ClickListenerDrag {
734
766
  step: number;
@@ -770,7 +802,7 @@ declare module 'abcjs' {
770
802
  height: number;
771
803
  left: number;
772
804
  width: number;
773
- elements: Array< any>; // TODO
805
+ elements: Array< HTMLElement>;
774
806
  startCharArray: Array<number>;
775
807
  endCharArray: Array<number>;
776
808
  midiPitches: MidiPitches
@@ -835,7 +867,7 @@ declare module 'abcjs' {
835
867
 
836
868
  export interface SequenceBeat {
837
869
  el_type: "beat";
838
- beats: any; // TODO
870
+ beats: [number,number,number];
839
871
  }
840
872
 
841
873
  export interface SequenceBeatAccents {
@@ -864,9 +896,9 @@ declare module 'abcjs' {
864
896
  export type MidiFile = any // This is a standard midi file format
865
897
 
866
898
  export interface MidiBufferPromise {
867
- cached: [any] // TODO
868
- error: [any] // TODO
869
- loaded: [any] // TODO
899
+ cached: Array<string>;
900
+ error: Array<string>;
901
+ loaded: Array<string>;
870
902
  }
871
903
 
872
904
  export interface AudioTrack {
@@ -977,22 +1009,39 @@ declare module 'abcjs' {
977
1009
  //
978
1010
  // Audio
979
1011
  //
980
- export type AudioControl = any // TODO
1012
+ export interface AudioControl {
1013
+ disable: (isDisabled: boolean) => void;
1014
+ setWarp: (tempo: number, warp: number) => void;
1015
+ setTempo: (tempo: number) => void;
1016
+ resetAll: () => void;
1017
+ pushPlay: (push: boolean) => void;
1018
+ pushLoop: (push: boolean) => void;
1019
+ setProgress: (percent: number, totalTime: number) => void;
1020
+ }
981
1021
 
982
1022
  export interface MidiBuffer {
983
1023
  init(params?: MidiBufferOptions): Promise<MidiBufferPromise>
984
1024
  prime(): Promise<void>
985
1025
  start(): void
986
- pause(): void
1026
+ pause(): number
987
1027
  resume(): void
988
- seek(position: number, units: ProgressUnit): void
989
- stop(): void
990
- download(): any // returns audio buffer in wav format
1028
+ seek(position: number, units?: ProgressUnit): void
1029
+ stop(): number
1030
+ download(): string // returns audio buffer in wav format as a reference to a blob
1031
+ }
1032
+
1033
+ export interface SynthInitResponse {
1034
+ status: "no-audio-context" | "created";
1035
+ loadingResponse?: {
1036
+ cached: Array<string>
1037
+ error: Array<string>
1038
+ loaded: Array<string>
1039
+ }
991
1040
  }
992
1041
 
993
1042
  export interface SynthObjectController {
994
1043
  disable(isDisabled: boolean): void
995
- setTune(visualObj: TuneObject, userAction: Boolean, audioParams?: AbcVisualParams): Promise<any> // TODO
1044
+ setTune(visualObj: TuneObject, userAction: Boolean, audioParams?: AbcVisualParams): Promise<SynthInitResponse>
996
1045
  load(selector: string, cursorControl?: any, visualOptions?: SynthVisualOptions): void
997
1046
  play(): void
998
1047
  pause(): void
@@ -1015,12 +1064,11 @@ declare module 'abcjs' {
1015
1064
  let SynthSequence: { new (): SynthSequenceClass }
1016
1065
 
1017
1066
  export function supportsAudio(): boolean
1018
- export function registerAudioContext(AudioContext): boolean
1067
+ export function registerAudioContext(ac?: AudioContext): boolean
1019
1068
  export function activeAudioContext(): AudioContext
1020
- export function CreateSynthControl(element: Selector, options: AbcVisualParams): AudioControl // TODO
1069
+ export function CreateSynthControl(element: Selector, options: AbcVisualParams): AudioControl
1021
1070
  export function getMidiFile(source: String | TuneObject, options?: MidiFileOptions): MidiFile;
1022
1071
  export function playEvent(pitches: MidiPitches, graceNotes: MidiGracePitches, milliSecondsPerMeasure: number): Promise<void>;
1023
- export function activeAudioContext(): AudioContext
1024
1072
  export function sequence(visualObj: TuneObject, options: AbcVisualParams): AudioSequence
1025
1073
  }
1026
1074
 
package/version.js CHANGED
@@ -1,3 +1,3 @@
1
- var version = '6.0.0-beta.34';
1
+ var version = '6.0.0-beta.39';
2
2
 
3
3
  module.exports = version;