@antimatter-audio/antimatter-ui 2.4.1 → 2.4.3

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.d.ts CHANGED
@@ -141,6 +141,11 @@ interface KnobProps {
141
141
  knobType?: KNOB_TYPE;
142
142
  className?: string;
143
143
  style?: object;
144
+ /**
145
+ * Returns the scaled value of the parameter. This corresponds to the return value of
146
+ * NormalisableRange::convertFrom0to1() (C++). This value will differ from a linear
147
+ * [0, 1] range if a non-default NormalisableRange was set for the parameter.
148
+ */
144
149
  mockInitialScaledValue?: number;
145
150
  mockProperties?: JuceSliderProperties;
146
151
  }
package/dist/index.js CHANGED
@@ -480,6 +480,7 @@ var clamp = function(val) {
480
480
  var min = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0, max = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : 1;
481
481
  return Math.max(min, Math.min(max, val));
482
482
  };
483
+ // export const roundUpToTwoDecimals = (val: number) => Math.ceil(val * 100) / 100;
483
484
  // mocks the `normalisedToScaledValue` internal method from JUCE
484
485
  // This will allow us to test the JS UI without needing access to the JUCE backend
485
486
  function normalisedToScaledValue(param) {
@@ -595,15 +596,11 @@ var KNOB_TYPE;
595
596
  KNOB_TYPE["BIPOLAR"] = "BIPOLAR";
596
597
  })(KNOB_TYPE || (KNOB_TYPE = {}));
597
598
  function Knob(param) {
598
- var label = param.label, _param_labelPosition = param.labelPosition, labelPosition = _param_labelPosition === void 0 ? POSITION.TOP : _param_labelPosition, _param_showValue = param.showValue, showValue = _param_showValue === void 0 ? true : _param_showValue, _param_knobType = param.knobType, knobType = _param_knobType === void 0 ? "STANDARD" : _param_knobType, id = param.id, className = param.className, _param_mockInitialScaledValue = param.mockInitialScaledValue, mockInitialScaledValue = _param_mockInitialScaledValue === void 0 ? 0 : _param_mockInitialScaledValue, _param_mockProperties = param.// From https://github.com/juce-framework/JUCE/blob/51d11a2be6d5c97ccf12b4e5e827006e19f0555a/modules/juce_gui_extra/native/javascript/index.js#L135
599
- mockProperties, mockProperties = _param_mockProperties === void 0 ? {
599
+ var label = param.label, _param_labelPosition = param.labelPosition, labelPosition = _param_labelPosition === void 0 ? POSITION.TOP : _param_labelPosition, _param_showValue = param.showValue, showValue = _param_showValue === void 0 ? true : _param_showValue, _param_knobType = param.knobType, knobType = _param_knobType === void 0 ? "STANDARD" : _param_knobType, id = param.id, className = param.className, _param_mockInitialScaledValue = param.// Mocks the initial scaled value of the knob for web veiws outside of JUCE
600
+ mockInitialScaledValue, mockInitialScaledValue = _param_mockInitialScaledValue === void 0 ? 0 : _param_mockInitialScaledValue, _param_mockProperties = param.mockProperties, mockProperties = _param_mockProperties === void 0 ? {
600
601
  start: 0,
601
- end: 100,
602
- interval: 0.01,
603
- skew: 1,
604
- name: '',
605
- label: '',
606
- numSteps: 100
602
+ end: 1,
603
+ interval: 0.01
607
604
  } : _param_mockProperties;
608
605
  var knobState = Juce.getSliderState(id);
609
606
  // if isLocalhost is true, the front end app is running outside of JUCE in a browser.
@@ -616,13 +613,9 @@ function Knob(param) {
616
613
  * The meaning of this range is the same as in the case of
617
614
  * AudioProcessorParameter::getValue() (C++).
618
615
  */ // See https://github.com/juce-framework/JUCE/blob/51d11a2be6d5c97ccf12b4e5e827006e19f0555a/modules/juce_gui_extra/native/javascript/index.js#L230C1-L238C6
616
+ // NOTE: We can think of this as a percentage value, in 0 to 1 format
619
617
  var _useState = _sliced_to_array$1(useState(0), 2), normalizedValue = _useState[0], setNormalizedValue = _useState[1];
620
- // getScaledValue:
621
- /**
622
- * Returns the scaled value of the parameter. This corresponds to the return value of
623
- * NormalisableRange::convertFrom0to1() (C++). This value will differ from a linear
624
- * [0, 1] range if a non-default NormalisableRange was set for the parameter.
625
- */ var _useState1 = _sliced_to_array$1(useState(0), 2), scaledValue = _useState1[0], setScaledValue = _useState1[1];
618
+ var _useState1 = _sliced_to_array$1(useState(0), 2), scaledValue = _useState1[0], setScaledValue = _useState1[1];
626
619
  var _useState2 = _sliced_to_array$1(useState(null), 2), properties = _useState2[0], setProperties = _useState2[1];
627
620
  var handleChange = function(_, newValue) {
628
621
  knobState === null || knobState === void 0 ? void 0 : knobState.setNormalisedValue(newValue);
@@ -631,7 +624,7 @@ function Knob(param) {
631
624
  if (isLocalhost) {
632
625
  var newValueClamped = clamp(newValue);
633
626
  setNormalizedValue(newValueClamped);
634
- (mockProperties === null || mockProperties === void 0 ? void 0 : mockProperties.start) && (mockProperties === null || mockProperties === void 0 ? void 0 : mockProperties.end) && setScaledValue(normalisedToScaledValue({
627
+ setScaledValue(normalisedToScaledValue({
635
628
  normalisedValue: newValueClamped,
636
629
  start: mockProperties === null || mockProperties === void 0 ? void 0 : mockProperties.start,
637
630
  end: mockProperties === null || mockProperties === void 0 ? void 0 : mockProperties.end
@@ -642,7 +635,7 @@ function Knob(param) {
642
635
  {
643
636
  if (isLocalhost) {
644
637
  // This sets 'mockProperties' as the value for 'properties' if the app is running in a browser.
645
- setProperties(mockProperties !== null && mockProperties !== void 0 ? mockProperties : null);
638
+ setProperties(mockProperties);
646
639
  setNormalizedValue(getNormalisedValue({
647
640
  scaledValue: mockInitialScaledValue,
648
641
  start: mockProperties === null || mockProperties === void 0 ? void 0 : mockProperties.start,
@@ -672,7 +665,7 @@ function Knob(param) {
672
665
  var bindDrag = useDrag(function(param) {
673
666
  var down = param.down, delta = param.delta;
674
667
  if (down) {
675
- var newValue = normalizedValue + delta[1] * ((properties === null || properties === void 0 ? void 0 : properties.interval) || 0.01) * -1;
668
+ var newValue = normalizedValue + delta[1] * ((properties === null || properties === void 0 ? void 0 : properties.interval) && (properties === null || properties === void 0 ? void 0 : properties.interval.toString().length) > 4 ? 4 : 0.4) * ((properties === null || properties === void 0 ? void 0 : properties.interval) || 0.01) * -1;
676
669
  handleChange(event, newValue);
677
670
  }
678
671
  }, {
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../node_modules/style-inject/dist/style-inject.es.js"],"sourcesContent":["function styleInject(css, ref) {\n if ( ref === void 0 ) ref = {};\n var insertAt = ref.insertAt;\n\n if (!css || typeof document === 'undefined') { return; }\n\n var head = document.head || document.getElementsByTagName('head')[0];\n var style = document.createElement('style');\n style.type = 'text/css';\n\n if (insertAt === 'top') {\n if (head.firstChild) {\n head.insertBefore(style, head.firstChild);\n } else {\n head.appendChild(style);\n }\n } else {\n head.appendChild(style);\n }\n\n if (style.styleSheet) {\n style.styleSheet.cssText = css;\n } else {\n style.appendChild(document.createTextNode(css));\n }\n}\n\nexport default styleInject;\n"],"names":[],"mappings":";;;;;;;;AAAA,SAAS,WAAW,CAAC,GAAG,EAAE,GAAG,EAAE;AAC/B,EAAE,KAAK,GAAG,KAAK,KAAK,CAAC,GAAG,GAAG,GAAG,EAAE,CAAC;AACjC,EAAE,IAAI,QAAQ,GAAG,GAAG,CAAC,QAAQ,CAAC;AAC9B;AACA,EAAE,IAAI,CAAC,GAAG,IAAI,OAAO,QAAQ,KAAK,WAAW,EAAE,EAAE,OAAO,EAAE;AAC1D;AACA,EAAE,IAAI,IAAI,GAAG,QAAQ,CAAC,IAAI,IAAI,QAAQ,CAAC,oBAAoB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;AACvE,EAAE,IAAI,KAAK,GAAG,QAAQ,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;AAC9C,EAAE,KAAK,CAAC,IAAI,GAAG,UAAU,CAAC;AAC1B;AACA,EAAE,IAAI,QAAQ,KAAK,KAAK,EAAE;AAC1B,IAAI,IAAI,IAAI,CAAC,UAAU,EAAE;AACzB,MAAM,IAAI,CAAC,YAAY,CAAC,KAAK,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;AAChD,KAAK,MAAM;AACX,MAAM,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;AAC9B,KAAK;AACL,GAAG,MAAM;AACT,IAAI,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;AAC5B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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","x_google_ignoreList":[0]}
1
+ {"version":3,"file":"index.js","sources":["../node_modules/style-inject/dist/style-inject.es.js"],"sourcesContent":["function styleInject(css, ref) {\n if ( ref === void 0 ) ref = {};\n var insertAt = ref.insertAt;\n\n if (!css || typeof document === 'undefined') { return; }\n\n var head = document.head || document.getElementsByTagName('head')[0];\n var style = document.createElement('style');\n style.type = 'text/css';\n\n if (insertAt === 'top') {\n if (head.firstChild) {\n head.insertBefore(style, head.firstChild);\n } else {\n head.appendChild(style);\n }\n } else {\n head.appendChild(style);\n }\n\n if (style.styleSheet) {\n style.styleSheet.cssText = css;\n } else {\n style.appendChild(document.createTextNode(css));\n }\n}\n\nexport default styleInject;\n"],"names":[],"mappings":";;;;;;;;AAAA,SAAS,WAAW,CAAC,GAAG,EAAE,GAAG,EAAE;AAC/B,EAAE,KAAK,GAAG,KAAK,KAAK,CAAC,GAAG,GAAG,GAAG,EAAE,CAAC;AACjC,EAAE,IAAI,QAAQ,GAAG,GAAG,CAAC,QAAQ,CAAC;AAC9B;AACA,EAAE,IAAI,CAAC,GAAG,IAAI,OAAO,QAAQ,KAAK,WAAW,EAAE,EAAE,OAAO,EAAE;AAC1D;AACA,EAAE,IAAI,IAAI,GAAG,QAAQ,CAAC,IAAI,IAAI,QAAQ,CAAC,oBAAoB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;AACvE,EAAE,IAAI,KAAK,GAAG,QAAQ,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;AAC9C,EAAE,KAAK,CAAC,IAAI,GAAG,UAAU,CAAC;AAC1B;AACA,EAAE,IAAI,QAAQ,KAAK,KAAK,EAAE;AAC1B,IAAI,IAAI,IAAI,CAAC,UAAU,EAAE;AACzB,MAAM,IAAI,CA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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","x_google_ignoreList":[0]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@antimatter-audio/antimatter-ui",
3
- "version": "2.4.1",
3
+ "version": "2.4.3",
4
4
  "description": "React UI component library for Antimatter Audio.",
5
5
  "repository": {
6
6
  "type": "git",