@minikeys/react 0.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.
@@ -0,0 +1,78 @@
1
+ import * as minikeys from 'minikeys';
2
+ import { NoteName, KeyMap, Sample, KeyboardMode, keyboardWhiteNotes } from 'minikeys';
3
+ import * as react_jsx_runtime from 'react/jsx-runtime';
4
+
5
+ type Highlights = {
6
+ rangeStart?: NoteName;
7
+ rangeEnd?: NoteName;
8
+ rangeColor?: string;
9
+ activeNotes?: NoteName[];
10
+ };
11
+ type ActiveKey = {
12
+ keyCode: string;
13
+ note?: NoteName;
14
+ };
15
+
16
+ type ModifierKey = {
17
+ keyCode: string;
18
+ label: string;
19
+ action: () => void;
20
+ actionOnRelease?: () => void;
21
+ bgColour?: string;
22
+ colour?: string;
23
+ };
24
+ type KeyboardProps = {
25
+ width?: number;
26
+ dualMode?: boolean;
27
+ showFullKeyboard?: boolean;
28
+ modifierKeys?: ModifierKey[];
29
+ activeKeys: ActiveKey[];
30
+ keyMap: KeyMap | undefined;
31
+ animate?: boolean;
32
+ onKeyClick?: (midiNote: number) => void;
33
+ };
34
+ declare const Keyboard: ({ width, dualMode, showFullKeyboard, modifierKeys, activeKeys, keyMap, animate, onKeyClick, }: KeyboardProps) => react_jsx_runtime.JSX.Element;
35
+
36
+ declare const useKeyboardControl: (keyMap: KeyMap | undefined, playNoteFromMidi?: (midiNote: number, velocity?: number) => void, modifierKeys?: ModifierKey[]) => {
37
+ activeKeys: ActiveKey[];
38
+ };
39
+
40
+ declare const useMiniKeys: (samples: Sample[]) => {
41
+ playNoteFromName: ((noteName: minikeys.NoteName, velocity?: number) => void) | undefined;
42
+ playNoteFromMidi: ((midiNote: number, velocity?: number) => void) | undefined;
43
+ setSustain: (sustain: boolean) => void;
44
+ sustain: boolean;
45
+ isLoading: boolean;
46
+ isSuccess: boolean;
47
+ isError: boolean;
48
+ progress: number;
49
+ };
50
+
51
+ declare const useMiniKeysKeyboard: (mode: KeyboardMode) => {
52
+ keyMap: KeyMap | undefined;
53
+ noteRange: {
54
+ low: "C-1" | "C#-1" | "D-1" | "D#-1" | "E-1" | "F-1" | "F#-1" | "G-1" | "G#-1" | "A-1" | "A#-1" | "B-1" | "C0" | "C#0" | "D0" | "D#0" | "E0" | "F0" | "F#0" | "G0" | "G#0" | "A0" | "A#0" | "B0" | "C1" | "C#1" | "D1" | "D#1" | "E1" | "F1" | "F#1" | "G1" | "G#1" | "A1" | "A#1" | "B1" | "C2" | "C#2" | "D2" | "D#2" | "E2" | "F2" | "F#2" | "G2" | "G#2" | "A2" | "A#2" | "B2" | "C3" | "C#3" | "D3" | "D#3" | "E3" | "F3" | "F#3" | "G3" | "G#3" | "A3" | "A#3" | "B3" | "C4" | "C#4" | "D4" | "D#4" | "E4" | "F4" | "F#4" | "G4" | "G#4" | "A4" | "A#4" | "B4" | "C5" | "C#5" | "D5" | "D#5" | "E5" | "F5" | "F#5" | "G5" | "G#5" | "A5" | "A#5" | "B5" | "C6" | "C#6" | "D6" | "D#6" | "E6" | "F6" | "F#6" | "G6" | "G#6" | "A6" | "A#6" | "B6" | "C7" | "C#7" | "D7" | "D#7" | "E7" | "F7" | "F#7" | "G7" | "G#7" | "A7" | "A#7" | "B7" | "C8" | "C#8" | "D8" | "D#8" | "E8" | "F8" | "F#8" | "G8" | "G#8" | "A8" | "A#8" | "B8" | "C9" | "C#9" | "D9" | "D#9" | "E9" | "F9" | "F#9" | "G9";
55
+ high: "C-1" | "C#-1" | "D-1" | "D#-1" | "E-1" | "F-1" | "F#-1" | "G-1" | "G#-1" | "A-1" | "A#-1" | "B-1" | "C0" | "C#0" | "D0" | "D#0" | "E0" | "F0" | "F#0" | "G0" | "G#0" | "A0" | "A#0" | "B0" | "C1" | "C#1" | "D1" | "D#1" | "E1" | "F1" | "F#1" | "G1" | "G#1" | "A1" | "A#1" | "B1" | "C2" | "C#2" | "D2" | "D#2" | "E2" | "F2" | "F#2" | "G2" | "G#2" | "A2" | "A#2" | "B2" | "C3" | "C#3" | "D3" | "D#3" | "E3" | "F3" | "F#3" | "G3" | "G#3" | "A3" | "A#3" | "B3" | "C4" | "C#4" | "D4" | "D#4" | "E4" | "F4" | "F#4" | "G4" | "G#4" | "A4" | "A#4" | "B4" | "C5" | "C#5" | "D5" | "D#5" | "E5" | "F5" | "F#5" | "G5" | "G#5" | "A5" | "A#5" | "B5" | "C6" | "C#6" | "D6" | "D#6" | "E6" | "F6" | "F#6" | "G6" | "G#6" | "A6" | "A#6" | "B6" | "C7" | "C#7" | "D7" | "D#7" | "E7" | "F7" | "F#7" | "G7" | "G#7" | "A7" | "A#7" | "B7" | "C8" | "C#8" | "D8" | "D#8" | "E8" | "F8" | "F#8" | "G8" | "G#8" | "A8" | "A#8" | "B8" | "C9" | "C#9" | "D9" | "D#9" | "E9" | "F9" | "F#9" | "G9";
56
+ } | undefined;
57
+ transposeDown: () => void;
58
+ transposeUp: () => void;
59
+ octaveDown: () => void;
60
+ octaveUp: () => void;
61
+ };
62
+
63
+ type WhiteNote = (typeof keyboardWhiteNotes)[number];
64
+ type PianoProps = {
65
+ width: number;
66
+ height?: number;
67
+ numKeys: number;
68
+ strokeColour?: string;
69
+ strokeWidth?: number;
70
+ baseNote?: WhiteNote;
71
+ showLabels?: boolean;
72
+ highlights?: Highlights;
73
+ noBorder?: boolean;
74
+ onClick?: (midiNote: number) => void;
75
+ };
76
+ declare const Piano: ({ width, numKeys, height, strokeWidth, strokeColour, baseNote, showLabels, noBorder, highlights, onClick, ...props }: PianoProps) => react_jsx_runtime.JSX.Element;
77
+
78
+ export { type Highlights, Keyboard, type KeyboardProps, type ModifierKey, Piano, type PianoProps, useKeyboardControl, useMiniKeys, useMiniKeysKeyboard };
@@ -0,0 +1,78 @@
1
+ import * as minikeys from 'minikeys';
2
+ import { NoteName, KeyMap, Sample, KeyboardMode, keyboardWhiteNotes } from 'minikeys';
3
+ import * as react_jsx_runtime from 'react/jsx-runtime';
4
+
5
+ type Highlights = {
6
+ rangeStart?: NoteName;
7
+ rangeEnd?: NoteName;
8
+ rangeColor?: string;
9
+ activeNotes?: NoteName[];
10
+ };
11
+ type ActiveKey = {
12
+ keyCode: string;
13
+ note?: NoteName;
14
+ };
15
+
16
+ type ModifierKey = {
17
+ keyCode: string;
18
+ label: string;
19
+ action: () => void;
20
+ actionOnRelease?: () => void;
21
+ bgColour?: string;
22
+ colour?: string;
23
+ };
24
+ type KeyboardProps = {
25
+ width?: number;
26
+ dualMode?: boolean;
27
+ showFullKeyboard?: boolean;
28
+ modifierKeys?: ModifierKey[];
29
+ activeKeys: ActiveKey[];
30
+ keyMap: KeyMap | undefined;
31
+ animate?: boolean;
32
+ onKeyClick?: (midiNote: number) => void;
33
+ };
34
+ declare const Keyboard: ({ width, dualMode, showFullKeyboard, modifierKeys, activeKeys, keyMap, animate, onKeyClick, }: KeyboardProps) => react_jsx_runtime.JSX.Element;
35
+
36
+ declare const useKeyboardControl: (keyMap: KeyMap | undefined, playNoteFromMidi?: (midiNote: number, velocity?: number) => void, modifierKeys?: ModifierKey[]) => {
37
+ activeKeys: ActiveKey[];
38
+ };
39
+
40
+ declare const useMiniKeys: (samples: Sample[]) => {
41
+ playNoteFromName: ((noteName: minikeys.NoteName, velocity?: number) => void) | undefined;
42
+ playNoteFromMidi: ((midiNote: number, velocity?: number) => void) | undefined;
43
+ setSustain: (sustain: boolean) => void;
44
+ sustain: boolean;
45
+ isLoading: boolean;
46
+ isSuccess: boolean;
47
+ isError: boolean;
48
+ progress: number;
49
+ };
50
+
51
+ declare const useMiniKeysKeyboard: (mode: KeyboardMode) => {
52
+ keyMap: KeyMap | undefined;
53
+ noteRange: {
54
+ low: "C-1" | "C#-1" | "D-1" | "D#-1" | "E-1" | "F-1" | "F#-1" | "G-1" | "G#-1" | "A-1" | "A#-1" | "B-1" | "C0" | "C#0" | "D0" | "D#0" | "E0" | "F0" | "F#0" | "G0" | "G#0" | "A0" | "A#0" | "B0" | "C1" | "C#1" | "D1" | "D#1" | "E1" | "F1" | "F#1" | "G1" | "G#1" | "A1" | "A#1" | "B1" | "C2" | "C#2" | "D2" | "D#2" | "E2" | "F2" | "F#2" | "G2" | "G#2" | "A2" | "A#2" | "B2" | "C3" | "C#3" | "D3" | "D#3" | "E3" | "F3" | "F#3" | "G3" | "G#3" | "A3" | "A#3" | "B3" | "C4" | "C#4" | "D4" | "D#4" | "E4" | "F4" | "F#4" | "G4" | "G#4" | "A4" | "A#4" | "B4" | "C5" | "C#5" | "D5" | "D#5" | "E5" | "F5" | "F#5" | "G5" | "G#5" | "A5" | "A#5" | "B5" | "C6" | "C#6" | "D6" | "D#6" | "E6" | "F6" | "F#6" | "G6" | "G#6" | "A6" | "A#6" | "B6" | "C7" | "C#7" | "D7" | "D#7" | "E7" | "F7" | "F#7" | "G7" | "G#7" | "A7" | "A#7" | "B7" | "C8" | "C#8" | "D8" | "D#8" | "E8" | "F8" | "F#8" | "G8" | "G#8" | "A8" | "A#8" | "B8" | "C9" | "C#9" | "D9" | "D#9" | "E9" | "F9" | "F#9" | "G9";
55
+ high: "C-1" | "C#-1" | "D-1" | "D#-1" | "E-1" | "F-1" | "F#-1" | "G-1" | "G#-1" | "A-1" | "A#-1" | "B-1" | "C0" | "C#0" | "D0" | "D#0" | "E0" | "F0" | "F#0" | "G0" | "G#0" | "A0" | "A#0" | "B0" | "C1" | "C#1" | "D1" | "D#1" | "E1" | "F1" | "F#1" | "G1" | "G#1" | "A1" | "A#1" | "B1" | "C2" | "C#2" | "D2" | "D#2" | "E2" | "F2" | "F#2" | "G2" | "G#2" | "A2" | "A#2" | "B2" | "C3" | "C#3" | "D3" | "D#3" | "E3" | "F3" | "F#3" | "G3" | "G#3" | "A3" | "A#3" | "B3" | "C4" | "C#4" | "D4" | "D#4" | "E4" | "F4" | "F#4" | "G4" | "G#4" | "A4" | "A#4" | "B4" | "C5" | "C#5" | "D5" | "D#5" | "E5" | "F5" | "F#5" | "G5" | "G#5" | "A5" | "A#5" | "B5" | "C6" | "C#6" | "D6" | "D#6" | "E6" | "F6" | "F#6" | "G6" | "G#6" | "A6" | "A#6" | "B6" | "C7" | "C#7" | "D7" | "D#7" | "E7" | "F7" | "F#7" | "G7" | "G#7" | "A7" | "A#7" | "B7" | "C8" | "C#8" | "D8" | "D#8" | "E8" | "F8" | "F#8" | "G8" | "G#8" | "A8" | "A#8" | "B8" | "C9" | "C#9" | "D9" | "D#9" | "E9" | "F9" | "F#9" | "G9";
56
+ } | undefined;
57
+ transposeDown: () => void;
58
+ transposeUp: () => void;
59
+ octaveDown: () => void;
60
+ octaveUp: () => void;
61
+ };
62
+
63
+ type WhiteNote = (typeof keyboardWhiteNotes)[number];
64
+ type PianoProps = {
65
+ width: number;
66
+ height?: number;
67
+ numKeys: number;
68
+ strokeColour?: string;
69
+ strokeWidth?: number;
70
+ baseNote?: WhiteNote;
71
+ showLabels?: boolean;
72
+ highlights?: Highlights;
73
+ noBorder?: boolean;
74
+ onClick?: (midiNote: number) => void;
75
+ };
76
+ declare const Piano: ({ width, numKeys, height, strokeWidth, strokeColour, baseNote, showLabels, noBorder, highlights, onClick, ...props }: PianoProps) => react_jsx_runtime.JSX.Element;
77
+
78
+ export { type Highlights, Keyboard, type KeyboardProps, type ModifierKey, Piano, type PianoProps, useKeyboardControl, useMiniKeys, useMiniKeysKeyboard };