@antimatter-audio/antimatter-ui 9.5.0 → 10.0.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.
Files changed (103) hide show
  1. package/dist/advanced/KeyValueDisplayScreen/KeyValueDisplayScreen.d.ts +12 -0
  2. package/dist/advanced/KeyValueDisplayScreen/KeyValueDisplayScreen.d.ts.map +1 -0
  3. package/dist/advanced/ModuleHeader/ModuleHeader.d.ts +11 -0
  4. package/dist/advanced/ModuleHeader/ModuleHeader.d.ts.map +1 -0
  5. package/dist/advanced/Oscilloscope/Oscilloscope.d.ts +12 -0
  6. package/dist/advanced/Oscilloscope/Oscilloscope.d.ts.map +1 -0
  7. package/dist/context/GlobalContextProvider.d.ts +20 -0
  8. package/dist/context/GlobalContextProvider.d.ts.map +1 -0
  9. package/dist/core/Button/Button.d.ts +24 -0
  10. package/dist/core/Button/Button.d.ts.map +1 -0
  11. package/dist/core/Dropdown/Dropdown.d.ts +14 -0
  12. package/dist/core/Dropdown/Dropdown.d.ts.map +1 -0
  13. package/dist/core/Indicators/hooks/useIndicator.d.ts +8 -0
  14. package/dist/core/Indicators/hooks/useIndicator.d.ts.map +1 -0
  15. package/dist/core/Slider/BarSlider.d.ts +30 -0
  16. package/dist/core/Slider/BarSlider.d.ts.map +1 -0
  17. package/dist/core/Slider/RotarySlider.d.ts +29 -0
  18. package/dist/core/Slider/RotarySlider.d.ts.map +1 -0
  19. package/dist/core/Tabs/Tabs.d.ts +19 -0
  20. package/dist/core/Tabs/Tabs.d.ts.map +1 -0
  21. package/dist/hooks/useCombobox.d.ts +15 -0
  22. package/dist/hooks/useCombobox.d.ts.map +1 -0
  23. package/dist/hooks/useObservable.d.ts +9 -0
  24. package/dist/hooks/useObservable.d.ts.map +1 -0
  25. package/dist/hooks/useRandom.d.ts +1 -0
  26. package/dist/hooks/useRandom.d.ts.map +1 -0
  27. package/dist/hooks/useSlider.d.ts +21 -0
  28. package/dist/hooks/useSlider.d.ts.map +1 -0
  29. package/dist/index.d.ts +3 -0
  30. package/dist/index.d.ts.map +1 -0
  31. package/dist/index.js +945 -304
  32. package/dist/index.js.map +1 -1
  33. package/dist/src/advanced/IconButton/IconButton.d.ts +31 -0
  34. package/dist/src/advanced/IconButton/IconButton.d.ts.map +1 -0
  35. package/dist/src/advanced/KeyValueDisplayScreen/KeyValueDisplayScreen.d.ts +12 -0
  36. package/dist/src/advanced/KeyValueDisplayScreen/KeyValueDisplayScreen.d.ts.map +1 -0
  37. package/dist/src/advanced/ModuleFooter/ModuleFooter.d.ts +7 -0
  38. package/dist/src/advanced/ModuleFooter/ModuleFooter.d.ts.map +1 -0
  39. package/dist/src/advanced/ModuleHeader/ModuleHeader.d.ts +11 -0
  40. package/dist/src/advanced/ModuleHeader/ModuleHeader.d.ts.map +1 -0
  41. package/dist/src/advanced/Oscilloscope/LinePlot.d.ts +12 -0
  42. package/dist/src/advanced/Oscilloscope/LinePlot.d.ts.map +1 -0
  43. package/dist/src/advanced/Oscilloscope/Oscilloscope.d.ts +12 -0
  44. package/dist/src/advanced/Oscilloscope/Oscilloscope.d.ts.map +1 -0
  45. package/dist/src/common/types.d.ts +53 -0
  46. package/dist/src/common/types.d.ts.map +1 -0
  47. package/dist/src/common/utils.d.ts +16 -0
  48. package/dist/src/common/utils.d.ts.map +1 -0
  49. package/dist/src/context/GlobalContextProvider.d.ts +20 -0
  50. package/dist/src/context/GlobalContextProvider.d.ts.map +1 -0
  51. package/dist/src/core/Box/Box.d.ts +51 -0
  52. package/dist/src/core/Box/Box.d.ts.map +1 -0
  53. package/dist/src/core/Box/types.d.ts +27 -0
  54. package/dist/src/core/Box/types.d.ts.map +1 -0
  55. package/dist/src/core/Button/Button.d.ts +24 -0
  56. package/dist/src/core/Button/Button.d.ts.map +1 -0
  57. package/dist/src/core/Button/types.d.ts +10 -0
  58. package/dist/src/core/Button/types.d.ts.map +1 -0
  59. package/dist/src/core/Dropdown/Dropdown.d.ts +14 -0
  60. package/dist/src/core/Dropdown/Dropdown.d.ts.map +1 -0
  61. package/dist/src/core/Heading/Heading.d.ts +20 -0
  62. package/dist/src/core/Heading/Heading.d.ts.map +1 -0
  63. package/dist/src/core/Heading/types.d.ts +7 -0
  64. package/dist/src/core/Heading/types.d.ts.map +1 -0
  65. package/dist/src/core/Indicators/IndicatorLight.d.ts +12 -0
  66. package/dist/src/core/Indicators/IndicatorLight.d.ts.map +1 -0
  67. package/dist/src/core/Indicators/hooks/useIndicator.d.ts +8 -0
  68. package/dist/src/core/Indicators/hooks/useIndicator.d.ts.map +1 -0
  69. package/dist/src/core/Input/Input.d.ts +26 -0
  70. package/dist/src/core/Input/Input.d.ts.map +1 -0
  71. package/dist/src/core/Label/Label.d.ts +18 -0
  72. package/dist/src/core/Label/Label.d.ts.map +1 -0
  73. package/dist/src/core/Matrix/Matrix.d.ts +13 -0
  74. package/dist/src/core/Matrix/Matrix.d.ts.map +1 -0
  75. package/dist/src/core/Slider/BarSlider.d.ts +30 -0
  76. package/dist/src/core/Slider/BarSlider.d.ts.map +1 -0
  77. package/dist/src/core/Slider/RotarySlider.d.ts +29 -0
  78. package/dist/src/core/Slider/RotarySlider.d.ts.map +1 -0
  79. package/dist/src/core/Slider/SliderValue.d.ts +14 -0
  80. package/dist/src/core/Slider/SliderValue.d.ts.map +1 -0
  81. package/dist/src/core/Slider/types.d.ts +41 -0
  82. package/dist/src/core/Slider/types.d.ts.map +1 -0
  83. package/dist/src/core/Slider/utils.d.ts +50 -0
  84. package/dist/src/core/Slider/utils.d.ts.map +1 -0
  85. package/dist/src/core/Spinner.d.ts +4 -0
  86. package/dist/src/core/Spinner.d.ts.map +1 -0
  87. package/dist/src/core/Tabs/Tabs.d.ts +19 -0
  88. package/dist/src/core/Tabs/Tabs.d.ts.map +1 -0
  89. package/dist/src/hooks/useCombobox.d.ts +15 -0
  90. package/dist/src/hooks/useCombobox.d.ts.map +1 -0
  91. package/dist/src/hooks/useObservable.d.ts +9 -0
  92. package/dist/src/hooks/useObservable.d.ts.map +1 -0
  93. package/dist/src/hooks/useRandom.d.ts +1 -0
  94. package/dist/src/hooks/useRandom.d.ts.map +1 -0
  95. package/dist/src/hooks/useRandomise.d.ts +3 -0
  96. package/dist/src/hooks/useRandomise.d.ts.map +1 -0
  97. package/dist/src/hooks/useSlider.d.ts +21 -0
  98. package/dist/src/hooks/useSlider.d.ts.map +1 -0
  99. package/dist/src/hooks/useTabs.d.ts +15 -0
  100. package/dist/src/hooks/useTabs.d.ts.map +1 -0
  101. package/dist/src/index.d.ts +27 -0
  102. package/dist/src/index.d.ts.map +1 -0
  103. 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, { useState, useEffect, useRef, useCallback } from 'react';
2
+ import React__default, { useState, useEffect, useRef, useReducer, useCallback, createContext, useContext } from 'react';
3
3
  import classnames from 'classnames';
4
4
  import { TabGroup, TabList, Tab, Listbox, ListboxButton, ListboxOptions, ListboxOption } from '@headlessui/react';
5
5
  import * as Juce from 'juce-framework-frontend';
@@ -84,18 +84,18 @@ var FontSizes = /*#__PURE__*/ function(FontSizes) {
84
84
  return FontSizes;
85
85
  }({});
86
86
 
87
- var css_248z$7 = ".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 font-size: 1rem;\n display: flex;\n align-items: center;\n justify-content: center;\n margin-right: 1px;\n cursor: pointer;\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 &:hover,\n &:focus-visible {\n outline: none;\n }\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";
87
+ var css_248z$7 = ".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";
88
88
  styleInject(css_248z$7);
89
89
 
90
- function _array_like_to_array$6(arr, len) {
90
+ function _array_like_to_array$8(arr, len) {
91
91
  if (len == null || len > arr.length) len = arr.length;
92
92
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
93
93
  return arr2;
94
94
  }
95
- function _array_with_holes$6(arr) {
95
+ function _array_with_holes$8(arr) {
96
96
  if (Array.isArray(arr)) return arr;
97
97
  }
98
- function _iterable_to_array_limit$6(arr, i) {
98
+ function _iterable_to_array_limit$8(arr, i) {
99
99
  var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
100
100
  if (_i == null) return;
101
101
  var _arr = [];
@@ -119,27 +119,27 @@ function _iterable_to_array_limit$6(arr, i) {
119
119
  }
120
120
  return _arr;
121
121
  }
122
- function _non_iterable_rest$6() {
122
+ function _non_iterable_rest$8() {
123
123
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
124
124
  }
125
- function _sliced_to_array$6(arr, i) {
126
- return _array_with_holes$6(arr) || _iterable_to_array_limit$6(arr, i) || _unsupported_iterable_to_array$6(arr, i) || _non_iterable_rest$6();
125
+ function _sliced_to_array$8(arr, i) {
126
+ return _array_with_holes$8(arr) || _iterable_to_array_limit$8(arr, i) || _unsupported_iterable_to_array$8(arr, i) || _non_iterable_rest$8();
127
127
  }
128
- function _unsupported_iterable_to_array$6(o, minLen) {
128
+ function _unsupported_iterable_to_array$8(o, minLen) {
129
129
  if (!o) return;
130
- if (typeof o === "string") return _array_like_to_array$6(o, minLen);
130
+ if (typeof o === "string") return _array_like_to_array$8(o, minLen);
131
131
  var n = Object.prototype.toString.call(o).slice(8, -1);
132
132
  if (n === "Object" && o.constructor) n = o.constructor.name;
133
133
  if (n === "Map" || n === "Set") return Array.from(n);
134
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$6(o, minLen);
134
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$8(o, minLen);
135
135
  }
136
136
  function Tabs(param) {
137
137
  var items = param.items, className = param.className, _param_padding = param.padding, padding = _param_padding === void 0 ? [
138
138
  Spacing.mediumSmall
139
139
  ] : _param_padding, _param_margin = param.margin, margin = _param_margin === void 0 ? [
140
140
  Spacing.none
141
- ] : _param_margin, onChange = param.onChange;
142
- var _useState = _sliced_to_array$6(useState(0), 2), selectedItem = _useState[0], setSelectedItem = _useState[1];
141
+ ] : _param_margin, onChange = param.onChange, selectedIndex = param.selectedIndex;
142
+ var _useState = _sliced_to_array$8(useState(0), 2), selectedItem = _useState[0], setSelectedItem = _useState[1];
143
143
  var handleChange = function(index) {
144
144
  setSelectedItem(index);
145
145
  onChange(index);
@@ -155,6 +155,7 @@ function Tabs(param) {
155
155
  marginBottom: "var(--mb-".concat((_margin_1 = margin[2]) !== null && _margin_1 !== void 0 ? _margin_1 : margin[0], ")"),
156
156
  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], ")")
157
157
  },
158
+ selectedIndex: selectedIndex,
158
159
  onChange: function(index) {
159
160
  return handleChange(index);
160
161
  }
@@ -196,15 +197,15 @@ var ButtonType = /*#__PURE__*/ function(ButtonType) {
196
197
  return ButtonType;
197
198
  }({});
198
199
 
199
- function _array_like_to_array$5(arr, len) {
200
+ function _array_like_to_array$7(arr, len) {
200
201
  if (len == null || len > arr.length) len = arr.length;
201
202
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
202
203
  return arr2;
203
204
  }
204
- function _array_with_holes$5(arr) {
205
+ function _array_with_holes$7(arr) {
205
206
  if (Array.isArray(arr)) return arr;
206
207
  }
207
- function _define_property$b(obj, key, value) {
208
+ function _define_property$d(obj, key, value) {
208
209
  if (key in obj) {
209
210
  Object.defineProperty(obj, key, {
210
211
  value: value,
@@ -217,7 +218,7 @@ function _define_property$b(obj, key, value) {
217
218
  }
218
219
  return obj;
219
220
  }
220
- function _iterable_to_array_limit$5(arr, i) {
221
+ function _iterable_to_array_limit$7(arr, i) {
221
222
  var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
222
223
  if (_i == null) return;
223
224
  var _arr = [];
@@ -241,10 +242,10 @@ function _iterable_to_array_limit$5(arr, i) {
241
242
  }
242
243
  return _arr;
243
244
  }
244
- function _non_iterable_rest$5() {
245
+ function _non_iterable_rest$7() {
245
246
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
246
247
  }
247
- function _object_spread$b(target) {
248
+ function _object_spread$d(target) {
248
249
  for(var i = 1; i < arguments.length; i++){
249
250
  var source = arguments[i] != null ? arguments[i] : {};
250
251
  var ownKeys = Object.keys(source);
@@ -254,27 +255,27 @@ function _object_spread$b(target) {
254
255
  }));
255
256
  }
256
257
  ownKeys.forEach(function(key) {
257
- _define_property$b(target, key, source[key]);
258
+ _define_property$d(target, key, source[key]);
258
259
  });
259
260
  }
260
261
  return target;
261
262
  }
262
- function _sliced_to_array$5(arr, i) {
263
- return _array_with_holes$5(arr) || _iterable_to_array_limit$5(arr, i) || _unsupported_iterable_to_array$5(arr, i) || _non_iterable_rest$5();
263
+ function _sliced_to_array$7(arr, i) {
264
+ return _array_with_holes$7(arr) || _iterable_to_array_limit$7(arr, i) || _unsupported_iterable_to_array$7(arr, i) || _non_iterable_rest$7();
264
265
  }
265
- function _unsupported_iterable_to_array$5(o, minLen) {
266
+ function _unsupported_iterable_to_array$7(o, minLen) {
266
267
  if (!o) return;
267
- if (typeof o === "string") return _array_like_to_array$5(o, minLen);
268
+ if (typeof o === "string") return _array_like_to_array$7(o, minLen);
268
269
  var n = Object.prototype.toString.call(o).slice(8, -1);
269
270
  if (n === "Object" && o.constructor) n = o.constructor.name;
270
271
  if (n === "Map" || n === "Set") return Array.from(n);
271
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$5(o, minLen);
272
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$7(o, minLen);
272
273
  }
273
274
  function Button(param) {
274
275
  var disabled = param.disabled, text = param.text, id = param.id, className = param.className, style = param.style, onClick = param.onClick, children = param.children, _param_padding = param.padding, padding = _param_padding === void 0 ? [
275
276
  Spacing.small
276
277
  ] : _param_padding, _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;
277
- var _React_useState = _sliced_to_array$5(React__default.useState(false), 2), isSelected = _React_useState[0], setIsSelected = _React_useState[1];
278
+ var _React_useState = _sliced_to_array$7(React__default.useState(false), 2), isSelected = _React_useState[0], setIsSelected = _React_useState[1];
278
279
  var buttonState = Juce.getToggleState(id);
279
280
  var isLocalhost = window.location.hostname === 'localhost';
280
281
  // Update the local state when the ID changes
@@ -331,7 +332,7 @@ function Button(param) {
331
332
  onMouseDown: handleMouseDown,
332
333
  disabled: disabled,
333
334
  onClick: onClick && onClick,
334
- style: _object_spread$b({
335
+ style: _object_spread$d({
335
336
  paddingTop: "var(--p-".concat(padding[0], ")"),
336
337
  paddingRight: "var(--p-".concat((_padding_ = padding[1]) !== null && _padding_ !== void 0 ? _padding_ : padding[0], ")"),
337
338
  paddingBottom: "var(--p-".concat((_padding_1 = padding[2]) !== null && _padding_1 !== void 0 ? _padding_1 : padding[0], ")"),
@@ -347,15 +348,68 @@ Button.size = ButtonSize;
347
348
  var css_248z$5 = ".Dropdown-button {\n font-size: var(--text-sm);\n display: flex;\n align-items: center;\n justify-content: center;\n padding: var(--spacing-lg);\n cursor: pointer;\n vertical-align: middle;\n white-space: nowrap;\n text-decoration: none;\n text-transform: uppercase;\n text-align: center;\n border: 0;\n border-radius: var(--radius-sm);\n appearance: none;\n user-select: none;\n -webkit-user-select: none;\n height: var(--spacing-xl);\n background: var(--bg-input);\n &:hover,\n &:focus,\n &:active {\n outline: none;\n background-color: var(--bg-highlighted);\n }\n &:disabled {\n cursor: not-allowed;\n }\n}\n\n.Dropdown-item {\n background-color: var(--bg-popover);\n padding: var(--spacing-l);\n cursor: pointer;\n user-select: none;\n -webkit-user-select: none;\n &:hover {\n background-color: var(--bg-highlighted);\n }\n &[data-selected] {\n background-color: var(--bg-selected);\n }\n}\n";
348
349
  styleInject(css_248z$5);
349
350
 
350
- function _array_like_to_array$4(arr, len) {
351
+ function useObservable(param) {
352
+ var onFire = param.onFire;
353
+ var observers = useRef([]);
354
+ var subscribe = function(observer, id) {
355
+ var _observers_current;
356
+ if (((_observers_current = observers.current) === null || _observers_current === void 0 ? void 0 : _observers_current.find(function(item) {
357
+ return item[1] === id;
358
+ })) === undefined) {
359
+ observers.current.push([
360
+ observer,
361
+ id
362
+ ]);
363
+ }
364
+ };
365
+ var unsubscribe = function(observer, id) {
366
+ var _observers_current;
367
+ if (((_observers_current = observers.current) === null || _observers_current === void 0 ? void 0 : _observers_current.find(function(item) {
368
+ return item[1] === id;
369
+ })) !== undefined) {
370
+ var _observers_current1;
371
+ var index = (_observers_current1 = observers.current) === null || _observers_current1 === void 0 ? void 0 : _observers_current1.findIndex(function(item) {
372
+ return item[1] === id;
373
+ });
374
+ observers.current.splice(index, 1);
375
+ }
376
+ };
377
+ var fire = function() {
378
+ var _observers_current;
379
+ onFire();
380
+ (_observers_current = observers.current) === null || _observers_current === void 0 ? void 0 : _observers_current.forEach(function(observer) {
381
+ return observer[0]();
382
+ });
383
+ };
384
+ return {
385
+ subscribe: subscribe,
386
+ unsubscribe: unsubscribe,
387
+ fire: fire
388
+ };
389
+ }
390
+
391
+ function _array_like_to_array$6(arr, len) {
351
392
  if (len == null || len > arr.length) len = arr.length;
352
393
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
353
394
  return arr2;
354
395
  }
355
- function _array_with_holes$4(arr) {
396
+ function _array_with_holes$6(arr) {
356
397
  if (Array.isArray(arr)) return arr;
357
398
  }
358
- function _iterable_to_array_limit$4(arr, i) {
399
+ function _define_property$c(obj, key, value) {
400
+ if (key in obj) {
401
+ Object.defineProperty(obj, key, {
402
+ value: value,
403
+ enumerable: true,
404
+ configurable: true,
405
+ writable: true
406
+ });
407
+ } else {
408
+ obj[key] = value;
409
+ }
410
+ return obj;
411
+ }
412
+ function _iterable_to_array_limit$6(arr, i) {
359
413
  var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
360
414
  if (_i == null) return;
361
415
  var _arr = [];
@@ -379,42 +433,187 @@ function _iterable_to_array_limit$4(arr, i) {
379
433
  }
380
434
  return _arr;
381
435
  }
382
- function _non_iterable_rest$4() {
436
+ function _non_iterable_rest$6() {
383
437
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
384
438
  }
385
- function _sliced_to_array$4(arr, i) {
386
- return _array_with_holes$4(arr) || _iterable_to_array_limit$4(arr, i) || _unsupported_iterable_to_array$4(arr, i) || _non_iterable_rest$4();
439
+ function _object_spread$c(target) {
440
+ for(var i = 1; i < arguments.length; i++){
441
+ var source = arguments[i] != null ? arguments[i] : {};
442
+ var ownKeys = Object.keys(source);
443
+ if (typeof Object.getOwnPropertySymbols === "function") {
444
+ ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
445
+ return Object.getOwnPropertyDescriptor(source, sym).enumerable;
446
+ }));
447
+ }
448
+ ownKeys.forEach(function(key) {
449
+ _define_property$c(target, key, source[key]);
450
+ });
451
+ }
452
+ return target;
387
453
  }
388
- function _unsupported_iterable_to_array$4(o, minLen) {
454
+ function ownKeys$2(object, enumerableOnly) {
455
+ var keys = Object.keys(object);
456
+ if (Object.getOwnPropertySymbols) {
457
+ var symbols = Object.getOwnPropertySymbols(object);
458
+ keys.push.apply(keys, symbols);
459
+ }
460
+ return keys;
461
+ }
462
+ function _object_spread_props$2(target, source) {
463
+ source = source != null ? source : {};
464
+ if (Object.getOwnPropertyDescriptors) {
465
+ Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
466
+ } else {
467
+ ownKeys$2(Object(source)).forEach(function(key) {
468
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
469
+ });
470
+ }
471
+ return target;
472
+ }
473
+ function _sliced_to_array$6(arr, i) {
474
+ return _array_with_holes$6(arr) || _iterable_to_array_limit$6(arr, i) || _unsupported_iterable_to_array$6(arr, i) || _non_iterable_rest$6();
475
+ }
476
+ function _unsupported_iterable_to_array$6(o, minLen) {
389
477
  if (!o) return;
390
- if (typeof o === "string") return _array_like_to_array$4(o, minLen);
478
+ if (typeof o === "string") return _array_like_to_array$6(o, minLen);
391
479
  var n = Object.prototype.toString.call(o).slice(8, -1);
392
480
  if (n === "Object" && o.constructor) n = o.constructor.name;
393
481
  if (n === "Map" || n === "Set") return Array.from(n);
394
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$4(o, minLen);
482
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$6(o, minLen);
395
483
  }
396
- function Dropdown(param) {
397
- var _param_items = param.items, items = _param_items === void 0 ? [
398
- 'Mock Item 1',
399
- 'Mock Item 2',
400
- 'Mock Item 3'
401
- ] : _param_items, className = param.className, id = param.id, style = param.style;
484
+ // Initial state
485
+ var defaultGlobalStateValue = {
486
+ highlightedItem: {
487
+ label: 'Antimatter Audio',
488
+ value: undefined
489
+ }
490
+ };
491
+ // Reducer function to handle state updates
492
+ var reducer = function(state, action) {
493
+ switch(action.type){
494
+ case 'SET_HIGHLIGHTED_ITEM':
495
+ return _object_spread_props$2(_object_spread$c({}, state), {
496
+ highlightedItem: action.payload
497
+ });
498
+ default:
499
+ return state;
500
+ }
501
+ };
502
+ // Create the context
503
+ var GlobalContext = /*#__PURE__*/ createContext({
504
+ globalState: defaultGlobalStateValue
505
+ });
506
+ // Custom hook for consuming context with a selector
507
+ function useGlobalContext(selector) {
508
+ var localContext = useContext(GlobalContext);
509
+ return selector ? selector(localContext) : localContext;
510
+ }
511
+ // Context provider
512
+ function GlobalContextProvider(param) {
513
+ var children = param.children;
514
+ var _useReducer = _sliced_to_array$6(useReducer(reducer, defaultGlobalStateValue), 2), state = _useReducer[0], dispatch = _useReducer[1];
515
+ var setHighlightedItem = useCallback(function(highlightedItem) {
516
+ dispatch({
517
+ type: 'SET_HIGHLIGHTED_ITEM',
518
+ payload: highlightedItem
519
+ });
520
+ }, []);
521
+ var onFire = function() {
522
+ //@ts-expect-error
523
+ window.__JUCE__.backend.emitEvent('setRandom', {});
524
+ };
525
+ var useRandom = useObservable({
526
+ onFire: onFire
527
+ });
528
+ var value = {
529
+ globalState: state,
530
+ setHighlightedItem: setHighlightedItem,
531
+ useRandom: useRandom
532
+ };
533
+ return /*#__PURE__*/ React__default.createElement(GlobalContext.Provider, {
534
+ value: value
535
+ }, children);
536
+ }
537
+
538
+ function _array_like_to_array$5(arr, len) {
539
+ if (len == null || len > arr.length) len = arr.length;
540
+ for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
541
+ return arr2;
542
+ }
543
+ function _array_with_holes$5(arr) {
544
+ if (Array.isArray(arr)) return arr;
545
+ }
546
+ function _iterable_to_array_limit$5(arr, i) {
547
+ var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
548
+ if (_i == null) return;
549
+ var _arr = [];
550
+ var _n = true;
551
+ var _d = false;
552
+ var _s, _e;
553
+ try {
554
+ for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
555
+ _arr.push(_s.value);
556
+ if (i && _arr.length === i) break;
557
+ }
558
+ } catch (err) {
559
+ _d = true;
560
+ _e = err;
561
+ } finally{
562
+ try {
563
+ if (!_n && _i["return"] != null) _i["return"]();
564
+ } finally{
565
+ if (_d) throw _e;
566
+ }
567
+ }
568
+ return _arr;
569
+ }
570
+ function _non_iterable_rest$5() {
571
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
572
+ }
573
+ function _sliced_to_array$5(arr, i) {
574
+ return _array_with_holes$5(arr) || _iterable_to_array_limit$5(arr, i) || _unsupported_iterable_to_array$5(arr, i) || _non_iterable_rest$5();
575
+ }
576
+ function _unsupported_iterable_to_array$5(o, minLen) {
577
+ if (!o) return;
578
+ if (typeof o === "string") return _array_like_to_array$5(o, minLen);
579
+ var n = Object.prototype.toString.call(o).slice(8, -1);
580
+ if (n === "Object" && o.constructor) n = o.constructor.name;
581
+ if (n === "Map" || n === "Set") return Array.from(n);
582
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$5(o, minLen);
583
+ }
584
+ var useCombobox = function(param) {
585
+ var id = param.id, label = param.label, _param_items = param.items, items = _param_items === void 0 ? [] : _param_items, onChange = param.onChange, _param_displayValInHeader = param.displayValInHeader, displayValInHeader = _param_displayValInHeader === void 0 ? true : _param_displayValInHeader;
402
586
  var comboBoxState = Juce.getComboBoxState(id);
403
- var _useState = _sliced_to_array$4(useState(comboBoxState.getChoiceIndex()), 2), value = _useState[0], setValue = _useState[1];
404
- var _useState1 = _sliced_to_array$4(useState(comboBoxState.properties), 2), properties = _useState1[0], setProperties = _useState1[1];
405
- var handleChange = function(event) {
406
- comboBoxState.setChoiceIndex(event);
407
- setValue(event);
587
+ var _useState = _sliced_to_array$5(useState(comboBoxState.getChoiceIndex()), 2), value = _useState[0], setValue = _useState[1];
588
+ var _useState1 = _sliced_to_array$5(useState(comboBoxState.properties), 2), properties = _useState1[0], setProperties = _useState1[1];
589
+ var setHighlightedItem = useGlobalContext().setHighlightedItem;
590
+ var choices = properties.choices.length ? properties.choices : items;
591
+ var prevIndex = useRef(null);
592
+ var handleChange = function(index) {
593
+ if (index !== prevIndex.current) {
594
+ comboBoxState.setChoiceIndex(index);
595
+ setValue(index);
596
+ onChange && onChange(index);
597
+ // //@ts-expect-error
598
+ // window.__JUCE__.backend.emitEvent('undoableActionOccurred', {});
599
+ if (displayValInHeader) {
600
+ setHighlightedItem({
601
+ label: label,
602
+ value: choices === null || choices === void 0 ? void 0 : choices[index]
603
+ });
604
+ }
605
+ prevIndex.current = index;
606
+ }
408
607
  };
409
608
  useEffect(function() {
410
609
  var comboBoxState = Juce.getComboBoxState(id);
411
- setValue(comboBoxState.getChoiceIndex());
610
+ handleChange(comboBoxState.getChoiceIndex());
412
611
  }, [
413
612
  id
414
613
  ]);
415
614
  useEffect(function() {
416
615
  var valueListenerId = comboBoxState.valueChangedEvent.addListener(function() {
417
- setValue(comboBoxState.getChoiceIndex());
616
+ handleChange(comboBoxState.getChoiceIndex());
418
617
  });
419
618
  var propertiesListenerId = comboBoxState.propertiesChangedEvent.addListener(function() {
420
619
  setProperties(comboBoxState.properties);
@@ -424,8 +623,38 @@ function Dropdown(param) {
424
623
  comboBoxState.propertiesChangedEvent.removeListener(propertiesListenerId);
425
624
  };
426
625
  });
427
- var displayedItems = properties.choices.length ? properties.choices : items;
428
- return /*#__PURE__*/ React__default.createElement(Listbox, {
626
+ var onMouseEnter = function() {
627
+ if (displayValInHeader) {
628
+ setHighlightedItem({
629
+ label: label,
630
+ value: choices === null || choices === void 0 ? void 0 : choices[value]
631
+ });
632
+ }
633
+ };
634
+ return {
635
+ value: value,
636
+ setValue: setValue,
637
+ choices: choices,
638
+ onMouseEnter: onMouseEnter,
639
+ handleChange: handleChange
640
+ };
641
+ };
642
+
643
+ function Dropdown(param) {
644
+ var _param_items = param.items, items = _param_items === void 0 ? [
645
+ 'Mock Item 1',
646
+ 'Mock Item 2',
647
+ 'Mock Item 3'
648
+ ] : _param_items, label = param.label, className = param.className, onChange = param.onChange, id = param.id, style = param.style;
649
+ var _useCombobox = useCombobox({
650
+ id: id,
651
+ label: label,
652
+ items: items,
653
+ onChange: onChange
654
+ }), value = _useCombobox.value, choices = _useCombobox.choices, onMouseEnter = _useCombobox.onMouseEnter, handleChange = _useCombobox.handleChange;
655
+ return /*#__PURE__*/ React__default.createElement("div", {
656
+ onMouseEnter: onMouseEnter
657
+ }, /*#__PURE__*/ React__default.createElement(Listbox, {
429
658
  value: value,
430
659
  onChange: handleChange
431
660
  }, /*#__PURE__*/ React__default.createElement(ListboxButton, {
@@ -435,17 +664,17 @@ function Dropdown(param) {
435
664
  onChange: function(value) {
436
665
  return console.log(value);
437
666
  }
438
- }, displayedItems[value]), /*#__PURE__*/ React__default.createElement(ListboxOptions, {
667
+ }, choices[value]), /*#__PURE__*/ React__default.createElement(ListboxOptions, {
439
668
  anchor: "bottom",
440
669
  portal: false,
441
670
  className: "Dropdown-items z-10"
442
- }, displayedItems.map(function(item, i) {
671
+ }, choices.map(function(item, i) {
443
672
  return /*#__PURE__*/ React__default.createElement(ListboxOption, {
444
673
  className: classnames('Dropdown-item'),
445
674
  key: item,
446
675
  value: i
447
- }, displayedItems[i]);
448
- })));
676
+ }, item);
677
+ }))));
449
678
  }
450
679
 
451
680
  var validate = function(param) {
@@ -476,19 +705,22 @@ var validate = function(param) {
476
705
  isValid: !errorMessages.length && !isIncomplete
477
706
  };
478
707
  };
708
+ var randomizeValue = function(min, max) {
709
+ return Math.random() * (max - min) + min;
710
+ };
479
711
 
480
712
  var css_248z$4 = ".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";
481
713
  styleInject(css_248z$4);
482
714
 
483
- function _array_like_to_array$3(arr, len) {
715
+ function _array_like_to_array$4(arr, len) {
484
716
  if (len == null || len > arr.length) len = arr.length;
485
717
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
486
718
  return arr2;
487
719
  }
488
- function _array_with_holes$3(arr) {
720
+ function _array_with_holes$4(arr) {
489
721
  if (Array.isArray(arr)) return arr;
490
722
  }
491
- function _define_property$a(obj, key, value) {
723
+ function _define_property$b(obj, key, value) {
492
724
  if (key in obj) {
493
725
  Object.defineProperty(obj, key, {
494
726
  value: value,
@@ -501,7 +733,7 @@ function _define_property$a(obj, key, value) {
501
733
  }
502
734
  return obj;
503
735
  }
504
- function _iterable_to_array_limit$3(arr, i) {
736
+ function _iterable_to_array_limit$4(arr, i) {
505
737
  var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
506
738
  if (_i == null) return;
507
739
  var _arr = [];
@@ -525,10 +757,10 @@ function _iterable_to_array_limit$3(arr, i) {
525
757
  }
526
758
  return _arr;
527
759
  }
528
- function _non_iterable_rest$3() {
760
+ function _non_iterable_rest$4() {
529
761
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
530
762
  }
531
- function _object_spread$a(target) {
763
+ function _object_spread$b(target) {
532
764
  for(var i = 1; i < arguments.length; i++){
533
765
  var source = arguments[i] != null ? arguments[i] : {};
534
766
  var ownKeys = Object.keys(source);
@@ -538,21 +770,21 @@ function _object_spread$a(target) {
538
770
  }));
539
771
  }
540
772
  ownKeys.forEach(function(key) {
541
- _define_property$a(target, key, source[key]);
773
+ _define_property$b(target, key, source[key]);
542
774
  });
543
775
  }
544
776
  return target;
545
777
  }
546
- function _sliced_to_array$3(arr, i) {
547
- return _array_with_holes$3(arr) || _iterable_to_array_limit$3(arr, i) || _unsupported_iterable_to_array$3(arr, i) || _non_iterable_rest$3();
778
+ function _sliced_to_array$4(arr, i) {
779
+ return _array_with_holes$4(arr) || _iterable_to_array_limit$4(arr, i) || _unsupported_iterable_to_array$4(arr, i) || _non_iterable_rest$4();
548
780
  }
549
- function _unsupported_iterable_to_array$3(o, minLen) {
781
+ function _unsupported_iterable_to_array$4(o, minLen) {
550
782
  if (!o) return;
551
- if (typeof o === "string") return _array_like_to_array$3(o, minLen);
783
+ if (typeof o === "string") return _array_like_to_array$4(o, minLen);
552
784
  var n = Object.prototype.toString.call(o).slice(8, -1);
553
785
  if (n === "Object" && o.constructor) n = o.constructor.name;
554
786
  if (n === "Map" || n === "Set") return Array.from(n);
555
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$3(o, minLen);
787
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$4(o, minLen);
556
788
  }
557
789
  // import { decimalToPercent, percentToDecimal } from '../../common/utils';
558
790
  // import debounce from 'lodash.debounce';
@@ -564,9 +796,9 @@ var InputTypes = /*#__PURE__*/ function(InputTypes) {
564
796
  function Input(param) {
565
797
  var onComplete = param.onComplete, value = param.value, min = param.min, max = param.max, _param_type = param.type, type = _param_type === void 0 ? "text" : _param_type, _param_minLength = param.minLength, minLength = _param_minLength === void 0 ? 1 : _param_minLength, _param_maxLength = param.maxLength, maxLength = _param_maxLength === void 0 ? 20 : _param_maxLength, fontSize = param.fontSize, style = param.style, className = param.className, id = param.id, _param_textColor = param.textColor, textColor = _param_textColor === void 0 ? '#999' : _param_textColor;
566
798
  var _inputRef_current;
567
- var _useState = _sliced_to_array$3(useState(value), 2), internalValue = _useState[0], setInternalValue = _useState[1];
568
- var _useState1 = _sliced_to_array$3(useState(false), 2), hasError = _useState1[0], setHasError = _useState1[1];
569
- var _useState2 = _sliced_to_array$3(useState(false), 2), hasIncompleteValue = _useState2[0], setHasIncompleteValue = _useState2[1];
799
+ var _useState = _sliced_to_array$4(useState(value), 2), internalValue = _useState[0], setInternalValue = _useState[1];
800
+ var _useState1 = _sliced_to_array$4(useState(false), 2), hasError = _useState1[0], setHasError = _useState1[1];
801
+ var _useState2 = _sliced_to_array$4(useState(false), 2), hasIncompleteValue = _useState2[0], setHasIncompleteValue = _useState2[1];
570
802
  var valueRef = useRef(null);
571
803
  var timer, timeoutVal = 2000;
572
804
  // (inputValue === '' || /^-?\d+$/.test(inputValue)
@@ -625,7 +857,6 @@ function Input(param) {
625
857
  // triggers a check to see if the user is actually done typing
626
858
  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));
627
859
  var handleChange = useCallback(function(e) {
628
- // console.log(e, e.target.value);
629
860
  var newValue = e.target.value;
630
861
  setHasError(false);
631
862
  var _validate = validate({
@@ -652,7 +883,6 @@ function Input(param) {
652
883
  ]);
653
884
  useEffect(function() {
654
885
  setInternalValue(value);
655
- // console.log(value, 'VALUUUUUU');
656
886
  var isValid = validate({
657
887
  value: value,
658
888
  type: type,
@@ -672,7 +902,7 @@ function Input(param) {
672
902
  id: id,
673
903
  ref: inputRef,
674
904
  className: classnames('TextInput', hasIncompleteValue || hasError ? 'is-blinking' : '', className),
675
- style: _object_spread$a({
905
+ style: _object_spread$b({
676
906
  // TODO
677
907
  // color: hasError ? 'red' : hasIncompleteValue ? '#999' : textColor
678
908
  color: hasError ? 'red' : textColor,
@@ -802,15 +1032,15 @@ var getPosition = function(param) {
802
1032
  }
803
1033
  };
804
1034
 
805
- function _array_like_to_array$2(arr, len) {
1035
+ function _array_like_to_array$3(arr, len) {
806
1036
  if (len == null || len > arr.length) len = arr.length;
807
1037
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
808
1038
  return arr2;
809
1039
  }
810
- function _array_with_holes$2(arr) {
1040
+ function _array_with_holes$3(arr) {
811
1041
  if (Array.isArray(arr)) return arr;
812
1042
  }
813
- function _iterable_to_array_limit$2(arr, i) {
1043
+ function _iterable_to_array_limit$3(arr, i) {
814
1044
  var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
815
1045
  if (_i == null) return;
816
1046
  var _arr = [];
@@ -834,29 +1064,29 @@ function _iterable_to_array_limit$2(arr, i) {
834
1064
  }
835
1065
  return _arr;
836
1066
  }
837
- function _non_iterable_rest$2() {
1067
+ function _non_iterable_rest$3() {
838
1068
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
839
1069
  }
840
- function _sliced_to_array$2(arr, i) {
841
- return _array_with_holes$2(arr) || _iterable_to_array_limit$2(arr, i) || _unsupported_iterable_to_array$2(arr, i) || _non_iterable_rest$2();
1070
+ function _sliced_to_array$3(arr, i) {
1071
+ return _array_with_holes$3(arr) || _iterable_to_array_limit$3(arr, i) || _unsupported_iterable_to_array$3(arr, i) || _non_iterable_rest$3();
842
1072
  }
843
- function _unsupported_iterable_to_array$2(o, minLen) {
1073
+ function _unsupported_iterable_to_array$3(o, minLen) {
844
1074
  if (!o) return;
845
- if (typeof o === "string") return _array_like_to_array$2(o, minLen);
1075
+ if (typeof o === "string") return _array_like_to_array$3(o, minLen);
846
1076
  var n = Object.prototype.toString.call(o).slice(8, -1);
847
1077
  if (n === "Object" && o.constructor) n = o.constructor.name;
848
1078
  if (n === "Map" || n === "Set") return Array.from(n);
849
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$2(o, minLen);
1079
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$3(o, minLen);
850
1080
  }
851
1081
  // 20.0f, 15000.0f, 0.1f, 0.7f),800.0f
852
1082
  // ValueType rangeStart, ValueType rangeEnd, ValueType intervalValue, ValueType skewFactor, bool useSymmetricSkew=false)
853
1083
  var useSlider = function(param) {
854
- var id = param.id, _param_mockProperties = param.mockProperties, mockProperties = _param_mockProperties === void 0 ? {
1084
+ var id = param.id, label = param.label, _param_mockProperties = param.mockProperties, mockProperties = _param_mockProperties === void 0 ? {
855
1085
  start: 20,
856
1086
  end: 15000,
857
1087
  interval: 0.1,
858
1088
  skew: 0.7
859
- } : _param_mockProperties, _param_mockInitialNormalisedValue = param.mockInitialNormalisedValue, mockInitialNormalisedValue = _param_mockInitialNormalisedValue === void 0 ? 0.0 : _param_mockInitialNormalisedValue, _param_sliderOrientation = param.sliderOrientation; _param_sliderOrientation === void 0 ? SliderOrientation.vertical : _param_sliderOrientation; var onChange = param.onChange;
1089
+ } : _param_mockProperties, _param_isRandomizable = param.isRandomizable, isRandomizable = _param_isRandomizable === void 0 ? false : _param_isRandomizable, _param_mockInitialNormalisedValue = param.mockInitialNormalisedValue, mockInitialNormalisedValue = _param_mockInitialNormalisedValue === void 0 ? 0.0 : _param_mockInitialNormalisedValue, _param_sliderOrientation = param.sliderOrientation; _param_sliderOrientation === void 0 ? SliderOrientation.vertical : _param_sliderOrientation; var onChange = param.onChange;
860
1090
  // const sliderState: JuceSlider = Juce.getSliderState(id);
861
1091
  // if isLocalhost is true, the front end app is running outside of JUCE in a browser.
862
1092
  var isLocalhost = window.location.hostname === 'localhost';
@@ -869,21 +1099,39 @@ var useSlider = function(param) {
869
1099
  * AudioProcessorParameter::getValue() (C++).
870
1100
  */ // See https://github.com/juce-framework/JUCE/blob/51d11a2be6d5c97ccf12b4e5e827006e19f0555a/modules/juce_gui_extra/native/javascript/index.js#L230C1-L238C6
871
1101
  // NOTE: We can think of this as a percentage value, in 0 to 1 format
872
- var _useState = _sliced_to_array$2(useState(0), 2), scaledValue = _useState[0], setScaledValue = _useState[1];
873
- var _useState1 = _sliced_to_array$2(useState(0), 2), normalisedValue = _useState1[0], setNormalisedValue = _useState1[1];
874
- var _useState2 = _sliced_to_array$2(useState(), 2), properties = _useState2[0], setProperties = _useState2[1];
1102
+ var _useState = _sliced_to_array$3(useState(0), 2), scaledValue = _useState[0], setScaledValue = _useState[1];
1103
+ var _useState1 = _sliced_to_array$3(useState(0), 2), normalisedValue = _useState1[0], setNormalisedValue = _useState1[1];
1104
+ var _useState2 = _sliced_to_array$3(useState(), 2), properties = _useState2[0], setProperties = _useState2[1];
875
1105
  var scaledValueRef = useRef(null);
876
1106
  var normalisedValueRef = useRef(null);
1107
+ // const randomValueSetCounter = useRef<number>(null);
1108
+ var _useGlobalContext = useGlobalContext(), useRandom = _useGlobalContext.useRandom, setHighlightedItem = _useGlobalContext.setHighlightedItem;
877
1109
  // Set the initial state
1110
+ //@ts-expect-error
878
1111
  useEffect(function() {
879
1112
  var sliderState = Juce.getSliderState(id);
880
- if (isLocalhost) {
1113
+ var setRandom = function() {
1114
+ var _sliderState_properties, _sliderState_properties1, _sliderState_properties2, _sliderState_properties3;
1115
+ var randomValue = randomizeValue(sliderState === null || sliderState === void 0 ? void 0 : (_sliderState_properties = sliderState.properties) === null || _sliderState_properties === void 0 ? void 0 : _sliderState_properties.start, sliderState === null || sliderState === void 0 ? void 0 : (_sliderState_properties1 = sliderState.properties) === null || _sliderState_properties1 === void 0 ? void 0 : _sliderState_properties1.end);
1116
+ var newValue = (sliderState === null || sliderState === void 0 ? void 0 : (_sliderState_properties2 = sliderState.properties) === null || _sliderState_properties2 === void 0 ? void 0 : _sliderState_properties2.start) === 0 && (sliderState === null || sliderState === void 0 ? void 0 : (_sliderState_properties3 = sliderState.properties) === null || _sliderState_properties3 === void 0 ? void 0 : _sliderState_properties3.end) === 1 ? randomValue : scaledToNormalised({
1117
+ scaledValue: randomValue,
1118
+ properties: sliderState === null || sliderState === void 0 ? void 0 : sliderState.properties
1119
+ });
1120
+ setNormalisedState(newValue);
1121
+ };
1122
+ if (!isLocalhost) {
1123
+ setNormalisedValue(normalisedValue);
1124
+ setProperties(sliderState === null || sliderState === void 0 ? void 0 : sliderState.properties);
1125
+ if (isRandomizable) {
1126
+ useRandom === null || useRandom === void 0 ? void 0 : useRandom.subscribe(setRandom, id);
1127
+ }
1128
+ return function() {
1129
+ useRandom === null || useRandom === void 0 ? void 0 : useRandom.unsubscribe(setRandom, id);
1130
+ };
1131
+ } else {
881
1132
  // This sets 'mockProperties' as the value for 'properties' if the app is running in a browser.
882
1133
  setProperties(mockProperties);
883
1134
  setNormalisedValue(mockInitialNormalisedValue);
884
- } else {
885
- setNormalisedValue(normalisedValue);
886
- setProperties(sliderState === null || sliderState === void 0 ? void 0 : sliderState.properties);
887
1135
  }
888
1136
  }, []);
889
1137
  // Update the local state when the ID changes
@@ -894,6 +1142,7 @@ var useSlider = function(param) {
894
1142
  id
895
1143
  ]);
896
1144
  // Sets up listeners to handle changes on the backend
1145
+ //@ts-expect-error
897
1146
  useEffect(function() {
898
1147
  if (!isLocalhost) {
899
1148
  var sliderState = Juce.getSliderState(id);
@@ -903,21 +1152,28 @@ var useSlider = function(param) {
903
1152
  var propertiesListenerId = sliderState === null || sliderState === void 0 ? void 0 : sliderState.propertiesChangedEvent.addListener(function() {
904
1153
  return setProperties(sliderState === null || sliderState === void 0 ? void 0 : sliderState.properties);
905
1154
  });
906
- return function cleanup() {
1155
+ return function() {
907
1156
  sliderState === null || sliderState === void 0 ? void 0 : sliderState.valueChangedEvent.removeListener(valueListenerId);
908
1157
  sliderState === null || sliderState === void 0 ? void 0 : sliderState.propertiesChangedEvent.removeListener(propertiesListenerId);
909
1158
  };
910
- } else {
911
- return;
912
1159
  }
913
- });
1160
+ }, [
1161
+ window
1162
+ ]);
914
1163
  // Update the local state from JUCE
915
1164
  var updateLocalState = function(sliderState) {
916
1165
  var normalisedValueFromState = sliderState === null || sliderState === void 0 ? void 0 : sliderState.getNormalisedValue();
917
1166
  var scaledValueFromState = sliderState === null || sliderState === void 0 ? void 0 : sliderState.getScaledValue();
1167
+ var scaledValue = parseFloat(scaledValueFromState.toFixed(2));
918
1168
  setNormalisedValue(parseFloat(normalisedValueFromState.toFixed(2)));
919
- setScaledValue(parseFloat(scaledValueFromState.toFixed(2)));
1169
+ setScaledValue(scaledValue);
920
1170
  onChange && onChange(parseFloat(scaledValueFromState.toFixed(2)));
1171
+ if ((scaledValueRef === null || scaledValueRef === void 0 ? void 0 : scaledValueRef.current) !== scaledValue) {
1172
+ setHighlightedItem({
1173
+ label: label,
1174
+ value: scaledValue
1175
+ });
1176
+ }
921
1177
  };
922
1178
  // Update JUCE state
923
1179
  var setNormalisedState = function(newValue) {
@@ -938,7 +1194,13 @@ var useSlider = function(param) {
938
1194
  }
939
1195
  };
940
1196
  var bindDrag = useDrag(function(param) {
941
- var down = param.down, delta = param.delta;
1197
+ var down = param.down, delta = param.delta, first = param.first, last = param.last;
1198
+ if (first) {
1199
+ //@ts-expect-error
1200
+ window.__JUCE__.backend.emitEvent('jsDragStarted', {
1201
+ i: "".concat(0)
1202
+ });
1203
+ }
942
1204
  if (down) {
943
1205
  var deltaVal = delta[1] * -1;
944
1206
  var newValue = (normalisedValue !== null && normalisedValue !== void 0 ? normalisedValue : 0) + deltaVal * // (properties?.interval && properties?.interval.toString().length > 4
@@ -947,22 +1209,48 @@ var useSlider = function(param) {
947
1209
  ((properties === null || properties === void 0 ? void 0 : properties.interval) || 0.01);
948
1210
  setNormalisedState(newValue);
949
1211
  }
1212
+ if (last) {
1213
+ //@ts-expect-error
1214
+ window.__JUCE__.backend.emitEvent('jsDragEnded', {
1215
+ i: "".concat(0)
1216
+ });
1217
+ }
950
1218
  }, {
951
1219
  preventDefault: true
952
1220
  });
953
1221
  var bindBarSliderDrag = useDrag(function(param) {
954
- var down = param.down, event = param.event;
1222
+ var down = param.down, event = param.event, first = param.first, last = param.last;
955
1223
  var _event_target;
956
1224
  var rect = event === null || event === void 0 ? void 0 : (_event_target = event.target) === null || _event_target === void 0 ? void 0 : _event_target.getBoundingClientRect();
957
1225
  var y = (event === null || event === void 0 ? void 0 : event.clientY) - rect.top;
1226
+ if (first) {
1227
+ //@ts-expect-error
1228
+ window.__JUCE__.backend.emitEvent('jsDragStarted', {
1229
+ i: "".concat(0)
1230
+ });
1231
+ }
958
1232
  if (down) {
959
1233
  // TODO: Increments?
960
1234
  var newValue = 1 - y / rect.height;
961
1235
  setNormalisedState(newValue);
962
1236
  }
963
- }, {
1237
+ if (last) {
1238
+ //@ts-expect-error
1239
+ window.__JUCE__.backend.emitEvent('jsDragEnded', {
1240
+ i: "".concat(0)
1241
+ });
1242
+ }
1243
+ }, {
964
1244
  preventDefault: true
965
1245
  });
1246
+ var onMouseEnter = function() {
1247
+ if ((scaledValueRef === null || scaledValueRef === void 0 ? void 0 : scaledValueRef.current) !== scaledValue) {
1248
+ setHighlightedItem({
1249
+ label: label,
1250
+ value: scaledValue
1251
+ });
1252
+ }
1253
+ };
966
1254
  // TODO: Refactor
967
1255
  // const onChangeStarted = () => sliderState.sliderDragStarted();
968
1256
  // const onChangeCommitted = () => sliderState.sliderDragEnded();
@@ -971,6 +1259,7 @@ var useSlider = function(param) {
971
1259
  setScaledState: setScaledState,
972
1260
  // onChangeStarted,
973
1261
  // onChangeCommitted,
1262
+ onMouseEnter: onMouseEnter,
974
1263
  bindBarSliderDrag: bindBarSliderDrag,
975
1264
  bindDrag: bindDrag,
976
1265
  normalisedValue: normalisedValue,
@@ -979,10 +1268,33 @@ var useSlider = function(param) {
979
1268
  };
980
1269
  };
981
1270
 
982
- var css_248z$3 = ".RotarySlider {\n position: relative;\n height: 50px;\n width: 50px;\n border-radius: 50%;\n aspect-ratio: 1 / 1;\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 border-color: var(--bg-popover) transparent var(--bg-popover) transparent;\n width: 0;\n height: 0;\n border-style: solid;\n border-width: 0 7px 10px 7px;\n transform: rotate(180deg);\n padding-bottom: var(--spacing-sm);\n}\n";
983
- styleInject(css_248z$3);
1271
+ var JustifyContent = /*#__PURE__*/ function(JustifyContent) {
1272
+ JustifyContent["flexStart"] = "flex-start";
1273
+ JustifyContent["flexEnd"] = "flex-end";
1274
+ JustifyContent["center"] = "center";
1275
+ JustifyContent["spaceBetween"] = "space-between";
1276
+ JustifyContent["spaceAround"] = "space-around";
1277
+ JustifyContent["spaceEvenly"] = "space-evenly";
1278
+ return JustifyContent;
1279
+ }({});
1280
+ var AlignItems = /*#__PURE__*/ function(AlignItems) {
1281
+ AlignItems["flexStart"] = "flex-start";
1282
+ AlignItems["flexEnd"] = "flex-end";
1283
+ AlignItems["center"] = "center";
1284
+ AlignItems["stretch"] = "stretch";
1285
+ AlignItems["baseline"] = "baseline";
1286
+ return AlignItems;
1287
+ }({});
1288
+ var LayoutTags = /*#__PURE__*/ function(LayoutTags) {
1289
+ LayoutTags["header"] = "header";
1290
+ LayoutTags["main"] = "main";
1291
+ LayoutTags["section"] = "section";
1292
+ LayoutTags["div"] = "div";
1293
+ LayoutTags["footer"] = "footer";
1294
+ return LayoutTags;
1295
+ }({});
984
1296
 
985
- function _define_property$9(obj, key, value) {
1297
+ function _define_property$a(obj, key, value) {
986
1298
  if (key in obj) {
987
1299
  Object.defineProperty(obj, key, {
988
1300
  value: value,
@@ -995,7 +1307,7 @@ function _define_property$9(obj, key, value) {
995
1307
  }
996
1308
  return obj;
997
1309
  }
998
- function _object_spread$9(target) {
1310
+ function _object_spread$a(target) {
999
1311
  for(var i = 1; i < arguments.length; i++){
1000
1312
  var source = arguments[i] != null ? arguments[i] : {};
1001
1313
  var ownKeys = Object.keys(source);
@@ -1005,85 +1317,61 @@ function _object_spread$9(target) {
1005
1317
  }));
1006
1318
  }
1007
1319
  ownKeys.forEach(function(key) {
1008
- _define_property$9(target, key, source[key]);
1009
- });
1010
- }
1011
- return target;
1012
- }
1013
- function ownKeys$1(object, enumerableOnly) {
1014
- var keys = Object.keys(object);
1015
- if (Object.getOwnPropertySymbols) {
1016
- var symbols = Object.getOwnPropertySymbols(object);
1017
- keys.push.apply(keys, symbols);
1018
- }
1019
- return keys;
1020
- }
1021
- function _object_spread_props$1(target, source) {
1022
- source = source != null ? source : {};
1023
- if (Object.getOwnPropertyDescriptors) {
1024
- Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
1025
- } else {
1026
- ownKeys$1(Object(source)).forEach(function(key) {
1027
- Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
1320
+ _define_property$a(target, key, source[key]);
1028
1321
  });
1029
1322
  }
1030
1323
  return target;
1031
1324
  }
1032
- function RotarySlider(param) {
1033
- var _param_polarity = param.polarity, polarity = _param_polarity === void 0 ? SliderPolarity.linear : _param_polarity, className = param.className, id = param.id, onMouseEnter = param.onMouseEnter, onChange = param.onChange, _param_rotationBehavior = param.rotationBehavior, rotationBehavior = _param_rotationBehavior === void 0 ? SliderRotationBehavior.rotateIndicator : _param_rotationBehavior, _param_mockInitialNormalisedValue = param.// Mocks the initial scaled value of the slider for web veiws outside of JUCE
1034
- mockInitialNormalisedValue, mockInitialNormalisedValue = _param_mockInitialNormalisedValue === void 0 ? 0 : _param_mockInitialNormalisedValue, _param_mockProperties = param.mockProperties, mockProperties = _param_mockProperties === void 0 ? {
1035
- start: 20.0,
1036
- end: 15000.0,
1037
- interval: 0.1,
1038
- skew: 0.7
1039
- } : _param_mockProperties, _param_color = param.color, color = _param_color === void 0 ? 'var(--color-gray-400)' : _param_color, style = param.style;
1040
- var _useSlider = useSlider({
1041
- id: id,
1042
- mockProperties: mockProperties,
1043
- mockInitialNormalisedValue: mockInitialNormalisedValue,
1044
- onChange: onChange
1045
- }), bindDrag = _useSlider.bindDrag, normalisedValue = _useSlider.normalisedValue, scaledValue = _useSlider.scaledValue;
1046
- return /*#__PURE__*/ React__default.createElement("div", {
1047
- style: {
1048
- display: 'flex',
1049
- flexDirection: 'column',
1050
- alignItems: 'center',
1051
- justifyContent: 'center'
1052
- }
1053
- }, polarity === SliderPolarity.bipolar && /*#__PURE__*/ React__default.createElement("div", {
1054
- className: classnames('RotarySlider-center-marker')
1055
- }), /*#__PURE__*/ React__default.createElement("div", _object_spread_props$1(_object_spread$9({
1056
- className: classnames('RotarySlider', polarity === SliderPolarity.linear ? 'Slider-polarity-linear' : 'Slider-polarity-bipolar', className)
1057
- }, bindDrag()), {
1058
- onMouseEnter: function() {
1059
- return onMouseEnter && onMouseEnter(id, scaledValue);
1060
- },
1061
- style: _object_spread$9({
1062
- touchAction: 'none'
1063
- }, style)
1064
- }), normalisedValue !== null ? /*#__PURE__*/ React__default.createElement("div", {
1065
- className: classnames('RotarySlider-Inner'),
1066
- style: _object_spread$9({
1067
- rotate: rotationBehavior === SliderRotationBehavior.rotateIndicator ? "".concat(polarity === SliderPolarity.linear ? normalisedValue : normalisedValue + 0.5, "turn") : ''
1068
- }, getTransformString({
1069
- sliderType: SliderType.rotary,
1070
- polarity: polarity,
1071
- normalisedValue: normalisedValue,
1072
- scaledValue: scaledValue
1073
- }), getPosition({
1074
- sliderType: SliderType.rotary,
1075
- polarity: polarity
1076
- }))
1077
- }, /*#__PURE__*/ React__default.createElement("div", {
1078
- className: classnames('RotarySlider-Indicator'),
1079
- style: _object_spread$9({
1080
- backgroundColor: color
1325
+ var BoxDisplay = /*#__PURE__*/ function(BoxDisplay) {
1326
+ BoxDisplay["flex"] = "flex";
1327
+ BoxDisplay["block"] = "block";
1328
+ return BoxDisplay;
1329
+ }(BoxDisplay || {});
1330
+ function Box(param) {
1331
+ var className = param.className, style = param.style, children = param.children, flex = param.flex, key = param.key, _param_alignItems = param.alignItems, alignItems = _param_alignItems === void 0 ? AlignItems.center : _param_alignItems, _param_justifyContent = param.justifyContent, justifyContent = _param_justifyContent === void 0 ? JustifyContent.center : _param_justifyContent, _param_display = param.display, display = _param_display === void 0 ? "flex" : _param_display, _param_width = param.width, width = _param_width === void 0 ? Width.auto : _param_width, _param_flexWrap = param.flexWrap, flexWrap = _param_flexWrap === void 0 ? FlexWrap.noWrap : _param_flexWrap, _param_height = param.height, height = _param_height === void 0 ? Height.auto : _param_height, _param_border = param.border, border = _param_border === void 0 ? false : _param_border, _param_flexDirection = param.flexDirection, flexDirection = _param_flexDirection === void 0 ? FlexDirection.row : _param_flexDirection, _param_padding = param.padding, padding = _param_padding === void 0 ? [
1332
+ Spacing.none,
1333
+ Spacing.none,
1334
+ Spacing.none,
1335
+ Spacing.none
1336
+ ] : _param_padding, _param_gap = param.gap, gap = _param_gap === void 0 ? Spacing.xSmall : _param_gap, _param_tag = param.tag, tag = _param_tag === void 0 ? LayoutTags.div : _param_tag;
1337
+ var Tag = tag;
1338
+ var _padding_, _padding_1, _padding_2, _ref;
1339
+ return /*#__PURE__*/ React__default.createElement(Tag, {
1340
+ // id="globalValues"
1341
+ key: key,
1342
+ className: className,
1343
+ style: _object_spread$a({
1344
+ flexWrap: flexWrap,
1345
+ display: display,
1346
+ gap: "var(--gap-".concat(gap, ")"),
1347
+ width: '100%',
1348
+ paddingTop: "var(--p-".concat(padding[0], ")"),
1349
+ paddingRight: "var(--p-".concat((_padding_ = padding[1]) !== null && _padding_ !== void 0 ? _padding_ : padding[0], ")"),
1350
+ paddingBottom: "var(--p-".concat((_padding_1 = padding[2]) !== null && _padding_1 !== void 0 ? _padding_1 : padding[0], ")"),
1351
+ 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], ")"),
1352
+ border: border ? '2px solid #999' : '',
1353
+ maxWidth: width,
1354
+ height: height,
1355
+ flexDirection: flexDirection === FlexDirection.row ? FlexDirection.row : FlexDirection.column,
1356
+ justifyContent: "".concat(justifyContent),
1357
+ alignItems: "".concat(alignItems),
1358
+ flex: flex ? flex : ''
1081
1359
  }, style)
1082
- })) : ''));
1360
+ }, children);
1083
1361
  }
1084
- RotarySlider.sliderPolarity = SliderPolarity;
1362
+ // Object.assign(Layout, width, height, ALIGN, JUSTIFY, DIRECTION, SPACING);
1363
+ Box.display = BoxDisplay;
1364
+ Box.alignItems = AlignItems;
1365
+ Box.justifyContent = JustifyContent;
1366
+ Box.gap = Spacing;
1367
+ Box.flexDirection = FlexDirection;
1368
+ Box.width = Width;
1369
+ Box.height = Height;
1370
+ Box.padding = Spacing;
1371
+ Box.flexWrap = FlexWrap;
1372
+ Box.tag = LayoutTags;
1085
1373
 
1086
- function _define_property$8(obj, key, value) {
1374
+ function _define_property$9(obj, key, value) {
1087
1375
  if (key in obj) {
1088
1376
  Object.defineProperty(obj, key, {
1089
1377
  value: value,
@@ -1096,7 +1384,7 @@ function _define_property$8(obj, key, value) {
1096
1384
  }
1097
1385
  return obj;
1098
1386
  }
1099
- function _object_spread$8(target) {
1387
+ function _object_spread$9(target) {
1100
1388
  for(var i = 1; i < arguments.length; i++){
1101
1389
  var source = arguments[i] != null ? arguments[i] : {};
1102
1390
  var ownKeys = Object.keys(source);
@@ -1106,7 +1394,7 @@ function _object_spread$8(target) {
1106
1394
  }));
1107
1395
  }
1108
1396
  ownKeys.forEach(function(key) {
1109
- _define_property$8(target, key, source[key]);
1397
+ _define_property$9(target, key, source[key]);
1110
1398
  });
1111
1399
  }
1112
1400
  return target;
@@ -1119,7 +1407,7 @@ function Label(param) {
1119
1407
  return /*#__PURE__*/ React.createElement("label", {
1120
1408
  id: id,
1121
1409
  htmlFor: htmlFor,
1122
- style: _object_spread$8({
1410
+ style: _object_spread$9({
1123
1411
  fontSize: "var(--text-".concat(fontSize),
1124
1412
  paddingTop: "var(--p-".concat(padding[0], ")"),
1125
1413
  paddingRight: "var(--p-".concat((_padding_ = padding[1]) !== null && _padding_ !== void 0 ? _padding_ : padding[0], ")"),
@@ -1134,33 +1422,10 @@ function Label(param) {
1134
1422
  Label.padding = Spacing;
1135
1423
  Label.fontSize = FontSizes;
1136
1424
 
1137
- var JustifyContent = /*#__PURE__*/ function(JustifyContent) {
1138
- JustifyContent["flexStart"] = "flex-start";
1139
- JustifyContent["flexEnd"] = "flex-end";
1140
- JustifyContent["center"] = "center";
1141
- JustifyContent["spaceBetween"] = "space-between";
1142
- JustifyContent["spaceAround"] = "space-around";
1143
- JustifyContent["spaceEvenly"] = "space-evenly";
1144
- return JustifyContent;
1145
- }({});
1146
- var AlignItems = /*#__PURE__*/ function(AlignItems) {
1147
- AlignItems["flexStart"] = "flex-start";
1148
- AlignItems["flexEnd"] = "flex-end";
1149
- AlignItems["center"] = "center";
1150
- AlignItems["stretch"] = "stretch";
1151
- AlignItems["baseline"] = "baseline";
1152
- return AlignItems;
1153
- }({});
1154
- var LayoutTags = /*#__PURE__*/ function(LayoutTags) {
1155
- LayoutTags["header"] = "header";
1156
- LayoutTags["main"] = "main";
1157
- LayoutTags["section"] = "section";
1158
- LayoutTags["div"] = "div";
1159
- LayoutTags["footer"] = "footer";
1160
- return LayoutTags;
1161
- }({});
1425
+ var css_248z$3 = ".RotarySlider {\n position: relative;\n height: 50px;\n width: 50px;\n border-radius: 50%;\n aspect-ratio: 1 / 1;\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 border-color: var(--bg-popover) transparent var(--bg-popover) transparent;\n width: 0;\n height: 0;\n border-style: solid;\n border-width: 0 7px 10px 7px;\n transform: rotate(180deg);\n padding-bottom: var(--spacing-sm);\n}\n";
1426
+ styleInject(css_248z$3);
1162
1427
 
1163
- function _define_property$7(obj, key, value) {
1428
+ function _define_property$8(obj, key, value) {
1164
1429
  if (key in obj) {
1165
1430
  Object.defineProperty(obj, key, {
1166
1431
  value: value,
@@ -1173,7 +1438,7 @@ function _define_property$7(obj, key, value) {
1173
1438
  }
1174
1439
  return obj;
1175
1440
  }
1176
- function _object_spread$7(target) {
1441
+ function _object_spread$8(target) {
1177
1442
  for(var i = 1; i < arguments.length; i++){
1178
1443
  var source = arguments[i] != null ? arguments[i] : {};
1179
1444
  var ownKeys = Object.keys(source);
@@ -1183,60 +1448,86 @@ function _object_spread$7(target) {
1183
1448
  }));
1184
1449
  }
1185
1450
  ownKeys.forEach(function(key) {
1186
- _define_property$7(target, key, source[key]);
1451
+ _define_property$8(target, key, source[key]);
1187
1452
  });
1188
1453
  }
1189
1454
  return target;
1190
1455
  }
1191
- var BoxDisplay = /*#__PURE__*/ function(BoxDisplay) {
1192
- BoxDisplay["flex"] = "flex";
1193
- BoxDisplay["block"] = "block";
1194
- return BoxDisplay;
1195
- }(BoxDisplay || {});
1196
- function Box(param) {
1197
- var className = param.className, style = param.style, children = param.children, flex = param.flex, _param_alignItems = param.alignItems, alignItems = _param_alignItems === void 0 ? AlignItems.center : _param_alignItems, _param_justifyContent = param.justifyContent, justifyContent = _param_justifyContent === void 0 ? JustifyContent.center : _param_justifyContent, _param_display = param.display, display = _param_display === void 0 ? "flex" : _param_display, _param_width = param.width, width = _param_width === void 0 ? Width.auto : _param_width, _param_flexWrap = param.flexWrap, flexWrap = _param_flexWrap === void 0 ? FlexWrap.noWrap : _param_flexWrap, _param_height = param.height, height = _param_height === void 0 ? Height.auto : _param_height, _param_border = param.border, border = _param_border === void 0 ? false : _param_border, _param_flexDirection = param.flexDirection, flexDirection = _param_flexDirection === void 0 ? FlexDirection.row : _param_flexDirection, _param_padding = param.padding, padding = _param_padding === void 0 ? [
1198
- Spacing.none,
1199
- Spacing.none,
1200
- Spacing.none,
1201
- Spacing.none
1202
- ] : _param_padding, _param_gap = param.gap, gap = _param_gap === void 0 ? Spacing.xSmall : _param_gap, _param_tag = param.tag, tag = _param_tag === void 0 ? LayoutTags.div : _param_tag;
1203
- var Tag = tag;
1204
- var _padding_, _padding_1, _padding_2, _ref;
1205
- return /*#__PURE__*/ React__default.createElement(Tag, {
1206
- // id="globalValues"
1207
- className: className,
1208
- style: _object_spread$7({
1209
- flexWrap: flexWrap,
1210
- display: display,
1211
- gap: "var(--gap-".concat(gap, ")"),
1212
- width: '100%',
1213
- paddingTop: "var(--p-".concat(padding[0], ")"),
1214
- paddingRight: "var(--p-".concat((_padding_ = padding[1]) !== null && _padding_ !== void 0 ? _padding_ : padding[0], ")"),
1215
- paddingBottom: "var(--p-".concat((_padding_1 = padding[2]) !== null && _padding_1 !== void 0 ? _padding_1 : padding[0], ")"),
1216
- 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], ")"),
1217
- border: border ? '2px solid #999' : '',
1218
- maxWidth: width,
1219
- height: height,
1220
- flexDirection: flexDirection === FlexDirection.row ? FlexDirection.row : FlexDirection.column,
1221
- justifyContent: "".concat(justifyContent),
1222
- alignItems: "".concat(alignItems),
1223
- flex: flex ? flex : ''
1456
+ function ownKeys$1(object, enumerableOnly) {
1457
+ var keys = Object.keys(object);
1458
+ if (Object.getOwnPropertySymbols) {
1459
+ var symbols = Object.getOwnPropertySymbols(object);
1460
+ keys.push.apply(keys, symbols);
1461
+ }
1462
+ return keys;
1463
+ }
1464
+ function _object_spread_props$1(target, source) {
1465
+ source = source != null ? source : {};
1466
+ if (Object.getOwnPropertyDescriptors) {
1467
+ Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
1468
+ } else {
1469
+ ownKeys$1(Object(source)).forEach(function(key) {
1470
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
1471
+ });
1472
+ }
1473
+ return target;
1474
+ }
1475
+ function RotarySlider(param) {
1476
+ var _param_polarity = param.polarity, polarity = _param_polarity === void 0 ? SliderPolarity.linear : _param_polarity, label = param.label, className = param.className, id = param.id, onChange = param.onChange, _param_rotationBehavior = param.rotationBehavior, rotationBehavior = _param_rotationBehavior === void 0 ? SliderRotationBehavior.rotateIndicator : _param_rotationBehavior, _param_mockInitialNormalisedValue = param.// Mocks the initial scaled value of the slider for web veiws outside of JUCE
1477
+ mockInitialNormalisedValue, mockInitialNormalisedValue = _param_mockInitialNormalisedValue === void 0 ? 0 : _param_mockInitialNormalisedValue, _param_isRandomizable = param.isRandomizable, isRandomizable = _param_isRandomizable === void 0 ? false : _param_isRandomizable, _param_mockProperties = param.mockProperties, mockProperties = _param_mockProperties === void 0 ? {
1478
+ start: 20.0,
1479
+ end: 15000.0,
1480
+ interval: 0.1,
1481
+ skew: 0.7
1482
+ } : _param_mockProperties, _param_color = param.color, color = _param_color === void 0 ? 'var(--color-gray-400)' : _param_color, style = param.style;
1483
+ var _useSlider = useSlider({
1484
+ id: id,
1485
+ label: label,
1486
+ mockProperties: mockProperties,
1487
+ mockInitialNormalisedValue: mockInitialNormalisedValue,
1488
+ onChange: onChange,
1489
+ isRandomizable: isRandomizable
1490
+ }), bindDrag = _useSlider.bindDrag, normalisedValue = _useSlider.normalisedValue, scaledValue = _useSlider.scaledValue, onMouseEnter = _useSlider.onMouseEnter;
1491
+ return /*#__PURE__*/ React__default.createElement(Box, {
1492
+ flexDirection: Box.flexDirection.column
1493
+ }, polarity === SliderPolarity.bipolar && /*#__PURE__*/ React__default.createElement("div", {
1494
+ className: classnames('RotarySlider-center-marker')
1495
+ }), /*#__PURE__*/ React__default.createElement("div", _object_spread_props$1(_object_spread$8({
1496
+ className: classnames('RotarySlider', polarity === SliderPolarity.linear ? 'Slider-polarity-linear' : 'Slider-polarity-bipolar', className)
1497
+ }, bindDrag()), {
1498
+ onMouseEnter: onMouseEnter,
1499
+ style: _object_spread$8({
1500
+ touchAction: 'none'
1501
+ }, style)
1502
+ }), normalisedValue !== null ? /*#__PURE__*/ React__default.createElement("div", {
1503
+ className: classnames('RotarySlider-Inner'),
1504
+ style: _object_spread$8({
1505
+ rotate: rotationBehavior === SliderRotationBehavior.rotateIndicator ? "".concat(polarity === SliderPolarity.linear ? normalisedValue : normalisedValue + 0.5, "turn") : ''
1506
+ }, getTransformString({
1507
+ sliderType: SliderType.rotary,
1508
+ polarity: polarity,
1509
+ normalisedValue: normalisedValue,
1510
+ scaledValue: scaledValue
1511
+ }), getPosition({
1512
+ sliderType: SliderType.rotary,
1513
+ polarity: polarity
1514
+ }))
1515
+ }, /*#__PURE__*/ React__default.createElement("div", {
1516
+ className: classnames('RotarySlider-Indicator'),
1517
+ style: _object_spread$8({
1518
+ backgroundColor: color
1224
1519
  }, style)
1225
- }, children);
1520
+ })) : ''), /*#__PURE__*/ React__default.createElement(Label, {
1521
+ padding: [
1522
+ Label.padding.mediumSmall
1523
+ ],
1524
+ fontSize: Label.fontSize.small,
1525
+ value: label
1526
+ }));
1226
1527
  }
1227
- // Object.assign(Layout, width, height, ALIGN, JUSTIFY, DIRECTION, SPACING);
1228
- Box.display = BoxDisplay;
1229
- Box.alignItems = AlignItems;
1230
- Box.justifyContent = JustifyContent;
1231
- Box.gap = Spacing;
1232
- Box.flexDirection = FlexDirection;
1233
- Box.width = Width;
1234
- Box.height = Height;
1235
- Box.padding = Spacing;
1236
- Box.flexWrap = FlexWrap;
1237
- Box.tag = LayoutTags;
1528
+ RotarySlider.sliderPolarity = SliderPolarity;
1238
1529
 
1239
- function _define_property$6(obj, key, value) {
1530
+ function _define_property$7(obj, key, value) {
1240
1531
  if (key in obj) {
1241
1532
  Object.defineProperty(obj, key, {
1242
1533
  value: value,
@@ -1249,7 +1540,7 @@ function _define_property$6(obj, key, value) {
1249
1540
  }
1250
1541
  return obj;
1251
1542
  }
1252
- function _object_spread$6(target) {
1543
+ function _object_spread$7(target) {
1253
1544
  for(var i = 1; i < arguments.length; i++){
1254
1545
  var source = arguments[i] != null ? arguments[i] : {};
1255
1546
  var ownKeys = Object.keys(source);
@@ -1259,7 +1550,7 @@ function _object_spread$6(target) {
1259
1550
  }));
1260
1551
  }
1261
1552
  ownKeys.forEach(function(key) {
1262
- _define_property$6(target, key, source[key]);
1553
+ _define_property$7(target, key, source[key]);
1263
1554
  });
1264
1555
  }
1265
1556
  return target;
@@ -1284,7 +1575,7 @@ function _object_spread_props(target, source) {
1284
1575
  return target;
1285
1576
  }
1286
1577
  function Slider(param) {
1287
- var _param_polarity = param.polarity, polarity = _param_polarity === void 0 ? SliderPolarity.linear : _param_polarity, _param_sliderOrientation = param.sliderOrientation, sliderOrientation = _param_sliderOrientation === void 0 ? SliderOrientation.vertical : _param_sliderOrientation, className = param.className, id = param.id, onMouseEnter = param.onMouseEnter, onChange = param.onChange, style = param.style, color = param.color, label = param.label, _param_mockInitialNormalisedValue = param.// Mocks the initial scaled value of the slider for web veiws outside of JUCE
1578
+ var _param_polarity = param.polarity, polarity = _param_polarity === void 0 ? SliderPolarity.linear : _param_polarity, _param_sliderOrientation = param.sliderOrientation, sliderOrientation = _param_sliderOrientation === void 0 ? SliderOrientation.vertical : _param_sliderOrientation, _param_isRandomizable = param.isRandomizable, isRandomizable = _param_isRandomizable === void 0 ? false : _param_isRandomizable, className = param.className, id = param.id, onChange = param.onChange, style = param.style, color = param.color, label = param.label, _param_mockInitialNormalisedValue = param.// Mocks the initial scaled value of the slider for web veiws outside of JUCE
1288
1579
  mockInitialNormalisedValue, mockInitialNormalisedValue = _param_mockInitialNormalisedValue === void 0 ? 0 : _param_mockInitialNormalisedValue, _param_mockProperties = param.mockProperties, mockProperties = _param_mockProperties === void 0 ? {
1289
1580
  start: 20.0,
1290
1581
  end: 15000.0,
@@ -1293,24 +1584,24 @@ function Slider(param) {
1293
1584
  } : _param_mockProperties;
1294
1585
  var _useSlider = useSlider({
1295
1586
  id: id,
1587
+ label: label,
1296
1588
  mockProperties: mockProperties,
1297
1589
  mockInitialNormalisedValue: mockInitialNormalisedValue,
1298
1590
  sliderOrientation: sliderOrientation,
1299
- onChange: onChange
1300
- }), bindBarSliderDrag = _useSlider.bindBarSliderDrag, normalisedValue = _useSlider.normalisedValue, scaledValue = _useSlider.scaledValue;
1591
+ onChange: onChange,
1592
+ isRandomizable: isRandomizable
1593
+ }), bindBarSliderDrag = _useSlider.bindBarSliderDrag, normalisedValue = _useSlider.normalisedValue, scaledValue = _useSlider.scaledValue, onMouseEnter = _useSlider.onMouseEnter;
1301
1594
  return /*#__PURE__*/ React__default.createElement(Box, {
1302
1595
  flexDirection: Box.flexDirection.column,
1303
1596
  justifyContent: Box.justifyContent.center,
1304
1597
  className: classnames(className)
1305
1598
  }, polarity === SliderPolarity.bipolar && /*#__PURE__*/ React__default.createElement("div", {
1306
1599
  className: 'Slider-center-marker'
1307
- }), /*#__PURE__*/ React__default.createElement("div", _object_spread_props(_object_spread$6({
1600
+ }), /*#__PURE__*/ React__default.createElement("div", _object_spread_props(_object_spread$7({
1308
1601
  className: classnames('Slider-bar', 'relative')
1309
1602
  }, bindBarSliderDrag()), {
1310
- onMouseEnter: function() {
1311
- return onMouseEnter && label && onMouseEnter(label, scaledValue);
1312
- },
1313
- style: _object_spread$6({
1603
+ onMouseEnter: onMouseEnter,
1604
+ style: _object_spread$7({
1314
1605
  touchAction: 'none',
1315
1606
  backgroundColor: 'var(--bg-input)',
1316
1607
  minWidth: sliderOrientation === SliderOrientation.horizontal ? '100px' : '20px',
@@ -1319,7 +1610,7 @@ function Slider(param) {
1319
1610
  }), normalisedValue ? /*#__PURE__*/ React__default.createElement("div", {
1320
1611
  // TODO: Why aren't the Tailwind classes working?
1321
1612
  // className={classnames('h-full', 'w-full', 'absolute', 'bg-input')}
1322
- style: _object_spread$6(_object_spread_props(_object_spread$6({
1613
+ style: _object_spread$7(_object_spread_props(_object_spread$7({
1323
1614
  height: '100%',
1324
1615
  width: '100%',
1325
1616
  position: 'absolute',
@@ -1375,7 +1666,7 @@ var HeadingTags = /*#__PURE__*/ function(HeadingTags) {
1375
1666
  return HeadingTags;
1376
1667
  }({});
1377
1668
 
1378
- function _define_property$5(obj, key, value) {
1669
+ function _define_property$6(obj, key, value) {
1379
1670
  if (key in obj) {
1380
1671
  Object.defineProperty(obj, key, {
1381
1672
  value: value,
@@ -1388,7 +1679,7 @@ function _define_property$5(obj, key, value) {
1388
1679
  }
1389
1680
  return obj;
1390
1681
  }
1391
- function _object_spread$5(target) {
1682
+ function _object_spread$6(target) {
1392
1683
  for(var i = 1; i < arguments.length; i++){
1393
1684
  var source = arguments[i] != null ? arguments[i] : {};
1394
1685
  var ownKeys = Object.keys(source);
@@ -1398,7 +1689,7 @@ function _object_spread$5(target) {
1398
1689
  }));
1399
1690
  }
1400
1691
  ownKeys.forEach(function(key) {
1401
- _define_property$5(target, key, source[key]);
1692
+ _define_property$6(target, key, source[key]);
1402
1693
  });
1403
1694
  }
1404
1695
  return target;
@@ -1411,7 +1702,7 @@ function Heading(param) {
1411
1702
  var _padding_, _padding_1, _padding_2, _ref;
1412
1703
  return /*#__PURE__*/ React.createElement(Tag, {
1413
1704
  id: id,
1414
- style: _object_spread$5({
1705
+ style: _object_spread$6({
1415
1706
  fontSize: "var(--text-".concat(fontSize),
1416
1707
  paddingTop: "var(--p-".concat(padding[0], ")"),
1417
1708
  paddingRight: "var(--p-".concat((_padding_ = padding[1]) !== null && _padding_ !== void 0 ? _padding_ : padding[0], ")"),
@@ -1463,15 +1754,15 @@ var Matrix = function(param) {
1463
1754
  }));
1464
1755
  };
1465
1756
 
1466
- function _array_like_to_array$1(arr, len) {
1757
+ function _array_like_to_array$2(arr, len) {
1467
1758
  if (len == null || len > arr.length) len = arr.length;
1468
1759
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
1469
1760
  return arr2;
1470
1761
  }
1471
- function _array_with_holes$1(arr) {
1762
+ function _array_with_holes$2(arr) {
1472
1763
  if (Array.isArray(arr)) return arr;
1473
1764
  }
1474
- function _iterable_to_array_limit$1(arr, i) {
1765
+ function _iterable_to_array_limit$2(arr, i) {
1475
1766
  var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
1476
1767
  if (_i == null) return;
1477
1768
  var _arr = [];
@@ -1495,26 +1786,26 @@ function _iterable_to_array_limit$1(arr, i) {
1495
1786
  }
1496
1787
  return _arr;
1497
1788
  }
1498
- function _non_iterable_rest$1() {
1789
+ function _non_iterable_rest$2() {
1499
1790
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
1500
1791
  }
1501
- function _sliced_to_array$1(arr, i) {
1502
- return _array_with_holes$1(arr) || _iterable_to_array_limit$1(arr, i) || _unsupported_iterable_to_array$1(arr, i) || _non_iterable_rest$1();
1792
+ function _sliced_to_array$2(arr, i) {
1793
+ return _array_with_holes$2(arr) || _iterable_to_array_limit$2(arr, i) || _unsupported_iterable_to_array$2(arr, i) || _non_iterable_rest$2();
1503
1794
  }
1504
- function _unsupported_iterable_to_array$1(o, minLen) {
1795
+ function _unsupported_iterable_to_array$2(o, minLen) {
1505
1796
  if (!o) return;
1506
- if (typeof o === "string") return _array_like_to_array$1(o, minLen);
1797
+ if (typeof o === "string") return _array_like_to_array$2(o, minLen);
1507
1798
  var n = Object.prototype.toString.call(o).slice(8, -1);
1508
1799
  if (n === "Object" && o.constructor) n = o.constructor.name;
1509
1800
  if (n === "Map" || n === "Set") return Array.from(n);
1510
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$1(o, minLen);
1801
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$2(o, minLen);
1511
1802
  }
1512
1803
  // 20.0f, 15000.0f, 0.1f, 0.7f),800.0f
1513
1804
  // ValueType rangeStart, ValueType rangeEnd, ValueType intervalValue, ValueType skewFactor, bool useSymmetricSkew=false)
1514
1805
  var useIndicator = function(param) {
1515
1806
  var id = param.id;
1516
1807
  var isLocalhost = window.location.hostname === 'localhost';
1517
- var _useState = _sliced_to_array$1(useState(0), 2), isActive = _useState[0], setIsActive = _useState[1];
1808
+ var _useState = _sliced_to_array$2(useState(0), 2), isActive = _useState[0], setIsActive = _useState[1];
1518
1809
  // Set the initial state
1519
1810
  useEffect(function() {
1520
1811
  if (!isLocalhost) {
@@ -1548,7 +1839,7 @@ var useIndicator = function(param) {
1548
1839
  };
1549
1840
  };
1550
1841
 
1551
- function _define_property$4(obj, key, value) {
1842
+ function _define_property$5(obj, key, value) {
1552
1843
  if (key in obj) {
1553
1844
  Object.defineProperty(obj, key, {
1554
1845
  value: value,
@@ -1561,7 +1852,7 @@ function _define_property$4(obj, key, value) {
1561
1852
  }
1562
1853
  return obj;
1563
1854
  }
1564
- function _object_spread$4(target) {
1855
+ function _object_spread$5(target) {
1565
1856
  for(var i = 1; i < arguments.length; i++){
1566
1857
  var source = arguments[i] != null ? arguments[i] : {};
1567
1858
  var ownKeys = Object.keys(source);
@@ -1571,7 +1862,7 @@ function _object_spread$4(target) {
1571
1862
  }));
1572
1863
  }
1573
1864
  ownKeys.forEach(function(key) {
1574
- _define_property$4(target, key, source[key]);
1865
+ _define_property$5(target, key, source[key]);
1575
1866
  });
1576
1867
  }
1577
1868
  return target;
@@ -1588,7 +1879,7 @@ function IndicatorLight(param) {
1588
1879
  }, /*#__PURE__*/ React__default.createElement("div", {
1589
1880
  id: id,
1590
1881
  className: classnames('IndicatorLight', 'bg-input', className),
1591
- style: _object_spread$4({
1882
+ style: _object_spread$5({
1592
1883
  width: '12px',
1593
1884
  height: '12px',
1594
1885
  background: isActive ? color : ''
@@ -1598,12 +1889,41 @@ function IndicatorLight(param) {
1598
1889
  }) : null);
1599
1890
  }
1600
1891
 
1601
- var css_248z$2 = ".IconButton {\n height: 28px;\n background: var(--bg-page);\n}\n\n.IconButton:hover {\n filter: brightness(80%);\n}\n";
1892
+ var css_248z$2 = ".IconButton {\n height: 28px;\n}\n\n.IconButton:hover:not(:disabled) {\n filter: brightness(80%);\n}\n";
1602
1893
  styleInject(css_248z$2);
1603
1894
 
1895
+ function _define_property$4(obj, key, value) {
1896
+ if (key in obj) {
1897
+ Object.defineProperty(obj, key, {
1898
+ value: value,
1899
+ enumerable: true,
1900
+ configurable: true,
1901
+ writable: true
1902
+ });
1903
+ } else {
1904
+ obj[key] = value;
1905
+ }
1906
+ return obj;
1907
+ }
1908
+ function _object_spread$4(target) {
1909
+ for(var i = 1; i < arguments.length; i++){
1910
+ var source = arguments[i] != null ? arguments[i] : {};
1911
+ var ownKeys = Object.keys(source);
1912
+ if (typeof Object.getOwnPropertySymbols === "function") {
1913
+ ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
1914
+ return Object.getOwnPropertyDescriptor(source, sym).enumerable;
1915
+ }));
1916
+ }
1917
+ ownKeys.forEach(function(key) {
1918
+ _define_property$4(target, key, source[key]);
1919
+ });
1920
+ }
1921
+ return target;
1922
+ }
1604
1923
  var ButtonIcon = /*#__PURE__*/ function(ButtonIcon) {
1605
1924
  ButtonIcon["undo"] = "UndoIcon";
1606
1925
  ButtonIcon["redo"] = "RedoIcon";
1926
+ ButtonIcon["random"] = "RandomIcon";
1607
1927
  return ButtonIcon;
1608
1928
  }(ButtonIcon || {});
1609
1929
  var UndoIcon = function(param) {
@@ -1654,12 +1974,72 @@ var RedoIcon = function(param) {
1654
1974
  "stroke-linejoin": "round"
1655
1975
  }));
1656
1976
  };
1977
+ var RandomIcon = function(param) {
1978
+ var color = param.color;
1979
+ return /*#__PURE__*/ React__default.createElement("svg", {
1980
+ width: "24px",
1981
+ height: "24px",
1982
+ viewBox: "0 0 24 24",
1983
+ "stroke-width": "1.5",
1984
+ fill: "none",
1985
+ xmlns: "http://www.w3.org/2000/svg",
1986
+ color: color
1987
+ }, /*#__PURE__*/ React__default.createElement("path", {
1988
+ d: "M11.7 1.1732C11.8856 1.06603 12.1144 1.06603 12.3 1.17321L21.2263 6.3268C21.4119 6.43397 21.5263 6.63205 21.5263 6.84641V17.1536C21.5263 17.3679 21.4119 17.566 21.2263 17.6732L12.3 22.8268C12.1144 22.934 11.8856 22.934 11.7 22.8268L2.77372 17.6732C2.58808 17.566 2.47372 17.3679 2.47372 17.1536V6.84641C2.47372 6.63205 2.58808 6.43397 2.77372 6.32679L11.7 1.1732Z",
1989
+ stroke: color,
1990
+ "stroke-width": "1.5",
1991
+ "stroke-linecap": "round",
1992
+ "stroke-linejoin": "round"
1993
+ }), /*#__PURE__*/ React__default.createElement("path", {
1994
+ d: "M17 15L7 15L12 7L17 15Z",
1995
+ stroke: color,
1996
+ "stroke-width": "1.5",
1997
+ "stroke-linecap": "round",
1998
+ "stroke-linejoin": "round"
1999
+ }), /*#__PURE__*/ React__default.createElement("path", {
2000
+ d: "M2.5 6.5L12 7",
2001
+ stroke: color,
2002
+ "stroke-width": "1.5",
2003
+ "stroke-linejoin": "round"
2004
+ }), /*#__PURE__*/ React__default.createElement("path", {
2005
+ d: "M2.5 6.5L7 15",
2006
+ stroke: color,
2007
+ "stroke-width": "1.5",
2008
+ "stroke-linejoin": "round"
2009
+ }), /*#__PURE__*/ React__default.createElement("path", {
2010
+ d: "M21.5 6.5L17 15",
2011
+ stroke: color,
2012
+ "stroke-width": "1.5",
2013
+ "stroke-linejoin": "round"
2014
+ }), /*#__PURE__*/ React__default.createElement("path", {
2015
+ d: "M21.5 6.5L12 6.99995L12 1",
2016
+ stroke: color,
2017
+ "stroke-width": "1.5",
2018
+ "stroke-linejoin": "round"
2019
+ }), /*#__PURE__*/ React__default.createElement("path", {
2020
+ d: "M21.5 17.5L17 15",
2021
+ stroke: color,
2022
+ "stroke-width": "1.5",
2023
+ "stroke-linejoin": "round"
2024
+ }), /*#__PURE__*/ React__default.createElement("path", {
2025
+ d: "M2.5 17.5L7 15",
2026
+ stroke: color,
2027
+ "stroke-width": "1.5",
2028
+ "stroke-linejoin": "round"
2029
+ }), /*#__PURE__*/ React__default.createElement("path", {
2030
+ d: "M7 15L12 23L17 15",
2031
+ stroke: color,
2032
+ "stroke-width": "1.5",
2033
+ "stroke-linejoin": "round"
2034
+ }));
2035
+ };
1657
2036
  var icons = {
1658
2037
  UndoIcon: UndoIcon,
1659
- RedoIcon: RedoIcon
2038
+ RedoIcon: RedoIcon,
2039
+ RandomIcon: RandomIcon
1660
2040
  };
1661
2041
  function IconButton(param) {
1662
- var id = param.id, icon = param.icon, onClick = param.onClick, className = param.className, style = param.style;
2042
+ var id = param.id, icon = param.icon, onClick = param.onClick, _param_disabled = param.disabled, disabled = _param_disabled === void 0 ? false : _param_disabled, _param_color = param.color, color = _param_color === void 0 ? 'var(--color-text)' : _param_color, _param_backgroundColor = param.backgroundColor, backgroundColor = _param_backgroundColor === void 0 ? 'var(--bg-page)' : _param_backgroundColor, className = param.className, style = param.style;
1663
2043
  var Icon = icons[icon];
1664
2044
  return /*#__PURE__*/ React__default.createElement(Button, {
1665
2045
  id: id,
@@ -1668,9 +2048,12 @@ function IconButton(param) {
1668
2048
  padding: [
1669
2049
  Button.padding.medium
1670
2050
  ],
1671
- style: style
2051
+ disabled: disabled,
2052
+ style: _object_spread$4({
2053
+ backgroundColor: backgroundColor
2054
+ }, style)
1672
2055
  }, /*#__PURE__*/ React__default.createElement(Icon, {
1673
- color: "var(--color-text)"
2056
+ color: disabled ? 'var(--color-gray-400)' : color
1674
2057
  }));
1675
2058
  }
1676
2059
  IconButton.icon = ButtonIcon;
@@ -1737,7 +2120,7 @@ function KeyValueDisplayScreen(param) {
1737
2120
  Label.padding.none,
1738
2121
  Label.padding.medium
1739
2122
  ]
1740
- }, data === null || data === void 0 ? void 0 : data.key), /*#__PURE__*/ React__default.createElement(Label, {
2123
+ }, "".concat(data === null || data === void 0 ? void 0 : data.key, ":")), /*#__PURE__*/ React__default.createElement(Label, {
1741
2124
  padding: [
1742
2125
  Label.padding.xSmall,
1743
2126
  Label.padding.mediumLarge,
@@ -1745,7 +2128,7 @@ function KeyValueDisplayScreen(param) {
1745
2128
  Label.padding.none
1746
2129
  ],
1747
2130
  className: 'KeyValueDisplayScreen-Item'
1748
- }, data === null || data === void 0 ? void 0 : data.value))) : /*#__PURE__*/ React__default.createElement(React__default.Fragment, null, /*#__PURE__*/ React__default.createElement(Box, null, /*#__PURE__*/ React__default.createElement(Label, null, "Sparkler v1.8.2")), /*#__PURE__*/ React__default.createElement(Box, null, /*#__PURE__*/ React__default.createElement(Label, null, "Antimatter audio"))));
2131
+ }, data === null || data === void 0 ? void 0 : data.value))) : /*#__PURE__*/ React__default.createElement(React__default.Fragment, null, /*#__PURE__*/ React__default.createElement(Box, null, /*#__PURE__*/ React__default.createElement(Label, null, "Antimatter Audio")), /*#__PURE__*/ React__default.createElement(Box, null, /*#__PURE__*/ React__default.createElement(Label, null))));
1749
2132
  }
1750
2133
 
1751
2134
  function LinePlot(param) {
@@ -1818,12 +2201,12 @@ function LinePlot(param) {
1818
2201
  var css_248z$1 = ".Oscilloscope {\n background: #0EAC8B;\n box-shadow: inset 0 0 20px #086350;\n height: 200px;\n };";
1819
2202
  styleInject(css_248z$1);
1820
2203
 
1821
- function _array_like_to_array(arr, len) {
2204
+ function _array_like_to_array$1(arr, len) {
1822
2205
  if (len == null || len > arr.length) len = arr.length;
1823
2206
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
1824
2207
  return arr2;
1825
2208
  }
1826
- function _array_with_holes(arr) {
2209
+ function _array_with_holes$1(arr) {
1827
2210
  if (Array.isArray(arr)) return arr;
1828
2211
  }
1829
2212
  function _define_property$2(obj, key, value) {
@@ -1839,7 +2222,7 @@ function _define_property$2(obj, key, value) {
1839
2222
  }
1840
2223
  return obj;
1841
2224
  }
1842
- function _iterable_to_array_limit(arr, i) {
2225
+ function _iterable_to_array_limit$1(arr, i) {
1843
2226
  var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
1844
2227
  if (_i == null) return;
1845
2228
  var _arr = [];
@@ -1863,7 +2246,7 @@ function _iterable_to_array_limit(arr, i) {
1863
2246
  }
1864
2247
  return _arr;
1865
2248
  }
1866
- function _non_iterable_rest() {
2249
+ function _non_iterable_rest$1() {
1867
2250
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
1868
2251
  }
1869
2252
  function _object_spread$2(target) {
@@ -1881,20 +2264,20 @@ function _object_spread$2(target) {
1881
2264
  }
1882
2265
  return target;
1883
2266
  }
1884
- function _sliced_to_array(arr, i) {
1885
- return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
2267
+ function _sliced_to_array$1(arr, i) {
2268
+ return _array_with_holes$1(arr) || _iterable_to_array_limit$1(arr, i) || _unsupported_iterable_to_array$1(arr, i) || _non_iterable_rest$1();
1886
2269
  }
1887
- function _unsupported_iterable_to_array(o, minLen) {
2270
+ function _unsupported_iterable_to_array$1(o, minLen) {
1888
2271
  if (!o) return;
1889
- if (typeof o === "string") return _array_like_to_array(o, minLen);
2272
+ if (typeof o === "string") return _array_like_to_array$1(o, minLen);
1890
2273
  var n = Object.prototype.toString.call(o).slice(8, -1);
1891
2274
  if (n === "Object" && o.constructor) n = o.constructor.name;
1892
2275
  if (n === "Map" || n === "Set") return Array.from(n);
1893
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
2276
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$1(o, minLen);
1894
2277
  }
1895
2278
  function Oscilloscope(param) {
1896
2279
  var width = param.width, height = param.height, className = param.className, style = param.style, id = param.id;
1897
- var _useState = _sliced_to_array(useState([]), 2), viewData = _useState[0], setViewData = _useState[1];
2280
+ var _useState = _sliced_to_array$1(useState([]), 2), viewData = _useState[0], setViewData = _useState[1];
1898
2281
  useEffect(function() {
1899
2282
  //@ts-expect-error
1900
2283
  var removalToken = window.__JUCE__.backend.addEventListener('oscData', function() {
@@ -1926,6 +2309,43 @@ function Oscilloscope(param) {
1926
2309
  var css_248z = "@import '../../styles.css';\n.ModuleHeader {\n background-color: var(--bg-section);\n font-weight: normal;\n}\n\n.ModuleHeader-Name {\n font-size: var(--text-lg);\n letter-spacing: 4px;\n text-transform: uppercase;\n font-weight: lighter;\n height: 1.75rem;\n color: var(--color-brand);\n}\n\n.ModuleHeader-Subheading {\n font-size: var(--text-xs);\n font-weight: lighter;\n letter-spacing: 2.25px;\n text-transform: uppercase;\n color: var(--color-brand);\n}\n";
1927
2310
  styleInject(css_248z);
1928
2311
 
2312
+ function _array_like_to_array(arr, len) {
2313
+ if (len == null || len > arr.length) len = arr.length;
2314
+ for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
2315
+ return arr2;
2316
+ }
2317
+ function _array_with_holes(arr) {
2318
+ if (Array.isArray(arr)) return arr;
2319
+ }
2320
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
2321
+ try {
2322
+ var info = gen[key](arg);
2323
+ var value = info.value;
2324
+ } catch (error) {
2325
+ reject(error);
2326
+ return;
2327
+ }
2328
+ if (info.done) {
2329
+ resolve(value);
2330
+ } else {
2331
+ Promise.resolve(value).then(_next, _throw);
2332
+ }
2333
+ }
2334
+ function _async_to_generator(fn) {
2335
+ return function() {
2336
+ var self = this, args = arguments;
2337
+ return new Promise(function(resolve, reject) {
2338
+ var gen = fn.apply(self, args);
2339
+ function _next(value) {
2340
+ asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
2341
+ }
2342
+ function _throw(err) {
2343
+ asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
2344
+ }
2345
+ _next(undefined);
2346
+ });
2347
+ };
2348
+ }
1929
2349
  function _define_property$1(obj, key, value) {
1930
2350
  if (key in obj) {
1931
2351
  Object.defineProperty(obj, key, {
@@ -1939,6 +2359,33 @@ function _define_property$1(obj, key, value) {
1939
2359
  }
1940
2360
  return obj;
1941
2361
  }
2362
+ function _iterable_to_array_limit(arr, i) {
2363
+ var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
2364
+ if (_i == null) return;
2365
+ var _arr = [];
2366
+ var _n = true;
2367
+ var _d = false;
2368
+ var _s, _e;
2369
+ try {
2370
+ for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
2371
+ _arr.push(_s.value);
2372
+ if (i && _arr.length === i) break;
2373
+ }
2374
+ } catch (err) {
2375
+ _d = true;
2376
+ _e = err;
2377
+ } finally{
2378
+ try {
2379
+ if (!_n && _i["return"] != null) _i["return"]();
2380
+ } finally{
2381
+ if (_d) throw _e;
2382
+ }
2383
+ }
2384
+ return _arr;
2385
+ }
2386
+ function _non_iterable_rest() {
2387
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
2388
+ }
1942
2389
  function _object_spread$1(target) {
1943
2390
  for(var i = 1; i < arguments.length; i++){
1944
2391
  var source = arguments[i] != null ? arguments[i] : {};
@@ -1954,10 +2401,202 @@ function _object_spread$1(target) {
1954
2401
  }
1955
2402
  return target;
1956
2403
  }
2404
+ function _sliced_to_array(arr, i) {
2405
+ return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
2406
+ }
2407
+ function _unsupported_iterable_to_array(o, minLen) {
2408
+ if (!o) return;
2409
+ if (typeof o === "string") return _array_like_to_array(o, minLen);
2410
+ var n = Object.prototype.toString.call(o).slice(8, -1);
2411
+ if (n === "Object" && o.constructor) n = o.constructor.name;
2412
+ if (n === "Map" || n === "Set") return Array.from(n);
2413
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
2414
+ }
2415
+ function _ts_generator(thisArg, body) {
2416
+ var f, y, t, g, _ = {
2417
+ label: 0,
2418
+ sent: function() {
2419
+ if (t[0] & 1) throw t[1];
2420
+ return t[1];
2421
+ },
2422
+ trys: [],
2423
+ ops: []
2424
+ };
2425
+ return g = {
2426
+ next: verb(0),
2427
+ "throw": verb(1),
2428
+ "return": verb(2)
2429
+ }, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
2430
+ return this;
2431
+ }), g;
2432
+ function verb(n) {
2433
+ return function(v) {
2434
+ return step([
2435
+ n,
2436
+ v
2437
+ ]);
2438
+ };
2439
+ }
2440
+ function step(op) {
2441
+ if (f) throw new TypeError("Generator is already executing.");
2442
+ while(_)try {
2443
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
2444
+ if (y = 0, t) op = [
2445
+ op[0] & 2,
2446
+ t.value
2447
+ ];
2448
+ switch(op[0]){
2449
+ case 0:
2450
+ case 1:
2451
+ t = op;
2452
+ break;
2453
+ case 4:
2454
+ _.label++;
2455
+ return {
2456
+ value: op[1],
2457
+ done: false
2458
+ };
2459
+ case 5:
2460
+ _.label++;
2461
+ y = op[1];
2462
+ op = [
2463
+ 0
2464
+ ];
2465
+ continue;
2466
+ case 7:
2467
+ op = _.ops.pop();
2468
+ _.trys.pop();
2469
+ continue;
2470
+ default:
2471
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
2472
+ _ = 0;
2473
+ continue;
2474
+ }
2475
+ if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
2476
+ _.label = op[1];
2477
+ break;
2478
+ }
2479
+ if (op[0] === 6 && _.label < t[1]) {
2480
+ _.label = t[1];
2481
+ t = op;
2482
+ break;
2483
+ }
2484
+ if (t && _.label < t[2]) {
2485
+ _.label = t[2];
2486
+ _.ops.push(op);
2487
+ break;
2488
+ }
2489
+ if (t[2]) _.ops.pop();
2490
+ _.trys.pop();
2491
+ continue;
2492
+ }
2493
+ op = body.call(thisArg, _);
2494
+ } catch (e) {
2495
+ op = [
2496
+ 6,
2497
+ e
2498
+ ];
2499
+ y = 0;
2500
+ } finally{
2501
+ f = t = 0;
2502
+ }
2503
+ if (op[0] & 5) throw op[1];
2504
+ return {
2505
+ value: op[0] ? op[1] : void 0,
2506
+ done: true
2507
+ };
2508
+ }
2509
+ }
1957
2510
  function ModuleHeader(param) {
1958
- var title = param.title, subtitle = param.subtitle, activeItem = param.activeItem, className = param.className, style = param.style;
2511
+ var title = param.title, subtitle = param.subtitle, className = param.className, style = param.style;
2512
+ var _globalState_highlightedItem, _globalState_highlightedItem1;
2513
+ var canUndoFunc = Juce.getNativeFunction('canUndo');
2514
+ var canRedoFunc = Juce.getNativeFunction('canRedo');
1959
2515
  var undo = Juce.getNativeFunction('undo');
1960
2516
  var redo = Juce.getNativeFunction('redo');
2517
+ var isLocalhost = window.location.hostname === 'localhost';
2518
+ var _useState = _sliced_to_array(useState(false), 2), canUndo = _useState[0], setCanUndo = _useState[1];
2519
+ var _useState1 = _sliced_to_array(useState(false), 2), canRedo = _useState1[0], setCanRedo = _useState1[1];
2520
+ var globalState = useGlobalContext().globalState;
2521
+ var handleUndo = function() {
2522
+ undo();
2523
+ };
2524
+ var handleRedo = function() {
2525
+ redo();
2526
+ };
2527
+ useEffect(function() {
2528
+ if (!isLocalhost) {
2529
+ var undoButtonListenerId = //@ts-expect-error
2530
+ window.__JUCE__.backend.addEventListener('updateUndoButton', function(event) {
2531
+ setCanUndo(event);
2532
+ });
2533
+ var redoButtonListenerId = //@ts-expect-error
2534
+ window.__JUCE__.backend.addEventListener('updateRedoButton', function(event) {
2535
+ setCanRedo(event);
2536
+ });
2537
+ return function cleanup() {
2538
+ //@ts-expect-error
2539
+ window.__JUCE__.backend.removeEventListener(undoButtonListenerId);
2540
+ //@ts-expect-error
2541
+ window.__JUCE__.backend.removeEventListener(redoButtonListenerId);
2542
+ };
2543
+ } else {
2544
+ return;
2545
+ }
2546
+ }, [
2547
+ window
2548
+ ]);
2549
+ useEffect(function() {
2550
+ var getUndoRedoState = /*#__PURE__*/ function() {
2551
+ var _ref = _async_to_generator(function() {
2552
+ var canUndoState, canRedoState, error;
2553
+ return _ts_generator(this, function(_state) {
2554
+ switch(_state.label){
2555
+ case 0:
2556
+ _state.trys.push([
2557
+ 0,
2558
+ 3,
2559
+ ,
2560
+ 4
2561
+ ]);
2562
+ return [
2563
+ 4,
2564
+ canUndoFunc()
2565
+ ];
2566
+ case 1:
2567
+ canUndoState = _state.sent();
2568
+ return [
2569
+ 4,
2570
+ canRedoFunc()
2571
+ ];
2572
+ case 2:
2573
+ canRedoState = _state.sent();
2574
+ setCanUndo(canUndoState);
2575
+ setCanRedo(canRedoState);
2576
+ return [
2577
+ 3,
2578
+ 4
2579
+ ];
2580
+ case 3:
2581
+ error = _state.sent();
2582
+ console.log(error);
2583
+ return [
2584
+ 3,
2585
+ 4
2586
+ ];
2587
+ case 4:
2588
+ return [
2589
+ 2
2590
+ ];
2591
+ }
2592
+ });
2593
+ });
2594
+ return function getUndoRedoState() {
2595
+ return _ref.apply(this, arguments);
2596
+ };
2597
+ }();
2598
+ getUndoRedoState();
2599
+ });
1961
2600
  return /*#__PURE__*/ React__default.createElement(Box, {
1962
2601
  gap: Box.gap.medium,
1963
2602
  tag: Box.tag.header,
@@ -1988,21 +2627,23 @@ function ModuleHeader(param) {
1988
2627
  flex: "0 0 250px"
1989
2628
  }, /*#__PURE__*/ React__default.createElement(KeyValueDisplayScreen, {
1990
2629
  data: {
1991
- key: activeItem === null || activeItem === void 0 ? void 0 : activeItem.key,
1992
- value: activeItem === null || activeItem === void 0 ? void 0 : activeItem.value
2630
+ key: globalState === null || globalState === void 0 ? void 0 : (_globalState_highlightedItem = globalState.highlightedItem) === null || _globalState_highlightedItem === void 0 ? void 0 : _globalState_highlightedItem.label,
2631
+ value: globalState === null || globalState === void 0 ? void 0 : (_globalState_highlightedItem1 = globalState.highlightedItem) === null || _globalState_highlightedItem1 === void 0 ? void 0 : _globalState_highlightedItem1.value
1993
2632
  }
1994
2633
  })), /*#__PURE__*/ React__default.createElement(Box, {
1995
2634
  flex: "0"
1996
2635
  }, /*#__PURE__*/ React__default.createElement(IconButton, {
1997
2636
  id: "undo",
1998
2637
  icon: IconButton.icon.undo,
2638
+ disabled: !canUndo,
1999
2639
  onClick: function() {
2000
- undo();
2640
+ handleUndo();
2001
2641
  }
2002
2642
  }), /*#__PURE__*/ React__default.createElement(IconButton, {
2003
2643
  id: "redo",
2644
+ disabled: !canRedo,
2004
2645
  onClick: function() {
2005
- redo();
2646
+ handleRedo();
2006
2647
  },
2007
2648
  icon: IconButton.icon.redo
2008
2649
  }))));
@@ -2052,5 +2693,5 @@ function ModuleFooter(param) {
2052
2693
  });
2053
2694
  }
2054
2695
 
2055
- export { Slider as BarSlider, Box, Button, Dropdown, FontSizes, Heading, IconButton, IndicatorLight, Input, KeyValueDisplayScreen, Label, Matrix, ModuleFooter, ModuleHeader, Oscilloscope, RotarySlider, SliderValue, Spacing, Tabs, clamp, decimalToPercent, getPosition, getTransformString, normalisedToScaled, percentToDecimal, scaledToNormalised as scaledTonormalised, useSlider };
2696
+ export { Slider as BarSlider, Box, Button, Dropdown, FontSizes, GlobalContextProvider, Heading, IconButton, IndicatorLight, Input, KeyValueDisplayScreen, Label, Matrix, ModuleFooter, ModuleHeader, Oscilloscope, RotarySlider, SliderValue, Spacing, Tabs, clamp, decimalToPercent, defaultGlobalStateValue as defaultValue, getPosition, getTransformString, normalisedToScaled, percentToDecimal, randomizeValue, scaledToNormalised as scaledTonormalised, useGlobalContext, useObservable, useSlider };
2056
2697
  //# sourceMappingURL=index.js.map