vector-score 1.0.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.
@@ -0,0 +1,9 @@
1
+ import { GlyphNames } from '../glyphs';
2
+ import { Durations, NoteObj } from '../types';
3
+ export declare function parseNoteString(noteString: string): NoteObj;
4
+ export declare function parseDurationNoteString(note: string): Durations;
5
+ export declare function parseRestString(rest: string): Durations;
6
+ export declare function getGlyphNameByClef(clef: string): GlyphNames;
7
+ export declare function getNoteSpacingFromReference(referenceNote: NoteObj, targetNote: NoteObj): number;
8
+ export declare function noteToAbsoluteSemitone(note: NoteObj): number;
9
+ export declare function getNameOctaveIdx(name: string, octave: number): number;
@@ -0,0 +1,7 @@
1
+ export { default as MusicStaff } from './classes/MusicStaff';
2
+ export { default as RhythmStaff } from './classes/RhythmStaff';
3
+ export { default as ScrollingStaff } from './classes/ScrollingStaff';
4
+ export type { MusicStaffOptions } from './classes/MusicStaff';
5
+ export type { RhythmStaffOptions } from './classes/RhythmStaff';
6
+ export type { ScrollingStaffOptions } from './classes/ScrollingStaff';
7
+ export type { StaffTypes } from './types';
@@ -0,0 +1,14 @@
1
+ import { default as SVGRenderer } from '../classes/SVGRenderer';
2
+ import { NoteObj, StaffTypes } from '../types';
3
+ import { LedgerLineEntry, StaffStrategy } from './StrategyInterface';
4
+ export default class GrandStaffStrategy implements StaffStrategy {
5
+ private params;
6
+ private rendererRef;
7
+ private width;
8
+ constructor(rendererRef: SVGRenderer, staffType: StaffTypes);
9
+ private drawStaffLines;
10
+ drawStaff: (width: number) => void;
11
+ shouldNoteFlip(noteYPos: number): boolean;
12
+ getLedgerLinesX(note: Omit<NoteObj, "accidental">, yPos: number): LedgerLineEntry[];
13
+ calculateNoteYPos: (note: Omit<NoteObj, "accidental">) => number;
14
+ }
@@ -0,0 +1,12 @@
1
+ import { default as SVGRenderer } from '../classes/SVGRenderer';
2
+ import { NoteObj, StaffTypes } from '../types';
3
+ import { LedgerLineEntry, StaffStrategy } from './StrategyInterface';
4
+ export default class SingleStaffStrategy implements StaffStrategy {
5
+ private params;
6
+ private rendererRef;
7
+ constructor(rendererRef: SVGRenderer, staffType: StaffTypes);
8
+ drawStaff: (width: number) => void;
9
+ shouldNoteFlip(noteYPos: number): boolean;
10
+ getLedgerLinesX(note: Omit<NoteObj, "accidental">, yPos: number): LedgerLineEntry[];
11
+ calculateNoteYPos: (note: Omit<NoteObj, "accidental">) => number;
12
+ }
@@ -0,0 +1,20 @@
1
+ import { NoteObj, StaffTypes } from '../types';
2
+ export interface StaffStrategy {
3
+ drawStaff(width: number): void;
4
+ calculateNoteYPos(note: Omit<NoteObj, "accidental">): number;
5
+ getLedgerLinesX(note: Omit<NoteObj, "accidental">, yPos: number): LedgerLineEntry[];
6
+ shouldNoteFlip(noteYPos: number): boolean;
7
+ }
8
+ export type StaffParams = {
9
+ staffType: StaffTypes;
10
+ paddingTop: number;
11
+ paddingBottom: number;
12
+ topLineNote: NoteObj;
13
+ topLineYPos: number;
14
+ bottomLineYPos: number;
15
+ };
16
+ export type LedgerLineEntry = {
17
+ x1: number;
18
+ x2: number;
19
+ yPos: number;
20
+ };
@@ -0,0 +1,11 @@
1
+ export type StaffTypes = 'treble' | 'bass' | 'alto' | 'grand';
2
+ export type NoteObj = {
3
+ name: NoteNames;
4
+ octave: number;
5
+ accidental?: Accidentals;
6
+ duration?: Durations;
7
+ };
8
+ export type NoteNames = 'C' | 'D' | 'E' | 'F' | 'G' | 'A' | 'B';
9
+ export type Durations = 'w' | 'h' | 'q' | 'e' | 's';
10
+ export type Accidentals = '#' | 'b' | '##' | 'bb' | 'n';
11
+ export type DurationsBeatValues = 4 | 2 | 1 | 0.5;