@antimatter-audio/antimatter-ui 9.6.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 +757 -319
  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$7(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$7(arr) {
95
+ function _array_with_holes$8(arr) {
96
96
  if (Array.isArray(arr)) return arr;
97
97
  }
98
- function _iterable_to_array_limit$7(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$7(arr, i) {
119
119
  }
120
120
  return _arr;
121
121
  }
122
- function _non_iterable_rest$7() {
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$7(arr, i) {
126
- return _array_with_holes$7(arr) || _iterable_to_array_limit$7(arr, i) || _unsupported_iterable_to_array$7(arr, i) || _non_iterable_rest$7();
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$7(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$7(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$7(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$7(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$6(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$6(arr) {
205
+ function _array_with_holes$7(arr) {
205
206
  if (Array.isArray(arr)) return arr;
206
207
  }
207
- function _define_property$c(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$c(obj, key, value) {
217
218
  }
218
219
  return obj;
219
220
  }
220
- function _iterable_to_array_limit$6(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$6(arr, i) {
241
242
  }
242
243
  return _arr;
243
244
  }
244
- function _non_iterable_rest$6() {
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$c(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$c(target) {
254
255
  }));
255
256
  }
256
257
  ownKeys.forEach(function(key) {
257
- _define_property$c(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$6(arr, i) {
263
- return _array_with_holes$6(arr) || _iterable_to_array_limit$6(arr, i) || _unsupported_iterable_to_array$6(arr, i) || _non_iterable_rest$6();
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$6(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$6(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$6(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$6(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$c({
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,6 +348,193 @@ 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
 
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) {
392
+ if (len == null || len > arr.length) len = arr.length;
393
+ for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
394
+ return arr2;
395
+ }
396
+ function _array_with_holes$6(arr) {
397
+ if (Array.isArray(arr)) return arr;
398
+ }
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) {
413
+ var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
414
+ if (_i == null) return;
415
+ var _arr = [];
416
+ var _n = true;
417
+ var _d = false;
418
+ var _s, _e;
419
+ try {
420
+ for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
421
+ _arr.push(_s.value);
422
+ if (i && _arr.length === i) break;
423
+ }
424
+ } catch (err) {
425
+ _d = true;
426
+ _e = err;
427
+ } finally{
428
+ try {
429
+ if (!_n && _i["return"] != null) _i["return"]();
430
+ } finally{
431
+ if (_d) throw _e;
432
+ }
433
+ }
434
+ return _arr;
435
+ }
436
+ function _non_iterable_rest$6() {
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.");
438
+ }
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;
453
+ }
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) {
477
+ if (!o) return;
478
+ if (typeof o === "string") return _array_like_to_array$6(o, minLen);
479
+ var n = Object.prototype.toString.call(o).slice(8, -1);
480
+ if (n === "Object" && o.constructor) n = o.constructor.name;
481
+ if (n === "Map" || n === "Set") return Array.from(n);
482
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$6(o, minLen);
483
+ }
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
+
350
538
  function _array_like_to_array$5(arr, len) {
351
539
  if (len == null || len > arr.length) len = arr.length;
352
540
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
@@ -393,28 +581,39 @@ function _unsupported_iterable_to_array$5(o, minLen) {
393
581
  if (n === "Map" || n === "Set") return Array.from(n);
394
582
  if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$5(o, minLen);
395
583
  }
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;
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
587
  var _useState = _sliced_to_array$5(useState(comboBoxState.getChoiceIndex()), 2), value = _useState[0], setValue = _useState[1];
404
588
  var _useState1 = _sliced_to_array$5(useState(comboBoxState.properties), 2), properties = _useState1[0], setProperties = _useState1[1];
405
- var handleChange = function(event) {
406
- comboBoxState.setChoiceIndex(event);
407
- setValue(event);
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) {
@@ -628,7 +857,6 @@ function Input(param) {
628
857
  // triggers a check to see if the user is actually done typing
629
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));
630
859
  var handleChange = useCallback(function(e) {
631
- // console.log(e, e.target.value);
632
860
  var newValue = e.target.value;
633
861
  setHasError(false);
634
862
  var _validate = validate({
@@ -655,7 +883,6 @@ function Input(param) {
655
883
  ]);
656
884
  useEffect(function() {
657
885
  setInternalValue(value);
658
- // console.log(value, 'VALUUUUUU');
659
886
  var isValid = validate({
660
887
  value: value,
661
888
  type: type,
@@ -854,7 +1081,7 @@ function _unsupported_iterable_to_array$3(o, minLen) {
854
1081
  // 20.0f, 15000.0f, 0.1f, 0.7f),800.0f
855
1082
  // ValueType rangeStart, ValueType rangeEnd, ValueType intervalValue, ValueType skewFactor, bool useSymmetricSkew=false)
856
1083
  var useSlider = function(param) {
857
- 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 ? {
858
1085
  start: 20,
859
1086
  end: 15000,
860
1087
  interval: 0.1,
@@ -877,17 +1104,34 @@ var useSlider = function(param) {
877
1104
  var _useState2 = _sliced_to_array$3(useState(), 2), properties = _useState2[0], setProperties = _useState2[1];
878
1105
  var scaledValueRef = useRef(null);
879
1106
  var normalisedValueRef = useRef(null);
880
- var randomValueSetCounter = useRef(null);
1107
+ // const randomValueSetCounter = useRef<number>(null);
1108
+ var _useGlobalContext = useGlobalContext(), useRandom = _useGlobalContext.useRandom, setHighlightedItem = _useGlobalContext.setHighlightedItem;
881
1109
  // Set the initial state
1110
+ //@ts-expect-error
882
1111
  useEffect(function() {
883
1112
  var sliderState = Juce.getSliderState(id);
884
- 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 {
885
1132
  // This sets 'mockProperties' as the value for 'properties' if the app is running in a browser.
886
1133
  setProperties(mockProperties);
887
1134
  setNormalisedValue(mockInitialNormalisedValue);
888
- } else {
889
- setNormalisedValue(normalisedValue);
890
- setProperties(sliderState === null || sliderState === void 0 ? void 0 : sliderState.properties);
891
1135
  }
892
1136
  }, []);
893
1137
  // Update the local state when the ID changes
@@ -898,6 +1142,7 @@ var useSlider = function(param) {
898
1142
  id
899
1143
  ]);
900
1144
  // Sets up listeners to handle changes on the backend
1145
+ //@ts-expect-error
901
1146
  useEffect(function() {
902
1147
  if (!isLocalhost) {
903
1148
  var sliderState = Juce.getSliderState(id);
@@ -907,31 +1152,10 @@ var useSlider = function(param) {
907
1152
  var propertiesListenerId = sliderState === null || sliderState === void 0 ? void 0 : sliderState.propertiesChangedEvent.addListener(function() {
908
1153
  return setProperties(sliderState === null || sliderState === void 0 ? void 0 : sliderState.properties);
909
1154
  });
910
- //@ts-expect-error
911
- var randomizeListenerId = window.__JUCE__.backend.addEventListener('triggerRandom', function(event) {
912
- var lastCharInIdAsNumber = parseInt(id.slice(-1), 10);
913
- var selectedBand = event[1] + 1;
914
- var idIsNotBandProperty = isNaN(lastCharInIdAsNumber);
915
- var idBelongsToSelectedBand = isNaN(lastCharInIdAsNumber) === false && lastCharInIdAsNumber === selectedBand;
916
- if (isRandomizable && event[0] !== randomValueSetCounter.current && (idIsNotBandProperty ? true : idBelongsToSelectedBand)) {
917
- var _sliderState_properties, _sliderState_properties1, _sliderState_properties2, _sliderState_properties3;
918
- 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);
919
- 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({
920
- scaledValue: randomValue,
921
- properties: sliderState === null || sliderState === void 0 ? void 0 : sliderState.properties
922
- });
923
- setNormalisedState(newValue);
924
- randomValueSetCounter.current = event;
925
- }
926
- });
927
- return function cleanup() {
1155
+ return function() {
928
1156
  sliderState === null || sliderState === void 0 ? void 0 : sliderState.valueChangedEvent.removeListener(valueListenerId);
929
1157
  sliderState === null || sliderState === void 0 ? void 0 : sliderState.propertiesChangedEvent.removeListener(propertiesListenerId);
930
- //@ts-expect-error
931
- window.__JUCE__.backend.removeEventListener(randomizeListenerId, id);
932
1158
  };
933
- } else {
934
- return;
935
1159
  }
936
1160
  }, [
937
1161
  window
@@ -940,9 +1164,16 @@ var useSlider = function(param) {
940
1164
  var updateLocalState = function(sliderState) {
941
1165
  var normalisedValueFromState = sliderState === null || sliderState === void 0 ? void 0 : sliderState.getNormalisedValue();
942
1166
  var scaledValueFromState = sliderState === null || sliderState === void 0 ? void 0 : sliderState.getScaledValue();
1167
+ var scaledValue = parseFloat(scaledValueFromState.toFixed(2));
943
1168
  setNormalisedValue(parseFloat(normalisedValueFromState.toFixed(2)));
944
- setScaledValue(parseFloat(scaledValueFromState.toFixed(2)));
1169
+ setScaledValue(scaledValue);
945
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
+ }
946
1177
  };
947
1178
  // Update JUCE state
948
1179
  var setNormalisedState = function(newValue) {
@@ -963,7 +1194,13 @@ var useSlider = function(param) {
963
1194
  }
964
1195
  };
965
1196
  var bindDrag = useDrag(function(param) {
966
- 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
+ }
967
1204
  if (down) {
968
1205
  var deltaVal = delta[1] * -1;
969
1206
  var newValue = (normalisedValue !== null && normalisedValue !== void 0 ? normalisedValue : 0) + deltaVal * // (properties?.interval && properties?.interval.toString().length > 4
@@ -972,22 +1209,48 @@ var useSlider = function(param) {
972
1209
  ((properties === null || properties === void 0 ? void 0 : properties.interval) || 0.01);
973
1210
  setNormalisedState(newValue);
974
1211
  }
1212
+ if (last) {
1213
+ //@ts-expect-error
1214
+ window.__JUCE__.backend.emitEvent('jsDragEnded', {
1215
+ i: "".concat(0)
1216
+ });
1217
+ }
975
1218
  }, {
976
1219
  preventDefault: true
977
1220
  });
978
1221
  var bindBarSliderDrag = useDrag(function(param) {
979
- var down = param.down, event = param.event;
1222
+ var down = param.down, event = param.event, first = param.first, last = param.last;
980
1223
  var _event_target;
981
1224
  var rect = event === null || event === void 0 ? void 0 : (_event_target = event.target) === null || _event_target === void 0 ? void 0 : _event_target.getBoundingClientRect();
982
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
+ }
983
1232
  if (down) {
984
1233
  // TODO: Increments?
985
1234
  var newValue = 1 - y / rect.height;
986
1235
  setNormalisedState(newValue);
987
1236
  }
1237
+ if (last) {
1238
+ //@ts-expect-error
1239
+ window.__JUCE__.backend.emitEvent('jsDragEnded', {
1240
+ i: "".concat(0)
1241
+ });
1242
+ }
988
1243
  }, {
989
1244
  preventDefault: true
990
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
+ };
991
1254
  // TODO: Refactor
992
1255
  // const onChangeStarted = () => sliderState.sliderDragStarted();
993
1256
  // const onChangeCommitted = () => sliderState.sliderDragEnded();
@@ -996,6 +1259,7 @@ var useSlider = function(param) {
996
1259
  setScaledState: setScaledState,
997
1260
  // onChangeStarted,
998
1261
  // onChangeCommitted,
1262
+ onMouseEnter: onMouseEnter,
999
1263
  bindBarSliderDrag: bindBarSliderDrag,
1000
1264
  bindDrag: bindDrag,
1001
1265
  normalisedValue: normalisedValue,
@@ -1004,8 +1268,31 @@ var useSlider = function(param) {
1004
1268
  };
1005
1269
  };
1006
1270
 
1007
- 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";
1008
- 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
+ }({});
1009
1296
 
1010
1297
  function _define_property$a(obj, key, value) {
1011
1298
  if (key in obj) {
@@ -1035,79 +1322,54 @@ function _object_spread$a(target) {
1035
1322
  }
1036
1323
  return target;
1037
1324
  }
1038
- function ownKeys$1(object, enumerableOnly) {
1039
- var keys = Object.keys(object);
1040
- if (Object.getOwnPropertySymbols) {
1041
- var symbols = Object.getOwnPropertySymbols(object);
1042
- keys.push.apply(keys, symbols);
1043
- }
1044
- return keys;
1045
- }
1046
- function _object_spread_props$1(target, source) {
1047
- source = source != null ? source : {};
1048
- if (Object.getOwnPropertyDescriptors) {
1049
- Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
1050
- } else {
1051
- ownKeys$1(Object(source)).forEach(function(key) {
1052
- Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
1053
- });
1054
- }
1055
- return target;
1056
- }
1057
- function RotarySlider(param) {
1058
- 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
1059
- 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 ? {
1060
- start: 20.0,
1061
- end: 15000.0,
1062
- interval: 0.1,
1063
- skew: 0.7
1064
- } : _param_mockProperties, _param_color = param.color, color = _param_color === void 0 ? 'var(--color-gray-400)' : _param_color, style = param.style;
1065
- var _useSlider = useSlider({
1066
- id: id,
1067
- mockProperties: mockProperties,
1068
- mockInitialNormalisedValue: mockInitialNormalisedValue,
1069
- onChange: onChange,
1070
- isRandomizable: isRandomizable
1071
- }), bindDrag = _useSlider.bindDrag, normalisedValue = _useSlider.normalisedValue, scaledValue = _useSlider.scaledValue;
1072
- return /*#__PURE__*/ React__default.createElement("div", {
1073
- style: {
1074
- display: 'flex',
1075
- flexDirection: 'column',
1076
- alignItems: 'center',
1077
- justifyContent: 'center'
1078
- }
1079
- }, polarity === SliderPolarity.bipolar && /*#__PURE__*/ React__default.createElement("div", {
1080
- className: classnames('RotarySlider-center-marker')
1081
- }), /*#__PURE__*/ React__default.createElement("div", _object_spread_props$1(_object_spread$a({
1082
- className: classnames('RotarySlider', polarity === SliderPolarity.linear ? 'Slider-polarity-linear' : 'Slider-polarity-bipolar', className)
1083
- }, bindDrag()), {
1084
- onMouseEnter: function() {
1085
- return onMouseEnter && onMouseEnter(id, scaledValue);
1086
- },
1087
- style: _object_spread$a({
1088
- touchAction: 'none'
1089
- }, style)
1090
- }), normalisedValue !== null ? /*#__PURE__*/ React__default.createElement("div", {
1091
- className: classnames('RotarySlider-Inner'),
1092
- style: _object_spread$a({
1093
- rotate: rotationBehavior === SliderRotationBehavior.rotateIndicator ? "".concat(polarity === SliderPolarity.linear ? normalisedValue : normalisedValue + 0.5, "turn") : ''
1094
- }, getTransformString({
1095
- sliderType: SliderType.rotary,
1096
- polarity: polarity,
1097
- normalisedValue: normalisedValue,
1098
- scaledValue: scaledValue
1099
- }), getPosition({
1100
- sliderType: SliderType.rotary,
1101
- polarity: polarity
1102
- }))
1103
- }, /*#__PURE__*/ React__default.createElement("div", {
1104
- className: classnames('RotarySlider-Indicator'),
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,
1105
1343
  style: _object_spread$a({
1106
- backgroundColor: color
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 : ''
1107
1359
  }, style)
1108
- })) : ''));
1360
+ }, children);
1109
1361
  }
1110
- 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;
1111
1373
 
1112
1374
  function _define_property$9(obj, key, value) {
1113
1375
  if (key in obj) {
@@ -1160,31 +1422,8 @@ function Label(param) {
1160
1422
  Label.padding = Spacing;
1161
1423
  Label.fontSize = FontSizes;
1162
1424
 
1163
- var JustifyContent = /*#__PURE__*/ function(JustifyContent) {
1164
- JustifyContent["flexStart"] = "flex-start";
1165
- JustifyContent["flexEnd"] = "flex-end";
1166
- JustifyContent["center"] = "center";
1167
- JustifyContent["spaceBetween"] = "space-between";
1168
- JustifyContent["spaceAround"] = "space-around";
1169
- JustifyContent["spaceEvenly"] = "space-evenly";
1170
- return JustifyContent;
1171
- }({});
1172
- var AlignItems = /*#__PURE__*/ function(AlignItems) {
1173
- AlignItems["flexStart"] = "flex-start";
1174
- AlignItems["flexEnd"] = "flex-end";
1175
- AlignItems["center"] = "center";
1176
- AlignItems["stretch"] = "stretch";
1177
- AlignItems["baseline"] = "baseline";
1178
- return AlignItems;
1179
- }({});
1180
- var LayoutTags = /*#__PURE__*/ function(LayoutTags) {
1181
- LayoutTags["header"] = "header";
1182
- LayoutTags["main"] = "main";
1183
- LayoutTags["section"] = "section";
1184
- LayoutTags["div"] = "div";
1185
- LayoutTags["footer"] = "footer";
1186
- return LayoutTags;
1187
- }({});
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);
1188
1427
 
1189
1428
  function _define_property$8(obj, key, value) {
1190
1429
  if (key in obj) {
@@ -1214,54 +1453,79 @@ function _object_spread$8(target) {
1214
1453
  }
1215
1454
  return target;
1216
1455
  }
1217
- var BoxDisplay = /*#__PURE__*/ function(BoxDisplay) {
1218
- BoxDisplay["flex"] = "flex";
1219
- BoxDisplay["block"] = "block";
1220
- return BoxDisplay;
1221
- }(BoxDisplay || {});
1222
- function Box(param) {
1223
- 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 ? [
1224
- Spacing.none,
1225
- Spacing.none,
1226
- Spacing.none,
1227
- Spacing.none
1228
- ] : _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;
1229
- var Tag = tag;
1230
- var _padding_, _padding_1, _padding_2, _ref;
1231
- return /*#__PURE__*/ React__default.createElement(Tag, {
1232
- // id="globalValues"
1233
- key: key,
1234
- className: className,
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,
1235
1499
  style: _object_spread$8({
1236
- flexWrap: flexWrap,
1237
- display: display,
1238
- gap: "var(--gap-".concat(gap, ")"),
1239
- width: '100%',
1240
- paddingTop: "var(--p-".concat(padding[0], ")"),
1241
- paddingRight: "var(--p-".concat((_padding_ = padding[1]) !== null && _padding_ !== void 0 ? _padding_ : padding[0], ")"),
1242
- paddingBottom: "var(--p-".concat((_padding_1 = padding[2]) !== null && _padding_1 !== void 0 ? _padding_1 : padding[0], ")"),
1243
- 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], ")"),
1244
- border: border ? '2px solid #999' : '',
1245
- maxWidth: width,
1246
- height: height,
1247
- flexDirection: flexDirection === FlexDirection.row ? FlexDirection.row : FlexDirection.column,
1248
- justifyContent: "".concat(justifyContent),
1249
- alignItems: "".concat(alignItems),
1250
- flex: flex ? flex : ''
1500
+ touchAction: 'none'
1251
1501
  }, style)
1252
- }, children);
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
1519
+ }, style)
1520
+ })) : ''), /*#__PURE__*/ React__default.createElement(Label, {
1521
+ padding: [
1522
+ Label.padding.mediumSmall
1523
+ ],
1524
+ fontSize: Label.fontSize.small,
1525
+ value: label
1526
+ }));
1253
1527
  }
1254
- // Object.assign(Layout, width, height, ALIGN, JUSTIFY, DIRECTION, SPACING);
1255
- Box.display = BoxDisplay;
1256
- Box.alignItems = AlignItems;
1257
- Box.justifyContent = JustifyContent;
1258
- Box.gap = Spacing;
1259
- Box.flexDirection = FlexDirection;
1260
- Box.width = Width;
1261
- Box.height = Height;
1262
- Box.padding = Spacing;
1263
- Box.flexWrap = FlexWrap;
1264
- Box.tag = LayoutTags;
1528
+ RotarySlider.sliderPolarity = SliderPolarity;
1265
1529
 
1266
1530
  function _define_property$7(obj, key, value) {
1267
1531
  if (key in obj) {
@@ -1311,7 +1575,7 @@ function _object_spread_props(target, source) {
1311
1575
  return target;
1312
1576
  }
1313
1577
  function Slider(param) {
1314
- 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, 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
1315
1579
  mockInitialNormalisedValue, mockInitialNormalisedValue = _param_mockInitialNormalisedValue === void 0 ? 0 : _param_mockInitialNormalisedValue, _param_mockProperties = param.mockProperties, mockProperties = _param_mockProperties === void 0 ? {
1316
1580
  start: 20.0,
1317
1581
  end: 15000.0,
@@ -1320,12 +1584,13 @@ function Slider(param) {
1320
1584
  } : _param_mockProperties;
1321
1585
  var _useSlider = useSlider({
1322
1586
  id: id,
1587
+ label: label,
1323
1588
  mockProperties: mockProperties,
1324
1589
  mockInitialNormalisedValue: mockInitialNormalisedValue,
1325
1590
  sliderOrientation: sliderOrientation,
1326
1591
  onChange: onChange,
1327
1592
  isRandomizable: isRandomizable
1328
- }), bindBarSliderDrag = _useSlider.bindBarSliderDrag, normalisedValue = _useSlider.normalisedValue, scaledValue = _useSlider.scaledValue;
1593
+ }), bindBarSliderDrag = _useSlider.bindBarSliderDrag, normalisedValue = _useSlider.normalisedValue, scaledValue = _useSlider.scaledValue, onMouseEnter = _useSlider.onMouseEnter;
1329
1594
  return /*#__PURE__*/ React__default.createElement(Box, {
1330
1595
  flexDirection: Box.flexDirection.column,
1331
1596
  justifyContent: Box.justifyContent.center,
@@ -1335,9 +1600,7 @@ function Slider(param) {
1335
1600
  }), /*#__PURE__*/ React__default.createElement("div", _object_spread_props(_object_spread$7({
1336
1601
  className: classnames('Slider-bar', 'relative')
1337
1602
  }, bindBarSliderDrag()), {
1338
- onMouseEnter: function() {
1339
- return onMouseEnter && label && onMouseEnter(label, scaledValue);
1340
- },
1603
+ onMouseEnter: onMouseEnter,
1341
1604
  style: _object_spread$7({
1342
1605
  touchAction: 'none',
1343
1606
  backgroundColor: 'var(--bg-input)',
@@ -1626,7 +1889,7 @@ function IndicatorLight(param) {
1626
1889
  }) : null);
1627
1890
  }
1628
1891
 
1629
- var css_248z$2 = ".IconButton {\n height: 28px;\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";
1630
1893
  styleInject(css_248z$2);
1631
1894
 
1632
1895
  function _define_property$4(obj, key, value) {
@@ -1776,7 +2039,7 @@ var icons = {
1776
2039
  RandomIcon: RandomIcon
1777
2040
  };
1778
2041
  function IconButton(param) {
1779
- var id = param.id, icon = param.icon, onClick = param.onClick, _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;
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;
1780
2043
  var Icon = icons[icon];
1781
2044
  return /*#__PURE__*/ React__default.createElement(Button, {
1782
2045
  id: id,
@@ -1785,11 +2048,12 @@ function IconButton(param) {
1785
2048
  padding: [
1786
2049
  Button.padding.medium
1787
2050
  ],
2051
+ disabled: disabled,
1788
2052
  style: _object_spread$4({
1789
2053
  backgroundColor: backgroundColor
1790
2054
  }, style)
1791
2055
  }, /*#__PURE__*/ React__default.createElement(Icon, {
1792
- color: color
2056
+ color: disabled ? 'var(--color-gray-400)' : color
1793
2057
  }));
1794
2058
  }
1795
2059
  IconButton.icon = ButtonIcon;
@@ -1856,7 +2120,7 @@ function KeyValueDisplayScreen(param) {
1856
2120
  Label.padding.none,
1857
2121
  Label.padding.medium
1858
2122
  ]
1859
- }, 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, {
1860
2124
  padding: [
1861
2125
  Label.padding.xSmall,
1862
2126
  Label.padding.mediumLarge,
@@ -1864,7 +2128,7 @@ function KeyValueDisplayScreen(param) {
1864
2128
  Label.padding.none
1865
2129
  ],
1866
2130
  className: 'KeyValueDisplayScreen-Item'
1867
- }, 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))));
1868
2132
  }
1869
2133
 
1870
2134
  function LinePlot(param) {
@@ -2045,6 +2309,43 @@ function Oscilloscope(param) {
2045
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";
2046
2310
  styleInject(css_248z);
2047
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
+ }
2048
2349
  function _define_property$1(obj, key, value) {
2049
2350
  if (key in obj) {
2050
2351
  Object.defineProperty(obj, key, {
@@ -2058,6 +2359,33 @@ function _define_property$1(obj, key, value) {
2058
2359
  }
2059
2360
  return obj;
2060
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
+ }
2061
2389
  function _object_spread$1(target) {
2062
2390
  for(var i = 1; i < arguments.length; i++){
2063
2391
  var source = arguments[i] != null ? arguments[i] : {};
@@ -2073,10 +2401,202 @@ function _object_spread$1(target) {
2073
2401
  }
2074
2402
  return target;
2075
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
+ }
2076
2510
  function ModuleHeader(param) {
2077
- 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');
2078
2515
  var undo = Juce.getNativeFunction('undo');
2079
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
+ });
2080
2600
  return /*#__PURE__*/ React__default.createElement(Box, {
2081
2601
  gap: Box.gap.medium,
2082
2602
  tag: Box.tag.header,
@@ -2107,21 +2627,23 @@ function ModuleHeader(param) {
2107
2627
  flex: "0 0 250px"
2108
2628
  }, /*#__PURE__*/ React__default.createElement(KeyValueDisplayScreen, {
2109
2629
  data: {
2110
- key: activeItem === null || activeItem === void 0 ? void 0 : activeItem.key,
2111
- 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
2112
2632
  }
2113
2633
  })), /*#__PURE__*/ React__default.createElement(Box, {
2114
2634
  flex: "0"
2115
2635
  }, /*#__PURE__*/ React__default.createElement(IconButton, {
2116
2636
  id: "undo",
2117
2637
  icon: IconButton.icon.undo,
2638
+ disabled: !canUndo,
2118
2639
  onClick: function() {
2119
- undo();
2640
+ handleUndo();
2120
2641
  }
2121
2642
  }), /*#__PURE__*/ React__default.createElement(IconButton, {
2122
2643
  id: "redo",
2644
+ disabled: !canRedo,
2123
2645
  onClick: function() {
2124
- redo();
2646
+ handleRedo();
2125
2647
  },
2126
2648
  icon: IconButton.icon.redo
2127
2649
  }))));
@@ -2171,89 +2693,5 @@ function ModuleFooter(param) {
2171
2693
  });
2172
2694
  }
2173
2695
 
2174
- function _array_like_to_array(arr, len) {
2175
- if (len == null || len > arr.length) len = arr.length;
2176
- for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
2177
- return arr2;
2178
- }
2179
- function _array_with_holes(arr) {
2180
- if (Array.isArray(arr)) return arr;
2181
- }
2182
- function _array_without_holes(arr) {
2183
- if (Array.isArray(arr)) return _array_like_to_array(arr);
2184
- }
2185
- function _iterable_to_array(iter) {
2186
- if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
2187
- }
2188
- function _iterable_to_array_limit(arr, i) {
2189
- var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
2190
- if (_i == null) return;
2191
- var _arr = [];
2192
- var _n = true;
2193
- var _d = false;
2194
- var _s, _e;
2195
- try {
2196
- for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
2197
- _arr.push(_s.value);
2198
- if (i && _arr.length === i) break;
2199
- }
2200
- } catch (err) {
2201
- _d = true;
2202
- _e = err;
2203
- } finally{
2204
- try {
2205
- if (!_n && _i["return"] != null) _i["return"]();
2206
- } finally{
2207
- if (_d) throw _e;
2208
- }
2209
- }
2210
- return _arr;
2211
- }
2212
- function _non_iterable_rest() {
2213
- throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
2214
- }
2215
- function _non_iterable_spread() {
2216
- throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
2217
- }
2218
- function _sliced_to_array(arr, i) {
2219
- return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
2220
- }
2221
- function _to_consumable_array(arr) {
2222
- return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread();
2223
- }
2224
- function _unsupported_iterable_to_array(o, minLen) {
2225
- if (!o) return;
2226
- if (typeof o === "string") return _array_like_to_array(o, minLen);
2227
- var n = Object.prototype.toString.call(o).slice(8, -1);
2228
- if (n === "Object" && o.constructor) n = o.constructor.name;
2229
- if (n === "Map" || n === "Set") return Array.from(n);
2230
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
2231
- }
2232
- function useObservable() {
2233
- var _useState = _sliced_to_array(useState([]), 2), observers = _useState[0], setObservers = _useState[1];
2234
- var subscribe = function(observer) {
2235
- if (!observers.includes(observer)) {
2236
- setObservers(_to_consumable_array(observers).concat([
2237
- observer
2238
- ]));
2239
- }
2240
- };
2241
- var unsubscribe = function(observer) {
2242
- setObservers(observers.filter(function(item) {
2243
- return item !== observer;
2244
- }));
2245
- };
2246
- var fire = function(action) {
2247
- observers.forEach(function() {
2248
- return action();
2249
- });
2250
- };
2251
- return {
2252
- subscribe: subscribe,
2253
- unsubscribe: unsubscribe,
2254
- fire: fire
2255
- };
2256
- }
2257
-
2258
- 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, randomizeValue, scaledToNormalised as scaledTonormalised, useObservable, 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 };
2259
2697
  //# sourceMappingURL=index.js.map