zds-pickers 4.0.13 → 4.0.14
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 +1 -1
- 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 +1 -1
- package/dist/types/other/SoundFontProvider.d.ts +1 -1
- 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 +4 -4
- package/lib/other/SoundFontProvider.tsx +1 -1
- 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 -7
- 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
|
@@ -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,7 @@ 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
6
|
|
|
7
7
|
const baseNotes = [
|
|
8
8
|
'C',
|
|
@@ -38,7 +38,7 @@ type OctavePlayerProps = {
|
|
|
38
38
|
width: number
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
-
const
|
|
41
|
+
const BaseOctavePlayer = ({
|
|
42
42
|
octave,
|
|
43
43
|
height,
|
|
44
44
|
width,
|
|
@@ -116,7 +116,7 @@ const WithProvider = ({
|
|
|
116
116
|
<div>
|
|
117
117
|
<h2>Octave: {octave}</h2>
|
|
118
118
|
</div>
|
|
119
|
-
<
|
|
119
|
+
<BaseOctavePlayer
|
|
120
120
|
disabled={isLoading}
|
|
121
121
|
{...{
|
|
122
122
|
height,
|
|
@@ -136,6 +136,6 @@ const WithProvider = ({
|
|
|
136
136
|
/>
|
|
137
137
|
)
|
|
138
138
|
|
|
139
|
-
export
|
|
139
|
+
export { WithProvider as OctavePlayer }
|
|
140
140
|
|
|
141
141
|
export type { OctavePlayerProps, WithProviderProps }
|
|
@@ -127,6 +127,6 @@ const SoundfontProvider = (props: SoundfontProviderProps) => {
|
|
|
127
127
|
// https://gleitz.github.io/midi-js-soundfonts/MusyngKite/acoustic_grand_piano-mp3.js
|
|
128
128
|
// https://gleitz.github.io/midi-js-soundfonts/FluidR3_GM/.js
|
|
129
129
|
|
|
130
|
-
export
|
|
130
|
+
export { SoundfontProvider }
|
|
131
131
|
|
|
132
132
|
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 }
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
import type { Point } from '../Types'
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
3
|
+
import { DrawCircle } from './DrawCircle'
|
|
4
|
+
import { DrawLine } from './DrawLine'
|
|
5
|
+
import { HelpersOverlay } from './HelpersOverlay'
|
|
6
|
+
import { toRadians } from '../utils'
|
|
7
7
|
|
|
8
8
|
/** Precision visual helpers */
|
|
9
9
|
|
|
@@ -49,9 +49,8 @@ class KnobVisualHelpers extends React.Component<
|
|
|
49
49
|
//Calculate current angle segment end point
|
|
50
50
|
//Note: Not sure why we need to subtract 90 here
|
|
51
51
|
const valueMarkerX =
|
|
52
|
-
props.radius * Math.cos(
|
|
53
|
-
const valueMarkerY =
|
|
54
|
-
props.radius * Math.sin(utils.toRadians(props.valueAngle - 90))
|
|
52
|
+
props.radius * Math.cos(toRadians(props.valueAngle - 90))
|
|
53
|
+
const valueMarkerY = props.radius * Math.sin(toRadians(props.valueAngle - 90))
|
|
55
54
|
|
|
56
55
|
return {
|
|
57
56
|
...state,
|
package/lib/rotaryKnob/index.tsx
CHANGED
|
@@ -9,11 +9,11 @@ import { select } from 'd3-selection'
|
|
|
9
9
|
import type { BaseType, Selection } from 'd3-selection'
|
|
10
10
|
import { useEffect, useRef, useState } from 'react'
|
|
11
11
|
import { SvgLoader, SvgProxy } from 'react-svgmt'
|
|
12
|
-
import InternalInput from './InternalInput'
|
|
12
|
+
import { InternalInput } from './InternalInput'
|
|
13
13
|
import type { Point } from './Types'
|
|
14
14
|
import { KnobVisualHelpers } from './helpers/KnobVisualHelpers'
|
|
15
15
|
import defaultSkin from './knobdefaultskin'
|
|
16
|
-
import
|
|
16
|
+
import { getAngleForPoint } from './utils'
|
|
17
17
|
|
|
18
18
|
/**
|
|
19
19
|
* type definition for the skin system attribute modification element
|
|
@@ -247,7 +247,7 @@ const RotaryKnob = (props: KnobProps) => {
|
|
|
247
247
|
onStart()
|
|
248
248
|
|
|
249
249
|
startPos = { x: event.x - cx, y: event.y - cy }
|
|
250
|
-
startAngle =
|
|
250
|
+
startAngle = getAngleForPoint(startPos.x, startPos.y)
|
|
251
251
|
initialAngle = convertValueToAngle(currentValue)
|
|
252
252
|
monitoring = false
|
|
253
253
|
|
|
@@ -263,14 +263,14 @@ const RotaryKnob = (props: KnobProps) => {
|
|
|
263
263
|
if (preciseMode) {
|
|
264
264
|
if (!monitoring && distanceFromCenter >= unlockDistance) {
|
|
265
265
|
startPos = currentPos
|
|
266
|
-
startAngle =
|
|
266
|
+
startAngle = getAngleForPoint(currentPos.x, currentPos.y)
|
|
267
267
|
monitoring = true
|
|
268
268
|
}
|
|
269
269
|
} else {
|
|
270
270
|
monitoring = true
|
|
271
271
|
}
|
|
272
272
|
|
|
273
|
-
const currentAngle =
|
|
273
|
+
const currentAngle = getAngleForPoint(currentPos.x, currentPos.y)
|
|
274
274
|
const deltaAngle = currentAngle - startAngle
|
|
275
275
|
let finalAngle = initialAngle + deltaAngle
|
|
276
276
|
finalAngle = normalizeAngle(finalAngle)
|
|
@@ -414,4 +414,4 @@ const RotaryKnob = (props: KnobProps) => {
|
|
|
414
414
|
)
|
|
415
415
|
}
|
|
416
416
|
|
|
417
|
-
export
|
|
417
|
+
export { RotaryKnob }
|
package/lib/rotaryKnob/utils.ts
CHANGED
|
@@ -102,7 +102,7 @@ function transformBoundingClientRectToDocument(box: DOMRect) {
|
|
|
102
102
|
return { top: ttop, left: tleft, width: box.width, height: box.height }
|
|
103
103
|
}
|
|
104
104
|
|
|
105
|
-
export
|
|
105
|
+
export {
|
|
106
106
|
// toGlobalCoordinates,
|
|
107
107
|
// toLocalCoordinates,
|
|
108
108
|
toRadians,
|