zds-pickers 4.0.25 → 4.1.1
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/README.md +199 -2
- package/dist/index.cjs.js +40 -15
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +3098 -10462
- package/dist/index.es.js.map +1 -1
- package/dist/other/OctavePlayer.js +2 -1
- package/dist/other/SoundFontProvider.js +65 -4
- package/dist/pickers/KeyPicker.js +14 -3
- package/dist/pickers/PianoPicker.js +2 -1
- package/dist/pickers/knobSkin10.js +18 -0
- package/dist/rotaryKnob/knobdefaultskin.js +13 -0
- package/dist/types/other/OctavePlayer.d.ts +3 -2
- package/dist/types/other/SoundFontProvider.d.ts +13 -0
- package/dist/types/pickers/KeyPicker.d.ts +7 -5
- package/dist/types/pickers/PianoPicker.d.ts +2 -1
- package/lib/other/OctavePlayer.tsx +4 -1
- package/lib/other/SoundFontProvider.tsx +86 -6
- package/lib/pickers/KeyPicker.tsx +44 -5
- package/lib/pickers/PianoPicker.tsx +3 -0
- package/lib/pickers/knobSkin10.tsx +18 -0
- package/lib/rotaryKnob/knobdefaultskin.ts +13 -0
- package/lib/temp/acoustic_grand_piano-mp3.js +14 -1
- package/package.json +13 -13
- package/stories/assets/sampleStyles.css +16 -0
- package/stories/picker.stories.tsx +48 -22
- package/vite.config.ts +18 -9
package/README.md
CHANGED
|
@@ -1,3 +1,200 @@
|
|
|
1
|
-
# zds-pickers
|
|
1
|
+
# zds-pickers 🎵
|
|
2
2
|
|
|
3
|
-
Picker controls that are common to ZendrumStudio apps
|
|
3
|
+
Picker controls that are common to ZendrumStudio apps - a React component library for MIDI/music applications.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
zds-pickers provides a comprehensive set of React components for building MIDI controller interfaces, music applications, and audio configuration UIs. The library focuses on picker-style controls that allow users to select values, notes, channels, and other musical parameters.
|
|
8
|
+
|
|
9
|
+
## Architecture
|
|
10
|
+
|
|
11
|
+
The library is organized into several key areas:
|
|
12
|
+
|
|
13
|
+
- **🎵 Music Components**: Piano interfaces, octave players, and audio providers
|
|
14
|
+
- **🎛️ Control Components**: Knobs, sliders, and interactive controls
|
|
15
|
+
- **🎯 Selection Components**: Dropdowns and pickers for various MIDI parameters
|
|
16
|
+
- **🔧 Utilities**: Shared components and helpers
|
|
17
|
+
|
|
18
|
+
## Key Features
|
|
19
|
+
|
|
20
|
+
- **TypeScript-first**: Full type safety with comprehensive interfaces
|
|
21
|
+
- **Audio Integration**: Built-in soundfont support for audio feedback
|
|
22
|
+
- **MIDI-Focused**: Components designed specifically for MIDI applications
|
|
23
|
+
- **Customizable**: Extensive theming and styling options
|
|
24
|
+
- **Accessible**: Keyboard navigation and screen reader support
|
|
25
|
+
- **Storybook Documentation**: Interactive component playground
|
|
26
|
+
|
|
27
|
+
## Quick Start
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
npm install zds-pickers
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
```tsx
|
|
34
|
+
import { PianoPicker, KnobPicker, NotePicker } from 'zds-pickers'
|
|
35
|
+
|
|
36
|
+
function MyMIDIApp() {
|
|
37
|
+
return (
|
|
38
|
+
<div>
|
|
39
|
+
<PianoPicker
|
|
40
|
+
width={800}
|
|
41
|
+
height={200}
|
|
42
|
+
instrumentName="acoustic_grand_piano"
|
|
43
|
+
onChange={(note) => console.log('Note played:', note)}
|
|
44
|
+
/>
|
|
45
|
+
<KnobPicker
|
|
46
|
+
label="Volume"
|
|
47
|
+
min={0}
|
|
48
|
+
max={127}
|
|
49
|
+
value={64}
|
|
50
|
+
onChange={(value) => console.log('Volume:', value)}
|
|
51
|
+
/>
|
|
52
|
+
</div>
|
|
53
|
+
)
|
|
54
|
+
}
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## Component Documentation
|
|
58
|
+
|
|
59
|
+
**📚 All component examples, props, and usage patterns are documented in Storybook.**
|
|
60
|
+
|
|
61
|
+
Run `npm run sb` to access the interactive component playground with:
|
|
62
|
+
- Live examples of all components
|
|
63
|
+
- Interactive prop controls
|
|
64
|
+
- Multiple variants and states
|
|
65
|
+
- Copy-paste code snippets
|
|
66
|
+
|
|
67
|
+
### Available Components
|
|
68
|
+
|
|
69
|
+
**🎵 Music & Audio**
|
|
70
|
+
- `PianoPicker` - Full piano keyboard with soundfont integration
|
|
71
|
+
- `OctavePlayer` - Single octave piano interface
|
|
72
|
+
- `KeyPicker` - Octave-based key selection (in development)
|
|
73
|
+
|
|
74
|
+
**🎛️ Controls**
|
|
75
|
+
- `KnobPicker` - Draggable knob with label and value display
|
|
76
|
+
- `ResponseCurvePicker` - Visual response curve selection
|
|
77
|
+
- `Knob` - Base knob component (from rotaryKnob)
|
|
78
|
+
|
|
79
|
+
**🎯 Selection**
|
|
80
|
+
- `NotePicker` - MIDI note selection with drum mapping support
|
|
81
|
+
- `ChannelPicker` - MIDI channel selection (1-16)
|
|
82
|
+
- `CCPicker` - MIDI Control Change number selection
|
|
83
|
+
- `StatusPicker` - MIDI status message selection
|
|
84
|
+
- `ChannelMappingPicker` - Channel mapping with drum kit presets
|
|
85
|
+
- `MappingPicker` - General mapping selection
|
|
86
|
+
- `PolarityPicker` - On/Off polarity selection
|
|
87
|
+
- `LatchPicker` - Latch mode selection
|
|
88
|
+
- `ValuePicker` - Generic value selection
|
|
89
|
+
|
|
90
|
+
**🔧 Utilities**
|
|
91
|
+
- `Select` - Generic select component with no-selection support
|
|
92
|
+
- `DefaultTooltip` - Tooltip component
|
|
93
|
+
- `SvgText` - SVG text rendering
|
|
94
|
+
|
|
95
|
+
## Audio Integration
|
|
96
|
+
|
|
97
|
+
The library includes `SoundfontProvider` for audio feedback:
|
|
98
|
+
|
|
99
|
+
```tsx
|
|
100
|
+
<SoundfontProvider
|
|
101
|
+
audioContext={audioContext}
|
|
102
|
+
instrumentName="acoustic_grand_piano"
|
|
103
|
+
soundfont="MusyngKite"
|
|
104
|
+
render={({ isLoading, playNote, stopNote }) => (
|
|
105
|
+
<YourComponent
|
|
106
|
+
playNote={playNote}
|
|
107
|
+
stopNote={stopNote}
|
|
108
|
+
disabled={isLoading}
|
|
109
|
+
/>
|
|
110
|
+
)}
|
|
111
|
+
/>
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
## Development
|
|
115
|
+
|
|
116
|
+
### Setup
|
|
117
|
+
```bash
|
|
118
|
+
npm install
|
|
119
|
+
npm run dev # Start Vite dev server
|
|
120
|
+
npm run sb # Start Storybook
|
|
121
|
+
npm run build # Build library
|
|
122
|
+
npm run lint # Run Biome linter
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
### Storybook
|
|
126
|
+
**Primary documentation and testing environment** - all component examples, props, and usage patterns:
|
|
127
|
+
```bash
|
|
128
|
+
npm run sb
|
|
129
|
+
# Opens http://localhost:6006
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
Storybook serves as the single source of truth for:
|
|
133
|
+
- Component examples and variants
|
|
134
|
+
- Interactive prop controls
|
|
135
|
+
- Live code snippets
|
|
136
|
+
- Visual testing and development
|
|
137
|
+
|
|
138
|
+
### Building
|
|
139
|
+
The library builds to both CommonJS and ES modules:
|
|
140
|
+
- `dist/index.cjs.js` - CommonJS build
|
|
141
|
+
- `dist/index.es.js` - ES module build
|
|
142
|
+
- `dist/types/` - TypeScript definitions
|
|
143
|
+
|
|
144
|
+
## Dependencies
|
|
145
|
+
|
|
146
|
+
### Core Dependencies
|
|
147
|
+
- **React 18+** - Component framework
|
|
148
|
+
- **TypeScript** - Type safety
|
|
149
|
+
- **D3.js** - Drag interactions and scaling
|
|
150
|
+
- **soundfont-player** - Audio playback
|
|
151
|
+
- **zds-react-piano** - Piano component
|
|
152
|
+
- **zds-mappings** - MIDI mappings
|
|
153
|
+
|
|
154
|
+
### Development Dependencies
|
|
155
|
+
- **Vite** - Build tool
|
|
156
|
+
- **Storybook** - Component documentation
|
|
157
|
+
- **Biome** - Linting and formatting
|
|
158
|
+
- **Tonal** - Music theory utilities
|
|
159
|
+
|
|
160
|
+
## Type Safety
|
|
161
|
+
|
|
162
|
+
All components are fully typed with TypeScript. Key interfaces:
|
|
163
|
+
|
|
164
|
+
```tsx
|
|
165
|
+
// Common picker props
|
|
166
|
+
interface BasePickerProps {
|
|
167
|
+
disabled?: boolean
|
|
168
|
+
label?: string
|
|
169
|
+
shrinkLabel?: boolean
|
|
170
|
+
value?: number | string
|
|
171
|
+
onChange?: (value: number | string) => void
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
// Audio provider props
|
|
175
|
+
interface SoundfontProviderProps {
|
|
176
|
+
audioContext: AudioContext
|
|
177
|
+
instrumentName?: Soundfont.InstrumentName
|
|
178
|
+
soundfont?: 'MusyngKite' | 'FluidR3_GM'
|
|
179
|
+
render: (props: AudioRenderProps) => React.ReactNode
|
|
180
|
+
}
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
## Contributing
|
|
184
|
+
|
|
185
|
+
This is a single-developer library. The codebase follows these patterns:
|
|
186
|
+
|
|
187
|
+
- **Functional components** with hooks
|
|
188
|
+
- **TypeScript interfaces** for all props
|
|
189
|
+
- **Storybook stories** for each component
|
|
190
|
+
- **Biome** for consistent formatting
|
|
191
|
+
- **Modular exports** from index.ts
|
|
192
|
+
|
|
193
|
+
## License
|
|
194
|
+
|
|
195
|
+
MIT License - see LICENSE file for details.
|
|
196
|
+
|
|
197
|
+
## Repository
|
|
198
|
+
|
|
199
|
+
- **GitHub**: https://github.com/dkadrios/zds-pickers
|
|
200
|
+
- **NPM**: https://www.npmjs.com/package/zds-pickers
|