@antimatter-audio/antimatter-ui 10.9.5 → 10.10.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/core/Tabs/Tabs.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 +334 -400
- package/dist/index.js.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/core/Tabs/Tabs.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
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import React__default, {
|
|
2
|
+
import React__default, { useEffect, useRef, useReducer, useCallback, createContext, useContext, useState } from 'react';
|
|
3
3
|
import classnames from 'classnames';
|
|
4
4
|
import { TabGroup, TabList, Tab, Listbox, ListboxButton, ListboxOptions, ListboxOption, Combobox, ComboboxInput, ComboboxButton, ComboboxOptions, ComboboxOption } from '@headlessui/react';
|
|
5
5
|
import * as Juce from 'juce-framework-frontend';
|
|
@@ -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";
|
|
@@ -96,61 +90,15 @@ var Orientation = /*#__PURE__*/ function(Orientation) {
|
|
|
96
90
|
var css_248z$a = ".Tabs {\n display: flex;\n font-size: 1rem;\n align-items: center;\n justify-content: center;\n vertical-align: middle;\n white-space: nowrap;\n text-decoration: none;\n text-transform: uppercase;\n text-align: center;\n border: 0;\n appearance: none;\n user-select: none;\n -webkit-user-select: none;\n}\n\n.Tabs-item {\n &:disabled {\n cursor: not-allowed;\n }\n}\n\n.Tabs-item::-moz-selection {\n background: transparent;\n}\n.Tabs-item::selection {\n background: transparent;\n}\n";
|
|
97
91
|
styleInject(css_248z$a);
|
|
98
92
|
|
|
99
|
-
function _array_like_to_array$e(arr, len) {
|
|
100
|
-
if (len == null || len > arr.length) len = arr.length;
|
|
101
|
-
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
102
|
-
return arr2;
|
|
103
|
-
}
|
|
104
|
-
function _array_with_holes$e(arr) {
|
|
105
|
-
if (Array.isArray(arr)) return arr;
|
|
106
|
-
}
|
|
107
|
-
function _iterable_to_array_limit$e(arr, i) {
|
|
108
|
-
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
109
|
-
if (_i == null) return;
|
|
110
|
-
var _arr = [];
|
|
111
|
-
var _n = true;
|
|
112
|
-
var _d = false;
|
|
113
|
-
var _s, _e;
|
|
114
|
-
try {
|
|
115
|
-
for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
|
|
116
|
-
_arr.push(_s.value);
|
|
117
|
-
if (i && _arr.length === i) break;
|
|
118
|
-
}
|
|
119
|
-
} catch (err) {
|
|
120
|
-
_d = true;
|
|
121
|
-
_e = err;
|
|
122
|
-
} finally{
|
|
123
|
-
try {
|
|
124
|
-
if (!_n && _i["return"] != null) _i["return"]();
|
|
125
|
-
} finally{
|
|
126
|
-
if (_d) throw _e;
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
return _arr;
|
|
130
|
-
}
|
|
131
|
-
function _non_iterable_rest$e() {
|
|
132
|
-
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
133
|
-
}
|
|
134
|
-
function _sliced_to_array$e(arr, i) {
|
|
135
|
-
return _array_with_holes$e(arr) || _iterable_to_array_limit$e(arr, i) || _unsupported_iterable_to_array$e(arr, i) || _non_iterable_rest$e();
|
|
136
|
-
}
|
|
137
|
-
function _unsupported_iterable_to_array$e(o, minLen) {
|
|
138
|
-
if (!o) return;
|
|
139
|
-
if (typeof o === "string") return _array_like_to_array$e(o, minLen);
|
|
140
|
-
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
141
|
-
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
142
|
-
if (n === "Map" || n === "Set") return Array.from(n);
|
|
143
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$e(o, minLen);
|
|
144
|
-
}
|
|
145
93
|
function Tabs(param) {
|
|
146
94
|
var items = param.items, className = param.className, _param_padding = param.padding, padding = _param_padding === void 0 ? [
|
|
147
95
|
Spacing.mediumSmall
|
|
148
96
|
] : _param_padding, _param_margin = param.margin, margin = _param_margin === void 0 ? [
|
|
149
97
|
Spacing.none
|
|
150
98
|
] : _param_margin, gap = param.gap, width = param.width, onChange = param.onChange, selectedIndex = param.selectedIndex;
|
|
151
|
-
|
|
99
|
+
// const [selectedItem, setSelectedItem] = useState(0);
|
|
152
100
|
var handleChange = function(index) {
|
|
153
|
-
setSelectedItem(index);
|
|
101
|
+
// setSelectedItem(index);
|
|
154
102
|
onChange(index);
|
|
155
103
|
};
|
|
156
104
|
var _margin_, _margin_1, _margin_2, _ref;
|
|
@@ -165,6 +113,7 @@ function Tabs(param) {
|
|
|
165
113
|
marginLeft: "var(--ml-".concat((_ref = (_margin_2 = margin[3]) !== null && _margin_2 !== void 0 ? _margin_2 : margin[1]) !== null && _ref !== void 0 ? _ref : margin[0], ")"),
|
|
166
114
|
width: width
|
|
167
115
|
},
|
|
116
|
+
manual: true,
|
|
168
117
|
selectedIndex: selectedIndex,
|
|
169
118
|
onChange: function(index) {
|
|
170
119
|
return handleChange(index);
|
|
@@ -188,7 +137,7 @@ function Tabs(param) {
|
|
|
188
137
|
paddingBottom: "var(--p-".concat((_padding_1 = padding[2]) !== null && _padding_1 !== void 0 ? _padding_1 : padding[0], ")"),
|
|
189
138
|
paddingLeft: "var(--p-".concat((_ref = (_padding_2 = padding[3]) !== null && _padding_2 !== void 0 ? _padding_2 : padding[1]) !== null && _ref !== void 0 ? _ref : padding[0], ")")
|
|
190
139
|
},
|
|
191
|
-
className: classnames('Tabs-item', 'bg-input', 'color-input-text'
|
|
140
|
+
className: classnames('Tabs-item', 'bg-input', 'color-input-text')
|
|
192
141
|
}, item);
|
|
193
142
|
})));
|
|
194
143
|
}
|
|
@@ -215,7 +164,7 @@ function _array_like_to_array$d(arr, len) {
|
|
|
215
164
|
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
216
165
|
return arr2;
|
|
217
166
|
}
|
|
218
|
-
function _array_with_holes$
|
|
167
|
+
function _array_with_holes$c(arr) {
|
|
219
168
|
if (Array.isArray(arr)) return arr;
|
|
220
169
|
}
|
|
221
170
|
function _define_property$k(obj, key, value) {
|
|
@@ -231,7 +180,7 @@ function _define_property$k(obj, key, value) {
|
|
|
231
180
|
}
|
|
232
181
|
return obj;
|
|
233
182
|
}
|
|
234
|
-
function _iterable_to_array_limit$
|
|
183
|
+
function _iterable_to_array_limit$c(arr, i) {
|
|
235
184
|
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
236
185
|
if (_i == null) return;
|
|
237
186
|
var _arr = [];
|
|
@@ -255,7 +204,7 @@ function _iterable_to_array_limit$d(arr, i) {
|
|
|
255
204
|
}
|
|
256
205
|
return _arr;
|
|
257
206
|
}
|
|
258
|
-
function _non_iterable_rest$
|
|
207
|
+
function _non_iterable_rest$c() {
|
|
259
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.");
|
|
260
209
|
}
|
|
261
210
|
function _object_spread$k(target) {
|
|
@@ -273,8 +222,8 @@ function _object_spread$k(target) {
|
|
|
273
222
|
}
|
|
274
223
|
return target;
|
|
275
224
|
}
|
|
276
|
-
function _sliced_to_array$
|
|
277
|
-
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();
|
|
278
227
|
}
|
|
279
228
|
function _unsupported_iterable_to_array$d(o, minLen) {
|
|
280
229
|
if (!o) return;
|
|
@@ -290,7 +239,7 @@ function Button(param) {
|
|
|
290
239
|
] : _param_padding, _param_margin = param.margin, margin = _param_margin === void 0 ? [
|
|
291
240
|
Spacing.none
|
|
292
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;
|
|
293
|
-
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];
|
|
294
243
|
var buttonState = Juce.getToggleState(id);
|
|
295
244
|
var isLocalhost = window.location.hostname === 'localhost';
|
|
296
245
|
// Update the local state when the ID changes
|
|
@@ -408,10 +357,31 @@ function useObservable(param) {
|
|
|
408
357
|
};
|
|
409
358
|
}
|
|
410
359
|
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
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
|
+
}
|
|
415
385
|
// export const roundUpToTwoDecimals = (val: number) => Math.ceil(val * 100) / 100;
|
|
416
386
|
// mocks the `normalisedToScaledValue` internal method from JUCE
|
|
417
387
|
// This will allow us to test the JS UI without needing access to the JUCE backend
|
|
@@ -426,7 +396,6 @@ function normalisedToScaled(param) {
|
|
|
426
396
|
function scaledToNormalised(param) {
|
|
427
397
|
var scaledValue = param.scaledValue, properties = param.properties;
|
|
428
398
|
var start = properties.start, end = properties.end, skew = properties.skew;
|
|
429
|
-
console.log(start, end, skew, 'start, end, skew');
|
|
430
399
|
return Math.pow((scaledValue - start) / (end - start), skew);
|
|
431
400
|
}
|
|
432
401
|
var decimalToPercent = function(decimal) {
|
|
@@ -435,13 +404,104 @@ var decimalToPercent = function(decimal) {
|
|
|
435
404
|
var percentToDecimal = function(percent) {
|
|
436
405
|
return Math.round(0.01 * (typeof percent === 'string' ? parseFloat(percent) : percent));
|
|
437
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
|
+
};
|
|
438
498
|
|
|
439
|
-
function _array_like_to_array$
|
|
499
|
+
function _array_like_to_array$b(arr, len) {
|
|
440
500
|
if (len == null || len > arr.length) len = arr.length;
|
|
441
501
|
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
442
502
|
return arr2;
|
|
443
503
|
}
|
|
444
|
-
function _array_with_holes$
|
|
504
|
+
function _array_with_holes$b(arr) {
|
|
445
505
|
if (Array.isArray(arr)) return arr;
|
|
446
506
|
}
|
|
447
507
|
function _define_property$j(obj, key, value) {
|
|
@@ -457,7 +517,7 @@ function _define_property$j(obj, key, value) {
|
|
|
457
517
|
}
|
|
458
518
|
return obj;
|
|
459
519
|
}
|
|
460
|
-
function _iterable_to_array_limit$
|
|
520
|
+
function _iterable_to_array_limit$b(arr, i) {
|
|
461
521
|
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
462
522
|
if (_i == null) return;
|
|
463
523
|
var _arr = [];
|
|
@@ -481,7 +541,7 @@ function _iterable_to_array_limit$c(arr, i) {
|
|
|
481
541
|
}
|
|
482
542
|
return _arr;
|
|
483
543
|
}
|
|
484
|
-
function _non_iterable_rest$
|
|
544
|
+
function _non_iterable_rest$b() {
|
|
485
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.");
|
|
486
546
|
}
|
|
487
547
|
function _object_spread$j(target) {
|
|
@@ -518,16 +578,16 @@ function _object_spread_props$4(target, source) {
|
|
|
518
578
|
}
|
|
519
579
|
return target;
|
|
520
580
|
}
|
|
521
|
-
function _sliced_to_array$
|
|
522
|
-
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();
|
|
523
583
|
}
|
|
524
|
-
function _unsupported_iterable_to_array$
|
|
584
|
+
function _unsupported_iterable_to_array$b(o, minLen) {
|
|
525
585
|
if (!o) return;
|
|
526
|
-
if (typeof o === "string") return _array_like_to_array$
|
|
586
|
+
if (typeof o === "string") return _array_like_to_array$b(o, minLen);
|
|
527
587
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
528
588
|
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
529
589
|
if (n === "Map" || n === "Set") return Array.from(n);
|
|
530
|
-
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);
|
|
531
591
|
}
|
|
532
592
|
// Initial state
|
|
533
593
|
var defaultGlobalStateValue = {
|
|
@@ -612,7 +672,7 @@ function useGlobalContext(selector) {
|
|
|
612
672
|
// Context provider
|
|
613
673
|
function GlobalContextProvider(param) {
|
|
614
674
|
var children = param.children;
|
|
615
|
-
var _useReducer = _sliced_to_array$
|
|
675
|
+
var _useReducer = _sliced_to_array$b(useReducer(reducer, defaultGlobalStateValue), 2), state = _useReducer[0], dispatch = _useReducer[1];
|
|
616
676
|
var highlightedItemChanged = useCallback(function(highlightedItem) {
|
|
617
677
|
dispatch({
|
|
618
678
|
type: 'HIGHLIGHTED_ITEM_CHANGED',
|
|
@@ -720,15 +780,15 @@ function GlobalContextProvider(param) {
|
|
|
720
780
|
}, children);
|
|
721
781
|
}
|
|
722
782
|
|
|
723
|
-
function _array_like_to_array$
|
|
783
|
+
function _array_like_to_array$a(arr, len) {
|
|
724
784
|
if (len == null || len > arr.length) len = arr.length;
|
|
725
785
|
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
726
786
|
return arr2;
|
|
727
787
|
}
|
|
728
|
-
function _array_with_holes$
|
|
788
|
+
function _array_with_holes$a(arr) {
|
|
729
789
|
if (Array.isArray(arr)) return arr;
|
|
730
790
|
}
|
|
731
|
-
function _iterable_to_array_limit$
|
|
791
|
+
function _iterable_to_array_limit$a(arr, i) {
|
|
732
792
|
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
733
793
|
if (_i == null) return;
|
|
734
794
|
var _arr = [];
|
|
@@ -752,26 +812,26 @@ function _iterable_to_array_limit$b(arr, i) {
|
|
|
752
812
|
}
|
|
753
813
|
return _arr;
|
|
754
814
|
}
|
|
755
|
-
function _non_iterable_rest$
|
|
815
|
+
function _non_iterable_rest$a() {
|
|
756
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.");
|
|
757
817
|
}
|
|
758
|
-
function _sliced_to_array$
|
|
759
|
-
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();
|
|
760
820
|
}
|
|
761
|
-
function _unsupported_iterable_to_array$
|
|
821
|
+
function _unsupported_iterable_to_array$a(o, minLen) {
|
|
762
822
|
if (!o) return;
|
|
763
|
-
if (typeof o === "string") return _array_like_to_array$
|
|
823
|
+
if (typeof o === "string") return _array_like_to_array$a(o, minLen);
|
|
764
824
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
765
825
|
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
766
826
|
if (n === "Map" || n === "Set") return Array.from(n);
|
|
767
|
-
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);
|
|
768
828
|
}
|
|
769
829
|
var useDropdown = function(param) {
|
|
770
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;
|
|
771
831
|
var _properties_choices;
|
|
772
832
|
var comboBoxState = Juce.getComboBoxState(id);
|
|
773
|
-
var _useState = _sliced_to_array$
|
|
774
|
-
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];
|
|
775
835
|
var setHighlightedItem = useGlobalContext().setHighlightedItem;
|
|
776
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 : [];
|
|
777
837
|
var filteredChoices = filter ? choices === null || choices === void 0 ? void 0 : choices.filter(function(item) {
|
|
@@ -1096,7 +1156,9 @@ function Dropdown(param) {
|
|
|
1096
1156
|
}), value = _useDropdown.value, choices = _useDropdown.choices, onMouseEnter = _useDropdown.onMouseEnter, handleChange = _useDropdown.handleChange;
|
|
1097
1157
|
return /*#__PURE__*/ React__default.createElement(Box, {
|
|
1098
1158
|
flexDirection: Box.flexDirection.column,
|
|
1099
|
-
onMouseEnter: onMouseEnter
|
|
1159
|
+
onMouseEnter: onMouseEnter,
|
|
1160
|
+
width: "100%",
|
|
1161
|
+
flex: "0 1 auto"
|
|
1100
1162
|
}, /*#__PURE__*/ React__default.createElement(Listbox, {
|
|
1101
1163
|
value: value,
|
|
1102
1164
|
onChange: handleChange
|
|
@@ -1127,6 +1189,9 @@ function Dropdown(param) {
|
|
|
1127
1189
|
}, item);
|
|
1128
1190
|
}))), /*#__PURE__*/ React__default.createElement(Label, {
|
|
1129
1191
|
padding: [
|
|
1192
|
+
Label.padding.mediumSmall,
|
|
1193
|
+
Label.padding.mediumSmall,
|
|
1194
|
+
Label.padding.none,
|
|
1130
1195
|
Label.padding.mediumSmall
|
|
1131
1196
|
],
|
|
1132
1197
|
fontSize: Label.fontSize.xSmall,
|
|
@@ -1137,90 +1202,15 @@ function Dropdown(param) {
|
|
|
1137
1202
|
}));
|
|
1138
1203
|
}
|
|
1139
1204
|
|
|
1140
|
-
var
|
|
1141
|
-
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;
|
|
1142
|
-
// TODO: Clean up
|
|
1143
|
-
var errorMessages = [];
|
|
1144
|
-
var isIncomplete = false;
|
|
1145
|
-
var length = value.toString().length;
|
|
1146
|
-
if (length > maxLength && (errorMessages === null || errorMessages === void 0 ? void 0 : errorMessages.indexOf(InputErrorStates === null || InputErrorStates === void 0 ? void 0 : InputErrorStates.exceedsMaxLength)) === -1) {
|
|
1147
|
-
errorMessages === null || errorMessages === void 0 ? void 0 : errorMessages.push(InputErrorStates === null || InputErrorStates === void 0 ? void 0 : InputErrorStates.exceedsMaxLength);
|
|
1148
|
-
}
|
|
1149
|
-
if (length < minLength) {
|
|
1150
|
-
isIncomplete = true;
|
|
1151
|
-
}
|
|
1152
|
-
if (type === InputTypes.number) {
|
|
1153
|
-
if (!(value === '' || /^-?[\d-.]+$/.test(value.toString()))) {
|
|
1154
|
-
errorMessages.push(InputErrorStates.invalidCharacter);
|
|
1155
|
-
}
|
|
1156
|
-
if (typeof value === 'number') {
|
|
1157
|
-
if ((value > max || value < min) && (errorMessages === null || errorMessages === void 0 ? void 0 : errorMessages.indexOf(InputErrorStates.valueOutOfRange)) === -1) {
|
|
1158
|
-
errorMessages === null || errorMessages === void 0 ? void 0 : errorMessages.push(InputErrorStates.valueOutOfRange);
|
|
1159
|
-
}
|
|
1160
|
-
}
|
|
1161
|
-
}
|
|
1162
|
-
return {
|
|
1163
|
-
errorMessages: errorMessages,
|
|
1164
|
-
isIncomplete: isIncomplete,
|
|
1165
|
-
isValid: !errorMessages.length && !isIncomplete
|
|
1166
|
-
};
|
|
1167
|
-
};
|
|
1168
|
-
var getBarTransformStyles = function(param) {
|
|
1169
|
-
var polarity = param.polarity, orientation = param.orientation, normalisedValue = param.normalisedValue;
|
|
1170
|
-
var wholeNumberNormalisedValue = normalisedValue * 100;
|
|
1171
|
-
var linearValue = wholeNumberNormalisedValue ? parseFloat(wholeNumberNormalisedValue === null || wholeNumberNormalisedValue === void 0 ? void 0 : wholeNumberNormalisedValue.toFixed(2)) : 0;
|
|
1172
|
-
var bipolarValue = (wholeNumberNormalisedValue - 50) / 100;
|
|
1173
|
-
if (polarity === Polarity.linear) {
|
|
1174
|
-
return orientation === Orientation.horizontal ? {
|
|
1175
|
-
width: linearValue ? "100%" : '1px',
|
|
1176
|
-
height: '100%',
|
|
1177
|
-
transform: linearValue ? "scale(".concat(Math.ceil(linearValue) * 0.01, ", 1)") : 'none',
|
|
1178
|
-
transformOrigin: 'center left',
|
|
1179
|
-
top: '0',
|
|
1180
|
-
bottom: '0',
|
|
1181
|
-
left: '0'
|
|
1182
|
-
} : {
|
|
1183
|
-
width: "100%",
|
|
1184
|
-
height: linearValue ? '100%' : '1px',
|
|
1185
|
-
transform: "scale(1, ".concat(Math.ceil(linearValue) * 0.01, ")"),
|
|
1186
|
-
transformOrigin: 'bottom center',
|
|
1187
|
-
top: '0',
|
|
1188
|
-
bottom: '0',
|
|
1189
|
-
left: '0'
|
|
1190
|
-
};
|
|
1191
|
-
} else {
|
|
1192
|
-
return orientation === Orientation.horizontal ? {
|
|
1193
|
-
width: bipolarValue ? "100%" : '1px',
|
|
1194
|
-
height: '100%',
|
|
1195
|
-
transform: bipolarValue ? "scale(".concat(bipolarValue, ", 1)") : 'none',
|
|
1196
|
-
transformOrigin: 'left center',
|
|
1197
|
-
top: '0',
|
|
1198
|
-
bottom: '0',
|
|
1199
|
-
left: '50%'
|
|
1200
|
-
} : {
|
|
1201
|
-
width: "100%",
|
|
1202
|
-
height: bipolarValue ? '100%' : '1px',
|
|
1203
|
-
transform: bipolarValue ? "scale(1, ".concat(bipolarValue, ")") : 'none',
|
|
1204
|
-
transformOrigin: 'bottom center',
|
|
1205
|
-
bottom: '50%',
|
|
1206
|
-
left: '0',
|
|
1207
|
-
right: '0'
|
|
1208
|
-
};
|
|
1209
|
-
}
|
|
1210
|
-
};
|
|
1211
|
-
var randomizeValue = function(min, max) {
|
|
1212
|
-
return Math.random() * (max - min) + min;
|
|
1213
|
-
};
|
|
1214
|
-
|
|
1215
|
-
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";
|
|
1216
1206
|
styleInject(css_248z$7);
|
|
1217
1207
|
|
|
1218
|
-
function _array_like_to_array$
|
|
1208
|
+
function _array_like_to_array$9(arr, len) {
|
|
1219
1209
|
if (len == null || len > arr.length) len = arr.length;
|
|
1220
1210
|
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
1221
1211
|
return arr2;
|
|
1222
1212
|
}
|
|
1223
|
-
function _array_with_holes$
|
|
1213
|
+
function _array_with_holes$9(arr) {
|
|
1224
1214
|
if (Array.isArray(arr)) return arr;
|
|
1225
1215
|
}
|
|
1226
1216
|
function _define_property$f(obj, key, value) {
|
|
@@ -1236,7 +1226,7 @@ function _define_property$f(obj, key, value) {
|
|
|
1236
1226
|
}
|
|
1237
1227
|
return obj;
|
|
1238
1228
|
}
|
|
1239
|
-
function _iterable_to_array_limit$
|
|
1229
|
+
function _iterable_to_array_limit$9(arr, i) {
|
|
1240
1230
|
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
1241
1231
|
if (_i == null) return;
|
|
1242
1232
|
var _arr = [];
|
|
@@ -1260,7 +1250,7 @@ function _iterable_to_array_limit$a(arr, i) {
|
|
|
1260
1250
|
}
|
|
1261
1251
|
return _arr;
|
|
1262
1252
|
}
|
|
1263
|
-
function _non_iterable_rest$
|
|
1253
|
+
function _non_iterable_rest$9() {
|
|
1264
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.");
|
|
1265
1255
|
}
|
|
1266
1256
|
function _object_spread$f(target) {
|
|
@@ -1278,16 +1268,16 @@ function _object_spread$f(target) {
|
|
|
1278
1268
|
}
|
|
1279
1269
|
return target;
|
|
1280
1270
|
}
|
|
1281
|
-
function _sliced_to_array$
|
|
1282
|
-
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();
|
|
1283
1273
|
}
|
|
1284
|
-
function _unsupported_iterable_to_array$
|
|
1274
|
+
function _unsupported_iterable_to_array$9(o, minLen) {
|
|
1285
1275
|
if (!o) return;
|
|
1286
|
-
if (typeof o === "string") return _array_like_to_array$
|
|
1276
|
+
if (typeof o === "string") return _array_like_to_array$9(o, minLen);
|
|
1287
1277
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
1288
1278
|
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
1289
1279
|
if (n === "Map" || n === "Set") return Array.from(n);
|
|
1290
|
-
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);
|
|
1291
1281
|
}
|
|
1292
1282
|
// import { decimalToPercent, percentToDecimal } from '../../common/utils';
|
|
1293
1283
|
// import debounce from 'lodash.debounce';
|
|
@@ -1297,62 +1287,85 @@ var InputTypes = /*#__PURE__*/ function(InputTypes) {
|
|
|
1297
1287
|
return InputTypes;
|
|
1298
1288
|
}({});
|
|
1299
1289
|
function Input(param) {
|
|
1300
|
-
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;
|
|
1301
1291
|
var _inputRef_current;
|
|
1302
|
-
var _useState = _sliced_to_array$
|
|
1303
|
-
|
|
1304
|
-
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];
|
|
1305
1295
|
var valueRef = useRef(null);
|
|
1306
|
-
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
|
+
]);
|
|
1307
1328
|
// (inputValue === '' || /^-?\d+$/.test(inputValue)
|
|
1308
|
-
function
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1329
|
+
function clickListener(event) {
|
|
1330
|
+
if (event.target.id === id) {
|
|
1331
|
+
var _document_getElementById;
|
|
1332
|
+
(_document_getElementById = document.getElementById(id)) === 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(id)) === null || _document_getElementById1 === void 0 ? void 0 : _document_getElementById1.blur();
|
|
1338
|
+
}
|
|
1339
|
+
}
|
|
1340
|
+
function handleSubmit(e) {
|
|
1341
|
+
var newValue = e.target.value;
|
|
1342
|
+
var _Juce_getSliderState = Juce.getSliderState(id), scaledValue = _Juce_getSliderState.scaledValue, properties = _Juce_getSliderState.properties;
|
|
1343
|
+
if ((valueRef === null || valueRef === void 0 ? void 0 : valueRef.current) !== newValue && e.target.id === id) {
|
|
1344
|
+
var validValue = getValidValueForInput({
|
|
1314
1345
|
value: newValue,
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
setHasIncompleteValue(false);
|
|
1323
|
-
setHasError(false);
|
|
1346
|
+
oldValue: scaledValue,
|
|
1347
|
+
properties: properties
|
|
1348
|
+
});
|
|
1349
|
+
valueRef.current = validValue;
|
|
1350
|
+
onComplete(validValue);
|
|
1351
|
+
if (validValue === valueRef.current) {
|
|
1352
|
+
setInternalValue(validValue);
|
|
1324
1353
|
}
|
|
1325
1354
|
}
|
|
1326
1355
|
}
|
|
1356
|
+
useEffect(function() {
|
|
1357
|
+
document.addEventListener('click', clickListener);
|
|
1358
|
+
return function() {
|
|
1359
|
+
document.removeEventListener('click', clickListener);
|
|
1360
|
+
};
|
|
1361
|
+
}, [
|
|
1362
|
+
window,
|
|
1363
|
+
isHighlighted
|
|
1364
|
+
]);
|
|
1327
1365
|
function handleKeyUp(e) {
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
if ((valueRef === null || valueRef === void 0 ? void 0 : valueRef.current) !== newValue) {
|
|
1332
|
-
var _validate = validate({
|
|
1333
|
-
value: newValue,
|
|
1334
|
-
type: type,
|
|
1335
|
-
minLength: minLength,
|
|
1336
|
-
maxLength: maxLength,
|
|
1337
|
-
min: min,
|
|
1338
|
-
max: max
|
|
1339
|
-
}), errorMessages = _validate.errorMessages, isIncomplete = _validate.isIncomplete;
|
|
1340
|
-
if (errorMessages.length && !isIncomplete) {
|
|
1341
|
-
setHasError(true);
|
|
1342
|
-
setHasIncompleteValue(false);
|
|
1343
|
-
}
|
|
1344
|
-
if (isIncomplete) {
|
|
1345
|
-
setHasIncompleteValue(true);
|
|
1346
|
-
}
|
|
1347
|
-
if (errorMessages.length === 0 && !isIncomplete) {
|
|
1348
|
-
setHasIncompleteValue(false);
|
|
1349
|
-
setHasError(false);
|
|
1350
|
-
onComplete && onComplete(newValue);
|
|
1351
|
-
}
|
|
1352
|
-
onComplete && onComplete(newValue);
|
|
1353
|
-
valueRef.current = newValue;
|
|
1354
|
-
}
|
|
1355
|
-
}, timeoutVal);
|
|
1366
|
+
if (e.key === 'Enter') {
|
|
1367
|
+
handleSubmit(e);
|
|
1368
|
+
}
|
|
1356
1369
|
}
|
|
1357
1370
|
var inputRef = useRef('');
|
|
1358
1371
|
// detects when the user is actively typing
|
|
@@ -1360,70 +1373,34 @@ function Input(param) {
|
|
|
1360
1373
|
// triggers a check to see if the user is actually done typing
|
|
1361
1374
|
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));
|
|
1362
1375
|
var handleChange = useCallback(function(e) {
|
|
1363
|
-
var newValue = e.target.value;
|
|
1364
|
-
setHasError(false);
|
|
1365
|
-
var _validate = validate({
|
|
1366
|
-
value: newValue,
|
|
1367
|
-
type: type,
|
|
1368
|
-
minLength: minLength,
|
|
1369
|
-
maxLength: maxLength,
|
|
1370
|
-
min: min,
|
|
1371
|
-
max: max
|
|
1372
|
-
}), errorMessages = _validate.errorMessages, isValid = _validate.isValid;
|
|
1373
|
-
if (isValid) {
|
|
1374
|
-
setHasError(false);
|
|
1375
|
-
setHasIncompleteValue(false);
|
|
1376
|
-
}
|
|
1377
1376
|
// Don't set the internal value if the value exceeds the max length
|
|
1378
1377
|
// Don't set the internal value if the value contains an invalid character
|
|
1379
|
-
if ((
|
|
1380
|
-
setInternalValue(
|
|
1378
|
+
if (validateInputChange(e)) {
|
|
1379
|
+
setInternalValue(e.target.value);
|
|
1381
1380
|
}
|
|
1382
1381
|
}, [
|
|
1383
|
-
|
|
1384
|
-
validate,
|
|
1382
|
+
getValidValueForInput,
|
|
1385
1383
|
setInternalValue
|
|
1386
1384
|
]);
|
|
1387
|
-
useEffect(
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
value: value,
|
|
1391
|
-
type: type,
|
|
1392
|
-
minLength: minLength,
|
|
1393
|
-
maxLength: maxLength,
|
|
1394
|
-
min: min,
|
|
1395
|
-
max: max
|
|
1396
|
-
}).isValid;
|
|
1397
|
-
if (isValid) {
|
|
1398
|
-
setHasError(false);
|
|
1399
|
-
setHasIncompleteValue(false);
|
|
1400
|
-
}
|
|
1401
|
-
}, [
|
|
1402
|
-
value
|
|
1403
|
-
]);
|
|
1385
|
+
// useEffect(() => {
|
|
1386
|
+
// setInternalValue(value);
|
|
1387
|
+
// }, [value]);
|
|
1404
1388
|
return /*#__PURE__*/ React__default.createElement("input", {
|
|
1405
1389
|
id: id,
|
|
1406
1390
|
ref: inputRef,
|
|
1407
|
-
className: classnames('TextInput',
|
|
1391
|
+
className: classnames('TextInput', isHighlighted ? 'is-highlighted' : '', className),
|
|
1408
1392
|
style: _object_spread$f({
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
color: hasError ? 'red' : textColor,
|
|
1412
|
-
fontSize: fontSize
|
|
1393
|
+
fontSize: "var(--text-".concat(fontSize),
|
|
1394
|
+
color: textColor
|
|
1413
1395
|
}, style),
|
|
1414
1396
|
value: internalValue,
|
|
1415
1397
|
onKeyUp: function() {
|
|
1416
1398
|
return handleKeyUp;
|
|
1417
1399
|
},
|
|
1418
|
-
|
|
1419
|
-
return
|
|
1420
|
-
},
|
|
1421
|
-
onBlur: function() {
|
|
1422
|
-
return setInternalValue(internalValue);
|
|
1423
|
-
},
|
|
1424
|
-
onFocus: function(e) {
|
|
1425
|
-
return e.target.select();
|
|
1400
|
+
onBlur: function(e) {
|
|
1401
|
+
return handleSubmit(e);
|
|
1426
1402
|
},
|
|
1403
|
+
// onFocus={(e) => e.target.select()}
|
|
1427
1404
|
onChange: function(e) {
|
|
1428
1405
|
return handleChange(e);
|
|
1429
1406
|
}
|
|
@@ -1438,15 +1415,15 @@ var SliderType = /*#__PURE__*/ function(SliderType) {
|
|
|
1438
1415
|
return SliderType;
|
|
1439
1416
|
}({});
|
|
1440
1417
|
|
|
1441
|
-
function _array_like_to_array$
|
|
1418
|
+
function _array_like_to_array$8(arr, len) {
|
|
1442
1419
|
if (len == null || len > arr.length) len = arr.length;
|
|
1443
1420
|
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
1444
1421
|
return arr2;
|
|
1445
1422
|
}
|
|
1446
|
-
function _array_with_holes$
|
|
1423
|
+
function _array_with_holes$8(arr) {
|
|
1447
1424
|
if (Array.isArray(arr)) return arr;
|
|
1448
1425
|
}
|
|
1449
|
-
function _iterable_to_array_limit$
|
|
1426
|
+
function _iterable_to_array_limit$8(arr, i) {
|
|
1450
1427
|
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
1451
1428
|
if (_i == null) return;
|
|
1452
1429
|
var _arr = [];
|
|
@@ -1470,19 +1447,19 @@ function _iterable_to_array_limit$9(arr, i) {
|
|
|
1470
1447
|
}
|
|
1471
1448
|
return _arr;
|
|
1472
1449
|
}
|
|
1473
|
-
function _non_iterable_rest$
|
|
1450
|
+
function _non_iterable_rest$8() {
|
|
1474
1451
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
1475
1452
|
}
|
|
1476
|
-
function _sliced_to_array$
|
|
1477
|
-
return _array_with_holes$
|
|
1453
|
+
function _sliced_to_array$8(arr, i) {
|
|
1454
|
+
return _array_with_holes$8(arr) || _iterable_to_array_limit$8(arr, i) || _unsupported_iterable_to_array$8(arr, i) || _non_iterable_rest$8();
|
|
1478
1455
|
}
|
|
1479
|
-
function _unsupported_iterable_to_array$
|
|
1456
|
+
function _unsupported_iterable_to_array$8(o, minLen) {
|
|
1480
1457
|
if (!o) return;
|
|
1481
|
-
if (typeof o === "string") return _array_like_to_array$
|
|
1458
|
+
if (typeof o === "string") return _array_like_to_array$8(o, minLen);
|
|
1482
1459
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
1483
1460
|
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
1484
1461
|
if (n === "Map" || n === "Set") return Array.from(n);
|
|
1485
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$
|
|
1462
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$8(o, minLen);
|
|
1486
1463
|
}
|
|
1487
1464
|
// 20.0f, 15000.0f, 0.1f, 0.7f),800.0f
|
|
1488
1465
|
// ValueType rangeStart, ValueType rangeEnd, ValueType intervalValue, ValueType skewFactor, bool useSymmetricSkew=false)
|
|
@@ -1493,6 +1470,28 @@ var useSlider = function(param) {
|
|
|
1493
1470
|
interval: 0.1,
|
|
1494
1471
|
skew: 0.7
|
|
1495
1472
|
} : _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;
|
|
1473
|
+
var clickListener = function clickListener(event) {
|
|
1474
|
+
var _event_target_closest;
|
|
1475
|
+
if (((_event_target_closest = event.target.closest('.Slider')) === null || _event_target_closest === void 0 ? void 0 : _event_target_closest.id) === id) {
|
|
1476
|
+
setIsActive(true);
|
|
1477
|
+
event.stopPropagation();
|
|
1478
|
+
} else {
|
|
1479
|
+
setIsActive(false);
|
|
1480
|
+
event.stopPropagation();
|
|
1481
|
+
}
|
|
1482
|
+
};
|
|
1483
|
+
var keyDownListener = function keyDownListener(event) {
|
|
1484
|
+
if (isActive) {
|
|
1485
|
+
if (event.key === 'ArrowLeft') {
|
|
1486
|
+
event.preventDefault();
|
|
1487
|
+
decrementValue();
|
|
1488
|
+
}
|
|
1489
|
+
if (event.key === 'ArrowRight') {
|
|
1490
|
+
event.preventDefault();
|
|
1491
|
+
incrementValue();
|
|
1492
|
+
}
|
|
1493
|
+
}
|
|
1494
|
+
};
|
|
1496
1495
|
// const sliderState: JuceSlider = Juce.getSliderState(id);
|
|
1497
1496
|
// if isLocalhost is true, the front end app is running outside of JUCE in a browser.
|
|
1498
1497
|
var isLocalhost = window.location.hostname === 'localhost';
|
|
@@ -1505,13 +1504,25 @@ var useSlider = function(param) {
|
|
|
1505
1504
|
* AudioProcessorParameter::getValue() (C++).
|
|
1506
1505
|
*/ // See https://github.com/juce-framework/JUCE/blob/51d11a2be6d5c97ccf12b4e5e827006e19f0555a/modules/juce_gui_extra/native/javascript/index.js#L230C1-L238C6
|
|
1507
1506
|
// NOTE: We can think of this as a percentage value, in 0 to 1 format
|
|
1508
|
-
var _useState = _sliced_to_array$
|
|
1507
|
+
var _useState = _sliced_to_array$8(useState(0), 2), scaledValue = _useState[0], setScaledValue = _useState[1];
|
|
1509
1508
|
// const [normalisedValue, setNormalisedValue] = useState(0);
|
|
1510
|
-
var _useState1 = _sliced_to_array$
|
|
1509
|
+
var _useState1 = _sliced_to_array$8(useState(), 2), properties = _useState1[0], setProperties = _useState1[1];
|
|
1511
1510
|
var scaledValueRef = useRef(null);
|
|
1512
1511
|
var normalisedValueRef = useRef(null);
|
|
1513
1512
|
// const randomValueSetCounter = useRef<number>(null);
|
|
1514
1513
|
var _useGlobalContext = useGlobalContext(), useRandom = _useGlobalContext.useRandom, highlightedItemChanged = _useGlobalContext.highlightedItemChanged, setDefaultParameter = _useGlobalContext.setDefaultParameter;
|
|
1514
|
+
var _useState2 = _sliced_to_array$8(useState(false), 2), isActive = _useState2[0], setIsActive = _useState2[1];
|
|
1515
|
+
useEffect(function() {
|
|
1516
|
+
document.addEventListener('click', clickListener);
|
|
1517
|
+
document.addEventListener('keydown', keyDownListener);
|
|
1518
|
+
return function() {
|
|
1519
|
+
document.removeEventListener('click', clickListener);
|
|
1520
|
+
document.removeEventListener('keydown', keyDownListener);
|
|
1521
|
+
};
|
|
1522
|
+
}, [
|
|
1523
|
+
window,
|
|
1524
|
+
isActive
|
|
1525
|
+
]);
|
|
1515
1526
|
// Set the initial state
|
|
1516
1527
|
//@ts-expect-error
|
|
1517
1528
|
useEffect(function() {
|
|
@@ -1647,8 +1658,6 @@ var useSlider = function(param) {
|
|
|
1647
1658
|
i: "".concat(0)
|
|
1648
1659
|
});
|
|
1649
1660
|
}
|
|
1650
|
-
}, {
|
|
1651
|
-
preventDefault: true
|
|
1652
1661
|
});
|
|
1653
1662
|
var bindBarSliderDrag = function() {
|
|
1654
1663
|
var drag = useDrag(function(param) {
|
|
@@ -1725,8 +1734,10 @@ var useSlider = function(param) {
|
|
|
1725
1734
|
setToDefaultState: setToDefaultState,
|
|
1726
1735
|
incrementValue: incrementValue,
|
|
1727
1736
|
decrementValue: decrementValue,
|
|
1737
|
+
isActive: isActive,
|
|
1728
1738
|
// onChangeStarted,
|
|
1729
1739
|
// onChangeCommitted,
|
|
1740
|
+
scaledToNormalised: scaledToNormalised,
|
|
1730
1741
|
onMouseEnter: onMouseEnter,
|
|
1731
1742
|
bindBarSliderDrag: bindBarSliderDrag,
|
|
1732
1743
|
bindDrag: bindDrag,
|
|
@@ -1736,17 +1747,9 @@ var useSlider = function(param) {
|
|
|
1736
1747
|
};
|
|
1737
1748
|
};
|
|
1738
1749
|
|
|
1739
|
-
var css_248z$6 = ".RotarySlider {\n position: relative
|
|
1750
|
+
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";
|
|
1740
1751
|
styleInject(css_248z$6);
|
|
1741
1752
|
|
|
1742
|
-
function _array_like_to_array$8(arr, len) {
|
|
1743
|
-
if (len == null || len > arr.length) len = arr.length;
|
|
1744
|
-
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
1745
|
-
return arr2;
|
|
1746
|
-
}
|
|
1747
|
-
function _array_with_holes$8(arr) {
|
|
1748
|
-
if (Array.isArray(arr)) return arr;
|
|
1749
|
-
}
|
|
1750
1753
|
function _define_property$e(obj, key, value) {
|
|
1751
1754
|
if (key in obj) {
|
|
1752
1755
|
Object.defineProperty(obj, key, {
|
|
@@ -1760,33 +1763,6 @@ function _define_property$e(obj, key, value) {
|
|
|
1760
1763
|
}
|
|
1761
1764
|
return obj;
|
|
1762
1765
|
}
|
|
1763
|
-
function _iterable_to_array_limit$8(arr, i) {
|
|
1764
|
-
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
1765
|
-
if (_i == null) return;
|
|
1766
|
-
var _arr = [];
|
|
1767
|
-
var _n = true;
|
|
1768
|
-
var _d = false;
|
|
1769
|
-
var _s, _e;
|
|
1770
|
-
try {
|
|
1771
|
-
for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
|
|
1772
|
-
_arr.push(_s.value);
|
|
1773
|
-
if (i && _arr.length === i) break;
|
|
1774
|
-
}
|
|
1775
|
-
} catch (err) {
|
|
1776
|
-
_d = true;
|
|
1777
|
-
_e = err;
|
|
1778
|
-
} finally{
|
|
1779
|
-
try {
|
|
1780
|
-
if (!_n && _i["return"] != null) _i["return"]();
|
|
1781
|
-
} finally{
|
|
1782
|
-
if (_d) throw _e;
|
|
1783
|
-
}
|
|
1784
|
-
}
|
|
1785
|
-
return _arr;
|
|
1786
|
-
}
|
|
1787
|
-
function _non_iterable_rest$8() {
|
|
1788
|
-
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
1789
|
-
}
|
|
1790
1766
|
function _object_spread$e(target) {
|
|
1791
1767
|
for(var i = 1; i < arguments.length; i++){
|
|
1792
1768
|
var source = arguments[i] != null ? arguments[i] : {};
|
|
@@ -1821,17 +1797,6 @@ function _object_spread_props$2(target, source) {
|
|
|
1821
1797
|
}
|
|
1822
1798
|
return target;
|
|
1823
1799
|
}
|
|
1824
|
-
function _sliced_to_array$8(arr, i) {
|
|
1825
|
-
return _array_with_holes$8(arr) || _iterable_to_array_limit$8(arr, i) || _unsupported_iterable_to_array$8(arr, i) || _non_iterable_rest$8();
|
|
1826
|
-
}
|
|
1827
|
-
function _unsupported_iterable_to_array$8(o, minLen) {
|
|
1828
|
-
if (!o) return;
|
|
1829
|
-
if (typeof o === "string") return _array_like_to_array$8(o, minLen);
|
|
1830
|
-
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
1831
|
-
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
1832
|
-
if (n === "Map" || n === "Set") return Array.from(n);
|
|
1833
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$8(o, minLen);
|
|
1834
|
-
}
|
|
1835
1800
|
var ProgressCircle = function(param) {
|
|
1836
1801
|
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;
|
|
1837
1802
|
var cx = width / 2;
|
|
@@ -1841,7 +1806,6 @@ var ProgressCircle = function(param) {
|
|
|
1841
1806
|
var activeZone = circ - circ * 0.25;
|
|
1842
1807
|
var linearOffset = circ - activeZone * (value * 100) / 100;
|
|
1843
1808
|
var bipolarOffset = circ - activeZone * (value * 100 - 50) / 100;
|
|
1844
|
-
console.log(width, height, 'width, height in progresscircle');
|
|
1845
1809
|
return /*#__PURE__*/ React__default.createElement("svg", {
|
|
1846
1810
|
className: "ProgressCircle",
|
|
1847
1811
|
width: width,
|
|
@@ -1893,7 +1857,7 @@ function RotarySlider(param) {
|
|
|
1893
1857
|
end: 15000.0,
|
|
1894
1858
|
interval: 0.1,
|
|
1895
1859
|
skew: 0.7
|
|
1896
|
-
} : _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 ?
|
|
1860
|
+
} : _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;
|
|
1897
1861
|
var _useSlider = useSlider({
|
|
1898
1862
|
id: id,
|
|
1899
1863
|
label: label,
|
|
@@ -1901,42 +1865,12 @@ function RotarySlider(param) {
|
|
|
1901
1865
|
mockInitialNormalisedValue: mockInitialNormalisedValue,
|
|
1902
1866
|
onChange: onChange,
|
|
1903
1867
|
isRandomizable: isRandomizable
|
|
1904
|
-
}), bindDrag = _useSlider.bindDrag, normalisedValue = _useSlider.normalisedValue, scaledValue = _useSlider.scaledValue, onMouseEnter = _useSlider.onMouseEnter, setToDefaultState = _useSlider.setToDefaultState,
|
|
1905
|
-
var _useState = _sliced_to_array$8(useState(false), 2), isActive = _useState[0], setIsActive = _useState[1];
|
|
1906
|
-
function clickListener(event) {
|
|
1907
|
-
var _event_target_closest;
|
|
1908
|
-
if (((_event_target_closest = event.target.closest('.RotarySlider')) === null || _event_target_closest === void 0 ? void 0 : _event_target_closest.id) === id) {
|
|
1909
|
-
setIsActive(true);
|
|
1910
|
-
} else {
|
|
1911
|
-
setIsActive(false);
|
|
1912
|
-
}
|
|
1913
|
-
}
|
|
1914
|
-
function keyDownListener(event) {
|
|
1915
|
-
if (isActive) {
|
|
1916
|
-
if (event.key === 'ArrowLeft') {
|
|
1917
|
-
event.preventDefault();
|
|
1918
|
-
decrementValue();
|
|
1919
|
-
}
|
|
1920
|
-
if (event.key === 'ArrowRight') {
|
|
1921
|
-
event.preventDefault();
|
|
1922
|
-
incrementValue();
|
|
1923
|
-
}
|
|
1924
|
-
}
|
|
1925
|
-
}
|
|
1926
|
-
useEffect(function() {
|
|
1927
|
-
document.addEventListener('click', clickListener, true);
|
|
1928
|
-
document.addEventListener('keydown', keyDownListener);
|
|
1929
|
-
return function() {
|
|
1930
|
-
document.removeEventListener('click', clickListener);
|
|
1931
|
-
document.removeEventListener('keydown', keyDownListener);
|
|
1932
|
-
};
|
|
1933
|
-
}, [
|
|
1934
|
-
window,
|
|
1935
|
-
isActive
|
|
1936
|
-
]);
|
|
1868
|
+
}), bindDrag = _useSlider.bindDrag, normalisedValue = _useSlider.normalisedValue, scaledValue = _useSlider.scaledValue, onMouseEnter = _useSlider.onMouseEnter, setToDefaultState = _useSlider.setToDefaultState, setNormalisedState = _useSlider.setNormalisedState, isActive = _useSlider.isActive, properties = _useSlider.properties;
|
|
1937
1869
|
return /*#__PURE__*/ React__default.createElement(Box, {
|
|
1938
1870
|
className: "RotarySlider-wrapper",
|
|
1939
|
-
flexDirection: Box.flexDirection.column
|
|
1871
|
+
flexDirection: Box.flexDirection.column,
|
|
1872
|
+
gap: Box.gap.none,
|
|
1873
|
+
flex: "0 1 auto"
|
|
1940
1874
|
}, polarity === Polarity.bipolar && /*#__PURE__*/ React__default.createElement("div", {
|
|
1941
1875
|
style: {
|
|
1942
1876
|
borderColor: "".concat(color, " transparent ").concat(color, " transparent")
|
|
@@ -1944,7 +1878,7 @@ function RotarySlider(param) {
|
|
|
1944
1878
|
className: classnames('RotarySlider-center-marker')
|
|
1945
1879
|
}), /*#__PURE__*/ React__default.createElement(Box, _object_spread_props$2(_object_spread$e({
|
|
1946
1880
|
id: id,
|
|
1947
|
-
className: classnames('RotarySlider', isActive ? 'corner-border' : '', polarity === Polarity.linear ? 'Slider-polarity-linear' : 'Slider-polarity-bipolar', className)
|
|
1881
|
+
className: classnames('Slider', 'RotarySlider', isActive ? 'corner-border' : '', polarity === Polarity.linear ? 'Slider-polarity-linear' : 'Slider-polarity-bipolar', className)
|
|
1948
1882
|
}, bindDrag()), {
|
|
1949
1883
|
onMouseEnter: onMouseEnter,
|
|
1950
1884
|
onDoubleClick: function() {
|
|
@@ -1964,16 +1898,28 @@ function RotarySlider(param) {
|
|
|
1964
1898
|
bgColor: color,
|
|
1965
1899
|
width: width,
|
|
1966
1900
|
height: height
|
|
1967
|
-
}), /*#__PURE__*/ React__default.createElement(
|
|
1901
|
+
})) : ''), /*#__PURE__*/ React__default.createElement(Input, {
|
|
1968
1902
|
className: "ProgressCircle-value",
|
|
1969
|
-
|
|
1970
|
-
|
|
1903
|
+
value: scaledValue,
|
|
1904
|
+
id: id,
|
|
1905
|
+
min: (properties === null || properties === void 0 ? void 0 : properties.start) || 0,
|
|
1906
|
+
max: (properties === null || properties === void 0 ? void 0 : properties.end) || 0,
|
|
1971
1907
|
style: {
|
|
1972
|
-
fontWeight: 'bold'
|
|
1908
|
+
fontWeight: 'bold',
|
|
1909
|
+
width: '100%',
|
|
1910
|
+
maxWidth: "".concat(width, "px"),
|
|
1911
|
+
marginBottom: 'var(--spacing-sm)'
|
|
1912
|
+
},
|
|
1913
|
+
onComplete: function(value) {
|
|
1914
|
+
var normalisedVal = properties && scaledToNormalised({
|
|
1915
|
+
scaledValue: value,
|
|
1916
|
+
properties: properties
|
|
1917
|
+
});
|
|
1918
|
+
normalisedVal !== undefined && setNormalisedState(normalisedVal);
|
|
1973
1919
|
}
|
|
1974
|
-
}
|
|
1920
|
+
}), /*#__PURE__*/ React__default.createElement(Label, {
|
|
1975
1921
|
padding: [
|
|
1976
|
-
Label.padding.
|
|
1922
|
+
Label.padding.none
|
|
1977
1923
|
],
|
|
1978
1924
|
fontSize: Label.fontSize.xSmall,
|
|
1979
1925
|
value: label
|
|
@@ -2085,24 +2031,6 @@ Slider.sliderType = SliderType;
|
|
|
2085
2031
|
Slider.sliderPolarity = Polarity;
|
|
2086
2032
|
Slider.sliderOrientation = Orientation;
|
|
2087
2033
|
|
|
2088
|
-
function SliderValue(param) {
|
|
2089
|
-
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;
|
|
2090
|
-
return /*#__PURE__*/ React__default.createElement(React__default.Fragment, null, isEditable ? /*#__PURE__*/ React__default.createElement(Input, {
|
|
2091
|
-
value: value,
|
|
2092
|
-
min: min,
|
|
2093
|
-
max: max,
|
|
2094
|
-
minLength: minLength,
|
|
2095
|
-
maxLength: maxLength,
|
|
2096
|
-
style: style,
|
|
2097
|
-
onComplete: onChange,
|
|
2098
|
-
className: classnames('SliderValue', className)
|
|
2099
|
-
}) : /*#__PURE__*/ React__default.createElement(Label, {
|
|
2100
|
-
value: value,
|
|
2101
|
-
className: classnames('SliderValue', className),
|
|
2102
|
-
style: style
|
|
2103
|
-
}));
|
|
2104
|
-
}
|
|
2105
|
-
|
|
2106
2034
|
var HeadingTags = /*#__PURE__*/ function(HeadingTags) {
|
|
2107
2035
|
HeadingTags["h1"] = "h1";
|
|
2108
2036
|
HeadingTags["h2"] = "h2";
|
|
@@ -3612,17 +3540,17 @@ function ModuleHeader(param) {
|
|
|
3612
3540
|
function keydownListener(event) {
|
|
3613
3541
|
var _document;
|
|
3614
3542
|
var activeElement = (_document = document) === null || _document === void 0 ? void 0 : _document.activeElement;
|
|
3615
|
-
// 8, Backspace
|
|
3616
3543
|
var elements = [
|
|
3617
3544
|
'input',
|
|
3618
|
-
'
|
|
3619
|
-
'button',
|
|
3620
|
-
'textarea',
|
|
3621
|
-
'div'
|
|
3545
|
+
'textarea'
|
|
3622
3546
|
];
|
|
3547
|
+
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);
|
|
3623
3548
|
if (event.key === 'Backspace' && activeElement && elements.indexOf(activeElement.tagName.toLowerCase()) === -1) {
|
|
3624
3549
|
event.preventDefault();
|
|
3625
3550
|
}
|
|
3551
|
+
if ((event.key === 'ArrowLeft' || event.key === 'ArrowRight') && !eventMatchesActiveInput) {
|
|
3552
|
+
event.preventDefault();
|
|
3553
|
+
}
|
|
3626
3554
|
}
|
|
3627
3555
|
useEffect(function() {
|
|
3628
3556
|
getParameters();
|
|
@@ -4805,7 +4733,10 @@ function LFOTab() {
|
|
|
4805
4733
|
return /*#__PURE__*/ React__default.createElement(Box, {
|
|
4806
4734
|
className: "LFOTab",
|
|
4807
4735
|
flexDirection: Box.flexDirection.column
|
|
4808
|
-
}, /*#__PURE__*/ React__default.createElement(Box,
|
|
4736
|
+
}, /*#__PURE__*/ React__default.createElement(Box, {
|
|
4737
|
+
alignItems: Box.alignItems.flexEnd,
|
|
4738
|
+
justifyContent: Box.justifyContent.spaceEvenly
|
|
4739
|
+
}, /*#__PURE__*/ React__default.createElement(Dropdown, {
|
|
4809
4740
|
labelColor: "var(--color-text)",
|
|
4810
4741
|
color: "var(--color-brand)",
|
|
4811
4742
|
id: "LFO1_Wave",
|
|
@@ -4849,7 +4780,10 @@ function LFOTab() {
|
|
|
4849
4780
|
}), /*#__PURE__*/ React__default.createElement(RotarySlider, {
|
|
4850
4781
|
id: "LFO1_Rand",
|
|
4851
4782
|
label: "LFO1 Rand"
|
|
4852
|
-
})), /*#__PURE__*/ React__default.createElement(Box,
|
|
4783
|
+
})), /*#__PURE__*/ React__default.createElement(Box, {
|
|
4784
|
+
alignItems: Box.alignItems.flexEnd,
|
|
4785
|
+
justifyContent: Box.justifyContent.spaceEvenly
|
|
4786
|
+
}, /*#__PURE__*/ React__default.createElement(Dropdown, {
|
|
4853
4787
|
labelColor: "var(--color-text)",
|
|
4854
4788
|
color: "var(--color-brand)",
|
|
4855
4789
|
id: "LFO2_Wave",
|
|
@@ -4896,7 +4830,7 @@ function LFOTab() {
|
|
|
4896
4830
|
})));
|
|
4897
4831
|
}
|
|
4898
4832
|
|
|
4899
|
-
var css_248z = "/* Tab styles */\n/* TODO: Refactor to use utility classes? */\n/* TODO: Clean up */\n\n.ModuleFooter {\n overflow-y: scroll;\n}\n\n.ModuleFooter .Tabs-item {\n background: transparent;\n color: var(--color-text);\n font-family: var(--font-leagueSpartan);\n background: var(--color-gray-600);\n flex: 1 0 auto;\n}\n\n.ModuleFooter .Tabs-item:hover,\n.ModuleFooter .tabs-item:focus,\n.ModuleFooter .tabs-item:focus-visible {\n background: var(--color-gray-700);\n}\n\n.ModuleFooter .Tabs-item[data-headlessui-state='selected'] {\n background: var(--color-gray-700);\n}\n";
|
|
4833
|
+
var css_248z = "/* Tab styles */\n/* TODO: Refactor to use utility classes? */\n/* TODO: Clean up */\n\n.ModuleFooter {\n overflow-y: scroll;\n}\n\n.ModuleFooter .Tabs-item {\n background: transparent;\n color: var(--color-text);\n font-family: var(--font-leagueSpartan);\n background: var(--color-gray-600);\n flex: 1 0 auto;\n}\n\n.ModuleFooter .Tabs-item:hover,\n.ModuleFooter .tabs-item:focus,\n.ModuleFooter .tabs-item:focus-visible {\n background: var(--color-gray-700);\n}\n\n.ModuleFooter .Tabs-item[data-headlessui-state='selected'],\n.ModuleFooter .Tabs-item[data-headlessui-state='selected focus'] {\n background: var(--color-gray-700);\n}\n";
|
|
4900
4834
|
styleInject(css_248z);
|
|
4901
4835
|
|
|
4902
4836
|
function _array_like_to_array(arr, len) {
|
|
@@ -5226,5 +5160,5 @@ function ModuleFooter(param) {
|
|
|
5226
5160
|
}, 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) : '')));
|
|
5227
5161
|
}
|
|
5228
5162
|
|
|
5229
|
-
export { Slider as BarSlider, Box, Button, Dropdown, FontSizes, GlobalContextProvider, Heading, IconButton, IndicatorLight, Input, KeyValueDisplayScreen, Label, ModuleFooter, ModuleHeader, Oscilloscope, RotarySlider,
|
|
5163
|
+
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 };
|
|
5230
5164
|
//# sourceMappingURL=index.js.map
|