@antimatter-audio/antimatter-ui 9.2.0 → 9.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +2 -2
- package/dist/index.js +23 -3
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -70,9 +70,9 @@ interface TextButtonProps {
|
|
|
70
70
|
text?: string;
|
|
71
71
|
className?: string;
|
|
72
72
|
style?: object;
|
|
73
|
-
children?:
|
|
73
|
+
children?: React__default.ReactNode;
|
|
74
74
|
}
|
|
75
|
-
declare function Button({ disabled, text, id, className, style, children, type, size, }:
|
|
75
|
+
declare function Button({ disabled, text, id, className, style, children, type, size, }: React__default.PropsWithChildren<TextButtonProps>): React__default.JSX.Element;
|
|
76
76
|
declare namespace Button {
|
|
77
77
|
var type: typeof ButtonType;
|
|
78
78
|
var size: typeof ButtonSize;
|
package/dist/index.js
CHANGED
|
@@ -267,8 +267,28 @@ function _unsupported_iterable_to_array$5(o, minLen) {
|
|
|
267
267
|
}
|
|
268
268
|
function Button(param) {
|
|
269
269
|
var disabled = param.disabled, text = param.text, id = param.id, className = param.className, style = param.style, children = param.children, _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;
|
|
270
|
-
var _React_useState = _sliced_to_array$5(
|
|
270
|
+
var _React_useState = _sliced_to_array$5(React__default.useState(false), 2), isSelected = _React_useState[0], setIsSelected = _React_useState[1];
|
|
271
271
|
var buttonState = Juce.getToggleState(id);
|
|
272
|
+
var isLocalhost = window.location.hostname === 'localhost';
|
|
273
|
+
// Update the local state when the ID changes
|
|
274
|
+
useEffect(function() {
|
|
275
|
+
setIsSelected(buttonState === null || buttonState === void 0 ? void 0 : buttonState.value);
|
|
276
|
+
}, [
|
|
277
|
+
id
|
|
278
|
+
]);
|
|
279
|
+
// Sets up listeners to handle changes on the backend
|
|
280
|
+
useEffect(function() {
|
|
281
|
+
if (!isLocalhost) {
|
|
282
|
+
var valueListenerId = buttonState === null || buttonState === void 0 ? void 0 : buttonState.valueChangedEvent.addListener(function() {
|
|
283
|
+
setIsSelected(buttonState === null || buttonState === void 0 ? void 0 : buttonState.value);
|
|
284
|
+
});
|
|
285
|
+
return function cleanup() {
|
|
286
|
+
buttonState === null || buttonState === void 0 ? void 0 : buttonState.valueChangedEvent.removeListener(valueListenerId);
|
|
287
|
+
};
|
|
288
|
+
} else {
|
|
289
|
+
return;
|
|
290
|
+
}
|
|
291
|
+
});
|
|
272
292
|
var handleMouseDown = function(e) {
|
|
273
293
|
e.preventDefault();
|
|
274
294
|
if (type === ButtonType.momentary) {
|
|
@@ -283,7 +303,7 @@ function Button(param) {
|
|
|
283
303
|
setIsSelected(false);
|
|
284
304
|
buttonState.setValue(false);
|
|
285
305
|
};
|
|
286
|
-
|
|
306
|
+
React__default.useEffect(function() {
|
|
287
307
|
if (type === ButtonType.momentary) {
|
|
288
308
|
window.addEventListener('mouseup', handleMouseUp);
|
|
289
309
|
return function() {
|
|
@@ -294,7 +314,7 @@ function Button(param) {
|
|
|
294
314
|
}, [
|
|
295
315
|
isSelected
|
|
296
316
|
]);
|
|
297
|
-
return /*#__PURE__*/
|
|
317
|
+
return /*#__PURE__*/ React__default.createElement("button", {
|
|
298
318
|
id: id,
|
|
299
319
|
onMouseDown: handleMouseDown,
|
|
300
320
|
disabled: disabled,
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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