zds-pickers 4.0.22 → 4.0.25
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 +12 -12
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +2296 -2277
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +1 -0
- package/dist/other/OctavePlayer.js +11 -11
- package/dist/pickers/KeyPicker.js +8 -0
- package/dist/pickers/Select.js +2 -2
- package/dist/types/index.d.ts +2 -0
- package/dist/types/other/OctavePlayer.d.ts +3 -2
- package/dist/types/pickers/KeyPicker.d.ts +10 -0
- package/dist/types/pickers/KnobPicker.d.ts +1 -1
- package/dist/types/pickers/PianoPicker.d.ts +1 -0
- package/dist/types/pickers/ResponseCurvePicker.d.ts +1 -1
- package/dist/types/pickers/Select.d.ts +1 -1
- package/lib/index.ts +2 -0
- package/lib/other/OctavePlayer.tsx +19 -31
- package/lib/pickers/KeyPicker.tsx +16 -0
- package/lib/pickers/PianoPicker.tsx +1 -0
- package/lib/pickers/Select.tsx +3 -3
- package/package.json +17 -19
- package/stories/picker.stories.tsx +15 -5
package/dist/index.js
CHANGED
|
@@ -7,6 +7,7 @@ export * from './other/SvgText';
|
|
|
7
7
|
export * from './pickers/CCPicker';
|
|
8
8
|
export * from './pickers/ChannelMappingPicker';
|
|
9
9
|
export * from './pickers/ChannelPicker';
|
|
10
|
+
export * from './pickers/KeyPicker';
|
|
10
11
|
export * from './pickers/Knob';
|
|
11
12
|
export * from './pickers/KnobPicker';
|
|
12
13
|
export * from './pickers/LatchPicker';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { jsx as _jsx
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { /* Midi, */ Note } from 'tonal';
|
|
3
3
|
import { Piano as ReactPiano } from 'zds-react-piano';
|
|
4
4
|
import { SoundfontProvider } from './SoundFontProvider';
|
|
@@ -35,14 +35,14 @@ const WithProvider = ({ format, height, hostname, instrumentName, octave = 4, on
|
|
|
35
35
|
hostname,
|
|
36
36
|
instrumentName,
|
|
37
37
|
onChange,
|
|
38
|
-
soundfont, render: ({ isLoading, playNote, stopNote
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
38
|
+
soundfont, render: ({ isLoading, playNote, stopNote }) => (_jsx(BaseOctavePlayer, { disabled: isLoading, height,
|
|
39
|
+
octave,
|
|
40
|
+
onClick,
|
|
41
|
+
onDoubleClick,
|
|
42
|
+
onKeyMouseEnter,
|
|
43
|
+
onKeyMouseLeave,
|
|
44
|
+
playNote,
|
|
45
|
+
stopNote,
|
|
46
|
+
Tooltip,
|
|
47
|
+
width })) }));
|
|
48
48
|
export { WithProvider as OctavePlayer };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { OctavePlayer } from '../other/OctavePlayer';
|
|
3
|
+
const KeyPicker = (props) => {
|
|
4
|
+
console.log('KeyPicker', props);
|
|
5
|
+
return _jsx(OctavePlayer, { ...props, activeNotes: [65] });
|
|
6
|
+
};
|
|
7
|
+
KeyPicker.propTypes = {};
|
|
8
|
+
export { KeyPicker };
|
package/dist/pickers/Select.js
CHANGED
|
@@ -25,8 +25,8 @@ const Select = forwardRef((props, ref) => {
|
|
|
25
25
|
}
|
|
26
26
|
}, [onChange]);
|
|
27
27
|
const flatOptionsList = options.reduce((acc, entry) => {
|
|
28
|
-
if ('
|
|
29
|
-
return acc.concat(entry.
|
|
28
|
+
if ('options' in entry) {
|
|
29
|
+
return acc.concat(entry.options);
|
|
30
30
|
}
|
|
31
31
|
return acc.concat(entry);
|
|
32
32
|
}, []);
|
package/dist/types/index.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ export * from './other/SvgText';
|
|
|
7
7
|
export * from './pickers/CCPicker';
|
|
8
8
|
export * from './pickers/ChannelMappingPicker';
|
|
9
9
|
export * from './pickers/ChannelPicker';
|
|
10
|
+
export * from './pickers/KeyPicker';
|
|
10
11
|
export * from './pickers/Knob';
|
|
11
12
|
export * from './pickers/KnobPicker';
|
|
12
13
|
export * from './pickers/LatchPicker';
|
|
@@ -27,6 +28,7 @@ export type * from './other/SvgText';
|
|
|
27
28
|
export type * from './pickers/CCPicker';
|
|
28
29
|
export type * from './pickers/ChannelMappingPicker';
|
|
29
30
|
export type * from './pickers/ChannelPicker';
|
|
31
|
+
export type * from './pickers/KeyPicker';
|
|
30
32
|
export type * from './pickers/Knob';
|
|
31
33
|
export type * from './pickers/KnobPicker';
|
|
32
34
|
export type * from './pickers/LatchPicker';
|
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
import type Soundfont from 'soundfont-player';
|
|
2
2
|
import type { TooltipProps } from './DefaultTooltip';
|
|
3
|
+
import type { PianoProps } from 'lib/pickers/PianoPicker';
|
|
3
4
|
type PianoMidiNote = {
|
|
4
5
|
accidental: boolean;
|
|
5
6
|
left: number;
|
|
6
7
|
midiNumber: number;
|
|
7
8
|
width: number;
|
|
8
9
|
};
|
|
9
|
-
type OctavePlayerProps = {
|
|
10
|
+
type OctavePlayerProps = PianoProps & {
|
|
10
11
|
disabled?: boolean;
|
|
11
12
|
height: number;
|
|
12
13
|
octave: number;
|
|
13
14
|
width: number;
|
|
14
15
|
};
|
|
15
|
-
type WithProviderProps = {
|
|
16
|
+
type WithProviderProps = PianoProps & {
|
|
16
17
|
format?: 'mp3' | 'ogg';
|
|
17
18
|
height: number;
|
|
18
19
|
hostname?: string;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type OctavePlayerProps } from '../other/OctavePlayer';
|
|
2
|
+
type KeyPickerProps = OctavePlayerProps & {
|
|
3
|
+
value: number;
|
|
4
|
+
onChange: (value: number) => void;
|
|
5
|
+
};
|
|
6
|
+
declare const KeyPicker: {
|
|
7
|
+
(props: KeyPickerProps): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
propTypes: {};
|
|
9
|
+
};
|
|
10
|
+
export { KeyPicker };
|
|
@@ -28,7 +28,7 @@ declare const KnobPicker: import("react").ForwardRefExoticComponent<Partial<impo
|
|
|
28
28
|
menuShouldScrollIntoView?: boolean;
|
|
29
29
|
onChange: (value: number) => void;
|
|
30
30
|
options: Option<number>[] | {
|
|
31
|
-
|
|
31
|
+
options: Option<number>[];
|
|
32
32
|
}[];
|
|
33
33
|
preserveMenuWidth?: boolean;
|
|
34
34
|
selectProps?: {
|
|
@@ -23,7 +23,7 @@ declare const ResponseCurvePicker: import("react").ForwardRefExoticComponent<Par
|
|
|
23
23
|
menuShouldScrollIntoView?: boolean;
|
|
24
24
|
onChange: (value: Curve) => void;
|
|
25
25
|
options: Option<Curve>[] | {
|
|
26
|
-
|
|
26
|
+
options: Option<Curve>[];
|
|
27
27
|
}[];
|
|
28
28
|
preserveMenuWidth?: boolean;
|
|
29
29
|
selectProps?: {
|
|
@@ -27,7 +27,7 @@ type SelectProps<T> = SelectComponentsConfig<Option<T>, false, GroupBase<Option<
|
|
|
27
27
|
menuShouldScrollIntoView?: boolean;
|
|
28
28
|
onChange: (value: Option<T>['value']) => void;
|
|
29
29
|
options: Option<T>[] | {
|
|
30
|
-
|
|
30
|
+
options: Option<T>[];
|
|
31
31
|
}[];
|
|
32
32
|
preserveMenuWidth?: boolean;
|
|
33
33
|
selectProps?: PassedSelectProps;
|
package/lib/index.ts
CHANGED
|
@@ -10,6 +10,7 @@ export * from './other/SvgText'
|
|
|
10
10
|
export * from './pickers/CCPicker'
|
|
11
11
|
export * from './pickers/ChannelMappingPicker'
|
|
12
12
|
export * from './pickers/ChannelPicker'
|
|
13
|
+
export * from './pickers/KeyPicker'
|
|
13
14
|
export * from './pickers/Knob'
|
|
14
15
|
export * from './pickers/KnobPicker'
|
|
15
16
|
export * from './pickers/LatchPicker'
|
|
@@ -34,6 +35,7 @@ export type * from './other/SvgText'
|
|
|
34
35
|
export type * from './pickers/CCPicker'
|
|
35
36
|
export type * from './pickers/ChannelMappingPicker'
|
|
36
37
|
export type * from './pickers/ChannelPicker'
|
|
38
|
+
export type * from './pickers/KeyPicker'
|
|
37
39
|
export type * from './pickers/Knob'
|
|
38
40
|
export type * from './pickers/KnobPicker'
|
|
39
41
|
export type * from './pickers/LatchPicker'
|
|
@@ -3,6 +3,7 @@ import { /* Midi, */ Note } from 'tonal'
|
|
|
3
3
|
import { Piano as ReactPiano } from 'zds-react-piano'
|
|
4
4
|
import type { TooltipProps } from './DefaultTooltip'
|
|
5
5
|
import { SoundfontProvider } from './SoundFontProvider'
|
|
6
|
+
import type { PianoProps } from 'lib/pickers/PianoPicker'
|
|
6
7
|
|
|
7
8
|
type PianoMidiNote = {
|
|
8
9
|
accidental: boolean
|
|
@@ -38,7 +39,7 @@ const whiteNotes = numNotes * 0.7 // approx
|
|
|
38
39
|
|
|
39
40
|
const audioContext = new window.AudioContext()
|
|
40
41
|
|
|
41
|
-
type OctavePlayerProps = {
|
|
42
|
+
type OctavePlayerProps = PianoProps & {
|
|
42
43
|
disabled?: boolean
|
|
43
44
|
height: number
|
|
44
45
|
octave: number
|
|
@@ -70,7 +71,7 @@ const BaseOctavePlayer = ({
|
|
|
70
71
|
)
|
|
71
72
|
}
|
|
72
73
|
|
|
73
|
-
type WithProviderProps = {
|
|
74
|
+
type WithProviderProps = PianoProps & {
|
|
74
75
|
format?: 'mp3' | 'ogg'
|
|
75
76
|
height: number
|
|
76
77
|
hostname?: string
|
|
@@ -110,35 +111,22 @@ const WithProvider = ({
|
|
|
110
111
|
onChange,
|
|
111
112
|
soundfont,
|
|
112
113
|
}}
|
|
113
|
-
render={({
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
height,
|
|
130
|
-
octave,
|
|
131
|
-
onClick,
|
|
132
|
-
onDoubleClick,
|
|
133
|
-
onKeyMouseEnter,
|
|
134
|
-
onKeyMouseLeave,
|
|
135
|
-
playNote,
|
|
136
|
-
stopNote,
|
|
137
|
-
Tooltip,
|
|
138
|
-
width,
|
|
139
|
-
}}
|
|
140
|
-
/>
|
|
141
|
-
</>
|
|
114
|
+
render={({ isLoading, playNote, stopNote }) => (
|
|
115
|
+
<BaseOctavePlayer
|
|
116
|
+
disabled={isLoading}
|
|
117
|
+
{...{
|
|
118
|
+
height,
|
|
119
|
+
octave,
|
|
120
|
+
onClick,
|
|
121
|
+
onDoubleClick,
|
|
122
|
+
onKeyMouseEnter,
|
|
123
|
+
onKeyMouseLeave,
|
|
124
|
+
playNote,
|
|
125
|
+
stopNote,
|
|
126
|
+
Tooltip,
|
|
127
|
+
width,
|
|
128
|
+
}}
|
|
129
|
+
/>
|
|
142
130
|
)}
|
|
143
131
|
/>
|
|
144
132
|
)
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { OctavePlayer, type OctavePlayerProps } from '../other/OctavePlayer'
|
|
2
|
+
|
|
3
|
+
type KeyPickerProps = OctavePlayerProps & {
|
|
4
|
+
value: number
|
|
5
|
+
onChange: (value: number) => void
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
const KeyPicker = (props: KeyPickerProps) => {
|
|
9
|
+
console.log('KeyPicker', props)
|
|
10
|
+
|
|
11
|
+
return <OctavePlayer {...props} activeNotes={[65]} />
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
KeyPicker.propTypes = {}
|
|
15
|
+
|
|
16
|
+
export { KeyPicker }
|
package/lib/pickers/Select.tsx
CHANGED
|
@@ -114,7 +114,7 @@ type SelectProps<T> = SelectComponentsConfig<
|
|
|
114
114
|
menuPosition?: 'fixed' | 'absolute'
|
|
115
115
|
menuShouldScrollIntoView?: boolean
|
|
116
116
|
onChange: (value: Option<T>['value']) => void
|
|
117
|
-
options: Option<T>[] | {
|
|
117
|
+
options: Option<T>[] | { options: Option<T>[] }[]
|
|
118
118
|
preserveMenuWidth?: boolean
|
|
119
119
|
selectProps?: PassedSelectProps
|
|
120
120
|
shrinkLabel?: boolean
|
|
@@ -150,8 +150,8 @@ const Select = forwardRef(
|
|
|
150
150
|
)
|
|
151
151
|
|
|
152
152
|
const flatOptionsList = options.reduce<Option<T>[]>((acc, entry) => {
|
|
153
|
-
if ('
|
|
154
|
-
return acc.concat(entry.
|
|
153
|
+
if ('options' in entry) {
|
|
154
|
+
return acc.concat(entry.options)
|
|
155
155
|
}
|
|
156
156
|
return acc.concat(entry)
|
|
157
157
|
}, [])
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "zds-pickers",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.25",
|
|
4
4
|
"main": "./dist/index.cjs.js",
|
|
5
5
|
"module": "./dist/index.es.js",
|
|
6
6
|
"types": "./dist/types/index.d.ts",
|
|
@@ -40,38 +40,35 @@
|
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
42
|
"@biomejs/biome": "1.9.4",
|
|
43
|
-
"@storybook/addon-actions": "8.
|
|
44
|
-
"@storybook/addon-docs": "8.
|
|
45
|
-
"@storybook/addon-essentials": "8.
|
|
46
|
-
"@storybook/addon-links": "8.
|
|
47
|
-
"@storybook/builder-vite": "8.
|
|
48
|
-
"@storybook/react
|
|
49
|
-
"@storybook/react": "8.
|
|
43
|
+
"@storybook/addon-actions": "8.6.3",
|
|
44
|
+
"@storybook/addon-docs": "8.6.3",
|
|
45
|
+
"@storybook/addon-essentials": "8.6.3",
|
|
46
|
+
"@storybook/addon-links": "8.6.3",
|
|
47
|
+
"@storybook/builder-vite": "8.6.3",
|
|
48
|
+
"@storybook/react": "8.6.3",
|
|
49
|
+
"@storybook/react-vite": "8.6.3",
|
|
50
50
|
"@types/d3-drag": "3.0.7",
|
|
51
|
-
"@types/d3-scale": "4.0.
|
|
51
|
+
"@types/d3-scale": "4.0.9",
|
|
52
52
|
"@types/d3-selection": "3.0.11",
|
|
53
|
-
"@types/react-dom": "18.3.5",
|
|
54
53
|
"@types/react": "18.3.18",
|
|
55
|
-
"@
|
|
54
|
+
"@types/react-dom": "18.3.5",
|
|
55
|
+
"@vitejs/plugin-react-swc": "3.8.0",
|
|
56
56
|
"classnames": "2.5.1",
|
|
57
|
-
"globals": "15.
|
|
57
|
+
"globals": "15.15.0",
|
|
58
58
|
"immer": "10.1.1",
|
|
59
59
|
"nodemon": "3.1.9",
|
|
60
60
|
"prop-types": "15.8.1",
|
|
61
|
-
"react-dom": "18.2.0",
|
|
62
|
-
"react": "18.2.0",
|
|
63
61
|
"rc-slider": "11.1.8",
|
|
64
|
-
"storybook": "8.
|
|
65
|
-
"typescript": "5.
|
|
66
|
-
"vite": "6.
|
|
62
|
+
"storybook": "8.6.3",
|
|
63
|
+
"typescript": "5.8.2",
|
|
64
|
+
"vite": "^6.3.6",
|
|
67
65
|
"zds-mappings": "1.4.9"
|
|
68
66
|
},
|
|
69
67
|
"dependencies": {
|
|
70
|
-
"caniuse-lite": "1.0.
|
|
68
|
+
"caniuse-lite": "1.0.30001741",
|
|
71
69
|
"d3-drag": "3.0.0",
|
|
72
70
|
"d3-scale": "4.0.2",
|
|
73
71
|
"d3-selection": "3.0.0",
|
|
74
|
-
"react-select": "5.9.0",
|
|
75
72
|
"react-svgmt": "2.0.2",
|
|
76
73
|
"soundfont-player": "0.12.0",
|
|
77
74
|
"tonal": "6.4.0",
|
|
@@ -81,6 +78,7 @@
|
|
|
81
78
|
"classnames": ">=2.5.1",
|
|
82
79
|
"react": ">=18.0.0",
|
|
83
80
|
"react-dom": ">=18.0.0",
|
|
81
|
+
"react-select": ">=5.10.0",
|
|
84
82
|
"zds-mappings": "1.4.9"
|
|
85
83
|
}
|
|
86
84
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Meta, StoryObj } from '@storybook/react'
|
|
2
2
|
// biome-ignore lint/correctness/noUnusedImports: <explanation>
|
|
3
3
|
import React from 'react'
|
|
4
|
-
import type * as Soundfont from 'soundfont-player'
|
|
4
|
+
// import type * as Soundfont from 'soundfont-player'
|
|
5
5
|
import { getMapping } from 'zds-mappings'
|
|
6
6
|
import { Statuses, statusOptions } from '../lib/midi/export'
|
|
7
7
|
import { OctavePlayer } from '../lib/other/OctavePlayer'
|
|
@@ -16,6 +16,7 @@ import { NotePicker } from '../lib/pickers/NotePicker'
|
|
|
16
16
|
import { PianoPicker } from '../lib/pickers/PianoPicker'
|
|
17
17
|
import { PolarityPicker } from '../lib/pickers/PolarityPicker'
|
|
18
18
|
import { ResponseCurve } from '../lib/pickers/ResponseCurve'
|
|
19
|
+
import { KeyPicker } from '../lib/pickers/KeyPicker'
|
|
19
20
|
import { ResponseCurvePicker } from '../lib/pickers/ResponseCurvePicker'
|
|
20
21
|
import {
|
|
21
22
|
type Option,
|
|
@@ -132,6 +133,17 @@ const ChannelMappingPickerUndefinedStory: StoryObj<
|
|
|
132
133
|
},
|
|
133
134
|
}
|
|
134
135
|
|
|
136
|
+
const KeyPickerStory: StoryObj<typeof KeyPicker> = {
|
|
137
|
+
render: args => <KeyPicker {...args} />,
|
|
138
|
+
args: {
|
|
139
|
+
instrumentName: 'acoustic_grand_piano',
|
|
140
|
+
height: 100,
|
|
141
|
+
width: 200,
|
|
142
|
+
octave: 4,
|
|
143
|
+
},
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
|
|
135
147
|
const KnobStory: StoryObj<typeof Knob> = {
|
|
136
148
|
render: args => <Knob {...args} />,
|
|
137
149
|
args: {
|
|
@@ -243,10 +255,7 @@ const NotePickerStory4: StoryObj<typeof NotePicker> = {
|
|
|
243
255
|
const OctavePlayerStory: StoryObj<typeof OctavePlayer> = {
|
|
244
256
|
render: args => <OctavePlayer {...args} />,
|
|
245
257
|
args: {
|
|
246
|
-
instrumentName:
|
|
247
|
-
control: { type: 'select' },
|
|
248
|
-
options: [undefined, 'acoustic_grand_piano'],
|
|
249
|
-
} as unknown as Soundfont.InstrumentName,
|
|
258
|
+
instrumentName: 'acoustic_grand_piano',
|
|
250
259
|
height: 100,
|
|
251
260
|
width: 200,
|
|
252
261
|
octave: 4,
|
|
@@ -372,6 +381,7 @@ export {
|
|
|
372
381
|
ChannelMappingPickerUndefinedStory as ChannelMappingPickerNoValue,
|
|
373
382
|
CCPickerStory as ChangeController,
|
|
374
383
|
CCPickerUndefinedStory as ChangeControllerNoValue,
|
|
384
|
+
KeyPickerStory as KeyPicker,
|
|
375
385
|
KnobStory as Knob,
|
|
376
386
|
KnobPickerStory as KnobPicker,
|
|
377
387
|
LatchPickerStory as LatchPicker,
|