midiwire 0.9.0 → 0.11.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.
package/README.md CHANGED
@@ -36,7 +36,7 @@ Or use directly in the browser from a CDN like [jsDelivr](https://www.jsdelivr.c
36
36
 
37
37
  <!-- Or specify a version if needed -->
38
38
  <script type="module">
39
- import { createMIDIController } from "https://cdn.jsdelivr.net/npm/midiwire@0.9.0/+esm";
39
+ import { createMIDIController } from "https://cdn.jsdelivr.net/npm/midiwire@X.Y.Z/+esm";
40
40
  </script>
41
41
  ```
42
42
 
@@ -57,12 +57,16 @@ const manager = new MIDIDeviceManager({
57
57
  });
58
58
 
59
59
  // Setup all selectors at once (returns MIDIController)
60
- const midi = await manager.setupSelectors({
61
- output: "#output-select",
62
- input: "#input-select",
63
- channel: "#channel-select",
64
- onConnect: ({ device, type }) => console.log(`${type}: ${device.name}`)
65
- });
60
+ const midi = await manager.setupSelectors(
61
+ {
62
+ output: "#output-select",
63
+ input: "#input-select",
64
+ channel: "#channel-select"
65
+ },
66
+ {
67
+ onConnect: ({ device, type }) => console.log(`${type}: ${device.name}`)
68
+ }
69
+ );
66
70
 
67
71
  // Use the MIDI controller directly
68
72
  midi.channel.sendCC(1, 100);
@@ -16,17 +16,21 @@
16
16
  * });
17
17
  *
18
18
  * // Setup all selectors with callbacks
19
- * const midi = await manager.setupSelectors({
20
- * output: document.getElementById("output-select"),
21
- * input: document.getElementById("input-select"),
22
- * channel: document.getElementById("channel-select"),
23
- * onConnect: ({ midi, device, type }) => {
24
- * console.log(`${type} connected: ${device.name}`);
19
+ * const midi = await manager.setupSelectors(
20
+ * {
21
+ * output: document.getElementById("output-select"),
22
+ * input: document.getElementById("input-select"),
23
+ * channel: document.getElementById("channel-select")
25
24
  * },
26
- * onDisconnect: ({ midi, type }) => {
27
- * console.log(`${type} disconnected`);
25
+ * {
26
+ * onConnect: ({ midi, device, type }) => {
27
+ * console.log(`${type} connected: ${device.name}`);
28
+ * },
29
+ * onDisconnect: ({ midi, type }) => {
30
+ * console.log(`${type} disconnected`);
31
+ * }
28
32
  * }
29
- * });
33
+ * );
30
34
  *
31
35
  * // Returns MIDI controller for immediate use
32
36
  * midi.channel.sendCC(1, 100);
@@ -35,7 +39,7 @@ export class MIDIDeviceManager {
35
39
  /**
36
40
  * Create a new MIDIDeviceManager instance
37
41
  * @param {Object} options - Configuration options
38
- * @param {MIDIController} [options.midiController] - MIDIController instance. Can also be set via setMIDI()
42
+ * @param {MIDIController} [options.midiController] - MIDIController instance
39
43
  * @param {Function} [options.onStatusUpdate] - Callback for status updates (message: string, state: string)
40
44
  * @param {Function} [options.onConnectionUpdate] - Callback when connection status changes (outputDevice: Object, inputDevice: Object, midi: MIDIController)
41
45
  * @param {number} [options.channel=1] - Default MIDI channel
@@ -54,45 +58,28 @@ export class MIDIDeviceManager {
54
58
  currentInput: any;
55
59
  isConnecting: boolean;
56
60
  /**
57
- * Initialize the device manager with a MIDIController
58
- * @param {MIDIController} midi
59
- */
60
- setMIDI(midi: MIDIController): void;
61
- /**
62
- * Set up device change event listeners for automatic UI updates when devices
63
- * connect or disconnect. Handles both successful connections and disconnections,
64
- * updating status messages and tracking the current device state.
65
- *
66
- * @param {Function} [onDeviceListChange] - Optional callback to refresh device list UI when devices change
67
- * @param {Object} [selectElements] - Optional select elements to update on disconnect
68
- * @param {HTMLSelectElement} [selectElements.output] - Output device select element
69
- * @param {HTMLSelectElement} [selectElements.input] - Input device select element
70
- * @returns {void}
71
- *
72
- * @emits CONTROLLER_EVENTS.DEV_OUT_CONNECTED
73
- * @emits CONTROLLER_EVENTS.DEV_OUT_DISCONNECTED
74
- *
75
- * @example
76
- * // Basic setup
77
- * manager.setupDeviceListeners();
78
- *
79
- * @example
80
- * // With device list refresh callback
81
- * manager.setupDeviceListeners(() => {
82
- * manager.output.populateDeviceList(deviceSelect);
83
- * });
61
+ * Set up all MIDI device selectors in one call. Handles population, connection
62
+ * handling, channel selection, and automatic refresh on device changes.
84
63
  *
85
- * @example
86
- * // With select elements to clear on disconnect
87
- * manager.setupDeviceListeners(null, {
88
- * output: outputSelect,
89
- * input: inputSelect
90
- * });
64
+ * @param {Object} selectors - Selectors configuration
65
+ * @param {HTMLSelectElement|string} [selectors.output] - Output device dropdown element or CSS selector
66
+ * @param {HTMLSelectElement|string} [selectors.input] - Input device dropdown element or CSS selector
67
+ * @param {HTMLSelectElement|string} [selectors.channel] - MIDI channel dropdown element or CSS selector
68
+ * @param {Object} [options] - Configuration options
69
+ * @param {Function} [options.onConnect] - Called when device connects ({ midi, device, type })
70
+ * @param {Function} [options.onDisconnect] - Called when device disconnects ({ midi, type })
71
+ * @param {Function} [options.onDeviceListChange] - Called when device list changes (for custom UI updates)
72
+ * @returns {Promise<MIDIController>} The MIDI controller instance for chaining
91
73
  */
92
- setupDeviceListeners(onDeviceListChange?: Function, selectElements?: {
93
- output?: HTMLSelectElement;
94
- input?: HTMLSelectElement;
95
- }): void;
74
+ setupSelectors(selectors?: {
75
+ output?: HTMLSelectElement | string;
76
+ input?: HTMLSelectElement | string;
77
+ channel?: HTMLSelectElement | string;
78
+ }, options?: {
79
+ onConnect?: Function;
80
+ onDisconnect?: Function;
81
+ onDeviceListChange?: Function;
82
+ }): Promise<MIDIController>;
96
83
  /**
97
84
  * Update status message and trigger status callback
98
85
  *
@@ -112,51 +99,16 @@ export class MIDIDeviceManager {
112
99
  */
113
100
  updateConnectionStatus(): void;
114
101
  /**
115
- * Set up all MIDI device selectors in one call. Handles population, connection
116
- * handling, channel selection, and automatic refresh on device changes.
117
- *
118
- * @param {Object} selectors - Selectors configuration
119
- * @param {HTMLSelectElement|string} [selectors.output] - Output device dropdown element or CSS selector string (e.g., "#output-select")
120
- * @param {HTMLSelectElement|string} [selectors.input] - Input device dropdown element or CSS selector string (e.g., "#input-select")
121
- * @param {HTMLSelectElement|string} [selectors.channel] - MIDI channel dropdown element or CSS selector
122
- * @param {Object} [options] - Configuration options
123
- * @param {Function} [options.onConnect] - Called when device connects ({ midi, device, type })
124
- * @param {Function} [options.onDisconnect] - Called when device disconnects ({ midi, type })
125
- * @returns {Promise<MIDIController>} The MIDI controller instance for chaining
126
- *
127
- * @example
128
- * // Setup all selectors at once with DOM elements
129
- * const midi = await manager.setupSelectors({
130
- * output: document.getElementById("output-select"),
131
- * input: document.getElementById("input-select"),
132
- * channel: document.getElementById("channel-select"),
133
- * onConnect: ({ midi, device, type }) => {
134
- * console.log(`${type} connected: ${device.name}`);
135
- * },
136
- * onDisconnect: ({ midi, type }) => {
137
- * console.log(`${type} disconnected`);
138
- * }
139
- * });
140
- *
141
- * @example
142
- * // Setup with CSS selectors (more concise)
143
- * const midi = await manager.setupSelectors({
144
- * output: "#output-select",
145
- * input: "#input-select",
146
- * channel: "#channel-select"
147
- * });
148
- *
149
- * // Now use the midi controller directly
150
- * midi.channel.sendCC(1, 100);
102
+ * Set up listeners for MIDI device connection/disconnection events.
103
+ * Automatically repopulates device lists and triggers callbacks when devices change.
104
+ * @private
105
+ * @param {Object} selectElements - Select elements to update
106
+ * @param {HTMLSelectElement} [selectElements.output] - Output device dropdown
107
+ * @param {HTMLSelectElement} [selectElements.input] - Input device dropdown
108
+ * @param {Function} [onDeviceListChange] - Callback when device list changes
151
109
  */
152
- setupSelectors(selectors?: {
153
- output?: HTMLSelectElement | string;
154
- input?: HTMLSelectElement | string;
155
- channel?: HTMLSelectElement | string;
156
- }, options?: {
157
- onConnect?: Function;
158
- onDisconnect?: Function;
159
- }): Promise<MIDIController>;
110
+ private _setupDeviceChangeListeners;
111
+ _listenersInitialized: boolean;
160
112
  /**
161
113
  * Resolve a selector to a DOM element
162
114
  * @private
@@ -1 +1 @@
1
- {"version":3,"file":"MIDIDeviceManager.d.ts","sourceRoot":"","sources":["../../src/core/MIDIDeviceManager.js"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH;IACE;;;;;;;OAOG;IACH,sBALG;QAAiC,cAAc,GAAvC,cAAc;QACK,cAAc;QACd,kBAAkB;QACpB,OAAO,GAAxB,MAAM;KAChB,EASA;IAPC,UAA0C;IAC1C,yBAA0D;IAC1D,6BAAkE;IAClE,gBAAmC;IACnC,mBAAyB;IACzB,kBAAwB;IACxB,sBAAyB;IAG3B;;;OAGG;IACH,cAFW,cAAc,QAIxB;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA8BG;IACH,qEAxBG;QAA2C,MAAM,GAAzC,iBAAiB;QACkB,KAAK,GAAxC,iBAAiB;KACzB,GAAU,IAAI,CAkEhB;IAED;;;;;;;;;;;;OAYG;IACH,sBAVW,MAAM,UACN,MAAM,GACJ,IAAI,CAUhB;IAED;;OAEG;IACH,+BAEC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAqCG;IACH,2BAjCG;QAA6C,MAAM,GAA3C,iBAAiB,GAAC,MAAM;QACa,KAAK,GAA1C,iBAAiB,GAAC,MAAM;QACa,OAAO,GAA5C,iBAAiB,GAAC,MAAM;KAChC,YACA;QAA2B,SAAS;QACT,YAAY;KACvC,GAAU,OAAO,CAAC,cAAc,CAAC,CAkFnC;IAED;;;;;OAKG;IACH,yBASC;IAED;;;;OAIG;IACH,0BAGC;IAED;;;;OAIG;IACH,yBAGC;IAED;;;;;;;;OAQG;IACH,sCA+CC;IAED;;;;;;;;OAQG;IACH,qCAoCC;IAED;;;;;;;;;OASG;IACH,4BAoCC;IAED;;;;;;;;OAQG;IACH,kCAKC;IAED;;;;;;;;OAQG;IACH,iCAMC;IAED;;;;;;;;;;;;;;;;;;;OAmBG;IACH,iCAWC;CACF"}
1
+ {"version":3,"file":"MIDIDeviceManager.d.ts","sourceRoot":"","sources":["../../src/core/MIDIDeviceManager.js"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH;IACE;;;;;;;OAOG;IACH,sBALG;QAAiC,cAAc,GAAvC,cAAc;QACK,cAAc;QACd,kBAAkB;QACpB,OAAO,GAAxB,MAAM;KAChB,EASA;IAPC,UAA0C;IAC1C,yBAA0D;IAC1D,6BAAkE;IAClE,gBAAmC;IACnC,mBAAyB;IACzB,kBAAwB;IACxB,sBAAyB;IAG3B;;;;;;;;;;;;;OAaG;IACH,2BATG;QAA6C,MAAM,GAA3C,iBAAiB,GAAC,MAAM;QACa,KAAK,GAA1C,iBAAiB,GAAC,MAAM;QACa,OAAO,GAA5C,iBAAiB,GAAC,MAAM;KAChC,YACA;QAA2B,SAAS;QACT,YAAY;QACZ,kBAAkB;KAC7C,GAAU,OAAO,CAAC,cAAc,CAAC,CAiDnC;IAED;;;;;;;;;;;;OAYG;IACH,sBAVW,MAAM,UACN,MAAM,GACJ,IAAI,CAUhB;IAED;;OAEG;IACH,+BAEC;IAED;;;;;;;;OAQG;IACH,oCAwDC;IArDC,+BAAiC;IAuDnC;;;;;OAKG;IACH,yBASC;IAED;;;;OAIG;IACH,0BAGC;IAED;;;;OAIG;IACH,yBAGC;IAED;;;;;;;;OAQG;IACH,sCA+CC;IAED;;;;;;;;OAQG;IACH,qCAoCC;IAED;;;;;;;;;OASG;IACH,4BAoCC;IAED;;;;;;;;OAQG;IACH,kCAKC;IAED;;;;;;;;OAQG;IACH,iCAMC;IAED;;;;;;;;;;;;;;;;;;;OAmBG;IACH,iCAWC;CACF"}
package/dist/index.d.ts CHANGED
@@ -1,101 +1,5 @@
1
- import { MIDIController } from './core/MIDIController.js';
2
1
  import { MIDIDeviceManager } from './core/MIDIDeviceManager.js';
3
- /**
4
- * Options for createMIDIController()
5
- * @typedef {Object} MIDIControlsOptions
6
- * @property {string} [selector="[data-midi-cc]"] - CSS selector for auto-binding elements that have data-midi-* attributes
7
- * @property {number} [inputChannel=1] - Input MIDI channel (1-16)
8
- * @property {number} [outputChannel=1] - Output MIDI channel (1-16)
9
- * @property {string|number} [output] - MIDI output device name, ID, or index to auto-connect to
10
- * @property {boolean} [sysex=false] - Request SysEx access for sending/receiving system exclusive messages
11
- * @property {boolean} [autoConnect=true] - Auto-connect to first available output device
12
- * @property {boolean} [watchDOM=false] - Automatically bind dynamically added elements using MutationObserver
13
- * @property {Function} [onReady] - Callback when MIDI is ready, receives (controller) as parameter
14
- * @property {Function} [onError] - Error handler for MIDI access errors
15
- * @property {string|number} [input] - MIDI input device name, ID, or index to connect to for receiving MIDI
16
- *
17
- * @example
18
- * // Basic auto-binding
19
- * const options = {
20
- * selector: "[data-midi-cc]",
21
- * outputChannel: 1,
22
- * watchDOM: true
23
- * };
24
- *
25
- * @example
26
- * // Connect to specific device
27
- * const options = {
28
- * output: "My MIDI Keyboard",
29
- * outputChannel: 2,
30
- * sysex: true
31
- * };
32
- *
33
- * @example
34
- * // With separate input/output channels
35
- * const options = {
36
- * inputChannel: 1,
37
- * outputChannel: 2,
38
- * input: "My MIDI Controller",
39
- * output: "My Synth"
40
- * };
41
- */
42
- /**
43
- * Create and initialize a MIDI controller with optional auto-binding. This factory function
44
- * creates a MIDIController instance, initializes it, and optionally sets up declarative binding
45
- * using DataAttributeBinder. Perfect for getting started quickly or when using data attributes.
46
- *
47
- * @param {MIDIControlsOptions} [options={}] - Configuration options
48
- * @returns {Promise<MIDIController>} A promise resolving to the initialized MIDIController instance
49
- * @throws {MIDIAccessError} If MIDI access is denied or browser doesn't support Web MIDI API
50
- *
51
- * @example
52
- * // Quick start with auto-binding
53
- * const midi = await createMIDIController({
54
- * selector: "[data-midi-cc]",
55
- * watchDOM: true
56
- * });
57
- *
58
- * @example
59
- * // Auto-bind with specific device and output channel
60
- * const midi = await createMIDIController({
61
- * output: "My Synth",
62
- * outputChannel: 2,
63
- * selector: "[data-midi-cc]",
64
- * onReady: (controller) => {
65
- * console.log("MIDI ready!");
66
- * }
67
- * });
68
- *
69
- * @example
70
- * // Auto-bind with separate input/output channels
71
- * const midi = await createMIDIController({
72
- * inputChannel: 1,
73
- * outputChannel: 2,
74
- * selector: "[data-midi-cc]",
75
- * watchDOM: true
76
- * });
77
- *
78
- * @example
79
- * // Programmatic binding (no auto-bind)
80
- * const midi = await createMIDIController({
81
- * autoConnect: false,
82
- * outputChannel: 1
83
- * });
84
- * await midi.device.connectOutput("My Synth");
85
- * const slider = document.getElementById("cutoff");
86
- * midi.bind(slider, { cc: 74 });
87
- *
88
- * @example
89
- * // With SysEx support
90
- * const midi = await createMIDIController({
91
- * sysex: true,
92
- * onReady: (controller) => {
93
- * // Send SysEx after connection
94
- * controller.sendSysEx([0x41, 0x10, 0x42]);
95
- * }
96
- * });
97
- */
98
- export function createMIDIController(options?: MIDIControlsOptions): Promise<MIDIController>;
2
+ import { MIDIController } from './core/MIDIController.js';
99
3
  /**
100
4
  * Options for createMIDIDeviceManager()
101
5
  * @typedef {Object} MIDIDeviceManagerOptions
@@ -230,6 +134,102 @@ export function createMIDIController(options?: MIDIControlsOptions): Promise<MID
230
134
  * });
231
135
  */
232
136
  export function createMIDIDeviceManager(options?: MIDIDeviceManagerOptions): Promise<MIDIDeviceManager>;
137
+ /**
138
+ * Options for createMIDIController()
139
+ * @typedef {Object} MIDIControlsOptions
140
+ * @property {string} [selector="[data-midi-cc]"] - CSS selector for auto-binding elements that have data-midi-* attributes
141
+ * @property {number} [inputChannel=1] - Input MIDI channel (1-16)
142
+ * @property {number} [outputChannel=1] - Output MIDI channel (1-16)
143
+ * @property {string|number} [output] - MIDI output device name, ID, or index to auto-connect to
144
+ * @property {boolean} [sysex=false] - Request SysEx access for sending/receiving system exclusive messages
145
+ * @property {boolean} [autoConnect=true] - Auto-connect to first available output device
146
+ * @property {boolean} [watchDOM=false] - Automatically bind dynamically added elements using MutationObserver
147
+ * @property {Function} [onReady] - Callback when MIDI is ready, receives (controller) as parameter
148
+ * @property {Function} [onError] - Error handler for MIDI access errors
149
+ * @property {string|number} [input] - MIDI input device name, ID, or index to connect to for receiving MIDI
150
+ *
151
+ * @example
152
+ * // Basic auto-binding
153
+ * const options = {
154
+ * selector: "[data-midi-cc]",
155
+ * outputChannel: 1,
156
+ * watchDOM: true
157
+ * };
158
+ *
159
+ * @example
160
+ * // Connect to specific device
161
+ * const options = {
162
+ * output: "My MIDI Keyboard",
163
+ * outputChannel: 2,
164
+ * sysex: true
165
+ * };
166
+ *
167
+ * @example
168
+ * // With separate input/output channels
169
+ * const options = {
170
+ * inputChannel: 1,
171
+ * outputChannel: 2,
172
+ * input: "My MIDI Controller",
173
+ * output: "My Synth"
174
+ * };
175
+ */
176
+ /**
177
+ * Create and initialize a MIDI controller with optional auto-binding. This factory function
178
+ * creates a MIDIController instance, initializes it, and optionally sets up declarative binding
179
+ * using DataAttributeBinder. Perfect for getting started quickly or when using data attributes.
180
+ *
181
+ * @param {MIDIControlsOptions} [options={}] - Configuration options
182
+ * @returns {Promise<MIDIController>} A promise resolving to the initialized MIDIController instance
183
+ * @throws {MIDIAccessError} If MIDI access is denied or browser doesn't support Web MIDI API
184
+ *
185
+ * @example
186
+ * // Quick start with auto-binding
187
+ * const midi = await createMIDIController({
188
+ * selector: "[data-midi-cc]",
189
+ * watchDOM: true
190
+ * });
191
+ *
192
+ * @example
193
+ * // Auto-bind with specific device and output channel
194
+ * const midi = await createMIDIController({
195
+ * output: "My Synth",
196
+ * outputChannel: 2,
197
+ * selector: "[data-midi-cc]",
198
+ * onReady: (controller) => {
199
+ * console.log("MIDI ready!");
200
+ * }
201
+ * });
202
+ *
203
+ * @example
204
+ * // Auto-bind with separate input/output channels
205
+ * const midi = await createMIDIController({
206
+ * inputChannel: 1,
207
+ * outputChannel: 2,
208
+ * selector: "[data-midi-cc]",
209
+ * watchDOM: true
210
+ * });
211
+ *
212
+ * @example
213
+ * // Programmatic binding (no auto-bind)
214
+ * const midi = await createMIDIController({
215
+ * autoConnect: false,
216
+ * outputChannel: 1
217
+ * });
218
+ * await midi.device.connectOutput("My Synth");
219
+ * const slider = document.getElementById("cutoff");
220
+ * midi.bind(slider, { cc: 74 });
221
+ *
222
+ * @example
223
+ * // With SysEx support
224
+ * const midi = await createMIDIController({
225
+ * sysex: true,
226
+ * onReady: (controller) => {
227
+ * // Send SysEx after connection
228
+ * controller.sendSysEx([0x41, 0x10, 0x42]);
229
+ * }
230
+ * });
231
+ */
232
+ export function createMIDIController(options?: MIDIControlsOptions): Promise<MIDIController>;
233
233
  export { DataAttributeBinder } from './bindings/DataAttributeBinder.js';
234
234
  export { EventEmitter } from './core/EventEmitter.js';
235
235
  export { MIDIDeviceManager } from './core/MIDIDeviceManager.js';
@@ -237,13 +237,17 @@ export * from './utils/midi.js';
237
237
  export * from './utils/sysex.js';
238
238
  export * from './utils/validators.js';
239
239
  /**
240
- * Options for createMIDIController()
240
+ * Options for createMIDIDeviceManager()
241
241
  */
242
- export type MIDIControlsOptions = {
242
+ export type MIDIDeviceManagerOptions = {
243
243
  /**
244
- * - CSS selector for auto-binding elements that have data-midi-* attributes
244
+ * - Callback for status updates (message: string, state: string)
245
245
  */
246
- selector?: string;
246
+ onStatusUpdate?: Function;
247
+ /**
248
+ * - Callback when connection status changes (device: Object, midi: MIDIController)
249
+ */
250
+ onConnectionUpdate?: Function;
247
251
  /**
248
252
  * - Input MIDI channel (1-16)
249
253
  */
@@ -257,42 +261,38 @@ export type MIDIControlsOptions = {
257
261
  */
258
262
  output?: string | number;
259
263
  /**
260
- * - Request SysEx access for sending/receiving system exclusive messages
264
+ * - Request SysEx access
261
265
  */
262
266
  sysex?: boolean;
263
267
  /**
264
- * - Auto-connect to first available output device
268
+ * - Callback when MIDI is ready, receives (midi: MIDIController, deviceManager: MIDIDeviceManager)
265
269
  */
266
- autoConnect?: boolean;
270
+ onReady?: Function;
267
271
  /**
268
- * - Automatically bind dynamically added elements using MutationObserver
272
+ * - Error handler for MIDI access errors
269
273
  */
270
- watchDOM?: boolean;
274
+ onError?: Function;
271
275
  /**
272
- * - Callback when MIDI is ready, receives (controller) as parameter
276
+ * - CSS selector for auto-binding controls
273
277
  */
274
- onReady?: Function;
278
+ selector?: string;
275
279
  /**
276
- * - Error handler for MIDI access errors
280
+ * - Automatically bind dynamically added elements
277
281
  */
278
- onError?: Function;
282
+ watchDOM?: boolean;
279
283
  /**
280
- * - MIDI input device name, ID, or index to connect to for receiving MIDI
284
+ * - MIDI input device name, ID, or index to connect to
281
285
  */
282
286
  input?: string | number;
283
287
  };
284
288
  /**
285
- * Options for createMIDIDeviceManager()
289
+ * Options for createMIDIController()
286
290
  */
287
- export type MIDIDeviceManagerOptions = {
288
- /**
289
- * - Callback for status updates (message: string, state: string)
290
- */
291
- onStatusUpdate?: Function;
291
+ export type MIDIControlsOptions = {
292
292
  /**
293
- * - Callback when connection status changes (device: Object, midi: MIDIController)
293
+ * - CSS selector for auto-binding elements that have data-midi-* attributes
294
294
  */
295
- onConnectionUpdate?: Function;
295
+ selector?: string;
296
296
  /**
297
297
  * - Input MIDI channel (1-16)
298
298
  */
@@ -306,27 +306,27 @@ export type MIDIDeviceManagerOptions = {
306
306
  */
307
307
  output?: string | number;
308
308
  /**
309
- * - Request SysEx access
309
+ * - Request SysEx access for sending/receiving system exclusive messages
310
310
  */
311
311
  sysex?: boolean;
312
312
  /**
313
- * - Callback when MIDI is ready, receives (midi: MIDIController, deviceManager: MIDIDeviceManager)
313
+ * - Auto-connect to first available output device
314
314
  */
315
- onReady?: Function;
315
+ autoConnect?: boolean;
316
316
  /**
317
- * - Error handler for MIDI access errors
317
+ * - Automatically bind dynamically added elements using MutationObserver
318
318
  */
319
- onError?: Function;
319
+ watchDOM?: boolean;
320
320
  /**
321
- * - CSS selector for auto-binding controls
321
+ * - Callback when MIDI is ready, receives (controller) as parameter
322
322
  */
323
- selector?: string;
323
+ onReady?: Function;
324
324
  /**
325
- * - Automatically bind dynamically added elements
325
+ * - Error handler for MIDI access errors
326
326
  */
327
- watchDOM?: boolean;
327
+ onError?: Function;
328
328
  /**
329
- * - MIDI input device name, ID, or index to connect to
329
+ * - MIDI input device name, ID, or index to connect to for receiving MIDI
330
330
  */
331
331
  input?: string | number;
332
332
  };
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.js"],"names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