zds-pickers 4.0.13 → 4.0.15
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.
- package/dist/index.cjs.js +160 -1
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +12482 -36
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/midi/ccValues.js +2 -2
- package/dist/other/DefaultTooltip.js +1 -1
- package/dist/other/OctavePlayer.js +4 -4
- package/dist/other/SoundFontProvider.js +5 -3
- package/dist/other/{SVGText.js → SvgText.js} +2 -3
- package/dist/pickers/CCPicker.js +4 -4
- package/dist/pickers/ChannelMappingPicker.js +2 -2
- package/dist/pickers/ChannelPicker.js +2 -2
- package/dist/pickers/Knob.js +3 -3
- package/dist/pickers/KnobPicker.js +3 -3
- package/dist/pickers/LatchPicker.js +2 -2
- package/dist/pickers/MappingPicker.js +2 -2
- package/dist/pickers/NotePicker.js +2 -2
- package/dist/pickers/PianoPicker.js +4 -4
- package/dist/pickers/PolarityPicker.js +2 -2
- package/dist/pickers/ResponseCurve.js +4 -4
- package/dist/pickers/ResponseCurvePicker.js +4 -4
- package/dist/pickers/Select.js +1 -1
- package/dist/pickers/StatusPicker.js +2 -2
- package/dist/pickers/ValuePicker.js +2 -2
- package/dist/pickers/knobSkin10.js +1 -1
- package/dist/rotaryKnob/InternalInput.js +1 -1
- package/dist/rotaryKnob/helpers/DrawCircle.js +1 -1
- package/dist/rotaryKnob/helpers/DrawLine.js +1 -1
- package/dist/rotaryKnob/helpers/HelpersOverlay.js +1 -1
- package/dist/rotaryKnob/helpers/KnobVisualHelpers.js +6 -6
- package/dist/rotaryKnob/index.js +6 -6
- package/dist/rotaryKnob/utils.js +4 -8
- package/dist/types/index.d.ts +2 -2
- package/dist/types/midi/ccValues.d.ts +2 -2
- package/dist/types/other/DefaultTooltip.d.ts +1 -1
- package/dist/types/other/OctavePlayer.d.ts +10 -4
- package/dist/types/other/SoundFontProvider.d.ts +2 -2
- package/dist/types/other/{SVGText.d.ts → SvgText.d.ts} +2 -3
- package/dist/types/pickers/CCPicker.d.ts +1 -1
- package/dist/types/pickers/ChannelMappingPicker.d.ts +1 -1
- package/dist/types/pickers/ChannelPicker.d.ts +1 -1
- package/dist/types/pickers/Knob.d.ts +1 -1
- package/dist/types/pickers/KnobPicker.d.ts +1 -1
- package/dist/types/pickers/LatchPicker.d.ts +1 -1
- package/dist/types/pickers/MappingPicker.d.ts +1 -1
- package/dist/types/pickers/NotePicker.d.ts +1 -1
- package/dist/types/pickers/PianoPicker.d.ts +1 -1
- package/dist/types/pickers/PolarityPicker.d.ts +1 -1
- package/dist/types/pickers/ResponseCurve.d.ts +3 -3
- package/dist/types/pickers/ResponseCurvePicker.d.ts +1 -1
- package/dist/types/pickers/Select.d.ts +1 -1
- package/dist/types/pickers/StatusPicker.d.ts +1 -1
- package/dist/types/pickers/ValuePicker.d.ts +1 -1
- package/dist/types/pickers/knobSkin10.d.ts +1 -1
- package/dist/types/rotaryKnob/InternalInput.d.ts +1 -1
- package/dist/types/rotaryKnob/helpers/DrawCircle.d.ts +1 -1
- package/dist/types/rotaryKnob/helpers/DrawLine.d.ts +1 -1
- package/dist/types/rotaryKnob/helpers/HelpersOverlay.d.ts +1 -1
- package/dist/types/rotaryKnob/index.d.ts +1 -1
- package/dist/types/rotaryKnob/utils.d.ts +1 -7
- package/lib/index.ts +2 -2
- package/lib/midi/ccValues.ts +2 -2
- package/lib/other/DefaultTooltip.ts +1 -1
- package/lib/other/OctavePlayer.tsx +14 -7
- package/lib/other/SoundFontProvider.tsx +6 -4
- package/lib/other/{SVGText.tsx → SvgText.tsx} +2 -4
- package/lib/pickers/CCPicker.tsx +4 -4
- package/lib/pickers/ChannelMappingPicker.tsx +2 -2
- package/lib/pickers/ChannelPicker.tsx +2 -2
- package/lib/pickers/Knob.tsx +3 -3
- package/lib/pickers/KnobPicker.tsx +3 -3
- package/lib/pickers/LatchPicker.tsx +2 -2
- package/lib/pickers/MappingPicker.tsx +2 -2
- package/lib/pickers/NotePicker.tsx +2 -2
- package/lib/pickers/PianoPicker.tsx +4 -4
- package/lib/pickers/PolarityPicker.tsx +2 -2
- package/lib/pickers/ResponseCurve.tsx +8 -8
- package/lib/pickers/ResponseCurvePicker.tsx +4 -4
- package/lib/pickers/Select.tsx +1 -1
- package/lib/pickers/StatusPicker.tsx +2 -2
- package/lib/pickers/ValuePicker.tsx +2 -2
- package/lib/pickers/knobSkin10.tsx +1 -1
- package/lib/rotaryKnob/InternalInput.tsx +1 -1
- package/lib/rotaryKnob/helpers/DrawCircle.tsx +1 -1
- package/lib/rotaryKnob/helpers/DrawLine.tsx +1 -1
- package/lib/rotaryKnob/helpers/HelpersOverlay.tsx +1 -1
- package/lib/rotaryKnob/helpers/KnobVisualHelpers.tsx +6 -6
- package/lib/rotaryKnob/index.tsx +6 -6
- package/lib/rotaryKnob/utils.ts +1 -1
- package/package.json +1 -1
- package/stories/assets/utils.js +1 -1
- package/stories/picker.stories.tsx +15 -15
|
@@ -4,5 +4,5 @@ import type { Option, SelectProps } from './Select';
|
|
|
4
4
|
type LatchPickerProps = SelectProps<Polarity>;
|
|
5
5
|
type LatchPickerRef = SelectInstance<Option<Polarity>, false, GroupBase<Option<Polarity>>>;
|
|
6
6
|
declare const LatchPicker: import("react").ForwardRefExoticComponent<LatchPickerProps & import("react").RefAttributes<SelectInstance<Option<Polarity>, false, GroupBase<Option<Polarity>>>>>;
|
|
7
|
-
export
|
|
7
|
+
export { LatchPicker };
|
|
8
8
|
export type { LatchPickerProps, LatchPickerRef };
|
|
@@ -7,5 +7,5 @@ type MappingPickerRef = SelectInstance<Option<string>, false, GroupBase<Option<s
|
|
|
7
7
|
declare const MappingPicker: import("react").ForwardRefExoticComponent<SelectProps<string> & {
|
|
8
8
|
allowClearing: boolean;
|
|
9
9
|
} & import("react").RefAttributes<SelectInstance<Option<string>, false, GroupBase<Option<string>>>>>;
|
|
10
|
-
export
|
|
10
|
+
export { MappingPicker };
|
|
11
11
|
export type { MappingPickerProps, MappingPickerRef };
|
|
@@ -16,5 +16,5 @@ declare const NotePicker: import("react").ForwardRefExoticComponent<SelectProps<
|
|
|
16
16
|
mapping?: Mapping;
|
|
17
17
|
onChange: (value: number) => void;
|
|
18
18
|
} & import("react").RefAttributes<SelectInstance<Option<number>, false, GroupBase<Option<number>>>>>;
|
|
19
|
-
export
|
|
19
|
+
export { NotePicker };
|
|
20
20
|
export type { NotePickerProps, NotePickerRef };
|
|
@@ -5,5 +5,5 @@ type PianoProps = {
|
|
|
5
5
|
width: number;
|
|
6
6
|
};
|
|
7
7
|
declare const WithProvider: ({ format, height, hostname, instrumentName, onChange, onClick, onDoubleClick, onKeyMouseEnter, onKeyMouseLeave, soundfont, width, }: WithProviderProps) => import("react/jsx-runtime").JSX.Element;
|
|
8
|
-
export
|
|
8
|
+
export { WithProvider as PianoPicker };
|
|
9
9
|
export type { PianoProps };
|
|
@@ -10,5 +10,5 @@ declare const PolarityPicker: import("react").ForwardRefExoticComponent<SelectPr
|
|
|
10
10
|
labelOff?: string;
|
|
11
11
|
labelOn?: string;
|
|
12
12
|
} & import("react").RefAttributes<SelectInstance<Option<Polarity>, false, GroupBase<Option<Polarity>>>>>;
|
|
13
|
-
export
|
|
13
|
+
export { PolarityPicker };
|
|
14
14
|
export type { Polarity, PolarityPickerProps, PolarityPickerRef };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type Curve } from '../midi/export';
|
|
2
2
|
import { type TooltipProps } from '../other/DefaultTooltip';
|
|
3
|
-
type
|
|
3
|
+
type ResponseCurveType = {
|
|
4
4
|
value: Curve;
|
|
5
5
|
label: React.ReactNode;
|
|
6
6
|
c1: number;
|
|
@@ -25,5 +25,5 @@ type ResponseCurveProps = {
|
|
|
25
25
|
value: Curve;
|
|
26
26
|
};
|
|
27
27
|
declare const ResponseCurve: (props: ResponseCurveProps) => import("react/jsx-runtime").JSX.Element;
|
|
28
|
-
export
|
|
29
|
-
export type {
|
|
28
|
+
export { ResponseCurve };
|
|
29
|
+
export type { ResponseCurveType, ResponseCurveProps };
|
|
@@ -11,5 +11,5 @@ declare const ResponseCurvePicker: import("react").ForwardRefExoticComponent<Sel
|
|
|
11
11
|
inverted?: boolean;
|
|
12
12
|
Tooltip?: React.FC<TooltipProps>;
|
|
13
13
|
} & import("react").RefAttributes<SelectInstance<Option<Curve>, false, GroupBase<Option<Curve>>>>>;
|
|
14
|
-
export
|
|
14
|
+
export { ResponseCurvePicker };
|
|
15
15
|
export type { ResponseCurvePickerProps, ResponseCurvePickerRef };
|
|
@@ -25,5 +25,5 @@ type SelectProps<T> = {
|
|
|
25
25
|
declare const Select: <T>(props: SelectProps<T> & {
|
|
26
26
|
ref?: React.ForwardedRef<SelectInstance<Option<T>, false, GroupBase<Option<T>>>>;
|
|
27
27
|
}) => JSX.Element;
|
|
28
|
-
export
|
|
28
|
+
export { Select };
|
|
29
29
|
export type { Option, SelectProps };
|
|
@@ -8,5 +8,5 @@ type StatusPickerRef = SelectInstance<Option<Status>, false, GroupBase<Option<St
|
|
|
8
8
|
declare const StatusPicker: import("react").ForwardRefExoticComponent<SelectProps<Status> & {
|
|
9
9
|
statuses: Option<Status>[];
|
|
10
10
|
} & import("react").RefAttributes<SelectInstance<Option<Status>, false, GroupBase<Option<Status>>>>>;
|
|
11
|
-
export
|
|
11
|
+
export { StatusPicker };
|
|
12
12
|
export type { StatusPickerProps, StatusPickerRef };
|
|
@@ -11,5 +11,5 @@ declare const ValuePicker: import("react").ForwardRefExoticComponent<SelectProps
|
|
|
11
11
|
max?: number;
|
|
12
12
|
min?: number;
|
|
13
13
|
} & import("react").RefAttributes<SelectInstance<Option<number>, false, GroupBase<Option<number>>>>>;
|
|
14
|
-
export
|
|
14
|
+
export { ValuePicker };
|
|
15
15
|
export type { ValuePickerProps, ValuePickerRef };
|
|
@@ -40,10 +40,4 @@ declare function transformBoundingClientRectToDocument(box: DOMRect): {
|
|
|
40
40
|
width: number;
|
|
41
41
|
height: number;
|
|
42
42
|
};
|
|
43
|
-
|
|
44
|
-
toRadians: typeof toRadians;
|
|
45
|
-
getQuadrant: typeof getQuadrant;
|
|
46
|
-
getAngleForPoint: typeof getAngleForPoint;
|
|
47
|
-
transformBoundingClientRectToDocument: typeof transformBoundingClientRectToDocument;
|
|
48
|
-
};
|
|
49
|
-
export default _default;
|
|
43
|
+
export { toRadians, getQuadrant, getAngleForPoint, transformBoundingClientRectToDocument, };
|
package/lib/index.ts
CHANGED
|
@@ -3,7 +3,7 @@ export * from './midi/export'
|
|
|
3
3
|
|
|
4
4
|
export * from './other/DefaultTooltip'
|
|
5
5
|
export * from './other/OctavePlayer'
|
|
6
|
-
export * from './other/
|
|
6
|
+
export * from './other/SvgText'
|
|
7
7
|
|
|
8
8
|
export * from './pickers/ChannelMappingPicker'
|
|
9
9
|
export * from './pickers/ChannelPicker'
|
|
@@ -26,7 +26,7 @@ export type * from './midi/export'
|
|
|
26
26
|
export type * from './other/DefaultTooltip'
|
|
27
27
|
export type * from './other/OctavePlayer'
|
|
28
28
|
export type * from './other/SoundFontProvider'
|
|
29
|
-
export type * from './other/
|
|
29
|
+
export type * from './other/SvgText'
|
|
30
30
|
|
|
31
31
|
export type * from './pickers/CCPicker'
|
|
32
32
|
export type * from './pickers/ChannelMappingPicker'
|
package/lib/midi/ccValues.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Option } from '../pickers/Select'
|
|
2
2
|
|
|
3
|
-
const
|
|
3
|
+
const changeControllerOptions = [
|
|
4
4
|
'Bank Select',
|
|
5
5
|
'Modulation Wheel',
|
|
6
6
|
'Breath Controller',
|
|
@@ -136,4 +136,4 @@ const CC_NAMES = [
|
|
|
136
136
|
}),
|
|
137
137
|
)
|
|
138
138
|
|
|
139
|
-
export
|
|
139
|
+
export { changeControllerOptions }
|
|
@@ -2,7 +2,14 @@ import type Soundfont from 'soundfont-player'
|
|
|
2
2
|
import { /* Midi, */ Note } from 'tonal'
|
|
3
3
|
import { Piano as ReactPiano } from 'zds-react-piano'
|
|
4
4
|
import type { TooltipProps } from './DefaultTooltip'
|
|
5
|
-
import SoundfontProvider from './SoundFontProvider'
|
|
5
|
+
import { SoundfontProvider } from './SoundFontProvider'
|
|
6
|
+
|
|
7
|
+
type PianoMidiNote = {
|
|
8
|
+
accidental: boolean
|
|
9
|
+
left: number
|
|
10
|
+
midiNumber: number
|
|
11
|
+
width: number
|
|
12
|
+
}
|
|
6
13
|
|
|
7
14
|
const baseNotes = [
|
|
8
15
|
'C',
|
|
@@ -38,7 +45,7 @@ type OctavePlayerProps = {
|
|
|
38
45
|
width: number
|
|
39
46
|
}
|
|
40
47
|
|
|
41
|
-
const
|
|
48
|
+
const BaseOctavePlayer = ({
|
|
42
49
|
octave,
|
|
43
50
|
height,
|
|
44
51
|
width,
|
|
@@ -67,12 +74,12 @@ type WithProviderProps = {
|
|
|
67
74
|
format?: 'mp3' | 'ogg'
|
|
68
75
|
height: number
|
|
69
76
|
hostname?: string
|
|
70
|
-
instrumentName
|
|
77
|
+
instrumentName?: Soundfont.InstrumentName
|
|
71
78
|
octave?: number
|
|
72
79
|
onChange?: (note: number) => void
|
|
73
80
|
onClick?: (note: number) => void
|
|
74
81
|
onDoubleClick?: (note: number) => void
|
|
75
|
-
onKeyMouseEnter?: (note:
|
|
82
|
+
onKeyMouseEnter?: (note: PianoMidiNote) => void
|
|
76
83
|
onKeyMouseLeave?: (note: number) => void
|
|
77
84
|
soundfont?: 'MusyngKite' | 'FluidR3_GM'
|
|
78
85
|
Tooltip?: TooltipProps
|
|
@@ -116,7 +123,7 @@ const WithProvider = ({
|
|
|
116
123
|
<div>
|
|
117
124
|
<h2>Octave: {octave}</h2>
|
|
118
125
|
</div>
|
|
119
|
-
<
|
|
126
|
+
<BaseOctavePlayer
|
|
120
127
|
disabled={isLoading}
|
|
121
128
|
{...{
|
|
122
129
|
height,
|
|
@@ -136,6 +143,6 @@ const WithProvider = ({
|
|
|
136
143
|
/>
|
|
137
144
|
)
|
|
138
145
|
|
|
139
|
-
export
|
|
146
|
+
export { WithProvider as OctavePlayer }
|
|
140
147
|
|
|
141
|
-
export type { OctavePlayerProps, WithProviderProps }
|
|
148
|
+
export type { OctavePlayerProps, PianoMidiNote, WithProviderProps }
|
|
@@ -11,7 +11,7 @@ type SoundfontProviderProps = {
|
|
|
11
11
|
audioContext: AudioContext
|
|
12
12
|
format?: 'mp3' | 'ogg'
|
|
13
13
|
hostname?: string
|
|
14
|
-
instrumentName
|
|
14
|
+
instrumentName?: Soundfont.InstrumentName
|
|
15
15
|
onChange?: (midiNumber: number) => void
|
|
16
16
|
render: (props: {
|
|
17
17
|
isLoading: boolean
|
|
@@ -54,7 +54,7 @@ const SoundfontProvider = (props: SoundfontProviderProps) => {
|
|
|
54
54
|
}).then(newInstrument => {
|
|
55
55
|
setInstrument(newInstrument)
|
|
56
56
|
})
|
|
57
|
-
} else if (
|
|
57
|
+
} else if (instrumentName) {
|
|
58
58
|
// the host app has already injected the soundfont into global space
|
|
59
59
|
Soundfont.instrument(audioContext, instrumentName).then(
|
|
60
60
|
newInstrument => {
|
|
@@ -70,7 +70,9 @@ const SoundfontProvider = (props: SoundfontProviderProps) => {
|
|
|
70
70
|
)
|
|
71
71
|
|
|
72
72
|
useEffect(() => {
|
|
73
|
-
|
|
73
|
+
if (instrumentName) {
|
|
74
|
+
loadInstrument(instrumentName)
|
|
75
|
+
}
|
|
74
76
|
}, [instrumentName, loadInstrument])
|
|
75
77
|
|
|
76
78
|
useEffect(() => {
|
|
@@ -127,6 +129,6 @@ const SoundfontProvider = (props: SoundfontProviderProps) => {
|
|
|
127
129
|
// https://gleitz.github.io/midi-js-soundfonts/MusyngKite/acoustic_grand_piano-mp3.js
|
|
128
130
|
// https://gleitz.github.io/midi-js-soundfonts/FluidR3_GM/.js
|
|
129
131
|
|
|
130
|
-
export
|
|
132
|
+
export { SoundfontProvider }
|
|
131
133
|
|
|
132
134
|
export type { SoundfontProviderProps }
|
|
@@ -91,7 +91,7 @@ type TextProps = Partial<HTMLOrSVGElement> & {
|
|
|
91
91
|
y?: number
|
|
92
92
|
}
|
|
93
93
|
|
|
94
|
-
const
|
|
94
|
+
const SvgText = (props: TextProps) => {
|
|
95
95
|
const {
|
|
96
96
|
className = '',
|
|
97
97
|
dx = 0,
|
|
@@ -216,8 +216,6 @@ const Text = (props: TextProps) => {
|
|
|
216
216
|
)
|
|
217
217
|
}
|
|
218
218
|
|
|
219
|
-
export
|
|
220
|
-
|
|
221
|
-
export { MEASUREMENT_ELEMENT_ID }
|
|
219
|
+
export { SvgText, MEASUREMENT_ELEMENT_ID }
|
|
222
220
|
|
|
223
221
|
export type { TextProps, WordWidths, WordsByLine }
|
package/lib/pickers/CCPicker.tsx
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { forwardRef } from 'react'
|
|
2
2
|
import type { GroupBase, SelectInstance } from 'react-select'
|
|
3
|
-
import
|
|
4
|
-
import Select from './Select'
|
|
3
|
+
import { changeControllerOptions } from '../midi/ccValues'
|
|
4
|
+
import { Select } from './Select'
|
|
5
5
|
import type { Option, SelectProps } from './Select'
|
|
6
6
|
|
|
7
7
|
type CCPickerProps = SelectProps<number>
|
|
@@ -18,11 +18,11 @@ const CCPicker = forwardRef<
|
|
|
18
18
|
>((props, ref) => (
|
|
19
19
|
<Select
|
|
20
20
|
{...props}
|
|
21
|
-
options={
|
|
21
|
+
options={changeControllerOptions}
|
|
22
22
|
ref={ref}
|
|
23
23
|
/>
|
|
24
24
|
))
|
|
25
25
|
|
|
26
|
-
export
|
|
26
|
+
export { CCPicker }
|
|
27
27
|
|
|
28
28
|
export type { CCPickerProps, CCPickerRef }
|
|
@@ -2,7 +2,7 @@ import cl from 'classnames'
|
|
|
2
2
|
import { forwardRef, useCallback, useEffect, useState } from 'react'
|
|
3
3
|
import type { GroupBase, SelectInstance } from 'react-select'
|
|
4
4
|
import { arraySequence } from '../utils'
|
|
5
|
-
import Select from './Select'
|
|
5
|
+
import { Select } from './Select'
|
|
6
6
|
import type { Option, SelectProps } from './Select'
|
|
7
7
|
|
|
8
8
|
type InternalValue = number | 'separator'
|
|
@@ -130,7 +130,7 @@ const ChannelMappingPicker = forwardRef<
|
|
|
130
130
|
)
|
|
131
131
|
})
|
|
132
132
|
|
|
133
|
-
export
|
|
133
|
+
export { ChannelMappingPicker }
|
|
134
134
|
|
|
135
135
|
export type {
|
|
136
136
|
ChannelMappingOption,
|
|
@@ -2,7 +2,7 @@ import cl from 'classnames'
|
|
|
2
2
|
import { forwardRef } from 'react'
|
|
3
3
|
import type { GroupBase, SelectInstance } from 'react-select'
|
|
4
4
|
import { arraySequence } from '../utils'
|
|
5
|
-
import Select from './Select'
|
|
5
|
+
import { Select } from './Select'
|
|
6
6
|
import type { Option, SelectProps } from './Select'
|
|
7
7
|
|
|
8
8
|
type Channel =
|
|
@@ -71,6 +71,6 @@ const ChannelPicker = forwardRef<
|
|
|
71
71
|
)
|
|
72
72
|
})
|
|
73
73
|
|
|
74
|
-
export
|
|
74
|
+
export { ChannelPicker }
|
|
75
75
|
|
|
76
76
|
export type { Channel, ChannelPickerProps, ChannelPickerRef }
|
package/lib/pickers/Knob.tsx
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { useCallback } from 'react'
|
|
2
2
|
import useStateWithDynamicDefault from '../hooks/useStateWithDynamicDefault'
|
|
3
|
-
import RotaryKnob from '../rotaryKnob'
|
|
3
|
+
import { RotaryKnob } from '../rotaryKnob'
|
|
4
4
|
import { assertRange } from '../utils'
|
|
5
|
-
import knobSkin10 from './knobSkin10'
|
|
5
|
+
import { knobSkin10 } from './knobSkin10'
|
|
6
6
|
|
|
7
7
|
type KnobProps = {
|
|
8
8
|
disabled?: boolean
|
|
@@ -88,6 +88,6 @@ const Knob = (props: KnobProps) => {
|
|
|
88
88
|
)
|
|
89
89
|
}
|
|
90
90
|
|
|
91
|
-
export
|
|
91
|
+
export { Knob }
|
|
92
92
|
|
|
93
93
|
export type { KnobProps }
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { forwardRef, useMemo } from 'react'
|
|
2
2
|
import type { GroupBase, SelectInstance } from 'react-select'
|
|
3
3
|
import { arraySequence } from '../utils'
|
|
4
|
-
import Knob from './Knob'
|
|
5
|
-
import Select from './Select'
|
|
4
|
+
import { Knob } from './Knob'
|
|
5
|
+
import { Select } from './Select'
|
|
6
6
|
import type { Option, SelectProps } from './Select'
|
|
7
7
|
|
|
8
8
|
type KnobPickerProps = SelectProps<number> & {
|
|
@@ -88,6 +88,6 @@ const KnobPicker = forwardRef<
|
|
|
88
88
|
)
|
|
89
89
|
})
|
|
90
90
|
|
|
91
|
-
export
|
|
91
|
+
export { KnobPicker }
|
|
92
92
|
|
|
93
93
|
export type { KnobPickerProps, KnobPickerRef }
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { forwardRef } from 'react'
|
|
2
2
|
import type { GroupBase, SelectInstance } from 'react-select'
|
|
3
3
|
import type { Polarity } from './PolarityPicker'
|
|
4
|
-
import Select from './Select'
|
|
4
|
+
import { Select } from './Select'
|
|
5
5
|
import type { Option, SelectProps } from './Select'
|
|
6
6
|
|
|
7
7
|
const options: Option<Polarity>[] = [
|
|
@@ -28,6 +28,6 @@ const LatchPicker = forwardRef<
|
|
|
28
28
|
/>
|
|
29
29
|
))
|
|
30
30
|
|
|
31
|
-
export
|
|
31
|
+
export { LatchPicker }
|
|
32
32
|
|
|
33
33
|
export type { LatchPickerProps, LatchPickerRef }
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { forwardRef, useMemo } from 'react'
|
|
2
2
|
import type { GroupBase, SelectInstance } from 'react-select'
|
|
3
3
|
import { getStockNames, getUserMappingNames } from 'zds-mappings'
|
|
4
|
-
import Select from './Select'
|
|
4
|
+
import { Select } from './Select'
|
|
5
5
|
import type { Option, SelectProps } from './Select'
|
|
6
6
|
|
|
7
7
|
type MappingPickerProps = SelectProps<string> & {
|
|
@@ -63,6 +63,6 @@ const MappingPicker = forwardRef<
|
|
|
63
63
|
)
|
|
64
64
|
})
|
|
65
65
|
|
|
66
|
-
export
|
|
66
|
+
export { MappingPicker }
|
|
67
67
|
|
|
68
68
|
export type { MappingPickerProps, MappingPickerRef }
|
|
@@ -4,7 +4,7 @@ import { Midi } from 'tonal'
|
|
|
4
4
|
import { type MapItem, type Mapping, emptyMapping } from 'zds-mappings'
|
|
5
5
|
import useStateWithDynamicDefault from '../hooks/useStateWithDynamicDefault'
|
|
6
6
|
import { assertRange } from '../utils'
|
|
7
|
-
import Select from './Select'
|
|
7
|
+
import { Select } from './Select'
|
|
8
8
|
import type { Option, SelectProps } from './Select'
|
|
9
9
|
|
|
10
10
|
const { midiToNoteName } = Midi
|
|
@@ -90,6 +90,6 @@ const NotePicker = forwardRef<
|
|
|
90
90
|
)
|
|
91
91
|
})
|
|
92
92
|
|
|
93
|
-
export
|
|
93
|
+
export { NotePicker }
|
|
94
94
|
|
|
95
95
|
export type { NotePickerProps, NotePickerRef }
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Piano as ReactPiano } from 'zds-react-piano'
|
|
2
2
|
import type { WithProviderProps } from '../other/OctavePlayer'
|
|
3
|
-
import SoundfontProvider from '../other/SoundFontProvider'
|
|
3
|
+
import { SoundfontProvider } from '../other/SoundFontProvider'
|
|
4
4
|
|
|
5
5
|
const firstNote = 21
|
|
6
6
|
const lastNote = 108
|
|
@@ -16,7 +16,7 @@ type PianoProps = {
|
|
|
16
16
|
width: number
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
const
|
|
19
|
+
const BasePianoPicker = ({ height, width, ...rest }: PianoProps) => {
|
|
20
20
|
const keyWidth = width / whiteNotes + 2
|
|
21
21
|
const keyWidthToHeight = keyWidth / height
|
|
22
22
|
|
|
@@ -55,7 +55,7 @@ const WithProvider = ({
|
|
|
55
55
|
soundfont,
|
|
56
56
|
}}
|
|
57
57
|
render={({ isLoading, playNote, stopNote }) => (
|
|
58
|
-
<
|
|
58
|
+
<BasePianoPicker
|
|
59
59
|
disabled={isLoading}
|
|
60
60
|
{...{
|
|
61
61
|
height,
|
|
@@ -72,6 +72,6 @@ const WithProvider = ({
|
|
|
72
72
|
/>
|
|
73
73
|
)
|
|
74
74
|
|
|
75
|
-
export
|
|
75
|
+
export { WithProvider as PianoPicker }
|
|
76
76
|
|
|
77
77
|
export type { PianoProps }
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { forwardRef } from 'react'
|
|
2
2
|
import type { GroupBase, SelectInstance } from 'react-select'
|
|
3
|
-
import Select from './Select'
|
|
3
|
+
import { Select } from './Select'
|
|
4
4
|
import type { Option, SelectProps } from './Select'
|
|
5
5
|
|
|
6
6
|
type Polarity = 0 | 1
|
|
@@ -34,6 +34,6 @@ const PolarityPicker = forwardRef<
|
|
|
34
34
|
)
|
|
35
35
|
})
|
|
36
36
|
|
|
37
|
-
export
|
|
37
|
+
export { PolarityPicker }
|
|
38
38
|
|
|
39
39
|
export type { Polarity, PolarityPickerProps, PolarityPickerRef }
|
|
@@ -4,10 +4,10 @@ import {
|
|
|
4
4
|
type Curve,
|
|
5
5
|
responseCurves as origResponseCurves,
|
|
6
6
|
} from '../midi/export'
|
|
7
|
-
import DefaultTooltip,
|
|
8
|
-
import
|
|
7
|
+
import { DefaultTooltip, type TooltipProps } from '../other/DefaultTooltip'
|
|
8
|
+
import { SvgText } from '../other/SvgText'
|
|
9
9
|
|
|
10
|
-
type
|
|
10
|
+
type ResponseCurveType = {
|
|
11
11
|
value: Curve
|
|
12
12
|
label: React.ReactNode
|
|
13
13
|
c1: number
|
|
@@ -64,7 +64,7 @@ const ResponseCurve = (props: ResponseCurveProps) => {
|
|
|
64
64
|
|
|
65
65
|
const responseCurves = origResponseCurves.map(
|
|
66
66
|
// biome-ignore lint/complexity/noExcessiveCognitiveComplexity: <explanation>
|
|
67
|
-
({ value, label }):
|
|
67
|
+
({ value, label }): ResponseCurveType => {
|
|
68
68
|
let c1 = 0
|
|
69
69
|
let c2 = 0
|
|
70
70
|
let x1 = axisX1
|
|
@@ -166,7 +166,7 @@ const ResponseCurve = (props: ResponseCurveProps) => {
|
|
|
166
166
|
y={0}
|
|
167
167
|
/>
|
|
168
168
|
|
|
169
|
-
<
|
|
169
|
+
<SvgText
|
|
170
170
|
className="axis"
|
|
171
171
|
textAnchor="middle"
|
|
172
172
|
transform={`translate(${axisX1 - 14} ${height / 2}) rotate(90)`}
|
|
@@ -175,7 +175,7 @@ const ResponseCurve = (props: ResponseCurveProps) => {
|
|
|
175
175
|
text="Applied force"
|
|
176
176
|
/>
|
|
177
177
|
|
|
178
|
-
<
|
|
178
|
+
<SvgText
|
|
179
179
|
className="axis"
|
|
180
180
|
textAnchor="middle"
|
|
181
181
|
transform={`translate(${width / 2} ${axisY2 + 13})`}
|
|
@@ -246,6 +246,6 @@ const ResponseCurve = (props: ResponseCurveProps) => {
|
|
|
246
246
|
)
|
|
247
247
|
}
|
|
248
248
|
|
|
249
|
-
export
|
|
249
|
+
export { ResponseCurve }
|
|
250
250
|
|
|
251
|
-
export type {
|
|
251
|
+
export type { ResponseCurveType, ResponseCurveProps }
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { forwardRef, useCallback } from 'react'
|
|
2
2
|
import type { GroupBase, SelectInstance } from 'react-select'
|
|
3
3
|
import { type Curve, responseCurves } from '../midi/export'
|
|
4
|
-
import DefaultTooltip,
|
|
4
|
+
import { DefaultTooltip, type TooltipProps } from '../other/DefaultTooltip'
|
|
5
5
|
import { findObj } from '../utils'
|
|
6
|
-
import ResponseCurve from './ResponseCurve'
|
|
7
|
-
import Select from './Select'
|
|
6
|
+
import { ResponseCurve } from './ResponseCurve'
|
|
7
|
+
import { Select } from './Select'
|
|
8
8
|
import type { Option, SelectProps } from './Select'
|
|
9
9
|
|
|
10
10
|
type ResponseCurvePickerProps = SelectProps<Curve> & {
|
|
@@ -70,6 +70,6 @@ const ResponseCurvePicker = forwardRef<
|
|
|
70
70
|
)
|
|
71
71
|
})
|
|
72
72
|
|
|
73
|
-
export
|
|
73
|
+
export { ResponseCurvePicker }
|
|
74
74
|
|
|
75
75
|
export type { ResponseCurvePickerProps, ResponseCurvePickerRef }
|
package/lib/pickers/Select.tsx
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Status } from 'lib/midi/export'
|
|
2
2
|
import { forwardRef } from 'react'
|
|
3
3
|
import type { GroupBase, SelectInstance } from 'react-select'
|
|
4
|
-
import Select from './Select'
|
|
4
|
+
import { Select } from './Select'
|
|
5
5
|
import type { Option, SelectProps } from './Select'
|
|
6
6
|
|
|
7
7
|
type StatusPickerProps = SelectProps<Status> & { statuses: Option<Status>[] }
|
|
@@ -23,6 +23,6 @@ const StatusPicker = forwardRef<
|
|
|
23
23
|
/>
|
|
24
24
|
))
|
|
25
25
|
|
|
26
|
-
export
|
|
26
|
+
export { StatusPicker }
|
|
27
27
|
|
|
28
28
|
export type { StatusPickerProps, StatusPickerRef }
|
|
@@ -2,7 +2,7 @@ import { forwardRef, useCallback, useMemo } from 'react'
|
|
|
2
2
|
import type { GroupBase, SelectInstance } from 'react-select'
|
|
3
3
|
import useStateWithDynamicDefault from '../hooks/useStateWithDynamicDefault'
|
|
4
4
|
import { arraySequence, assertRange } from '../utils'
|
|
5
|
-
import Select from './Select'
|
|
5
|
+
import { Select } from './Select'
|
|
6
6
|
import type { Option, SelectProps } from './Select'
|
|
7
7
|
|
|
8
8
|
type ValuePickerProps = SelectProps<number> & {
|
|
@@ -62,6 +62,6 @@ const ValuePicker = forwardRef<
|
|
|
62
62
|
)
|
|
63
63
|
})
|
|
64
64
|
|
|
65
|
-
export
|
|
65
|
+
export { ValuePicker }
|
|
66
66
|
|
|
67
67
|
export type { ValuePickerProps, ValuePickerRef }
|