@antimatter-audio/antimatter-ui 10.9.6 → 10.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/dist/advanced/ModMatrix/ModMatrix.d.ts.map +1 -1
- package/dist/advanced/ModMatrix/ModMatrixRow.d.ts.map +1 -1
- package/dist/advanced/ModuleFooter/LFOTab.d.ts.map +1 -1
- package/dist/advanced/ModuleHeader/ModuleHeader.d.ts.map +1 -1
- package/dist/common/types.d.ts +0 -5
- package/dist/common/types.d.ts.map +1 -1
- package/dist/common/utils.d.ts +23 -13
- package/dist/common/utils.d.ts.map +1 -1
- package/dist/core/Box/Box.d.ts +1 -0
- package/dist/core/Box/Box.d.ts.map +1 -1
- package/dist/core/Dropdown/Dropdown.d.ts.map +1 -1
- package/dist/core/Input/Input.d.ts +7 -12
- package/dist/core/Input/Input.d.ts.map +1 -1
- package/dist/core/Slider/RotarySlider.d.ts.map +1 -1
- package/dist/core/Slider/utils.d.ts.map +1 -1
- package/dist/hooks/useSlider.d.ts +5 -0
- package/dist/hooks/useSlider.d.ts.map +1 -1
- package/dist/index.js +359 -364
- package/dist/index.js.map +1 -1
- package/dist/src/advanced/ModMatrix/ModMatrix.d.ts.map +1 -1
- package/dist/src/advanced/ModuleFooter/LFOTab.d.ts.map +1 -1
- package/dist/src/advanced/ModuleHeader/ModuleHeader.d.ts.map +1 -1
- package/dist/src/common/types.d.ts +0 -5
- package/dist/src/common/types.d.ts.map +1 -1
- package/dist/src/common/utils.d.ts +23 -13
- package/dist/src/common/utils.d.ts.map +1 -1
- package/dist/src/core/Dropdown/Dropdown.d.ts.map +1 -1
- package/dist/src/core/Input/Input.d.ts +4 -5
- package/dist/src/core/Input/Input.d.ts.map +1 -1
- package/dist/src/core/Slider/RotarySlider.d.ts.map +1 -1
- package/dist/src/core/Slider/utils.d.ts.map +1 -1
- package/dist/src/hooks/useSlider.d.ts +3 -0
- package/dist/src/hooks/useSlider.d.ts.map +1 -1
- package/dist/src/index.d.ts +2 -4
- package/dist/src/index.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -67,12 +67,6 @@ var Width = /*#__PURE__*/ function(Width) {
|
|
|
67
67
|
Width["auto"] = "auto";
|
|
68
68
|
return Width;
|
|
69
69
|
}({});
|
|
70
|
-
var InputErrorStates = /*#__PURE__*/ function(InputErrorStates) {
|
|
71
|
-
InputErrorStates["exceedsMaxLength"] = "exceedsMaxLength";
|
|
72
|
-
InputErrorStates["valueOutOfRange"] = "valueOutOfRange";
|
|
73
|
-
InputErrorStates["invalidCharacter"] = "invalidCharacter";
|
|
74
|
-
return InputErrorStates;
|
|
75
|
-
}({});
|
|
76
70
|
var FontSizes = /*#__PURE__*/ function(FontSizes) {
|
|
77
71
|
FontSizes["xSmall"] = "xs";
|
|
78
72
|
FontSizes["small"] = "sm";
|
|
@@ -170,7 +164,7 @@ function _array_like_to_array$d(arr, len) {
|
|
|
170
164
|
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
171
165
|
return arr2;
|
|
172
166
|
}
|
|
173
|
-
function _array_with_holes$
|
|
167
|
+
function _array_with_holes$c(arr) {
|
|
174
168
|
if (Array.isArray(arr)) return arr;
|
|
175
169
|
}
|
|
176
170
|
function _define_property$k(obj, key, value) {
|
|
@@ -186,7 +180,7 @@ function _define_property$k(obj, key, value) {
|
|
|
186
180
|
}
|
|
187
181
|
return obj;
|
|
188
182
|
}
|
|
189
|
-
function _iterable_to_array_limit$
|
|
183
|
+
function _iterable_to_array_limit$c(arr, i) {
|
|
190
184
|
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
191
185
|
if (_i == null) return;
|
|
192
186
|
var _arr = [];
|
|
@@ -210,7 +204,7 @@ function _iterable_to_array_limit$d(arr, i) {
|
|
|
210
204
|
}
|
|
211
205
|
return _arr;
|
|
212
206
|
}
|
|
213
|
-
function _non_iterable_rest$
|
|
207
|
+
function _non_iterable_rest$c() {
|
|
214
208
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
215
209
|
}
|
|
216
210
|
function _object_spread$k(target) {
|
|
@@ -228,8 +222,8 @@ function _object_spread$k(target) {
|
|
|
228
222
|
}
|
|
229
223
|
return target;
|
|
230
224
|
}
|
|
231
|
-
function _sliced_to_array$
|
|
232
|
-
return _array_with_holes$
|
|
225
|
+
function _sliced_to_array$c(arr, i) {
|
|
226
|
+
return _array_with_holes$c(arr) || _iterable_to_array_limit$c(arr, i) || _unsupported_iterable_to_array$d(arr, i) || _non_iterable_rest$c();
|
|
233
227
|
}
|
|
234
228
|
function _unsupported_iterable_to_array$d(o, minLen) {
|
|
235
229
|
if (!o) return;
|
|
@@ -245,7 +239,7 @@ function Button(param) {
|
|
|
245
239
|
] : _param_padding, _param_margin = param.margin, margin = _param_margin === void 0 ? [
|
|
246
240
|
Spacing.none
|
|
247
241
|
] : _param_margin, _param_type = param.type, type = _param_type === void 0 ? ButtonType.latch : _param_type, _param_size = param.size, size = _param_size === void 0 ? ButtonSize.large : _param_size;
|
|
248
|
-
var _React_useState = _sliced_to_array$
|
|
242
|
+
var _React_useState = _sliced_to_array$c(React__default.useState(false), 2), isSelected = _React_useState[0], setIsSelected = _React_useState[1];
|
|
249
243
|
var buttonState = Juce.getToggleState(id);
|
|
250
244
|
var isLocalhost = window.location.hostname === 'localhost';
|
|
251
245
|
// Update the local state when the ID changes
|
|
@@ -363,10 +357,31 @@ function useObservable(param) {
|
|
|
363
357
|
};
|
|
364
358
|
}
|
|
365
359
|
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
360
|
+
function _array_like_to_array$c(arr, len) {
|
|
361
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
362
|
+
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
363
|
+
return arr2;
|
|
364
|
+
}
|
|
365
|
+
function _array_without_holes$1(arr) {
|
|
366
|
+
if (Array.isArray(arr)) return _array_like_to_array$c(arr);
|
|
367
|
+
}
|
|
368
|
+
function _iterable_to_array$1(iter) {
|
|
369
|
+
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
370
|
+
}
|
|
371
|
+
function _non_iterable_spread$1() {
|
|
372
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
373
|
+
}
|
|
374
|
+
function _to_consumable_array$1(arr) {
|
|
375
|
+
return _array_without_holes$1(arr) || _iterable_to_array$1(arr) || _unsupported_iterable_to_array$c(arr) || _non_iterable_spread$1();
|
|
376
|
+
}
|
|
377
|
+
function _unsupported_iterable_to_array$c(o, minLen) {
|
|
378
|
+
if (!o) return;
|
|
379
|
+
if (typeof o === "string") return _array_like_to_array$c(o, minLen);
|
|
380
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
381
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
382
|
+
if (n === "Map" || n === "Set") return Array.from(n);
|
|
383
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$c(o, minLen);
|
|
384
|
+
}
|
|
370
385
|
// export const roundUpToTwoDecimals = (val: number) => Math.ceil(val * 100) / 100;
|
|
371
386
|
// mocks the `normalisedToScaledValue` internal method from JUCE
|
|
372
387
|
// This will allow us to test the JS UI without needing access to the JUCE backend
|
|
@@ -381,7 +396,6 @@ function normalisedToScaled(param) {
|
|
|
381
396
|
function scaledToNormalised(param) {
|
|
382
397
|
var scaledValue = param.scaledValue, properties = param.properties;
|
|
383
398
|
var start = properties.start, end = properties.end, skew = properties.skew;
|
|
384
|
-
console.log(start, end, skew, 'start, end, skew');
|
|
385
399
|
return Math.pow((scaledValue - start) / (end - start), skew);
|
|
386
400
|
}
|
|
387
401
|
var decimalToPercent = function(decimal) {
|
|
@@ -390,13 +404,104 @@ var decimalToPercent = function(decimal) {
|
|
|
390
404
|
var percentToDecimal = function(percent) {
|
|
391
405
|
return Math.round(0.01 * (typeof percent === 'string' ? parseFloat(percent) : percent));
|
|
392
406
|
};
|
|
407
|
+
var inputCharacterIsValid = function(char) {
|
|
408
|
+
var validCharacter = /^[\d.-]$/;
|
|
409
|
+
return validCharacter.test(char.toString());
|
|
410
|
+
};
|
|
411
|
+
var clamp = function(val) {
|
|
412
|
+
var min = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0, max = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : 1;
|
|
413
|
+
return Math.max(min, Math.min(max, val));
|
|
414
|
+
};
|
|
415
|
+
function snapToLegalValue(param) {
|
|
416
|
+
var value = param.value, properties = param.properties;
|
|
417
|
+
var interval = properties.interval, start = properties.start, end = properties.end;
|
|
418
|
+
if (interval == 0) return value;
|
|
419
|
+
var roundedInterval = parseFloat(interval === null || interval === void 0 ? void 0 : interval.toFixed(2));
|
|
420
|
+
var formattedValue = start + roundedInterval * Math.floor((value - start) / roundedInterval + 0.5);
|
|
421
|
+
return clamp(parseFloat(formattedValue.toFixed(2)), start, end);
|
|
422
|
+
}
|
|
423
|
+
// const validNumber = /^-?\.?\d+(\.\d)?$/;
|
|
424
|
+
// const lastNumberIsDigit = /\d$/;
|
|
425
|
+
var validateInputChange = function(e) {
|
|
426
|
+
return e.nativeEvent.data === '' || e.nativeEvent.data === null || inputCharacterIsValid(e.nativeEvent.data);
|
|
427
|
+
};
|
|
428
|
+
var getValidValueForInput = function(param) {
|
|
429
|
+
var value = param.value, oldValue = param.oldValue, properties = param.properties;
|
|
430
|
+
var _splitValueArray_;
|
|
431
|
+
// TODO: Clean up
|
|
432
|
+
var matchCriteria = /^-?(?:\d+\.\d+|\d+|\.\d+)$/g;
|
|
433
|
+
var splitValue = value.toString().matchAll(matchCriteria);
|
|
434
|
+
var splitValueArray = _to_consumable_array$1(splitValue);
|
|
435
|
+
var validValue = splitValueArray === null || splitValueArray === void 0 ? void 0 : (_splitValueArray_ = splitValueArray[0]) === null || _splitValueArray_ === void 0 ? void 0 : _splitValueArray_[0];
|
|
436
|
+
var start = properties.start, end = properties.end;
|
|
437
|
+
if (validValue !== null && validValue !== undefined) {
|
|
438
|
+
if (parseFloat(validValue) > end) {
|
|
439
|
+
return end;
|
|
440
|
+
} else if (parseFloat(validValue) < start) {
|
|
441
|
+
return start;
|
|
442
|
+
} else {
|
|
443
|
+
return snapToLegalValue({
|
|
444
|
+
value: parseFloat(validValue),
|
|
445
|
+
properties: properties
|
|
446
|
+
});
|
|
447
|
+
}
|
|
448
|
+
} else {
|
|
449
|
+
return oldValue;
|
|
450
|
+
}
|
|
451
|
+
};
|
|
452
|
+
var getBarTransformStyles = function(param) {
|
|
453
|
+
var polarity = param.polarity, orientation = param.orientation, normalisedValue = param.normalisedValue;
|
|
454
|
+
var wholeNumberNormalisedValue = normalisedValue * 100;
|
|
455
|
+
var linearValue = wholeNumberNormalisedValue ? parseFloat(wholeNumberNormalisedValue === null || wholeNumberNormalisedValue === void 0 ? void 0 : wholeNumberNormalisedValue.toFixed(2)) : 0;
|
|
456
|
+
var bipolarValue = (wholeNumberNormalisedValue - 50) / 100;
|
|
457
|
+
if (polarity === Polarity.linear) {
|
|
458
|
+
return orientation === Orientation.horizontal ? {
|
|
459
|
+
width: linearValue ? "100%" : '1px',
|
|
460
|
+
height: '100%',
|
|
461
|
+
transform: linearValue ? "scale(".concat(Math.ceil(linearValue) * 0.01, ", 1)") : 'none',
|
|
462
|
+
transformOrigin: 'center left',
|
|
463
|
+
top: '0',
|
|
464
|
+
bottom: '0',
|
|
465
|
+
left: '0'
|
|
466
|
+
} : {
|
|
467
|
+
width: "100%",
|
|
468
|
+
height: linearValue ? '100%' : '1px',
|
|
469
|
+
transform: "scale(1, ".concat(Math.ceil(linearValue) * 0.01, ")"),
|
|
470
|
+
transformOrigin: 'bottom center',
|
|
471
|
+
top: '0',
|
|
472
|
+
bottom: '0',
|
|
473
|
+
left: '0'
|
|
474
|
+
};
|
|
475
|
+
} else {
|
|
476
|
+
return orientation === Orientation.horizontal ? {
|
|
477
|
+
width: bipolarValue ? "100%" : '1px',
|
|
478
|
+
height: '100%',
|
|
479
|
+
transform: bipolarValue ? "scale(".concat(bipolarValue, ", 1)") : 'none',
|
|
480
|
+
transformOrigin: 'left center',
|
|
481
|
+
top: '0',
|
|
482
|
+
bottom: '0',
|
|
483
|
+
left: '50%'
|
|
484
|
+
} : {
|
|
485
|
+
width: "100%",
|
|
486
|
+
height: bipolarValue ? '100%' : '1px',
|
|
487
|
+
transform: bipolarValue ? "scale(1, ".concat(bipolarValue, ")") : 'none',
|
|
488
|
+
transformOrigin: 'bottom center',
|
|
489
|
+
bottom: '50%',
|
|
490
|
+
left: '0',
|
|
491
|
+
right: '0'
|
|
492
|
+
};
|
|
493
|
+
}
|
|
494
|
+
};
|
|
495
|
+
var randomizeValue = function(min, max) {
|
|
496
|
+
return Math.random() * (max - min) + min;
|
|
497
|
+
};
|
|
393
498
|
|
|
394
|
-
function _array_like_to_array$
|
|
499
|
+
function _array_like_to_array$b(arr, len) {
|
|
395
500
|
if (len == null || len > arr.length) len = arr.length;
|
|
396
501
|
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
397
502
|
return arr2;
|
|
398
503
|
}
|
|
399
|
-
function _array_with_holes$
|
|
504
|
+
function _array_with_holes$b(arr) {
|
|
400
505
|
if (Array.isArray(arr)) return arr;
|
|
401
506
|
}
|
|
402
507
|
function _define_property$j(obj, key, value) {
|
|
@@ -412,7 +517,7 @@ function _define_property$j(obj, key, value) {
|
|
|
412
517
|
}
|
|
413
518
|
return obj;
|
|
414
519
|
}
|
|
415
|
-
function _iterable_to_array_limit$
|
|
520
|
+
function _iterable_to_array_limit$b(arr, i) {
|
|
416
521
|
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
417
522
|
if (_i == null) return;
|
|
418
523
|
var _arr = [];
|
|
@@ -436,7 +541,7 @@ function _iterable_to_array_limit$c(arr, i) {
|
|
|
436
541
|
}
|
|
437
542
|
return _arr;
|
|
438
543
|
}
|
|
439
|
-
function _non_iterable_rest$
|
|
544
|
+
function _non_iterable_rest$b() {
|
|
440
545
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
441
546
|
}
|
|
442
547
|
function _object_spread$j(target) {
|
|
@@ -473,16 +578,16 @@ function _object_spread_props$4(target, source) {
|
|
|
473
578
|
}
|
|
474
579
|
return target;
|
|
475
580
|
}
|
|
476
|
-
function _sliced_to_array$
|
|
477
|
-
return _array_with_holes$
|
|
581
|
+
function _sliced_to_array$b(arr, i) {
|
|
582
|
+
return _array_with_holes$b(arr) || _iterable_to_array_limit$b(arr, i) || _unsupported_iterable_to_array$b(arr, i) || _non_iterable_rest$b();
|
|
478
583
|
}
|
|
479
|
-
function _unsupported_iterable_to_array$
|
|
584
|
+
function _unsupported_iterable_to_array$b(o, minLen) {
|
|
480
585
|
if (!o) return;
|
|
481
|
-
if (typeof o === "string") return _array_like_to_array$
|
|
586
|
+
if (typeof o === "string") return _array_like_to_array$b(o, minLen);
|
|
482
587
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
483
588
|
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
484
589
|
if (n === "Map" || n === "Set") return Array.from(n);
|
|
485
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$
|
|
590
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$b(o, minLen);
|
|
486
591
|
}
|
|
487
592
|
// Initial state
|
|
488
593
|
var defaultGlobalStateValue = {
|
|
@@ -567,7 +672,7 @@ function useGlobalContext(selector) {
|
|
|
567
672
|
// Context provider
|
|
568
673
|
function GlobalContextProvider(param) {
|
|
569
674
|
var children = param.children;
|
|
570
|
-
var _useReducer = _sliced_to_array$
|
|
675
|
+
var _useReducer = _sliced_to_array$b(useReducer(reducer, defaultGlobalStateValue), 2), state = _useReducer[0], dispatch = _useReducer[1];
|
|
571
676
|
var highlightedItemChanged = useCallback(function(highlightedItem) {
|
|
572
677
|
dispatch({
|
|
573
678
|
type: 'HIGHLIGHTED_ITEM_CHANGED',
|
|
@@ -675,15 +780,15 @@ function GlobalContextProvider(param) {
|
|
|
675
780
|
}, children);
|
|
676
781
|
}
|
|
677
782
|
|
|
678
|
-
function _array_like_to_array$
|
|
783
|
+
function _array_like_to_array$a(arr, len) {
|
|
679
784
|
if (len == null || len > arr.length) len = arr.length;
|
|
680
785
|
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
681
786
|
return arr2;
|
|
682
787
|
}
|
|
683
|
-
function _array_with_holes$
|
|
788
|
+
function _array_with_holes$a(arr) {
|
|
684
789
|
if (Array.isArray(arr)) return arr;
|
|
685
790
|
}
|
|
686
|
-
function _iterable_to_array_limit$
|
|
791
|
+
function _iterable_to_array_limit$a(arr, i) {
|
|
687
792
|
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
688
793
|
if (_i == null) return;
|
|
689
794
|
var _arr = [];
|
|
@@ -707,26 +812,26 @@ function _iterable_to_array_limit$b(arr, i) {
|
|
|
707
812
|
}
|
|
708
813
|
return _arr;
|
|
709
814
|
}
|
|
710
|
-
function _non_iterable_rest$
|
|
815
|
+
function _non_iterable_rest$a() {
|
|
711
816
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
712
817
|
}
|
|
713
|
-
function _sliced_to_array$
|
|
714
|
-
return _array_with_holes$
|
|
818
|
+
function _sliced_to_array$a(arr, i) {
|
|
819
|
+
return _array_with_holes$a(arr) || _iterable_to_array_limit$a(arr, i) || _unsupported_iterable_to_array$a(arr, i) || _non_iterable_rest$a();
|
|
715
820
|
}
|
|
716
|
-
function _unsupported_iterable_to_array$
|
|
821
|
+
function _unsupported_iterable_to_array$a(o, minLen) {
|
|
717
822
|
if (!o) return;
|
|
718
|
-
if (typeof o === "string") return _array_like_to_array$
|
|
823
|
+
if (typeof o === "string") return _array_like_to_array$a(o, minLen);
|
|
719
824
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
720
825
|
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
721
826
|
if (n === "Map" || n === "Set") return Array.from(n);
|
|
722
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$
|
|
827
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$a(o, minLen);
|
|
723
828
|
}
|
|
724
829
|
var useDropdown = function(param) {
|
|
725
830
|
var id = param.id, label = param.label, _param_items = param.items, items = _param_items === void 0 ? [] : _param_items, filter = param.filter, onChange = param.onChange, _param_displayValInHeader = param.displayValInHeader, displayValInHeader = _param_displayValInHeader === void 0 ? true : _param_displayValInHeader;
|
|
726
831
|
var _properties_choices;
|
|
727
832
|
var comboBoxState = Juce.getComboBoxState(id);
|
|
728
|
-
var _useState = _sliced_to_array$
|
|
729
|
-
var _useState1 = _sliced_to_array$
|
|
833
|
+
var _useState = _sliced_to_array$a(useState(comboBoxState.getChoiceIndex()), 2), index = _useState[0], setIndex = _useState[1];
|
|
834
|
+
var _useState1 = _sliced_to_array$a(useState(comboBoxState.properties), 2), properties = _useState1[0], setProperties = _useState1[1];
|
|
730
835
|
var setHighlightedItem = useGlobalContext().setHighlightedItem;
|
|
731
836
|
var choices = items.length ? items : (properties === null || properties === void 0 ? void 0 : (_properties_choices = properties.choices) === null || _properties_choices === void 0 ? void 0 : _properties_choices.length) ? properties === null || properties === void 0 ? void 0 : properties.choices : [];
|
|
732
837
|
var filteredChoices = filter ? choices === null || choices === void 0 ? void 0 : choices.filter(function(item) {
|
|
@@ -1051,7 +1156,9 @@ function Dropdown(param) {
|
|
|
1051
1156
|
}), value = _useDropdown.value, choices = _useDropdown.choices, onMouseEnter = _useDropdown.onMouseEnter, handleChange = _useDropdown.handleChange;
|
|
1052
1157
|
return /*#__PURE__*/ React__default.createElement(Box, {
|
|
1053
1158
|
flexDirection: Box.flexDirection.column,
|
|
1054
|
-
onMouseEnter: onMouseEnter
|
|
1159
|
+
onMouseEnter: onMouseEnter,
|
|
1160
|
+
width: "100%",
|
|
1161
|
+
flex: "0 1 auto"
|
|
1055
1162
|
}, /*#__PURE__*/ React__default.createElement(Listbox, {
|
|
1056
1163
|
value: value,
|
|
1057
1164
|
onChange: handleChange
|
|
@@ -1082,6 +1189,9 @@ function Dropdown(param) {
|
|
|
1082
1189
|
}, item);
|
|
1083
1190
|
}))), /*#__PURE__*/ React__default.createElement(Label, {
|
|
1084
1191
|
padding: [
|
|
1192
|
+
Label.padding.mediumSmall,
|
|
1193
|
+
Label.padding.mediumSmall,
|
|
1194
|
+
Label.padding.none,
|
|
1085
1195
|
Label.padding.mediumSmall
|
|
1086
1196
|
],
|
|
1087
1197
|
fontSize: Label.fontSize.xSmall,
|
|
@@ -1092,90 +1202,15 @@ function Dropdown(param) {
|
|
|
1092
1202
|
}));
|
|
1093
1203
|
}
|
|
1094
1204
|
|
|
1095
|
-
var
|
|
1096
|
-
var value = param.value, minLength = param.minLength, maxLength = param.maxLength, min = param.min, max = param.max, _param_type = param.type, type = _param_type === void 0 ? InputTypes.text : _param_type;
|
|
1097
|
-
// TODO: Clean up
|
|
1098
|
-
var errorMessages = [];
|
|
1099
|
-
var isIncomplete = false;
|
|
1100
|
-
var length = value.toString().length;
|
|
1101
|
-
if (length > maxLength && (errorMessages === null || errorMessages === void 0 ? void 0 : errorMessages.indexOf(InputErrorStates === null || InputErrorStates === void 0 ? void 0 : InputErrorStates.exceedsMaxLength)) === -1) {
|
|
1102
|
-
errorMessages === null || errorMessages === void 0 ? void 0 : errorMessages.push(InputErrorStates === null || InputErrorStates === void 0 ? void 0 : InputErrorStates.exceedsMaxLength);
|
|
1103
|
-
}
|
|
1104
|
-
if (length < minLength) {
|
|
1105
|
-
isIncomplete = true;
|
|
1106
|
-
}
|
|
1107
|
-
if (type === InputTypes.number) {
|
|
1108
|
-
if (!(value === '' || /^-?[\d-.]+$/.test(value.toString()))) {
|
|
1109
|
-
errorMessages.push(InputErrorStates.invalidCharacter);
|
|
1110
|
-
}
|
|
1111
|
-
if (typeof value === 'number') {
|
|
1112
|
-
if ((value > max || value < min) && (errorMessages === null || errorMessages === void 0 ? void 0 : errorMessages.indexOf(InputErrorStates.valueOutOfRange)) === -1) {
|
|
1113
|
-
errorMessages === null || errorMessages === void 0 ? void 0 : errorMessages.push(InputErrorStates.valueOutOfRange);
|
|
1114
|
-
}
|
|
1115
|
-
}
|
|
1116
|
-
}
|
|
1117
|
-
return {
|
|
1118
|
-
errorMessages: errorMessages,
|
|
1119
|
-
isIncomplete: isIncomplete,
|
|
1120
|
-
isValid: !errorMessages.length && !isIncomplete
|
|
1121
|
-
};
|
|
1122
|
-
};
|
|
1123
|
-
var getBarTransformStyles = function(param) {
|
|
1124
|
-
var polarity = param.polarity, orientation = param.orientation, normalisedValue = param.normalisedValue;
|
|
1125
|
-
var wholeNumberNormalisedValue = normalisedValue * 100;
|
|
1126
|
-
var linearValue = wholeNumberNormalisedValue ? parseFloat(wholeNumberNormalisedValue === null || wholeNumberNormalisedValue === void 0 ? void 0 : wholeNumberNormalisedValue.toFixed(2)) : 0;
|
|
1127
|
-
var bipolarValue = (wholeNumberNormalisedValue - 50) / 100;
|
|
1128
|
-
if (polarity === Polarity.linear) {
|
|
1129
|
-
return orientation === Orientation.horizontal ? {
|
|
1130
|
-
width: linearValue ? "100%" : '1px',
|
|
1131
|
-
height: '100%',
|
|
1132
|
-
transform: linearValue ? "scale(".concat(Math.ceil(linearValue) * 0.01, ", 1)") : 'none',
|
|
1133
|
-
transformOrigin: 'center left',
|
|
1134
|
-
top: '0',
|
|
1135
|
-
bottom: '0',
|
|
1136
|
-
left: '0'
|
|
1137
|
-
} : {
|
|
1138
|
-
width: "100%",
|
|
1139
|
-
height: linearValue ? '100%' : '1px',
|
|
1140
|
-
transform: "scale(1, ".concat(Math.ceil(linearValue) * 0.01, ")"),
|
|
1141
|
-
transformOrigin: 'bottom center',
|
|
1142
|
-
top: '0',
|
|
1143
|
-
bottom: '0',
|
|
1144
|
-
left: '0'
|
|
1145
|
-
};
|
|
1146
|
-
} else {
|
|
1147
|
-
return orientation === Orientation.horizontal ? {
|
|
1148
|
-
width: bipolarValue ? "100%" : '1px',
|
|
1149
|
-
height: '100%',
|
|
1150
|
-
transform: bipolarValue ? "scale(".concat(bipolarValue, ", 1)") : 'none',
|
|
1151
|
-
transformOrigin: 'left center',
|
|
1152
|
-
top: '0',
|
|
1153
|
-
bottom: '0',
|
|
1154
|
-
left: '50%'
|
|
1155
|
-
} : {
|
|
1156
|
-
width: "100%",
|
|
1157
|
-
height: bipolarValue ? '100%' : '1px',
|
|
1158
|
-
transform: bipolarValue ? "scale(1, ".concat(bipolarValue, ")") : 'none',
|
|
1159
|
-
transformOrigin: 'bottom center',
|
|
1160
|
-
bottom: '50%',
|
|
1161
|
-
left: '0',
|
|
1162
|
-
right: '0'
|
|
1163
|
-
};
|
|
1164
|
-
}
|
|
1165
|
-
};
|
|
1166
|
-
var randomizeValue = function(min, max) {
|
|
1167
|
-
return Math.random() * (max - min) + min;
|
|
1168
|
-
};
|
|
1169
|
-
|
|
1170
|
-
var css_248z$7 = ".TextInput {\n user-select: none;\n -webkit-user-select: none;\n}\n\n.TextInput::-moz-selection {\n background: transparent;\n}\n.TextInput::selection {\n background: transparent;\n}\n";
|
|
1205
|
+
var css_248z$7 = ".TextInput {\n pointer-events: auto;\n /* font-size: var(--text-xs); */\n}\n\n.TextInput::-moz-selection {\n background: transparent;\n}\n.TextInput::selection {\n background: transparent;\n}\n\n.TextInput.is-highlighted {\n background: var(--color-gray-600);\n border: 1px solid var(--color-gray-500);\n}\n";
|
|
1171
1206
|
styleInject(css_248z$7);
|
|
1172
1207
|
|
|
1173
|
-
function _array_like_to_array$
|
|
1208
|
+
function _array_like_to_array$9(arr, len) {
|
|
1174
1209
|
if (len == null || len > arr.length) len = arr.length;
|
|
1175
1210
|
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
1176
1211
|
return arr2;
|
|
1177
1212
|
}
|
|
1178
|
-
function _array_with_holes$
|
|
1213
|
+
function _array_with_holes$9(arr) {
|
|
1179
1214
|
if (Array.isArray(arr)) return arr;
|
|
1180
1215
|
}
|
|
1181
1216
|
function _define_property$f(obj, key, value) {
|
|
@@ -1191,7 +1226,7 @@ function _define_property$f(obj, key, value) {
|
|
|
1191
1226
|
}
|
|
1192
1227
|
return obj;
|
|
1193
1228
|
}
|
|
1194
|
-
function _iterable_to_array_limit$
|
|
1229
|
+
function _iterable_to_array_limit$9(arr, i) {
|
|
1195
1230
|
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
1196
1231
|
if (_i == null) return;
|
|
1197
1232
|
var _arr = [];
|
|
@@ -1215,7 +1250,7 @@ function _iterable_to_array_limit$a(arr, i) {
|
|
|
1215
1250
|
}
|
|
1216
1251
|
return _arr;
|
|
1217
1252
|
}
|
|
1218
|
-
function _non_iterable_rest$
|
|
1253
|
+
function _non_iterable_rest$9() {
|
|
1219
1254
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
1220
1255
|
}
|
|
1221
1256
|
function _object_spread$f(target) {
|
|
@@ -1233,16 +1268,16 @@ function _object_spread$f(target) {
|
|
|
1233
1268
|
}
|
|
1234
1269
|
return target;
|
|
1235
1270
|
}
|
|
1236
|
-
function _sliced_to_array$
|
|
1237
|
-
return _array_with_holes$
|
|
1271
|
+
function _sliced_to_array$9(arr, i) {
|
|
1272
|
+
return _array_with_holes$9(arr) || _iterable_to_array_limit$9(arr, i) || _unsupported_iterable_to_array$9(arr, i) || _non_iterable_rest$9();
|
|
1238
1273
|
}
|
|
1239
|
-
function _unsupported_iterable_to_array$
|
|
1274
|
+
function _unsupported_iterable_to_array$9(o, minLen) {
|
|
1240
1275
|
if (!o) return;
|
|
1241
|
-
if (typeof o === "string") return _array_like_to_array$
|
|
1276
|
+
if (typeof o === "string") return _array_like_to_array$9(o, minLen);
|
|
1242
1277
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
1243
1278
|
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
1244
1279
|
if (n === "Map" || n === "Set") return Array.from(n);
|
|
1245
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$
|
|
1280
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$9(o, minLen);
|
|
1246
1281
|
}
|
|
1247
1282
|
// import { decimalToPercent, percentToDecimal } from '../../common/utils';
|
|
1248
1283
|
// import debounce from 'lodash.debounce';
|
|
@@ -1252,62 +1287,105 @@ var InputTypes = /*#__PURE__*/ function(InputTypes) {
|
|
|
1252
1287
|
return InputTypes;
|
|
1253
1288
|
}({});
|
|
1254
1289
|
function Input(param) {
|
|
1255
|
-
var onComplete = param.onComplete, value = param.value
|
|
1290
|
+
var onComplete = param.onComplete, value = param.value; param.min; param.max; var _param_fontSize = param.fontSize, fontSize = _param_fontSize === void 0 ? FontSizes.xSmall : _param_fontSize, style = param.style, className = param.className, id = param.id, _param_textColor = param.textColor, textColor = _param_textColor === void 0 ? 'var(--color-text)' : _param_textColor;
|
|
1256
1291
|
var _inputRef_current;
|
|
1257
|
-
var _useState = _sliced_to_array$
|
|
1258
|
-
|
|
1259
|
-
var
|
|
1292
|
+
var _useState = _sliced_to_array$9(useState(value), 2), internalValue = _useState[0], setInternalValue = _useState[1];
|
|
1293
|
+
// const [hasError, setHasError] = useState<boolean>(false);
|
|
1294
|
+
var _useState1 = _sliced_to_array$9(useState(false), 2), isHighlighted = _useState1[0], setIsHighlighted = _useState1[1];
|
|
1260
1295
|
var valueRef = useRef(null);
|
|
1261
|
-
var
|
|
1296
|
+
var isLocalhost = window.location.hostname === 'localhost';
|
|
1297
|
+
// Sets up listeners to handle changes on the backend
|
|
1298
|
+
useEffect(function() {
|
|
1299
|
+
var sliderState = Juce.getSliderState(id);
|
|
1300
|
+
var legalVal = snapToLegalValue({
|
|
1301
|
+
value: sliderState === null || sliderState === void 0 ? void 0 : sliderState.scaledValue,
|
|
1302
|
+
properties: sliderState.properties
|
|
1303
|
+
});
|
|
1304
|
+
setInternalValue(legalVal);
|
|
1305
|
+
valueRef.current = legalVal;
|
|
1306
|
+
}, [
|
|
1307
|
+
id
|
|
1308
|
+
]);
|
|
1309
|
+
useEffect(function() {
|
|
1310
|
+
if (!isLocalhost) {
|
|
1311
|
+
var sliderState = Juce.getSliderState(id);
|
|
1312
|
+
var valueListenerId = sliderState === null || sliderState === void 0 ? void 0 : sliderState.valueChangedEvent.addListener(function(e) {
|
|
1313
|
+
var legalVal = snapToLegalValue({
|
|
1314
|
+
value: sliderState === null || sliderState === void 0 ? void 0 : sliderState.scaledValue,
|
|
1315
|
+
properties: sliderState.properties
|
|
1316
|
+
});
|
|
1317
|
+
valueRef.current = legalVal;
|
|
1318
|
+
setInternalValue(legalVal);
|
|
1319
|
+
});
|
|
1320
|
+
return function() {
|
|
1321
|
+
sliderState === null || sliderState === void 0 ? void 0 : sliderState.valueChangedEvent.removeListener(valueListenerId);
|
|
1322
|
+
};
|
|
1323
|
+
}
|
|
1324
|
+
return;
|
|
1325
|
+
}, [
|
|
1326
|
+
window
|
|
1327
|
+
]);
|
|
1262
1328
|
// (inputValue === '' || /^-?\d+$/.test(inputValue)
|
|
1263
|
-
function
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1329
|
+
function clickListener(event) {
|
|
1330
|
+
if (event.target.id === "".concat(id, "-input")) {
|
|
1331
|
+
var _document_getElementById;
|
|
1332
|
+
(_document_getElementById = document.getElementById("".concat(id, "-input"))) === null || _document_getElementById === void 0 ? void 0 : _document_getElementById.focus();
|
|
1333
|
+
setIsHighlighted(true);
|
|
1334
|
+
} else {
|
|
1335
|
+
var _document_getElementById1;
|
|
1336
|
+
setIsHighlighted(false);
|
|
1337
|
+
(_document_getElementById1 = document.getElementById("".concat(id, "-input"))) === null || _document_getElementById1 === void 0 ? void 0 : _document_getElementById1.blur();
|
|
1338
|
+
}
|
|
1339
|
+
}
|
|
1340
|
+
function keyDownListener(event) {
|
|
1341
|
+
var _document_activeElement;
|
|
1342
|
+
var validChar = /\d|\-|\./;
|
|
1343
|
+
if (((_document_activeElement = document.activeElement) === null || _document_activeElement === void 0 ? void 0 : _document_activeElement.id) === id && validChar.test(event.key)) {
|
|
1344
|
+
var _document_getElementById;
|
|
1345
|
+
event.preventDefault();
|
|
1346
|
+
(_document_getElementById = document.getElementById("".concat(id, "-input"))) === null || _document_getElementById === void 0 ? void 0 : _document_getElementById.focus();
|
|
1347
|
+
setIsHighlighted(true);
|
|
1348
|
+
setInternalValue(event.key);
|
|
1349
|
+
}
|
|
1350
|
+
}
|
|
1351
|
+
function handleSubmit(e) {
|
|
1352
|
+
var newValue = e.target.value;
|
|
1353
|
+
var _Juce_getSliderState = Juce.getSliderState(id), scaledValue = _Juce_getSliderState.scaledValue, properties = _Juce_getSliderState.properties;
|
|
1354
|
+
if ((valueRef === null || valueRef === void 0 ? void 0 : valueRef.current) !== newValue && e.target.id === "".concat(id, "-input")) {
|
|
1355
|
+
var _document_getElementById;
|
|
1356
|
+
var validValue = getValidValueForInput({
|
|
1269
1357
|
value: newValue,
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
setHasIncompleteValue(false);
|
|
1278
|
-
setHasError(false);
|
|
1358
|
+
oldValue: scaledValue,
|
|
1359
|
+
properties: properties
|
|
1360
|
+
});
|
|
1361
|
+
valueRef.current = validValue;
|
|
1362
|
+
onComplete(validValue);
|
|
1363
|
+
if (validValue === valueRef.current) {
|
|
1364
|
+
setInternalValue(validValue);
|
|
1279
1365
|
}
|
|
1366
|
+
(_document_getElementById = document.getElementById(id)) === null || _document_getElementById === void 0 ? void 0 : _document_getElementById.focus();
|
|
1280
1367
|
}
|
|
1281
1368
|
}
|
|
1369
|
+
useEffect(function() {
|
|
1370
|
+
document.addEventListener('click', clickListener);
|
|
1371
|
+
document.addEventListener('keydown', keyDownListener);
|
|
1372
|
+
return function() {
|
|
1373
|
+
document.removeEventListener('click', clickListener);
|
|
1374
|
+
document.removeEventListener('keydown', keyDownListener);
|
|
1375
|
+
};
|
|
1376
|
+
}, [
|
|
1377
|
+
window,
|
|
1378
|
+
isHighlighted
|
|
1379
|
+
]);
|
|
1282
1380
|
function handleKeyUp(e) {
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
type: type,
|
|
1290
|
-
minLength: minLength,
|
|
1291
|
-
maxLength: maxLength,
|
|
1292
|
-
min: min,
|
|
1293
|
-
max: max
|
|
1294
|
-
}), errorMessages = _validate.errorMessages, isIncomplete = _validate.isIncomplete;
|
|
1295
|
-
if (errorMessages.length && !isIncomplete) {
|
|
1296
|
-
setHasError(true);
|
|
1297
|
-
setHasIncompleteValue(false);
|
|
1298
|
-
}
|
|
1299
|
-
if (isIncomplete) {
|
|
1300
|
-
setHasIncompleteValue(true);
|
|
1301
|
-
}
|
|
1302
|
-
if (errorMessages.length === 0 && !isIncomplete) {
|
|
1303
|
-
setHasIncompleteValue(false);
|
|
1304
|
-
setHasError(false);
|
|
1305
|
-
onComplete && onComplete(newValue);
|
|
1306
|
-
}
|
|
1307
|
-
onComplete && onComplete(newValue);
|
|
1308
|
-
valueRef.current = newValue;
|
|
1381
|
+
if (e.key === 'Enter') {
|
|
1382
|
+
var _document_activeElement;
|
|
1383
|
+
handleSubmit(e);
|
|
1384
|
+
setIsHighlighted(false);
|
|
1385
|
+
if (((_document_activeElement = document.activeElement) === null || _document_activeElement === void 0 ? void 0 : _document_activeElement.id) === "".concat(id, "-input")) {
|
|
1386
|
+
document.activeElement.blur();
|
|
1309
1387
|
}
|
|
1310
|
-
}
|
|
1388
|
+
}
|
|
1311
1389
|
}
|
|
1312
1390
|
var inputRef = useRef('');
|
|
1313
1391
|
// detects when the user is actively typing
|
|
@@ -1315,70 +1393,34 @@ function Input(param) {
|
|
|
1315
1393
|
// triggers a check to see if the user is actually done typing
|
|
1316
1394
|
inputRef === null || inputRef === void 0 ? void 0 : inputRef.current) && (inputRef === null || inputRef === void 0 ? void 0 : (_inputRef_current = inputRef.current) === null || _inputRef_current === void 0 ? void 0 : _inputRef_current.addEventListener('keyup', handleKeyUp));
|
|
1317
1395
|
var handleChange = useCallback(function(e) {
|
|
1318
|
-
var newValue = e.target.value;
|
|
1319
|
-
setHasError(false);
|
|
1320
|
-
var _validate = validate({
|
|
1321
|
-
value: newValue,
|
|
1322
|
-
type: type,
|
|
1323
|
-
minLength: minLength,
|
|
1324
|
-
maxLength: maxLength,
|
|
1325
|
-
min: min,
|
|
1326
|
-
max: max
|
|
1327
|
-
}), errorMessages = _validate.errorMessages, isValid = _validate.isValid;
|
|
1328
|
-
if (isValid) {
|
|
1329
|
-
setHasError(false);
|
|
1330
|
-
setHasIncompleteValue(false);
|
|
1331
|
-
}
|
|
1332
1396
|
// Don't set the internal value if the value exceeds the max length
|
|
1333
1397
|
// Don't set the internal value if the value contains an invalid character
|
|
1334
|
-
if ((
|
|
1335
|
-
setInternalValue(
|
|
1398
|
+
if (validateInputChange(e)) {
|
|
1399
|
+
setInternalValue(e.target.value);
|
|
1336
1400
|
}
|
|
1337
1401
|
}, [
|
|
1338
|
-
|
|
1339
|
-
validate,
|
|
1402
|
+
getValidValueForInput,
|
|
1340
1403
|
setInternalValue
|
|
1341
1404
|
]);
|
|
1342
|
-
useEffect(
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
value: value,
|
|
1346
|
-
type: type,
|
|
1347
|
-
minLength: minLength,
|
|
1348
|
-
maxLength: maxLength,
|
|
1349
|
-
min: min,
|
|
1350
|
-
max: max
|
|
1351
|
-
}).isValid;
|
|
1352
|
-
if (isValid) {
|
|
1353
|
-
setHasError(false);
|
|
1354
|
-
setHasIncompleteValue(false);
|
|
1355
|
-
}
|
|
1356
|
-
}, [
|
|
1357
|
-
value
|
|
1358
|
-
]);
|
|
1405
|
+
// useEffect(() => {
|
|
1406
|
+
// setInternalValue(value);
|
|
1407
|
+
// }, [value]);
|
|
1359
1408
|
return /*#__PURE__*/ React__default.createElement("input", {
|
|
1360
|
-
id: id,
|
|
1409
|
+
id: "".concat(id, "-input"),
|
|
1361
1410
|
ref: inputRef,
|
|
1362
|
-
className: classnames('TextInput',
|
|
1411
|
+
className: classnames('TextInput', isHighlighted ? 'is-highlighted' : '', className),
|
|
1363
1412
|
style: _object_spread$f({
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
color: hasError ? 'red' : textColor,
|
|
1367
|
-
fontSize: fontSize
|
|
1413
|
+
fontSize: "var(--text-".concat(fontSize),
|
|
1414
|
+
color: textColor
|
|
1368
1415
|
}, style),
|
|
1369
1416
|
value: internalValue,
|
|
1370
1417
|
onKeyUp: function() {
|
|
1371
1418
|
return handleKeyUp;
|
|
1372
1419
|
},
|
|
1373
|
-
|
|
1374
|
-
return
|
|
1375
|
-
},
|
|
1376
|
-
onBlur: function() {
|
|
1377
|
-
return setInternalValue(internalValue);
|
|
1378
|
-
},
|
|
1379
|
-
onFocus: function(e) {
|
|
1380
|
-
return e.target.select();
|
|
1420
|
+
onBlur: function(e) {
|
|
1421
|
+
return handleSubmit(e);
|
|
1381
1422
|
},
|
|
1423
|
+
// onFocus={(e) => e.target.select()}
|
|
1382
1424
|
onChange: function(e) {
|
|
1383
1425
|
return handleChange(e);
|
|
1384
1426
|
}
|
|
@@ -1393,15 +1435,15 @@ var SliderType = /*#__PURE__*/ function(SliderType) {
|
|
|
1393
1435
|
return SliderType;
|
|
1394
1436
|
}({});
|
|
1395
1437
|
|
|
1396
|
-
function _array_like_to_array$
|
|
1438
|
+
function _array_like_to_array$8(arr, len) {
|
|
1397
1439
|
if (len == null || len > arr.length) len = arr.length;
|
|
1398
1440
|
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
1399
1441
|
return arr2;
|
|
1400
1442
|
}
|
|
1401
|
-
function _array_with_holes$
|
|
1443
|
+
function _array_with_holes$8(arr) {
|
|
1402
1444
|
if (Array.isArray(arr)) return arr;
|
|
1403
1445
|
}
|
|
1404
|
-
function _iterable_to_array_limit$
|
|
1446
|
+
function _iterable_to_array_limit$8(arr, i) {
|
|
1405
1447
|
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
1406
1448
|
if (_i == null) return;
|
|
1407
1449
|
var _arr = [];
|
|
@@ -1425,19 +1467,19 @@ function _iterable_to_array_limit$9(arr, i) {
|
|
|
1425
1467
|
}
|
|
1426
1468
|
return _arr;
|
|
1427
1469
|
}
|
|
1428
|
-
function _non_iterable_rest$
|
|
1470
|
+
function _non_iterable_rest$8() {
|
|
1429
1471
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
1430
1472
|
}
|
|
1431
|
-
function _sliced_to_array$
|
|
1432
|
-
return _array_with_holes$
|
|
1473
|
+
function _sliced_to_array$8(arr, i) {
|
|
1474
|
+
return _array_with_holes$8(arr) || _iterable_to_array_limit$8(arr, i) || _unsupported_iterable_to_array$8(arr, i) || _non_iterable_rest$8();
|
|
1433
1475
|
}
|
|
1434
|
-
function _unsupported_iterable_to_array$
|
|
1476
|
+
function _unsupported_iterable_to_array$8(o, minLen) {
|
|
1435
1477
|
if (!o) return;
|
|
1436
|
-
if (typeof o === "string") return _array_like_to_array$
|
|
1478
|
+
if (typeof o === "string") return _array_like_to_array$8(o, minLen);
|
|
1437
1479
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
1438
1480
|
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
1439
1481
|
if (n === "Map" || n === "Set") return Array.from(n);
|
|
1440
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$
|
|
1482
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$8(o, minLen);
|
|
1441
1483
|
}
|
|
1442
1484
|
// 20.0f, 15000.0f, 0.1f, 0.7f),800.0f
|
|
1443
1485
|
// ValueType rangeStart, ValueType rangeEnd, ValueType intervalValue, ValueType skewFactor, bool useSymmetricSkew=false)
|
|
@@ -1448,6 +1490,32 @@ var useSlider = function(param) {
|
|
|
1448
1490
|
interval: 0.1,
|
|
1449
1491
|
skew: 0.7
|
|
1450
1492
|
} : _param_mockProperties, _param_isRandomizable = param.isRandomizable, isRandomizable = _param_isRandomizable === void 0 ? false : _param_isRandomizable, _param_orientation = param.orientation, orientation = _param_orientation === void 0 ? Orientation.vertical : _param_orientation, _param_dragOrientation = param.dragOrientation, dragOrientation = _param_dragOrientation === void 0 ? Orientation.vertical : _param_dragOrientation, _param_mockInitialNormalisedValue = param.mockInitialNormalisedValue, mockInitialNormalisedValue = _param_mockInitialNormalisedValue === void 0 ? 0.0 : _param_mockInitialNormalisedValue, onChange = param.onChange;
|
|
1493
|
+
var clickListener = function clickListener(event) {
|
|
1494
|
+
var _event_target_closest;
|
|
1495
|
+
if (((_event_target_closest = event.target.closest('.Slider')) === null || _event_target_closest === void 0 ? void 0 : _event_target_closest.id) === id) {
|
|
1496
|
+
var _document_getElementById;
|
|
1497
|
+
setIsActive(true);
|
|
1498
|
+
(_document_getElementById = document.getElementById(id)) === null || _document_getElementById === void 0 ? void 0 : _document_getElementById.focus();
|
|
1499
|
+
event.stopPropagation();
|
|
1500
|
+
} else {
|
|
1501
|
+
var _document_getElementById1;
|
|
1502
|
+
setIsActive(false);
|
|
1503
|
+
(_document_getElementById1 = document.getElementById(id)) === null || _document_getElementById1 === void 0 ? void 0 : _document_getElementById1.blur();
|
|
1504
|
+
event.stopPropagation();
|
|
1505
|
+
}
|
|
1506
|
+
};
|
|
1507
|
+
var keyDownListener = function keyDownListener(event) {
|
|
1508
|
+
if (isActive) {
|
|
1509
|
+
if (event.key === 'ArrowLeft') {
|
|
1510
|
+
event.preventDefault();
|
|
1511
|
+
decrementValue();
|
|
1512
|
+
}
|
|
1513
|
+
if (event.key === 'ArrowRight') {
|
|
1514
|
+
event.preventDefault();
|
|
1515
|
+
incrementValue();
|
|
1516
|
+
}
|
|
1517
|
+
}
|
|
1518
|
+
};
|
|
1451
1519
|
// const sliderState: JuceSlider = Juce.getSliderState(id);
|
|
1452
1520
|
// if isLocalhost is true, the front end app is running outside of JUCE in a browser.
|
|
1453
1521
|
var isLocalhost = window.location.hostname === 'localhost';
|
|
@@ -1460,13 +1528,25 @@ var useSlider = function(param) {
|
|
|
1460
1528
|
* AudioProcessorParameter::getValue() (C++).
|
|
1461
1529
|
*/ // See https://github.com/juce-framework/JUCE/blob/51d11a2be6d5c97ccf12b4e5e827006e19f0555a/modules/juce_gui_extra/native/javascript/index.js#L230C1-L238C6
|
|
1462
1530
|
// NOTE: We can think of this as a percentage value, in 0 to 1 format
|
|
1463
|
-
var _useState = _sliced_to_array$
|
|
1531
|
+
var _useState = _sliced_to_array$8(useState(0), 2), scaledValue = _useState[0], setScaledValue = _useState[1];
|
|
1464
1532
|
// const [normalisedValue, setNormalisedValue] = useState(0);
|
|
1465
|
-
var _useState1 = _sliced_to_array$
|
|
1533
|
+
var _useState1 = _sliced_to_array$8(useState(), 2), properties = _useState1[0], setProperties = _useState1[1];
|
|
1466
1534
|
var scaledValueRef = useRef(null);
|
|
1467
1535
|
var normalisedValueRef = useRef(null);
|
|
1468
1536
|
// const randomValueSetCounter = useRef<number>(null);
|
|
1469
1537
|
var _useGlobalContext = useGlobalContext(), useRandom = _useGlobalContext.useRandom, highlightedItemChanged = _useGlobalContext.highlightedItemChanged, setDefaultParameter = _useGlobalContext.setDefaultParameter;
|
|
1538
|
+
var _useState2 = _sliced_to_array$8(useState(false), 2), isActive = _useState2[0], setIsActive = _useState2[1];
|
|
1539
|
+
useEffect(function() {
|
|
1540
|
+
document.addEventListener('click', clickListener);
|
|
1541
|
+
document.addEventListener('keydown', keyDownListener);
|
|
1542
|
+
return function() {
|
|
1543
|
+
document.removeEventListener('click', clickListener);
|
|
1544
|
+
document.removeEventListener('keydown', keyDownListener);
|
|
1545
|
+
};
|
|
1546
|
+
}, [
|
|
1547
|
+
window,
|
|
1548
|
+
isActive
|
|
1549
|
+
]);
|
|
1470
1550
|
// Set the initial state
|
|
1471
1551
|
//@ts-expect-error
|
|
1472
1552
|
useEffect(function() {
|
|
@@ -1602,8 +1682,6 @@ var useSlider = function(param) {
|
|
|
1602
1682
|
i: "".concat(0)
|
|
1603
1683
|
});
|
|
1604
1684
|
}
|
|
1605
|
-
}, {
|
|
1606
|
-
preventDefault: true
|
|
1607
1685
|
});
|
|
1608
1686
|
var bindBarSliderDrag = function() {
|
|
1609
1687
|
var drag = useDrag(function(param) {
|
|
@@ -1680,8 +1758,10 @@ var useSlider = function(param) {
|
|
|
1680
1758
|
setToDefaultState: setToDefaultState,
|
|
1681
1759
|
incrementValue: incrementValue,
|
|
1682
1760
|
decrementValue: decrementValue,
|
|
1761
|
+
isActive: isActive,
|
|
1683
1762
|
// onChangeStarted,
|
|
1684
1763
|
// onChangeCommitted,
|
|
1764
|
+
scaledToNormalised: scaledToNormalised,
|
|
1685
1765
|
onMouseEnter: onMouseEnter,
|
|
1686
1766
|
bindBarSliderDrag: bindBarSliderDrag,
|
|
1687
1767
|
bindDrag: bindDrag,
|
|
@@ -1691,17 +1771,9 @@ var useSlider = function(param) {
|
|
|
1691
1771
|
};
|
|
1692
1772
|
};
|
|
1693
1773
|
|
|
1694
|
-
var css_248z$6 = ".RotarySlider {\n position: relative
|
|
1774
|
+
var css_248z$6 = ".RotarySlider {\n /* position: relative; */\n /* border-radius: 50%; */\n display: flex;\n flex-direction: column;\n justify-content: center;\n aspect-ratio: 1 / 1;\n border: 1px solid transparent;\n}\n\n.RotarySlider-Inner {\n height: 100%;\n width: 100%;\n right: 0;\n top: 0;\n bottom: 0;\n left: 0;\n background-color: var(--bg-popover);\n border-radius: 50%;\n}\n\n.RotarySlider-Indicator {\n position: absolute;\n top: 0;\n right: 0;\n left: 50%;\n width: var(--spacing-xs);\n height: 50%;\n transform: translate(-50%, 0) rotate(0) skewX(0) skewY(0) scaleX(1) scaleY(1);\n}\n\n.RotarySlider-center-marker {\n width: 0;\n height: 0;\n border-style: solid;\n border-width: 0 5px 8px 5px;\n transform: rotate(180deg);\n padding-bottom: var(--spacing-sm);\n}\n\n.ProgressCircle-wrapper {\n position: relative;\n}\n.ProgressCircle {\n fill: none;\n pointer-events: none;\n}\n\n.ProgressCircle-value {\n text-align: center;\n margin-top: -3px;\n height: 0.8rem;\n line-height: 0.8rem;\n}\n\n.ProgressCircle-bg {\n stroke-width: 3px;\n transform-origin: center;\n transform: rotate(135deg);\n stroke-linecap: round;\n font-size: var(--text-sm);\n pointer-events: none;\n}\n.ProgressCircle-fg {\n stroke-width: 3px;\n /* stroke-dasharray: 75; */\n /* stroke-dashoffset: calc(880 - (660 * 0) / 100); */\n transform-origin: center;\n stroke-linecap: round;\n pointer-events: none;\n}\n\n.corner-border {\n --b: 1px; /* thickness of the border */\n --c: var(--color-gray-500); /* color of the border */\n --w: 5px; /* width of border */\n\n border: var(--b) solid #0000; /* space for the border */\n --_g: #0000 90deg, var(--c) 0;\n --_p: var(--w) var(--w) border-box no-repeat;\n background:\n conic-gradient(from 90deg at top var(--b) left var(--b), var(--_g)) 0 0 /\n var(--_p),\n conic-gradient(from 180deg at top var(--b) right var(--b), var(--_g)) 100% 0 /\n var(--_p),\n conic-gradient(from 0deg at bottom var(--b) left var(--b), var(--_g)) 0 100% /\n var(--_p),\n conic-gradient(from -90deg at bottom var(--b) right var(--b), var(--_g))\n 100% 100% / var(--_p);\n}\n";
|
|
1695
1775
|
styleInject(css_248z$6);
|
|
1696
1776
|
|
|
1697
|
-
function _array_like_to_array$8(arr, len) {
|
|
1698
|
-
if (len == null || len > arr.length) len = arr.length;
|
|
1699
|
-
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
1700
|
-
return arr2;
|
|
1701
|
-
}
|
|
1702
|
-
function _array_with_holes$8(arr) {
|
|
1703
|
-
if (Array.isArray(arr)) return arr;
|
|
1704
|
-
}
|
|
1705
1777
|
function _define_property$e(obj, key, value) {
|
|
1706
1778
|
if (key in obj) {
|
|
1707
1779
|
Object.defineProperty(obj, key, {
|
|
@@ -1715,33 +1787,6 @@ function _define_property$e(obj, key, value) {
|
|
|
1715
1787
|
}
|
|
1716
1788
|
return obj;
|
|
1717
1789
|
}
|
|
1718
|
-
function _iterable_to_array_limit$8(arr, i) {
|
|
1719
|
-
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
1720
|
-
if (_i == null) return;
|
|
1721
|
-
var _arr = [];
|
|
1722
|
-
var _n = true;
|
|
1723
|
-
var _d = false;
|
|
1724
|
-
var _s, _e;
|
|
1725
|
-
try {
|
|
1726
|
-
for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
|
|
1727
|
-
_arr.push(_s.value);
|
|
1728
|
-
if (i && _arr.length === i) break;
|
|
1729
|
-
}
|
|
1730
|
-
} catch (err) {
|
|
1731
|
-
_d = true;
|
|
1732
|
-
_e = err;
|
|
1733
|
-
} finally{
|
|
1734
|
-
try {
|
|
1735
|
-
if (!_n && _i["return"] != null) _i["return"]();
|
|
1736
|
-
} finally{
|
|
1737
|
-
if (_d) throw _e;
|
|
1738
|
-
}
|
|
1739
|
-
}
|
|
1740
|
-
return _arr;
|
|
1741
|
-
}
|
|
1742
|
-
function _non_iterable_rest$8() {
|
|
1743
|
-
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
1744
|
-
}
|
|
1745
1790
|
function _object_spread$e(target) {
|
|
1746
1791
|
for(var i = 1; i < arguments.length; i++){
|
|
1747
1792
|
var source = arguments[i] != null ? arguments[i] : {};
|
|
@@ -1776,17 +1821,6 @@ function _object_spread_props$2(target, source) {
|
|
|
1776
1821
|
}
|
|
1777
1822
|
return target;
|
|
1778
1823
|
}
|
|
1779
|
-
function _sliced_to_array$8(arr, i) {
|
|
1780
|
-
return _array_with_holes$8(arr) || _iterable_to_array_limit$8(arr, i) || _unsupported_iterable_to_array$8(arr, i) || _non_iterable_rest$8();
|
|
1781
|
-
}
|
|
1782
|
-
function _unsupported_iterable_to_array$8(o, minLen) {
|
|
1783
|
-
if (!o) return;
|
|
1784
|
-
if (typeof o === "string") return _array_like_to_array$8(o, minLen);
|
|
1785
|
-
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
1786
|
-
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
1787
|
-
if (n === "Map" || n === "Set") return Array.from(n);
|
|
1788
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$8(o, minLen);
|
|
1789
|
-
}
|
|
1790
1824
|
var ProgressCircle = function(param) {
|
|
1791
1825
|
var color = param.color, bgColor = param.bgColor, _param_width = param.width, width = _param_width === void 0 ? 40 : _param_width, _param_height = param.height, height = _param_height === void 0 ? 40 : _param_height, _param_strokeWidth = param.strokeWidth, strokeWidth = _param_strokeWidth === void 0 ? 3 : _param_strokeWidth, _param_polarity = param.polarity, polarity = _param_polarity === void 0 ? Polarity.linear : _param_polarity, value = param.value;
|
|
1792
1826
|
var cx = width / 2;
|
|
@@ -1847,7 +1881,7 @@ function RotarySlider(param) {
|
|
|
1847
1881
|
end: 15000.0,
|
|
1848
1882
|
interval: 0.1,
|
|
1849
1883
|
skew: 0.7
|
|
1850
|
-
} : _param_mockProperties; param.labelColor; var _param_color = param.color, color = _param_color === void 0 ? 'var(--color-gray-500)' : _param_color, _param_bgColor = param.bgColor, bgColor = _param_bgColor === void 0 ? 'var(--color-gray-200)' : _param_bgColor, _param_width = param.width, width = _param_width === void 0 ? 40 : _param_width, _param_height = param.height, height = _param_height === void 0 ?
|
|
1884
|
+
} : _param_mockProperties; param.labelColor; var _param_color = param.color, color = _param_color === void 0 ? 'var(--color-gray-500)' : _param_color, _param_bgColor = param.bgColor, bgColor = _param_bgColor === void 0 ? 'var(--color-gray-200)' : _param_bgColor, _param_width = param.width, width = _param_width === void 0 ? 40 : _param_width, _param_height = param.height, height = _param_height === void 0 ? 38 : _param_height, style = param.style;
|
|
1851
1885
|
var _useSlider = useSlider({
|
|
1852
1886
|
id: id,
|
|
1853
1887
|
label: label,
|
|
@@ -1855,42 +1889,12 @@ function RotarySlider(param) {
|
|
|
1855
1889
|
mockInitialNormalisedValue: mockInitialNormalisedValue,
|
|
1856
1890
|
onChange: onChange,
|
|
1857
1891
|
isRandomizable: isRandomizable
|
|
1858
|
-
}), bindDrag = _useSlider.bindDrag, normalisedValue = _useSlider.normalisedValue, scaledValue = _useSlider.scaledValue, onMouseEnter = _useSlider.onMouseEnter, setToDefaultState = _useSlider.setToDefaultState,
|
|
1859
|
-
var _useState = _sliced_to_array$8(useState(false), 2), isActive = _useState[0], setIsActive = _useState[1];
|
|
1860
|
-
function clickListener(event) {
|
|
1861
|
-
var _event_target_closest;
|
|
1862
|
-
if (((_event_target_closest = event.target.closest('.RotarySlider')) === null || _event_target_closest === void 0 ? void 0 : _event_target_closest.id) === id) {
|
|
1863
|
-
setIsActive(true);
|
|
1864
|
-
} else {
|
|
1865
|
-
setIsActive(false);
|
|
1866
|
-
}
|
|
1867
|
-
}
|
|
1868
|
-
function keyDownListener(event) {
|
|
1869
|
-
if (isActive) {
|
|
1870
|
-
if (event.key === 'ArrowLeft') {
|
|
1871
|
-
event.preventDefault();
|
|
1872
|
-
decrementValue();
|
|
1873
|
-
}
|
|
1874
|
-
if (event.key === 'ArrowRight') {
|
|
1875
|
-
event.preventDefault();
|
|
1876
|
-
incrementValue();
|
|
1877
|
-
}
|
|
1878
|
-
}
|
|
1879
|
-
}
|
|
1880
|
-
useEffect(function() {
|
|
1881
|
-
document.addEventListener('click', clickListener, true);
|
|
1882
|
-
document.addEventListener('keydown', keyDownListener);
|
|
1883
|
-
return function() {
|
|
1884
|
-
document.removeEventListener('click', clickListener);
|
|
1885
|
-
document.removeEventListener('keydown', keyDownListener);
|
|
1886
|
-
};
|
|
1887
|
-
}, [
|
|
1888
|
-
window,
|
|
1889
|
-
isActive
|
|
1890
|
-
]);
|
|
1892
|
+
}), bindDrag = _useSlider.bindDrag, normalisedValue = _useSlider.normalisedValue, scaledValue = _useSlider.scaledValue, onMouseEnter = _useSlider.onMouseEnter, setToDefaultState = _useSlider.setToDefaultState, setNormalisedState = _useSlider.setNormalisedState, isActive = _useSlider.isActive, properties = _useSlider.properties;
|
|
1891
1893
|
return /*#__PURE__*/ React__default.createElement(Box, {
|
|
1892
1894
|
className: "RotarySlider-wrapper",
|
|
1893
|
-
flexDirection: Box.flexDirection.column
|
|
1895
|
+
flexDirection: Box.flexDirection.column,
|
|
1896
|
+
gap: Box.gap.none,
|
|
1897
|
+
flex: "0 1 auto"
|
|
1894
1898
|
}, polarity === Polarity.bipolar && /*#__PURE__*/ React__default.createElement("div", {
|
|
1895
1899
|
style: {
|
|
1896
1900
|
borderColor: "".concat(color, " transparent ").concat(color, " transparent")
|
|
@@ -1898,7 +1902,8 @@ function RotarySlider(param) {
|
|
|
1898
1902
|
className: classnames('RotarySlider-center-marker')
|
|
1899
1903
|
}), /*#__PURE__*/ React__default.createElement(Box, _object_spread_props$2(_object_spread$e({
|
|
1900
1904
|
id: id,
|
|
1901
|
-
|
|
1905
|
+
tabIndex: 0,
|
|
1906
|
+
className: classnames('Slider', 'RotarySlider', isActive ? 'corner-border' : '', polarity === Polarity.linear ? 'Slider-polarity-linear' : 'Slider-polarity-bipolar', className)
|
|
1902
1907
|
}, bindDrag()), {
|
|
1903
1908
|
onMouseEnter: onMouseEnter,
|
|
1904
1909
|
onDoubleClick: function() {
|
|
@@ -1918,16 +1923,28 @@ function RotarySlider(param) {
|
|
|
1918
1923
|
bgColor: color,
|
|
1919
1924
|
width: width,
|
|
1920
1925
|
height: height
|
|
1921
|
-
}), /*#__PURE__*/ React__default.createElement(
|
|
1926
|
+
})) : ''), /*#__PURE__*/ React__default.createElement(Input, {
|
|
1922
1927
|
className: "ProgressCircle-value",
|
|
1923
|
-
|
|
1924
|
-
|
|
1928
|
+
value: scaledValue,
|
|
1929
|
+
id: id,
|
|
1930
|
+
min: (properties === null || properties === void 0 ? void 0 : properties.start) || 0,
|
|
1931
|
+
max: (properties === null || properties === void 0 ? void 0 : properties.end) || 0,
|
|
1925
1932
|
style: {
|
|
1926
|
-
fontWeight: 'bold'
|
|
1933
|
+
fontWeight: 'bold',
|
|
1934
|
+
width: '100%',
|
|
1935
|
+
maxWidth: "".concat(width, "px"),
|
|
1936
|
+
marginBottom: 'var(--spacing-sm)'
|
|
1937
|
+
},
|
|
1938
|
+
onComplete: function(value) {
|
|
1939
|
+
var normalisedVal = properties && scaledToNormalised({
|
|
1940
|
+
scaledValue: value,
|
|
1941
|
+
properties: properties
|
|
1942
|
+
});
|
|
1943
|
+
normalisedVal !== undefined && setNormalisedState(normalisedVal);
|
|
1927
1944
|
}
|
|
1928
|
-
}
|
|
1945
|
+
}), /*#__PURE__*/ React__default.createElement(Label, {
|
|
1929
1946
|
padding: [
|
|
1930
|
-
Label.padding.
|
|
1947
|
+
Label.padding.none
|
|
1931
1948
|
],
|
|
1932
1949
|
fontSize: Label.fontSize.xSmall,
|
|
1933
1950
|
value: label
|
|
@@ -2039,24 +2056,6 @@ Slider.sliderType = SliderType;
|
|
|
2039
2056
|
Slider.sliderPolarity = Polarity;
|
|
2040
2057
|
Slider.sliderOrientation = Orientation;
|
|
2041
2058
|
|
|
2042
|
-
function SliderValue(param) {
|
|
2043
|
-
var value = param.value, min = param.min, max = param.max, minLength = param.minLength, maxLength = param.maxLength, isEditable = param.isEditable, onChange = param.onChange, className = param.className, style = param.style;
|
|
2044
|
-
return /*#__PURE__*/ React__default.createElement(React__default.Fragment, null, isEditable ? /*#__PURE__*/ React__default.createElement(Input, {
|
|
2045
|
-
value: value,
|
|
2046
|
-
min: min,
|
|
2047
|
-
max: max,
|
|
2048
|
-
minLength: minLength,
|
|
2049
|
-
maxLength: maxLength,
|
|
2050
|
-
style: style,
|
|
2051
|
-
onComplete: onChange,
|
|
2052
|
-
className: classnames('SliderValue', className)
|
|
2053
|
-
}) : /*#__PURE__*/ React__default.createElement(Label, {
|
|
2054
|
-
value: value,
|
|
2055
|
-
className: classnames('SliderValue', className),
|
|
2056
|
-
style: style
|
|
2057
|
-
}));
|
|
2058
|
-
}
|
|
2059
|
-
|
|
2060
2059
|
var HeadingTags = /*#__PURE__*/ function(HeadingTags) {
|
|
2061
2060
|
HeadingTags["h1"] = "h1";
|
|
2062
2061
|
HeadingTags["h2"] = "h2";
|
|
@@ -3566,18 +3565,15 @@ function ModuleHeader(param) {
|
|
|
3566
3565
|
function keydownListener(event) {
|
|
3567
3566
|
var _document;
|
|
3568
3567
|
var activeElement = (_document = document) === null || _document === void 0 ? void 0 : _document.activeElement;
|
|
3569
|
-
// 8, Backspace
|
|
3570
3568
|
var elements = [
|
|
3571
3569
|
'input',
|
|
3572
|
-
'
|
|
3573
|
-
'button',
|
|
3574
|
-
'textarea',
|
|
3575
|
-
'div'
|
|
3570
|
+
'textarea'
|
|
3576
3571
|
];
|
|
3572
|
+
var eventMatchesActiveInput = activeElement && elements.includes(activeElement === null || activeElement === void 0 ? void 0 : activeElement.tagName.toLowerCase()) && event.target.id === (activeElement === null || activeElement === void 0 ? void 0 : activeElement.id);
|
|
3577
3573
|
if (event.key === 'Backspace' && activeElement && elements.indexOf(activeElement.tagName.toLowerCase()) === -1) {
|
|
3578
3574
|
event.preventDefault();
|
|
3579
3575
|
}
|
|
3580
|
-
if (event.key === 'ArrowLeft' || event.key === 'ArrowRight') {
|
|
3576
|
+
if ((event.key === 'ArrowLeft' || event.key === 'ArrowRight') && !eventMatchesActiveInput) {
|
|
3581
3577
|
event.preventDefault();
|
|
3582
3578
|
}
|
|
3583
3579
|
}
|
|
@@ -4598,19 +4594,18 @@ function ModMatrix(param) {
|
|
|
4598
4594
|
var getAutomatableParamsListFunc = Juce.getNativeFunction('getAutomatableParamsList');
|
|
4599
4595
|
var getAllModSlotsFunc = Juce.getNativeFunction('getAllModSlots');
|
|
4600
4596
|
var getModSlotParamsFunc = Juce.getNativeFunction('getModSlotParams');
|
|
4601
|
-
var getAllParametersFunc = Juce.getNativeFunction('getAllParameters');
|
|
4602
4597
|
var _useGlobalContext = useGlobalContext(), automatableParamsListReceived = _useGlobalContext.automatableParamsListReceived, automatableParamLabelsReceived = _useGlobalContext.automatableParamLabelsReceived, modSlotsReceived = _useGlobalContext.modSlotsReceived, modSlotParamsListReceived = _useGlobalContext.modSlotParamsListReceived, modSlotParamLabelsReceived = _useGlobalContext.modSlotParamLabelsReceived, _useGlobalContext_globalState = _useGlobalContext.globalState, modSlotParamLabels = _useGlobalContext_globalState.modSlotParamLabels, modSlots = _useGlobalContext_globalState.modSlots;
|
|
4603
4598
|
var getAPVTSParams = function() {
|
|
4604
4599
|
return _async_to_generator$1(function() {
|
|
4605
|
-
var automatableParamsList, modSlotsData, modSlotParams,
|
|
4600
|
+
var automatableParamsList, modSlotsData, modSlotParams, e;
|
|
4606
4601
|
return _ts_generator$1(this, function(_state) {
|
|
4607
4602
|
switch(_state.label){
|
|
4608
4603
|
case 0:
|
|
4609
4604
|
_state.trys.push([
|
|
4610
4605
|
0,
|
|
4611
|
-
|
|
4606
|
+
4,
|
|
4612
4607
|
,
|
|
4613
|
-
|
|
4608
|
+
5
|
|
4614
4609
|
]);
|
|
4615
4610
|
return [
|
|
4616
4611
|
4,
|
|
@@ -4630,13 +4625,7 @@ function ModMatrix(param) {
|
|
|
4630
4625
|
];
|
|
4631
4626
|
case 3:
|
|
4632
4627
|
modSlotParams = _state.sent();
|
|
4633
|
-
|
|
4634
|
-
4,
|
|
4635
|
-
getAllParametersFunc()
|
|
4636
|
-
];
|
|
4637
|
-
case 4:
|
|
4638
|
-
ap = _state.sent();
|
|
4639
|
-
console.log(ap, 'apapapapappa');
|
|
4628
|
+
// const ap = await getAllParametersFunc();
|
|
4640
4629
|
automatableParamsListReceived(automatableParamsList === null || automatableParamsList === void 0 ? void 0 : automatableParamsList[0]);
|
|
4641
4630
|
automatableParamLabelsReceived(automatableParamsList === null || automatableParamsList === void 0 ? void 0 : automatableParamsList[1]);
|
|
4642
4631
|
modSlotsReceived(modSlotsData || []);
|
|
@@ -4644,16 +4633,16 @@ function ModMatrix(param) {
|
|
|
4644
4633
|
modSlotParamLabelsReceived(modSlotParams === null || modSlotParams === void 0 ? void 0 : modSlotParams[1]);
|
|
4645
4634
|
return [
|
|
4646
4635
|
3,
|
|
4647
|
-
|
|
4636
|
+
5
|
|
4648
4637
|
];
|
|
4649
|
-
case
|
|
4638
|
+
case 4:
|
|
4650
4639
|
e = _state.sent();
|
|
4651
4640
|
console.log(e);
|
|
4652
4641
|
return [
|
|
4653
4642
|
3,
|
|
4654
|
-
|
|
4643
|
+
5
|
|
4655
4644
|
];
|
|
4656
|
-
case
|
|
4645
|
+
case 5:
|
|
4657
4646
|
return [
|
|
4658
4647
|
2
|
|
4659
4648
|
];
|
|
@@ -4762,7 +4751,10 @@ function LFOTab() {
|
|
|
4762
4751
|
return /*#__PURE__*/ React__default.createElement(Box, {
|
|
4763
4752
|
className: "LFOTab",
|
|
4764
4753
|
flexDirection: Box.flexDirection.column
|
|
4765
|
-
}, /*#__PURE__*/ React__default.createElement(Box,
|
|
4754
|
+
}, /*#__PURE__*/ React__default.createElement(Box, {
|
|
4755
|
+
alignItems: Box.alignItems.flexEnd,
|
|
4756
|
+
justifyContent: Box.justifyContent.spaceEvenly
|
|
4757
|
+
}, /*#__PURE__*/ React__default.createElement(Dropdown, {
|
|
4766
4758
|
labelColor: "var(--color-text)",
|
|
4767
4759
|
color: "var(--color-brand)",
|
|
4768
4760
|
id: "LFO1_Wave",
|
|
@@ -4806,7 +4798,10 @@ function LFOTab() {
|
|
|
4806
4798
|
}), /*#__PURE__*/ React__default.createElement(RotarySlider, {
|
|
4807
4799
|
id: "LFO1_Rand",
|
|
4808
4800
|
label: "LFO1 Rand"
|
|
4809
|
-
})), /*#__PURE__*/ React__default.createElement(Box,
|
|
4801
|
+
})), /*#__PURE__*/ React__default.createElement(Box, {
|
|
4802
|
+
alignItems: Box.alignItems.flexEnd,
|
|
4803
|
+
justifyContent: Box.justifyContent.spaceEvenly
|
|
4804
|
+
}, /*#__PURE__*/ React__default.createElement(Dropdown, {
|
|
4810
4805
|
labelColor: "var(--color-text)",
|
|
4811
4806
|
color: "var(--color-brand)",
|
|
4812
4807
|
id: "LFO2_Wave",
|
|
@@ -5183,5 +5178,5 @@ function ModuleFooter(param) {
|
|
|
5183
5178
|
}, isTabSelected("ModMatrix") ? /*#__PURE__*/ React__default.createElement(ModMatrixTab, null) : '', isTabSelected("InputMod") ? /*#__PURE__*/ React__default.createElement(InputModTab, null) : '', isTabSelected("LFOs") ? /*#__PURE__*/ React__default.createElement(LFOTab, null) : '', isTabSelected("Sequencer") ? /*#__PURE__*/ React__default.createElement(SequencerTab, null) : '', isTabSelected("Settings") ? /*#__PURE__*/ React__default.createElement(SettingsTab, null) : '')));
|
|
5184
5179
|
}
|
|
5185
5180
|
|
|
5186
|
-
export { Slider as BarSlider, Box, Button, Dropdown, FontSizes, GlobalContextProvider, Heading, IconButton, IndicatorLight, Input, KeyValueDisplayScreen, Label, ModuleFooter, ModuleHeader, Oscilloscope, RotarySlider,
|
|
5181
|
+
export { Slider as BarSlider, Box, Button, Dropdown, FontSizes, GlobalContextProvider, Heading, IconButton, IndicatorLight, Input, KeyValueDisplayScreen, Label, ModuleFooter, ModuleHeader, Oscilloscope, RotarySlider, Spacing, Tabs, clamp, decimalToPercent, defaultGlobalStateValue as defaultValue, normalisedToScaled, percentToDecimal, randomizeValue, scaledToNormalised as scaledTonormalised, useGlobalContext, useObservable, useSlider };
|
|
5187
5182
|
//# sourceMappingURL=index.js.map
|