zds-pickers 4.1.1 → 4.1.4
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 +9 -9
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +3236 -3135
- package/dist/index.es.js.map +1 -1
- package/dist/other/SoundFontProvider.js +6 -5
- package/dist/types/other/SoundFontProvider.d.ts +1 -1
- package/lib/soundfonts/acoustic_grand_piano-mp3.js +107 -0
- package/package.json +9 -2
- package/.editorconfig +0 -19
- package/.github/workflows/codeql-analysis.yml +0 -67
- package/.nvmrc +0 -1
- package/.prettierignore +0 -0
- package/.prettierrc +0 -13
- package/.storybook/main.ts +0 -42
- package/.storybook/manager.ts +0 -12
- package/.storybook/preview.tsx +0 -26
- package/.vscode/extensions.json +0 -32
- package/.vscode/javascript.code-snippets +0 -229
- package/.vscode/settings.json +0 -358
- package/biome.jsonc +0 -158
- package/lib/@types/nebiru-react-rotary-knob.d.ts +0 -20
- package/lib/@types/react-svgmt.d.ts +0 -74
- package/lib/@types/zds-mappings.d.ts +0 -55
- package/lib/@types/zds-react-piano.d.ts +0 -17
- package/lib/hooks/useComponentSize.ts +0 -52
- package/lib/hooks/useStateWithDynamicDefault.ts +0 -13
- package/lib/index.ts +0 -52
- package/lib/midi/ccValues.ts +0 -139
- package/lib/midi/export.ts +0 -88
- package/lib/other/DefaultTooltip.ts +0 -14
- package/lib/other/OctavePlayer.tsx +0 -139
- package/lib/other/SoundFontProvider.tsx +0 -214
- package/lib/other/SvgText.tsx +0 -221
- package/lib/pickers/CCPicker.tsx +0 -28
- package/lib/pickers/ChannelMappingPicker.tsx +0 -150
- package/lib/pickers/ChannelPicker.tsx +0 -84
- package/lib/pickers/KeyPicker.tsx +0 -55
- package/lib/pickers/Knob.tsx +0 -93
- package/lib/pickers/KnobPicker.tsx +0 -93
- package/lib/pickers/LatchPicker.tsx +0 -33
- package/lib/pickers/MappingPicker.tsx +0 -68
- package/lib/pickers/NotePicker.tsx +0 -95
- package/lib/pickers/PianoPicker.tsx +0 -81
- package/lib/pickers/PolarityPicker.tsx +0 -39
- package/lib/pickers/ResponseCurve.tsx +0 -251
- package/lib/pickers/ResponseCurvePicker.tsx +0 -75
- package/lib/pickers/Select.tsx +0 -268
- package/lib/pickers/StatusPicker.tsx +0 -30
- package/lib/pickers/ValuePicker.tsx +0 -67
- package/lib/pickers/knobSkin10.tsx +0 -112
- package/lib/rotaryKnob/InternalInput.tsx +0 -43
- package/lib/rotaryKnob/Types.ts +0 -6
- package/lib/rotaryKnob/helpers/DrawCircle.tsx +0 -41
- package/lib/rotaryKnob/helpers/DrawLine.tsx +0 -32
- package/lib/rotaryKnob/helpers/HelpersOverlay.tsx +0 -43
- package/lib/rotaryKnob/helpers/KnobVisualHelpers.tsx +0 -138
- package/lib/rotaryKnob/index.tsx +0 -417
- package/lib/rotaryKnob/knobdefaultskin.ts +0 -69
- package/lib/rotaryKnob/utils.ts +0 -112
- package/lib/utils.ts +0 -41
- package/stories/assets/sampleStyles.css +0 -365
- package/stories/assets/utils.js +0 -7
- package/stories/picker.stories.tsx +0 -432
- package/tsconfig.json +0 -35
- package/vite.config.ts +0 -41
- /package/{lib/temp → dist/soundfonts}/acoustic_grand_piano-mp3.js +0 -0
|
@@ -21,11 +21,12 @@ if (typeof global !== 'undefined') {
|
|
|
21
21
|
global.MIDI = window.MIDI || { Soundfont: {} };
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
|
-
// Import
|
|
24
|
+
// CRITICAL: Import at top level to ensure bundler processes it
|
|
25
|
+
// Import bundled soundfont to avoid CSP issues in Electron apps
|
|
25
26
|
// NOTE: This adds ~2.2MB to the bundle size. Currently all consumers need piano,
|
|
26
27
|
// but if future web apps don't need audio, consider making this import conditional
|
|
27
28
|
// or implementing lazy loading to reduce bundle size for audio-free use cases.
|
|
28
|
-
import '../
|
|
29
|
+
import '../soundfonts/acoustic_grand_piano-mp3';
|
|
29
30
|
const isDefined = (item) => item !== undefined && item !== null && !Number.isNaN(item);
|
|
30
31
|
const SoundfontProvider = (props) => {
|
|
31
32
|
const { audioContext, format, hostname, instrumentName, onChange, render, soundfont, } = props;
|
|
@@ -41,7 +42,7 @@ const SoundfontProvider = (props) => {
|
|
|
41
42
|
format,
|
|
42
43
|
soundfont,
|
|
43
44
|
nameToUrl: (name, sf, fmt) => `${hostname}/${sf}/${name}-${fmt}.js`,
|
|
44
|
-
}).then(newInstrument => {
|
|
45
|
+
}).then((newInstrument) => {
|
|
45
46
|
setInstrument(newInstrument);
|
|
46
47
|
});
|
|
47
48
|
}
|
|
@@ -108,7 +109,7 @@ const SoundfontProvider = (props) => {
|
|
|
108
109
|
if (instrument) {
|
|
109
110
|
audioContext.resume().then(() => {
|
|
110
111
|
const audioNode = instrument.play(String(midiNumber));
|
|
111
|
-
setActiveAudioNodes(prev => ({ ...prev, [midiNumber]: audioNode }));
|
|
112
|
+
setActiveAudioNodes((prev) => ({ ...prev, [midiNumber]: audioNode }));
|
|
112
113
|
});
|
|
113
114
|
}
|
|
114
115
|
};
|
|
@@ -119,7 +120,7 @@ const SoundfontProvider = (props) => {
|
|
|
119
120
|
}
|
|
120
121
|
const audioNode = activeAudioNodes[midiNumber];
|
|
121
122
|
audioNode.stop();
|
|
122
|
-
setActiveAudioNodes(prev => {
|
|
123
|
+
setActiveAudioNodes((prev) => {
|
|
123
124
|
const { [midiNumber]: _, ...rest } = prev;
|
|
124
125
|
return rest;
|
|
125
126
|
});
|