@antimatter-audio/antimatter-ui 10.16.5 → 10.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/advanced/ModMatrix/ModMatrix.d.ts.map +1 -1
- package/dist/advanced/ModMatrix/ModMatrixComboboxCell.d.ts +1 -1
- package/dist/advanced/ModMatrix/ModMatrixComboboxCell.d.ts.map +1 -1
- package/dist/advanced/ModMatrix/ModMatrixRow.d.ts +1 -1
- package/dist/advanced/ModMatrix/ModMatrixRow.d.ts.map +1 -1
- package/dist/advanced/ModMatrix/constants.d.ts +1 -0
- package/dist/advanced/ModMatrix/constants.d.ts.map +1 -1
- package/dist/context/GlobalContextProvider.d.ts +7 -3
- package/dist/context/GlobalContextProvider.d.ts.map +1 -1
- package/dist/core/Button/Button.d.ts.map +1 -1
- package/dist/hooks/useCombobox.d.ts +0 -1
- package/dist/hooks/useCombobox.d.ts.map +1 -1
- package/dist/hooks/useDropdown.d.ts.map +1 -1
- package/dist/hooks/useSlider.d.ts +1 -1
- package/dist/hooks/useSlider.d.ts.map +1 -1
- package/dist/index.js +303 -232
- package/dist/index.js.map +1 -1
- package/dist/src/advanced/ModMatrix/ModMatrix.d.ts.map +1 -1
- package/dist/src/advanced/ModMatrix/ModMatrixComboboxCell.d.ts +1 -1
- package/dist/src/advanced/ModMatrix/ModMatrixComboboxCell.d.ts.map +1 -1
- package/dist/src/advanced/ModMatrix/ModMatrixRow.d.ts +1 -1
- package/dist/src/advanced/ModMatrix/ModMatrixRow.d.ts.map +1 -1
- package/dist/src/advanced/ModMatrix/constants.d.ts +1 -0
- package/dist/src/advanced/ModMatrix/constants.d.ts.map +1 -1
- package/dist/src/context/GlobalContextProvider.d.ts +7 -3
- package/dist/src/context/GlobalContextProvider.d.ts.map +1 -1
- package/dist/src/core/Button/Button.d.ts.map +1 -1
- package/dist/src/hooks/useCombobox.d.ts +0 -1
- package/dist/src/hooks/useCombobox.d.ts.map +1 -1
- package/dist/src/hooks/useDropdown.d.ts.map +1 -1
- package/dist/src/hooks/useSlider.d.ts +1 -1
- package/dist/src/hooks/useSlider.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -615,19 +615,22 @@ var reducer = function(state, action) {
|
|
|
615
615
|
allParameters: action.payload
|
|
616
616
|
});
|
|
617
617
|
case 'MOD_SLOTS_RECEIVED':
|
|
618
|
-
var _action_payload;
|
|
619
618
|
return _object_spread_props$4(_object_spread$k({}, state), {
|
|
620
619
|
modSlotIds: action.payload.map(function(val) {
|
|
621
620
|
return val[0];
|
|
622
|
-
})
|
|
621
|
+
})
|
|
622
|
+
});
|
|
623
|
+
case 'MOD_SLOT_ROW_TARGETS_RECEIVED':
|
|
624
|
+
var _action_payload;
|
|
625
|
+
return _object_spread_props$4(_object_spread$k({}, state), {
|
|
623
626
|
modSlotTargets: action === null || action === void 0 ? void 0 : (_action_payload = action.payload) === null || _action_payload === void 0 ? void 0 : _action_payload.reduce(function(acc, val) {
|
|
624
627
|
return _object_spread_props$4(_object_spread$k({}, acc), _define_property$k({}, val[0], val[1]));
|
|
625
628
|
}, {})
|
|
626
629
|
});
|
|
627
|
-
case '
|
|
630
|
+
case 'MOD_SLOT_ROW_TARGET_UPDATED':
|
|
628
631
|
var _action_payload1, _action_payload2;
|
|
629
632
|
return _object_spread_props$4(_object_spread$k({}, state), {
|
|
630
|
-
modSlotTargets: _object_spread_props$4(_object_spread$k({}, state === null || state === void 0 ? void 0 : state.modSlotTargets), _define_property$k({}, (_action_payload1 = action.payload) === null || _action_payload1 === void 0 ? void 0 : _action_payload1
|
|
633
|
+
modSlotTargets: _object_spread_props$4(_object_spread$k({}, state === null || state === void 0 ? void 0 : state.modSlotTargets), _define_property$k({}, (_action_payload1 = action.payload) === null || _action_payload1 === void 0 ? void 0 : _action_payload1.id, action === null || action === void 0 ? void 0 : (_action_payload2 = action.payload) === null || _action_payload2 === void 0 ? void 0 : _action_payload2.value))
|
|
631
634
|
});
|
|
632
635
|
case 'MOD_SLOT_PREVIEW_TARGET_INDEX_UPDATED':
|
|
633
636
|
{
|
|
@@ -762,6 +765,18 @@ function GlobalContextProvider(param) {
|
|
|
762
765
|
payload: modSlots
|
|
763
766
|
});
|
|
764
767
|
}, []);
|
|
768
|
+
var modSlotRowTargetsReceived = useCallback(function(modSlots) {
|
|
769
|
+
dispatch({
|
|
770
|
+
type: 'MOD_SLOT_ROW_TARGETS_RECEIVED',
|
|
771
|
+
payload: modSlots
|
|
772
|
+
});
|
|
773
|
+
}, []);
|
|
774
|
+
var modSlotRowTargetUpdated = useCallback(function(modSlot) {
|
|
775
|
+
dispatch({
|
|
776
|
+
type: 'MOD_SLOT_ROW_TARGET_UPDATED',
|
|
777
|
+
payload: modSlot
|
|
778
|
+
});
|
|
779
|
+
}, []);
|
|
765
780
|
var modSlotPreviewTargetIndexUpdated = useCallback(function(targetIndex) {
|
|
766
781
|
dispatch({
|
|
767
782
|
type: 'MOD_SLOT_PREVIEW_TARGET_INDEX_UPDATED',
|
|
@@ -792,12 +807,6 @@ function GlobalContextProvider(param) {
|
|
|
792
807
|
payload: null
|
|
793
808
|
});
|
|
794
809
|
}, []);
|
|
795
|
-
var modSlotTargetUpdated = useCallback(function(modSlot) {
|
|
796
|
-
dispatch({
|
|
797
|
-
type: 'MOD_SLOT_TARGETS_UPDATED',
|
|
798
|
-
payload: modSlot
|
|
799
|
-
});
|
|
800
|
-
}, []);
|
|
801
810
|
var modSlotParamsListReceived = useCallback(function(modSlotParams) {
|
|
802
811
|
dispatch({
|
|
803
812
|
type: 'MOD_SLOT_PARAMS_LIST_RECEIVED',
|
|
@@ -834,69 +843,104 @@ function GlobalContextProvider(param) {
|
|
|
834
843
|
var paramIndex = state === null || state === void 0 ? void 0 : state.allParameters.indexOf(id);
|
|
835
844
|
return state === null || state === void 0 ? void 0 : state.defaultParamValues[paramIndex];
|
|
836
845
|
};
|
|
837
|
-
|
|
846
|
+
// const setModSlotTarget = (newTarget: number, rowId: string) => {
|
|
847
|
+
// const comboBoxState = Juce.getComboBoxState(rowId);
|
|
848
|
+
// comboBoxState?.setChoiceIndex(newTarget);
|
|
849
|
+
// };
|
|
850
|
+
var refetchModSlots = function() {
|
|
851
|
+
return _async_to_generator$4(function() {
|
|
852
|
+
var getAllModSlotsFunc, modSlotsData, e;
|
|
853
|
+
return _ts_generator$4(this, function(_state) {
|
|
854
|
+
switch(_state.label){
|
|
855
|
+
case 0:
|
|
856
|
+
_state.trys.push([
|
|
857
|
+
0,
|
|
858
|
+
2,
|
|
859
|
+
,
|
|
860
|
+
3
|
|
861
|
+
]);
|
|
862
|
+
getAllModSlotsFunc = Juce.getNativeFunction('getAllModSlots');
|
|
863
|
+
return [
|
|
864
|
+
4,
|
|
865
|
+
getAllModSlotsFunc()
|
|
866
|
+
];
|
|
867
|
+
case 1:
|
|
868
|
+
modSlotsData = _state.sent();
|
|
869
|
+
modSlotRowTargetsReceived(modSlotsData || []);
|
|
870
|
+
return [
|
|
871
|
+
3,
|
|
872
|
+
3
|
|
873
|
+
];
|
|
874
|
+
case 2:
|
|
875
|
+
e = _state.sent();
|
|
876
|
+
console.log(e);
|
|
877
|
+
return [
|
|
878
|
+
3,
|
|
879
|
+
3
|
|
880
|
+
];
|
|
881
|
+
case 3:
|
|
882
|
+
return [
|
|
883
|
+
2
|
|
884
|
+
];
|
|
885
|
+
}
|
|
886
|
+
});
|
|
887
|
+
})();
|
|
888
|
+
};
|
|
889
|
+
var setModSlotRowTargetAsPreview = function(param) {
|
|
890
|
+
var paramIndex = param.paramIndex, paramId = param.paramId;
|
|
838
891
|
var _Object_values;
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
892
|
+
// Setting a row target for a preview row enables the preview row to be interactive.
|
|
893
|
+
// This row target will not be saved to Juce until a user sets a new value for one of the inputs in the row.
|
|
894
|
+
// This function only stores the target in local state and does NOT save anything to the Juce state.
|
|
895
|
+
var targetIndex = paramId ? state.automatableParamsList.indexOf(paramId) : paramIndex;
|
|
896
|
+
if (!((_Object_values = Object.values(state.modSlotTargets)) === null || _Object_values === void 0 ? void 0 : _Object_values.includes(targetIndex))) {
|
|
897
|
+
setNewModSlotPreview();
|
|
898
|
+
modSlotPreviewTargetIndexUpdated(targetIndex);
|
|
842
899
|
modSlotPreviewIsEditableUpdated(true);
|
|
843
900
|
}
|
|
844
901
|
};
|
|
845
|
-
var
|
|
846
|
-
var _state_modSlotPreview, _state_modSlotPreview1
|
|
847
|
-
var rowState = Juce.getComboBoxState(
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
,
|
|
859
|
-
3
|
|
860
|
-
]);
|
|
861
|
-
getAllModSlotsFunc = Juce.getNativeFunction('getAllModSlots');
|
|
862
|
-
return [
|
|
863
|
-
4,
|
|
864
|
-
getAllModSlotsFunc()
|
|
865
|
-
];
|
|
866
|
-
case 1:
|
|
867
|
-
modSlotsData = _state.sent();
|
|
868
|
-
modSlotsReceived(modSlotsData || []);
|
|
869
|
-
return [
|
|
870
|
-
3,
|
|
871
|
-
3
|
|
872
|
-
];
|
|
873
|
-
case 2:
|
|
874
|
-
e = _state.sent();
|
|
875
|
-
console.log(e);
|
|
876
|
-
return [
|
|
877
|
-
3,
|
|
878
|
-
3
|
|
879
|
-
];
|
|
880
|
-
case 3:
|
|
881
|
-
return [
|
|
882
|
-
2
|
|
883
|
-
];
|
|
884
|
-
}
|
|
885
|
-
});
|
|
886
|
-
})();
|
|
887
|
-
};
|
|
888
|
-
if (defaultParameter !== null && defaultParameter !== undefined && value !== defaultParameter && rowId === ((_state_modSlotPreview1 = state.modSlotPreview) === null || _state_modSlotPreview1 === void 0 ? void 0 : _state_modSlotPreview1.slotId) && ((_state_modSlotPreview2 = state.modSlotPreview) === null || _state_modSlotPreview2 === void 0 ? void 0 : _state_modSlotPreview2.slotId) && ((_state_modSlotPreview3 = state.modSlotPreview) === null || _state_modSlotPreview3 === void 0 ? void 0 : _state_modSlotPreview3.targetIndex)) {
|
|
889
|
-
var _state_modSlotPreview4;
|
|
890
|
-
modSlotTargetUpdated([
|
|
891
|
-
state.modSlotPreview.slotId,
|
|
892
|
-
state.modSlotPreview.targetIndex
|
|
893
|
-
]);
|
|
894
|
-
rowState === null || rowState === void 0 ? void 0 : rowState.setChoiceIndex((_state_modSlotPreview4 = state.modSlotPreview) === null || _state_modSlotPreview4 === void 0 ? void 0 : _state_modSlotPreview4.targetIndex);
|
|
902
|
+
var saveModSlotPreviewRowTargetToBackend = function(value, rowId) {
|
|
903
|
+
var _state_modSlotPreview, _state_modSlotPreview1;
|
|
904
|
+
var rowState = Juce.getComboBoxState(rowId);
|
|
905
|
+
// If the row is a preview row, setting a target will remove the row's preview status.
|
|
906
|
+
// In this scenario, we want to clear the current row's preview status and set a new preview row (if there is an unassigned mod slot available)
|
|
907
|
+
var defaultParameter = getDefaultParameter(rowId);
|
|
908
|
+
if (((_state_modSlotPreview = state.modSlotPreview) === null || _state_modSlotPreview === void 0 ? void 0 : _state_modSlotPreview.slotId) && ((_state_modSlotPreview1 = state.modSlotPreview) === null || _state_modSlotPreview1 === void 0 ? void 0 : _state_modSlotPreview1.targetIndex) && defaultParameter !== null && defaultParameter !== undefined && value !== defaultParameter) {
|
|
909
|
+
var _state_modSlotPreview2;
|
|
910
|
+
modSlotRowTargetUpdated({
|
|
911
|
+
id: state.modSlotPreview.slotId,
|
|
912
|
+
value: state.modSlotPreview.targetIndex
|
|
913
|
+
});
|
|
914
|
+
rowState === null || rowState === void 0 ? void 0 : rowState.setChoiceIndex((_state_modSlotPreview2 = state.modSlotPreview) === null || _state_modSlotPreview2 === void 0 ? void 0 : _state_modSlotPreview2.targetIndex);
|
|
895
915
|
clearModSlotPreview();
|
|
896
916
|
setNewModSlotPreview();
|
|
897
917
|
refetchModSlots();
|
|
898
918
|
}
|
|
899
919
|
};
|
|
920
|
+
var updateModSlotRowTarget = function(value, rowId) {
|
|
921
|
+
// An index of 0 = 'none' in the mod slot target list.
|
|
922
|
+
// If the new row target value is 0, the user is deleting the row's target.
|
|
923
|
+
// Clear all of the values that have been set for that target on the front end and in JUCE.
|
|
924
|
+
console.log(value, state.modSlotPreview, rowId, 'value, state.modSlotPreview, rowId,in context');
|
|
925
|
+
var rowState = Juce.getComboBoxState(rowId);
|
|
926
|
+
rowState === null || rowState === void 0 ? void 0 : rowState.setChoiceIndex(value);
|
|
927
|
+
if (rowId === state.modSlotPreview.slotId) {
|
|
928
|
+
clearModSlotPreview();
|
|
929
|
+
}
|
|
930
|
+
if (value === 0) {
|
|
931
|
+
var _state_modSlotParams_rowId, _state_modSlotParams;
|
|
932
|
+
state === null || state === void 0 ? void 0 : (_state_modSlotParams = state.modSlotParams) === null || _state_modSlotParams === void 0 ? void 0 : (_state_modSlotParams_rowId = _state_modSlotParams[rowId]) === null || _state_modSlotParams_rowId === void 0 ? void 0 : _state_modSlotParams_rowId.forEach(function(item) {
|
|
933
|
+
setDefaultParameter(item);
|
|
934
|
+
});
|
|
935
|
+
clearModSlotPreview();
|
|
936
|
+
setNewModSlotPreview();
|
|
937
|
+
}
|
|
938
|
+
modSlotRowTargetUpdated({
|
|
939
|
+
id: rowId,
|
|
940
|
+
value: value
|
|
941
|
+
});
|
|
942
|
+
refetchModSlots();
|
|
943
|
+
};
|
|
900
944
|
var onFire = function() {
|
|
901
945
|
//@ts-expect-error
|
|
902
946
|
window.__JUCE__.backend.emitEvent('setRandom', {});
|
|
@@ -922,11 +966,13 @@ function GlobalContextProvider(param) {
|
|
|
922
966
|
setDefaultParameter: setDefaultParameter,
|
|
923
967
|
getDefaultParameter: getDefaultParameter,
|
|
924
968
|
modSlotsReceived: modSlotsReceived,
|
|
925
|
-
|
|
969
|
+
modSlotRowTargetsReceived: modSlotRowTargetsReceived,
|
|
970
|
+
// setModSlotTarget,
|
|
926
971
|
modSlotParamsListReceived: modSlotParamsListReceived,
|
|
927
972
|
modSlotParamLabelsReceived: modSlotParamLabelsReceived,
|
|
928
|
-
|
|
929
|
-
|
|
973
|
+
setModSlotRowTargetAsPreview: setModSlotRowTargetAsPreview,
|
|
974
|
+
saveModSlotPreviewRowTargetToBackend: saveModSlotPreviewRowTargetToBackend,
|
|
975
|
+
updateModSlotRowTarget: updateModSlotRowTarget,
|
|
930
976
|
useRandom: useRandom
|
|
931
977
|
};
|
|
932
978
|
return /*#__PURE__*/ React__default.createElement(GlobalContext.Provider, {
|
|
@@ -1017,7 +1063,7 @@ function Button(param) {
|
|
|
1017
1063
|
var _React_useState = _sliced_to_array$f(React__default.useState(false), 2), isSelected = _React_useState[0], setIsSelected = _React_useState[1];
|
|
1018
1064
|
var buttonState = Juce.getToggleState(id);
|
|
1019
1065
|
var isLocalhost = window.location.hostname === 'localhost';
|
|
1020
|
-
var
|
|
1066
|
+
var setModSlotRowTargetAsPreview = useGlobalContext().setModSlotRowTargetAsPreview;
|
|
1021
1067
|
// Update the local state when the ID changes
|
|
1022
1068
|
useEffect(function() {
|
|
1023
1069
|
setIsSelected(buttonState === null || buttonState === void 0 ? void 0 : buttonState.value);
|
|
@@ -1038,7 +1084,10 @@ function Button(param) {
|
|
|
1038
1084
|
}
|
|
1039
1085
|
});
|
|
1040
1086
|
var handleMouseDown = function(e) {
|
|
1041
|
-
|
|
1087
|
+
// TODO: handle this in a callback?
|
|
1088
|
+
setModSlotRowTargetAsPreview({
|
|
1089
|
+
paramId: id
|
|
1090
|
+
});
|
|
1042
1091
|
if (!onClick) {
|
|
1043
1092
|
e.preventDefault();
|
|
1044
1093
|
if (type === ButtonType.momentary) {
|
|
@@ -1141,12 +1190,13 @@ function _unsupported_iterable_to_array$e(o, minLen) {
|
|
|
1141
1190
|
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$e(o, minLen);
|
|
1142
1191
|
}
|
|
1143
1192
|
var useDropdown = function(param) {
|
|
1144
|
-
var id = param.id,
|
|
1193
|
+
var id = param.id, // TODO: Is there a better way to handle mod matrix dropdowns?
|
|
1194
|
+
rowId = param.rowId, label = param.label, _param_items = param.items, items = _param_items === void 0 ? [] : _param_items, _param_isDisabled = param.isDisabled, isDisabled = _param_isDisabled === void 0 ? false : _param_isDisabled, filter = param.filter, onChange = param.onChange, _param_displayValInHeader = param.displayValInHeader, displayValInHeader = _param_displayValInHeader === void 0 ? true : _param_displayValInHeader;
|
|
1145
1195
|
var _properties_choices;
|
|
1146
1196
|
var comboBoxState = Juce.getComboBoxState(id);
|
|
1147
1197
|
var _useState = _sliced_to_array$e(useState(comboBoxState.getChoiceIndex()), 2), index = _useState[0], setIndex = _useState[1];
|
|
1148
1198
|
var _useState1 = _sliced_to_array$e(useState(comboBoxState.properties), 2), properties = _useState1[0], setProperties = _useState1[1];
|
|
1149
|
-
var _useGlobalContext = useGlobalContext(), highlightedItemChanged = _useGlobalContext.highlightedItemChanged,
|
|
1199
|
+
var _useGlobalContext = useGlobalContext(), highlightedItemChanged = _useGlobalContext.highlightedItemChanged, setModSlotRowTargetAsPreview = _useGlobalContext.setModSlotRowTargetAsPreview;
|
|
1150
1200
|
var choices = items.length ? items : (properties === null || properties === void 0 ? void 0 : (_properties_choices = properties.choices) === null || _properties_choices === void 0 ? void 0 : _properties_choices.length) ? properties === null || properties === void 0 ? void 0 : properties.choices : [];
|
|
1151
1201
|
var filteredChoices = filter ? choices === null || choices === void 0 ? void 0 : choices.filter(function(item) {
|
|
1152
1202
|
var _item_;
|
|
@@ -1159,8 +1209,9 @@ var useDropdown = function(param) {
|
|
|
1159
1209
|
if (choiceIndex !== prevIndex.current) {
|
|
1160
1210
|
comboBoxState.setChoiceIndex(choiceIndex);
|
|
1161
1211
|
setIndex(choiceIndex);
|
|
1212
|
+
// TODO: Is there a better way to do this?
|
|
1162
1213
|
if (rowId) {
|
|
1163
|
-
onChange && onChange(choiceIndex,
|
|
1214
|
+
onChange && onChange(choiceIndex, rowId);
|
|
1164
1215
|
} else {
|
|
1165
1216
|
onChange && onChange(choiceIndex, id);
|
|
1166
1217
|
}
|
|
@@ -1206,7 +1257,9 @@ var useDropdown = function(param) {
|
|
|
1206
1257
|
}
|
|
1207
1258
|
};
|
|
1208
1259
|
var onClick = function() {
|
|
1209
|
-
|
|
1260
|
+
setModSlotRowTargetAsPreview({
|
|
1261
|
+
paramId: id
|
|
1262
|
+
});
|
|
1210
1263
|
};
|
|
1211
1264
|
return {
|
|
1212
1265
|
value: choices[index],
|
|
@@ -1862,8 +1915,10 @@ var useSlider = function(param) {
|
|
|
1862
1915
|
var scaledValueRef = useRef(null);
|
|
1863
1916
|
var normalisedValueRef = useRef(null);
|
|
1864
1917
|
var sliderState = Juce.getSliderState(id);
|
|
1918
|
+
var prevValueRef = useRef(null);
|
|
1865
1919
|
// const randomValueSetCounter = useRef<number>(null);
|
|
1866
|
-
var _useGlobalContext = useGlobalContext(), useRandom = _useGlobalContext.useRandom, highlightedItemChanged = _useGlobalContext.highlightedItemChanged, setDefaultParameter = _useGlobalContext.setDefaultParameter,
|
|
1920
|
+
var _useGlobalContext = useGlobalContext(), useRandom = _useGlobalContext.useRandom, highlightedItemChanged = _useGlobalContext.highlightedItemChanged, setDefaultParameter = _useGlobalContext.setDefaultParameter, setModSlotRowTargetAsPreview = _useGlobalContext.setModSlotRowTargetAsPreview, _useGlobalContext_globalState = _useGlobalContext.// setModSlotRowTarget,
|
|
1921
|
+
globalState, automatableParamsList = _useGlobalContext_globalState.automatableParamsList, modSlotTargets = _useGlobalContext_globalState.modSlotTargets, modSlotPreview = _useGlobalContext_globalState.modSlotPreview;
|
|
1867
1922
|
var _useState2 = _sliced_to_array$c(useState(false), 2), isActive = _useState2[0], setIsActive = _useState2[1];
|
|
1868
1923
|
useEffect(function() {
|
|
1869
1924
|
document.addEventListener('click', clickListener);
|
|
@@ -1906,33 +1961,35 @@ var useSlider = function(param) {
|
|
|
1906
1961
|
normalisedValueRef.current = mockInitialNormalisedValue;
|
|
1907
1962
|
}
|
|
1908
1963
|
}, []);
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1964
|
+
// TODO: take out mod slot logic
|
|
1965
|
+
var changeHandler = function(scaledValueFromState, sliderId) {
|
|
1966
|
+
if (rowId === modSlotPreview.targetIndex) {
|
|
1967
|
+
onChange && onChange(parseFloat(scaledValueFromState.toFixed(2)), rowId);
|
|
1912
1968
|
} else {
|
|
1913
1969
|
onChange && onChange(parseFloat(scaledValueFromState.toFixed(2)), sliderId);
|
|
1914
1970
|
}
|
|
1915
|
-
}
|
|
1916
|
-
onChange
|
|
1917
|
-
]);
|
|
1971
|
+
};
|
|
1918
1972
|
// Update the local state from JUCE
|
|
1919
|
-
var updateLocalState = function(
|
|
1973
|
+
var updateLocalState = function() {
|
|
1920
1974
|
var normalisedValueFromState = sliderState === null || sliderState === void 0 ? void 0 : sliderState.getNormalisedValue();
|
|
1921
1975
|
var scaledValueFromState = sliderState === null || sliderState === void 0 ? void 0 : sliderState.getScaledValue();
|
|
1922
1976
|
var scaledValue = parseFloat(scaledValueFromState.toFixed(2));
|
|
1923
1977
|
normalisedValueRef.current = parseFloat(normalisedValueFromState.toFixed(2));
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
|
|
1978
|
+
if (scaledValue !== prevValueRef.current) {
|
|
1979
|
+
setScaledValue(scaledValue);
|
|
1980
|
+
rowId && changeHandler(scaledValueFromState, rowId);
|
|
1981
|
+
if (displayValInHeader && (scaledValueRef === null || scaledValueRef === void 0 ? void 0 : scaledValueRef.current) !== scaledValue) {
|
|
1982
|
+
highlightedItemChanged({
|
|
1983
|
+
label: label,
|
|
1984
|
+
value: scaledValue
|
|
1985
|
+
});
|
|
1986
|
+
}
|
|
1987
|
+
prevValueRef.current = scaledValue;
|
|
1931
1988
|
}
|
|
1932
1989
|
};
|
|
1933
1990
|
// Update the local state when the ID changes
|
|
1934
1991
|
useEffect(function() {
|
|
1935
|
-
updateLocalState(
|
|
1992
|
+
updateLocalState();
|
|
1936
1993
|
}, [
|
|
1937
1994
|
id
|
|
1938
1995
|
]);
|
|
@@ -1941,7 +1998,7 @@ var useSlider = function(param) {
|
|
|
1941
1998
|
useEffect(function() {
|
|
1942
1999
|
if (!isLocalhost) {
|
|
1943
2000
|
var valueListenerId = sliderState === null || sliderState === void 0 ? void 0 : sliderState.valueChangedEvent.addListener(function() {
|
|
1944
|
-
updateLocalState(
|
|
2001
|
+
updateLocalState();
|
|
1945
2002
|
});
|
|
1946
2003
|
var propertiesListenerId = sliderState === null || sliderState === void 0 ? void 0 : sliderState.propertiesChangedEvent.addListener(function() {
|
|
1947
2004
|
return setProperties(sliderState === null || sliderState === void 0 ? void 0 : sliderState.properties);
|
|
@@ -2006,7 +2063,11 @@ var useSlider = function(param) {
|
|
|
2006
2063
|
var bindDrag = useGesture({
|
|
2007
2064
|
onMouseDown: function(param) {
|
|
2008
2065
|
param.event;
|
|
2009
|
-
|
|
2066
|
+
if (id !== modSlotPreview.rowId) {
|
|
2067
|
+
setModSlotRowTargetAsPreview({
|
|
2068
|
+
paramId: id
|
|
2069
|
+
});
|
|
2070
|
+
}
|
|
2010
2071
|
if (!dragInProgress) {
|
|
2011
2072
|
sliderState.sliderDragStarted(id);
|
|
2012
2073
|
dragInProgress = true;
|
|
@@ -4233,57 +4294,7 @@ var targetColors = [
|
|
|
4233
4294
|
'#cb4d62'
|
|
4234
4295
|
];
|
|
4235
4296
|
var ComboboxCellWidth = '217px';
|
|
4236
|
-
|
|
4237
|
-
function _define_property$5(obj, key, value) {
|
|
4238
|
-
if (key in obj) {
|
|
4239
|
-
Object.defineProperty(obj, key, {
|
|
4240
|
-
value: value,
|
|
4241
|
-
enumerable: true,
|
|
4242
|
-
configurable: true,
|
|
4243
|
-
writable: true
|
|
4244
|
-
});
|
|
4245
|
-
} else {
|
|
4246
|
-
obj[key] = value;
|
|
4247
|
-
}
|
|
4248
|
-
return obj;
|
|
4249
|
-
}
|
|
4250
|
-
function _object_spread$5(target) {
|
|
4251
|
-
for(var i = 1; i < arguments.length; i++){
|
|
4252
|
-
var source = arguments[i] != null ? arguments[i] : {};
|
|
4253
|
-
var ownKeys = Object.keys(source);
|
|
4254
|
-
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
4255
|
-
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
4256
|
-
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
4257
|
-
}));
|
|
4258
|
-
}
|
|
4259
|
-
ownKeys.forEach(function(key) {
|
|
4260
|
-
_define_property$5(target, key, source[key]);
|
|
4261
|
-
});
|
|
4262
|
-
}
|
|
4263
|
-
return target;
|
|
4264
|
-
}
|
|
4265
|
-
function SingleBarViz(param) {
|
|
4266
|
-
var _param_background = param.background, background = _param_background === void 0 ? 'var(--color-brand)' : _param_background, _param_height = param.height, height = _param_height === void 0 ? '6px' : _param_height, _param_polarity = param.polarity, polarity = _param_polarity === void 0 ? Polarity.unipolar : _param_polarity, _param_orientation = param.orientation, orientation = _param_orientation === void 0 ? Orientation.horizontal : _param_orientation, value = param.value, className = param.className, style = param.style;
|
|
4267
|
-
return /*#__PURE__*/ React__default.createElement("div", {
|
|
4268
|
-
className: className,
|
|
4269
|
-
style: {
|
|
4270
|
-
width: '100%',
|
|
4271
|
-
height: height,
|
|
4272
|
-
background: 'var(--color-gray-600)',
|
|
4273
|
-
position: 'relative'
|
|
4274
|
-
}
|
|
4275
|
-
}, /*#__PURE__*/ React__default.createElement("div", {
|
|
4276
|
-
style: _object_spread$5({
|
|
4277
|
-
position: 'absolute',
|
|
4278
|
-
background: background
|
|
4279
|
-
}, getBarTransformStyles({
|
|
4280
|
-
polarity: polarity,
|
|
4281
|
-
orientation: orientation,
|
|
4282
|
-
normalisedValue: value || 0
|
|
4283
|
-
}), style)
|
|
4284
|
-
}));
|
|
4285
|
-
}
|
|
4286
|
-
SingleBarViz.polarity = Polarity;
|
|
4297
|
+
var DeleteButtonCellWidth = '50px';
|
|
4287
4298
|
|
|
4288
4299
|
function _array_like_to_array$7(arr, len) {
|
|
4289
4300
|
if (len == null || len > arr.length) len = arr.length;
|
|
@@ -4332,12 +4343,13 @@ function _unsupported_iterable_to_array$7(o, minLen) {
|
|
|
4332
4343
|
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$7(o, minLen);
|
|
4333
4344
|
}
|
|
4334
4345
|
var useCombobox = function(param) {
|
|
4335
|
-
var id = param.id, filter = param.filter
|
|
4346
|
+
var id = param.id, filter = param.filter;
|
|
4336
4347
|
var _Object_values;
|
|
4337
4348
|
var comboBoxState = Juce.getComboBoxState(id);
|
|
4338
4349
|
var _useState = _sliced_to_array$7(useState(0), 2), value = _useState[0], setValue = _useState[1];
|
|
4339
4350
|
var _useState1 = _sliced_to_array$7(useState(comboBoxState === null || comboBoxState === void 0 ? void 0 : comboBoxState.properties), 2), properties = _useState1[0], setProperties = _useState1[1];
|
|
4340
|
-
var
|
|
4351
|
+
var prevValue = useRef(null);
|
|
4352
|
+
var _useGlobalContext = useGlobalContext(); _useGlobalContext.highlightedItemChanged; var setModSlotRowTargetAsPreview = _useGlobalContext.setModSlotRowTargetAsPreview, _useGlobalContext_globalState = _useGlobalContext.globalState, automatableParamLabels = _useGlobalContext_globalState.automatableParamLabels, modSlotTargets = _useGlobalContext_globalState.modSlotTargets, modSlotPreview = _useGlobalContext_globalState.modSlotPreview;
|
|
4341
4353
|
//TODO: Filter choices for subsequent rows
|
|
4342
4354
|
// const availableChoices = properties?.choices;
|
|
4343
4355
|
useEffect(function() {
|
|
@@ -4349,7 +4361,7 @@ var useCombobox = function(param) {
|
|
|
4349
4361
|
setProperties(comboBoxState === null || comboBoxState === void 0 ? void 0 : comboBoxState.properties);
|
|
4350
4362
|
});
|
|
4351
4363
|
useEffect(function() {
|
|
4352
|
-
if (modSlotPreview.slotId === id
|
|
4364
|
+
if (modSlotPreview.slotId === id) {
|
|
4353
4365
|
setValue(modSlotPreview.targetIndex);
|
|
4354
4366
|
}
|
|
4355
4367
|
}, [
|
|
@@ -4359,7 +4371,9 @@ var useCombobox = function(param) {
|
|
|
4359
4371
|
useEffect(function() {
|
|
4360
4372
|
var _comboBoxState_valueChangedEvent, _comboBoxState_propertiesChangedEvent;
|
|
4361
4373
|
var valueListenerId = comboBoxState === null || comboBoxState === void 0 ? void 0 : (_comboBoxState_valueChangedEvent = comboBoxState.valueChangedEvent) === null || _comboBoxState_valueChangedEvent === void 0 ? void 0 : _comboBoxState_valueChangedEvent.addListener(function() {
|
|
4362
|
-
|
|
4374
|
+
if ((comboBoxState === null || comboBoxState === void 0 ? void 0 : comboBoxState.getChoiceIndex()) !== prevValue) {
|
|
4375
|
+
setValue(comboBoxState === null || comboBoxState === void 0 ? void 0 : comboBoxState.getChoiceIndex());
|
|
4376
|
+
}
|
|
4363
4377
|
});
|
|
4364
4378
|
var propertiesListenerId = comboBoxState === null || comboBoxState === void 0 ? void 0 : (_comboBoxState_propertiesChangedEvent = comboBoxState.propertiesChangedEvent) === null || _comboBoxState_propertiesChangedEvent === void 0 ? void 0 : _comboBoxState_propertiesChangedEvent.addListener(function() {
|
|
4365
4379
|
setProperties(comboBoxState === null || comboBoxState === void 0 ? void 0 : comboBoxState.properties);
|
|
@@ -4385,20 +4399,30 @@ var useCombobox = function(param) {
|
|
|
4385
4399
|
var _item_toLowerCase;
|
|
4386
4400
|
return item === null || item === void 0 ? void 0 : (_item_toLowerCase = item.toLowerCase()) === null || _item_toLowerCase === void 0 ? void 0 : _item_toLowerCase.includes(filter === null || filter === void 0 ? void 0 : filter.toLowerCase());
|
|
4387
4401
|
}) : displayedLabels;
|
|
4388
|
-
|
|
4389
|
-
|
|
4390
|
-
|
|
4391
|
-
|
|
4392
|
-
|
|
4393
|
-
|
|
4394
|
-
|
|
4395
|
-
|
|
4396
|
-
|
|
4397
|
-
|
|
4402
|
+
// const prevValue = useRef<string | null>(null);
|
|
4403
|
+
// const handleChange = (newValue: number) => {
|
|
4404
|
+
// if (newValue !== prevValue.current) {
|
|
4405
|
+
// // const juceIndex = automatableParamLabels?.indexOf(newValue);
|
|
4406
|
+
// // comboBoxState?.setChoiceIndex(newValue);s
|
|
4407
|
+
// setValue(newValue);
|
|
4408
|
+
// // onChange && onChange(newValue);
|
|
4409
|
+
// // //@ts-expect-error
|
|
4410
|
+
// // window.__JUCE__.backend.emitEvent('undoableActionOccurred', {});
|
|
4411
|
+
// if (displayValInHeader) {
|
|
4412
|
+
// highlightedItemChanged({
|
|
4413
|
+
// label,
|
|
4414
|
+
// value: automatableParamLabels?.[newValue],
|
|
4415
|
+
// });
|
|
4416
|
+
// }
|
|
4417
|
+
// prevValue.current = newValue;
|
|
4418
|
+
// }
|
|
4419
|
+
// };
|
|
4398
4420
|
var onMouseEnter = function() {
|
|
4399
4421
|
};
|
|
4400
4422
|
var onClick = function() {
|
|
4401
|
-
|
|
4423
|
+
setModSlotRowTargetAsPreview({
|
|
4424
|
+
paramId: id
|
|
4425
|
+
});
|
|
4402
4426
|
};
|
|
4403
4427
|
return {
|
|
4404
4428
|
value: value,
|
|
@@ -4407,8 +4431,7 @@ var useCombobox = function(param) {
|
|
|
4407
4431
|
choices: properties === null || properties === void 0 ? void 0 : properties.choices,
|
|
4408
4432
|
filteredChoices: filteredChoices,
|
|
4409
4433
|
onMouseEnter: onMouseEnter,
|
|
4410
|
-
onClick: onClick
|
|
4411
|
-
handleChange: handleChange
|
|
4434
|
+
onClick: onClick
|
|
4412
4435
|
};
|
|
4413
4436
|
};
|
|
4414
4437
|
|
|
@@ -4420,7 +4443,7 @@ function _array_like_to_array$6(arr, len) {
|
|
|
4420
4443
|
function _array_with_holes$6(arr) {
|
|
4421
4444
|
if (Array.isArray(arr)) return arr;
|
|
4422
4445
|
}
|
|
4423
|
-
function _define_property$
|
|
4446
|
+
function _define_property$5(obj, key, value) {
|
|
4424
4447
|
if (key in obj) {
|
|
4425
4448
|
Object.defineProperty(obj, key, {
|
|
4426
4449
|
value: value,
|
|
@@ -4460,7 +4483,7 @@ function _iterable_to_array_limit$6(arr, i) {
|
|
|
4460
4483
|
function _non_iterable_rest$6() {
|
|
4461
4484
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
4462
4485
|
}
|
|
4463
|
-
function _object_spread$
|
|
4486
|
+
function _object_spread$5(target) {
|
|
4464
4487
|
for(var i = 1; i < arguments.length; i++){
|
|
4465
4488
|
var source = arguments[i] != null ? arguments[i] : {};
|
|
4466
4489
|
var ownKeys = Object.keys(source);
|
|
@@ -4470,7 +4493,7 @@ function _object_spread$4(target) {
|
|
|
4470
4493
|
}));
|
|
4471
4494
|
}
|
|
4472
4495
|
ownKeys.forEach(function(key) {
|
|
4473
|
-
_define_property$
|
|
4496
|
+
_define_property$5(target, key, source[key]);
|
|
4474
4497
|
});
|
|
4475
4498
|
}
|
|
4476
4499
|
return target;
|
|
@@ -4487,31 +4510,38 @@ function _unsupported_iterable_to_array$6(o, minLen) {
|
|
|
4487
4510
|
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$6(o, minLen);
|
|
4488
4511
|
}
|
|
4489
4512
|
function ModMatrixComboboxCell(param) {
|
|
4490
|
-
var
|
|
4491
|
-
var
|
|
4492
|
-
var
|
|
4493
|
-
var _useState1 = _sliced_to_array$6(useState(''), 2), filterString = _useState1[0], setFilterString = _useState1[1];
|
|
4494
|
-
var _useGlobalContext = useGlobalContext(), automatableParamLabels = _useGlobalContext.globalState.automatableParamLabels;
|
|
4513
|
+
var rowId = param.rowId, key = param.key, color = param.color, style = param.style;
|
|
4514
|
+
var _useState = _sliced_to_array$6(useState(''), 2), filterString = _useState[0], setFilterString = _useState[1];
|
|
4515
|
+
var _useGlobalContext = useGlobalContext(), updateModSlotRowTarget = _useGlobalContext.updateModSlotRowTarget, setModSlotRowTargetAsPreview = _useGlobalContext.setModSlotRowTargetAsPreview, clearModSlotPreview = _useGlobalContext.clearModSlotPreview, setNewModSlotPreview = _useGlobalContext.setNewModSlotPreview, _useGlobalContext_globalState = _useGlobalContext.globalState, modSlotPreview = _useGlobalContext_globalState.modSlotPreview, automatableParamLabels = _useGlobalContext_globalState.automatableParamLabels;
|
|
4495
4516
|
var _useCombobox = useCombobox({
|
|
4496
4517
|
id: rowId,
|
|
4497
|
-
filter: filterString,
|
|
4498
|
-
|
|
4499
|
-
|
|
4500
|
-
|
|
4501
|
-
|
|
4502
|
-
|
|
4503
|
-
|
|
4504
|
-
|
|
4518
|
+
filter: filterString}), value = _useCombobox.value, filteredChoices = _useCombobox.filteredChoices;
|
|
4519
|
+
var previewValue = modSlotPreview.slotId === rowId ? modSlotPreview.targetIndex : null;
|
|
4520
|
+
var onChange = function(newValue) {
|
|
4521
|
+
// TODO: 'juceIndex' is needed here because the 'value' from the combobox is the string label.
|
|
4522
|
+
// Refactor the combobox so that the 'value' is the index number corresponding to the parameter's index in JUCE?
|
|
4523
|
+
// console.log(newValue, 'NV');
|
|
4524
|
+
var juceIndex = automatableParamLabels === null || automatableParamLabels === void 0 ? void 0 : automatableParamLabels.indexOf(newValue);
|
|
4525
|
+
// handleChange(juceIndex);
|
|
4526
|
+
if (rowId === modSlotPreview.slotId) {
|
|
4527
|
+
if (juceIndex > 0) {
|
|
4528
|
+
setModSlotRowTargetAsPreview({
|
|
4529
|
+
paramIndex: juceIndex
|
|
4530
|
+
});
|
|
4531
|
+
} else {
|
|
4532
|
+
clearModSlotPreview();
|
|
4533
|
+
setNewModSlotPreview();
|
|
4534
|
+
}
|
|
4535
|
+
} else {
|
|
4536
|
+
updateModSlotRowTarget(juceIndex, rowId);
|
|
4505
4537
|
}
|
|
4506
|
-
}
|
|
4507
|
-
target
|
|
4508
|
-
]);
|
|
4538
|
+
};
|
|
4509
4539
|
return /*#__PURE__*/ React__default.createElement(Box, {
|
|
4510
4540
|
key: key,
|
|
4511
4541
|
className: "ModMatrixCell ModMatrixComboboxCell",
|
|
4512
4542
|
justifyContent: Box.justifyContent.flexEnd,
|
|
4513
4543
|
flexDirection: Box.flexDirection.column,
|
|
4514
|
-
style: _object_spread$
|
|
4544
|
+
style: _object_spread$5({
|
|
4515
4545
|
color: color
|
|
4516
4546
|
}, style),
|
|
4517
4547
|
padding: [
|
|
@@ -4521,8 +4551,8 @@ function ModMatrixComboboxCell(param) {
|
|
|
4521
4551
|
alignItems: Box.alignItems.flexStart,
|
|
4522
4552
|
height: '2.5rem'
|
|
4523
4553
|
}, /*#__PURE__*/ React__default.createElement(Combobox, {
|
|
4524
|
-
value: value,
|
|
4525
|
-
onChange:
|
|
4554
|
+
value: value || previewValue,
|
|
4555
|
+
onChange: onChange
|
|
4526
4556
|
}, /*#__PURE__*/ React__default.createElement(Box, null, /*#__PURE__*/ React__default.createElement(ComboboxInput, {
|
|
4527
4557
|
displayValue: function(item) {
|
|
4528
4558
|
return value ? automatableParamLabels === null || automatableParamLabels === void 0 ? void 0 : automatableParamLabels[value] : '';
|
|
@@ -4555,17 +4585,10 @@ function ModMatrixComboboxCell(param) {
|
|
|
4555
4585
|
key: item,
|
|
4556
4586
|
value: item
|
|
4557
4587
|
}, /*#__PURE__*/ React__default.createElement(Label, null, item));
|
|
4558
|
-
})))
|
|
4559
|
-
value: targetValue,
|
|
4560
|
-
polarity: SingleBarViz === null || SingleBarViz === void 0 ? void 0 : (_SingleBarViz_polarity = SingleBarViz.polarity) === null || _SingleBarViz_polarity === void 0 ? void 0 : _SingleBarViz_polarity.unipolar,
|
|
4561
|
-
background: color,
|
|
4562
|
-
style: {
|
|
4563
|
-
alignSelf: 'flex-end'
|
|
4564
|
-
}
|
|
4565
|
-
}));
|
|
4588
|
+
}))));
|
|
4566
4589
|
}
|
|
4567
4590
|
|
|
4568
|
-
function _define_property$
|
|
4591
|
+
function _define_property$4(obj, key, value) {
|
|
4569
4592
|
if (key in obj) {
|
|
4570
4593
|
Object.defineProperty(obj, key, {
|
|
4571
4594
|
value: value,
|
|
@@ -4578,7 +4601,7 @@ function _define_property$3(obj, key, value) {
|
|
|
4578
4601
|
}
|
|
4579
4602
|
return obj;
|
|
4580
4603
|
}
|
|
4581
|
-
function _object_spread$
|
|
4604
|
+
function _object_spread$4(target) {
|
|
4582
4605
|
for(var i = 1; i < arguments.length; i++){
|
|
4583
4606
|
var source = arguments[i] != null ? arguments[i] : {};
|
|
4584
4607
|
var ownKeys = Object.keys(source);
|
|
@@ -4588,7 +4611,7 @@ function _object_spread$3(target) {
|
|
|
4588
4611
|
}));
|
|
4589
4612
|
}
|
|
4590
4613
|
ownKeys.forEach(function(key) {
|
|
4591
|
-
_define_property$
|
|
4614
|
+
_define_property$4(target, key, source[key]);
|
|
4592
4615
|
});
|
|
4593
4616
|
}
|
|
4594
4617
|
return target;
|
|
@@ -4597,20 +4620,20 @@ function _object_spread$3(target) {
|
|
|
4597
4620
|
function ModMatrixToggleCell(param) {
|
|
4598
4621
|
var modifier = param.modifier, _param_isDisabled = param.isDisabled, isDisabled = _param_isDisabled === void 0 ? false : _param_isDisabled, rowId = param.rowId, color = param.color, style = param.style;
|
|
4599
4622
|
var // getDefaultParameter,
|
|
4600
|
-
|
|
4623
|
+
saveModSlotPreviewRowTargetToBackend = useGlobalContext().saveModSlotPreviewRowTargetToBackend;
|
|
4601
4624
|
// const rowState = Juce.getComboBoxState(rowId);
|
|
4602
4625
|
var _useDropdown = useDropdown({
|
|
4603
4626
|
id: modifier,
|
|
4604
4627
|
rowId: rowId,
|
|
4605
4628
|
isDisabled: isDisabled,
|
|
4606
|
-
onChange:
|
|
4629
|
+
onChange: saveModSlotPreviewRowTargetToBackend
|
|
4607
4630
|
}), index = _useDropdown.index, choices = _useDropdown.choices, handleChange = _useDropdown.handleChange;
|
|
4608
4631
|
return /*#__PURE__*/ React__default.createElement(Box, {
|
|
4609
4632
|
className: "ModMatrixCell ModMatrixToggleCell ".concat(isDisabled ? 'isDisabled' : ''),
|
|
4610
4633
|
justifyContent: Box.justifyContent.flexEnd,
|
|
4611
4634
|
alignItems: Box.alignItems.flexStart,
|
|
4612
4635
|
flexDirection: Box.flexDirection.column,
|
|
4613
|
-
style: _object_spread$
|
|
4636
|
+
style: _object_spread$4({
|
|
4614
4637
|
color: color,
|
|
4615
4638
|
pointerEvents: 'all'
|
|
4616
4639
|
}, style),
|
|
@@ -4634,6 +4657,57 @@ function ModMatrixToggleCell(param) {
|
|
|
4634
4657
|
}, Object.keys(Polarity)[index] || '0')));
|
|
4635
4658
|
}
|
|
4636
4659
|
|
|
4660
|
+
function _define_property$3(obj, key, value) {
|
|
4661
|
+
if (key in obj) {
|
|
4662
|
+
Object.defineProperty(obj, key, {
|
|
4663
|
+
value: value,
|
|
4664
|
+
enumerable: true,
|
|
4665
|
+
configurable: true,
|
|
4666
|
+
writable: true
|
|
4667
|
+
});
|
|
4668
|
+
} else {
|
|
4669
|
+
obj[key] = value;
|
|
4670
|
+
}
|
|
4671
|
+
return obj;
|
|
4672
|
+
}
|
|
4673
|
+
function _object_spread$3(target) {
|
|
4674
|
+
for(var i = 1; i < arguments.length; i++){
|
|
4675
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
|
4676
|
+
var ownKeys = Object.keys(source);
|
|
4677
|
+
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
4678
|
+
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
4679
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
4680
|
+
}));
|
|
4681
|
+
}
|
|
4682
|
+
ownKeys.forEach(function(key) {
|
|
4683
|
+
_define_property$3(target, key, source[key]);
|
|
4684
|
+
});
|
|
4685
|
+
}
|
|
4686
|
+
return target;
|
|
4687
|
+
}
|
|
4688
|
+
function SingleBarViz(param) {
|
|
4689
|
+
var _param_background = param.background, background = _param_background === void 0 ? 'var(--color-brand)' : _param_background, _param_height = param.height, height = _param_height === void 0 ? '6px' : _param_height, _param_polarity = param.polarity, polarity = _param_polarity === void 0 ? Polarity.unipolar : _param_polarity, _param_orientation = param.orientation, orientation = _param_orientation === void 0 ? Orientation.horizontal : _param_orientation, value = param.value, className = param.className, style = param.style;
|
|
4690
|
+
return /*#__PURE__*/ React__default.createElement("div", {
|
|
4691
|
+
className: className,
|
|
4692
|
+
style: {
|
|
4693
|
+
width: '100%',
|
|
4694
|
+
height: height,
|
|
4695
|
+
background: 'var(--color-gray-600)',
|
|
4696
|
+
position: 'relative'
|
|
4697
|
+
}
|
|
4698
|
+
}, /*#__PURE__*/ React__default.createElement("div", {
|
|
4699
|
+
style: _object_spread$3({
|
|
4700
|
+
position: 'absolute',
|
|
4701
|
+
background: background
|
|
4702
|
+
}, getBarTransformStyles({
|
|
4703
|
+
polarity: polarity,
|
|
4704
|
+
orientation: orientation,
|
|
4705
|
+
normalisedValue: value || 0
|
|
4706
|
+
}), style)
|
|
4707
|
+
}));
|
|
4708
|
+
}
|
|
4709
|
+
SingleBarViz.polarity = Polarity;
|
|
4710
|
+
|
|
4637
4711
|
function _define_property$2(obj, key, value) {
|
|
4638
4712
|
if (key in obj) {
|
|
4639
4713
|
Object.defineProperty(obj, key, {
|
|
@@ -4684,14 +4758,14 @@ function _object_spread_props(target, source) {
|
|
|
4684
4758
|
function ModMatrixCell(param) {
|
|
4685
4759
|
var modifier = param.modifier, rowId = param.rowId, isDisabled = param.isDisabled, color = param.color, style = param.style;
|
|
4686
4760
|
var _SingleBarViz_polarity;
|
|
4687
|
-
var _useGlobalContext = useGlobalContext(), setDefaultParameter = _useGlobalContext.setDefaultParameter,
|
|
4761
|
+
var _useGlobalContext = useGlobalContext(), setDefaultParameter = _useGlobalContext.setDefaultParameter, saveModSlotPreviewRowTargetToBackend = _useGlobalContext.saveModSlotPreviewRowTargetToBackend;
|
|
4688
4762
|
var _useSlider = useSlider({
|
|
4689
4763
|
id: modifier,
|
|
4690
4764
|
rowId: rowId,
|
|
4691
4765
|
displayValInHeader: false,
|
|
4692
4766
|
orientation: Orientation.horizontal,
|
|
4693
4767
|
dragOrientation: Orientation.vertical,
|
|
4694
|
-
onChange:
|
|
4768
|
+
onChange: saveModSlotPreviewRowTargetToBackend,
|
|
4695
4769
|
isDisabled: isDisabled
|
|
4696
4770
|
}), bindBarSliderDrag = _useSlider.bindBarSliderDrag, normalisedValue = _useSlider.normalisedValue, scaledValue = _useSlider.scaledValue;
|
|
4697
4771
|
return /*#__PURE__*/ React__default.createElement(Box, _object_spread_props(_object_spread$2({
|
|
@@ -4736,30 +4810,7 @@ function ModMatrixCell(param) {
|
|
|
4736
4810
|
function ModMatrixRow(param) {
|
|
4737
4811
|
var rowId = param.rowId, key = param.key;
|
|
4738
4812
|
var _modSlotParams_rowId;
|
|
4739
|
-
|
|
4740
|
-
var _useGlobalContext = useGlobalContext(), // modSlotTargetUpdated,
|
|
4741
|
-
setDefaultParameter = _useGlobalContext.setDefaultParameter, modSlotPreviewIsEditableUpdated = _useGlobalContext.modSlotPreviewIsEditableUpdated, modSlotPreviewTargetIndexUpdated = _useGlobalContext.modSlotPreviewTargetIndexUpdated, setNewModSlotPreview = _useGlobalContext.setNewModSlotPreview, modSlotTargetUpdated = _useGlobalContext.modSlotTargetUpdated, _useGlobalContext_globalState = _useGlobalContext.globalState, modSlotParams = _useGlobalContext_globalState.modSlotParams, modSlotTargets = _useGlobalContext_globalState.modSlotTargets, modSlotPreview = _useGlobalContext_globalState.modSlotPreview;
|
|
4742
|
-
var handleTargetChange = function(newTarget) {
|
|
4743
|
-
if (newTarget > 0) {
|
|
4744
|
-
// modSlotTargetUpdated([rowId, newTarget]);
|
|
4745
|
-
if (rowId === modSlotPreview.slotId) {
|
|
4746
|
-
modSlotPreviewTargetIndexUpdated(newTarget);
|
|
4747
|
-
modSlotPreviewIsEditableUpdated(true);
|
|
4748
|
-
}
|
|
4749
|
-
} else {
|
|
4750
|
-
var _modSlotParams_rowId;
|
|
4751
|
-
modSlotTargetUpdated([
|
|
4752
|
-
rowId,
|
|
4753
|
-
0
|
|
4754
|
-
]);
|
|
4755
|
-
modSlotParams === null || modSlotParams === void 0 ? void 0 : (_modSlotParams_rowId = modSlotParams[rowId]) === null || _modSlotParams_rowId === void 0 ? void 0 : _modSlotParams_rowId.forEach(function(item) {
|
|
4756
|
-
setDefaultParameter(item);
|
|
4757
|
-
});
|
|
4758
|
-
if (!modSlotPreview.slotId) {
|
|
4759
|
-
setNewModSlotPreview();
|
|
4760
|
-
}
|
|
4761
|
-
}
|
|
4762
|
-
};
|
|
4813
|
+
var _useGlobalContext = useGlobalContext(), updateModSlotRowTarget = _useGlobalContext.updateModSlotRowTarget, _useGlobalContext_globalState = _useGlobalContext.globalState, modSlotParams = _useGlobalContext_globalState.modSlotParams, modSlotPreview = _useGlobalContext_globalState.modSlotPreview;
|
|
4763
4814
|
return /*#__PURE__*/ React__default.createElement(Box, {
|
|
4764
4815
|
className: "ModMatrixBodyRow",
|
|
4765
4816
|
gap: Box.gap.medium,
|
|
@@ -4770,10 +4821,10 @@ function ModMatrixRow(param) {
|
|
|
4770
4821
|
flexDirection: Box.flexDirection.column,
|
|
4771
4822
|
style: {
|
|
4772
4823
|
color: targetColors[0]
|
|
4773
|
-
}
|
|
4824
|
+
},
|
|
4825
|
+
flex: "3"
|
|
4774
4826
|
}, /*#__PURE__*/ React__default.createElement(ModMatrixComboboxCell, {
|
|
4775
|
-
target
|
|
4776
|
-
handleTargetChange: handleTargetChange,
|
|
4827
|
+
// target={modSlotTargets[rowId]}
|
|
4777
4828
|
rowId: rowId,
|
|
4778
4829
|
color: targetColors[0],
|
|
4779
4830
|
style: {
|
|
@@ -4788,7 +4839,8 @@ function ModMatrixRow(param) {
|
|
|
4788
4839
|
style: {
|
|
4789
4840
|
color: targetColors[i + 1]
|
|
4790
4841
|
},
|
|
4791
|
-
key: item
|
|
4842
|
+
key: item,
|
|
4843
|
+
flex: "2"
|
|
4792
4844
|
}, i !== arr.length - 1 ? /*#__PURE__*/ React__default.createElement(ModMatrixCell, {
|
|
4793
4845
|
rowId: rowId,
|
|
4794
4846
|
modifier: modSlotParams === null || modSlotParams === void 0 ? void 0 : (_modSlotParams_rowId = modSlotParams[rowId]) === null || _modSlotParams_rowId === void 0 ? void 0 : _modSlotParams_rowId[i],
|
|
@@ -4800,7 +4852,18 @@ function ModMatrixRow(param) {
|
|
|
4800
4852
|
color: targetColors[i + 1],
|
|
4801
4853
|
isDisabled: modSlotPreview.slotId === rowId && !modSlotPreview.targetIndex
|
|
4802
4854
|
}));
|
|
4803
|
-
})
|
|
4855
|
+
}), /*#__PURE__*/ React__default.createElement(Box, {
|
|
4856
|
+
flex: "0 0 ".concat(DeleteButtonCellWidth)
|
|
4857
|
+
}, /*#__PURE__*/ React__default.createElement(IconButton, {
|
|
4858
|
+
backgroundColor: "transparent",
|
|
4859
|
+
id: "delete-row",
|
|
4860
|
+
icon: Icon.icon.delete,
|
|
4861
|
+
width: "20px",
|
|
4862
|
+
disabled: modSlotPreview.slotId === rowId && !modSlotPreview.targetIndex,
|
|
4863
|
+
onClick: function() {
|
|
4864
|
+
return updateModSlotRowTarget(0, rowId);
|
|
4865
|
+
}
|
|
4866
|
+
})));
|
|
4804
4867
|
}
|
|
4805
4868
|
|
|
4806
4869
|
function _array_like_to_array$5(arr, len) {
|
|
@@ -5016,7 +5079,7 @@ function ModMatrix(param) {
|
|
|
5016
5079
|
var getAllModSlotsFunc = Juce.getNativeFunction('getAllModSlots');
|
|
5017
5080
|
var getModSlotParamsFunc = Juce.getNativeFunction('getModSlotParams');
|
|
5018
5081
|
var _useState = _sliced_to_array$5(useState([]), 2), displayedModSlots = _useState[0], setDisplayedModSlots = _useState[1];
|
|
5019
|
-
var _useGlobalContext = useGlobalContext(), automatableParamsListReceived = _useGlobalContext.automatableParamsListReceived, automatableParamLabelsReceived = _useGlobalContext.automatableParamLabelsReceived, modSlotsReceived = _useGlobalContext.modSlotsReceived, setNewModSlotPreview = _useGlobalContext.setNewModSlotPreview, modSlotParamsListReceived = _useGlobalContext.modSlotParamsListReceived, modSlotParamLabelsReceived = _useGlobalContext.modSlotParamLabelsReceived, _useGlobalContext_globalState = _useGlobalContext.globalState, modSlotParamLabels = _useGlobalContext_globalState.modSlotParamLabels, modSlotTargets = _useGlobalContext_globalState.modSlotTargets, modSlotIds = _useGlobalContext_globalState.modSlotIds, modSlotPreview = _useGlobalContext_globalState.modSlotPreview;
|
|
5082
|
+
var _useGlobalContext = useGlobalContext(), automatableParamsListReceived = _useGlobalContext.automatableParamsListReceived, automatableParamLabelsReceived = _useGlobalContext.automatableParamLabelsReceived, modSlotsReceived = _useGlobalContext.modSlotsReceived, modSlotRowTargetsReceived = _useGlobalContext.modSlotRowTargetsReceived, setNewModSlotPreview = _useGlobalContext.setNewModSlotPreview, modSlotParamsListReceived = _useGlobalContext.modSlotParamsListReceived, modSlotParamLabelsReceived = _useGlobalContext.modSlotParamLabelsReceived, _useGlobalContext_globalState = _useGlobalContext.globalState, modSlotParamLabels = _useGlobalContext_globalState.modSlotParamLabels, modSlotTargets = _useGlobalContext_globalState.modSlotTargets, modSlotIds = _useGlobalContext_globalState.modSlotIds, modSlotPreview = _useGlobalContext_globalState.modSlotPreview;
|
|
5020
5083
|
// Empty state preview row
|
|
5021
5084
|
useEffect(function() {
|
|
5022
5085
|
var unassignedModSlots = modSlotIds === null || modSlotIds === void 0 ? void 0 : modSlotIds.filter(function(item) {
|
|
@@ -5030,6 +5093,10 @@ function ModMatrix(param) {
|
|
|
5030
5093
|
modSlotIds,
|
|
5031
5094
|
modSlotPreview
|
|
5032
5095
|
]);
|
|
5096
|
+
// console.log(
|
|
5097
|
+
// modSlotTargets,
|
|
5098
|
+
// 'modSlotTargetsmodSlotTargetsmodSlotTargetsmodSlotTargets',
|
|
5099
|
+
// );
|
|
5033
5100
|
useEffect(function() {
|
|
5034
5101
|
var _Object_keys;
|
|
5035
5102
|
var displayedSlots = (_Object_keys = Object.keys(modSlotTargets)) === null || _Object_keys === void 0 ? void 0 : _Object_keys.reduce(function(acc, item) {
|
|
@@ -5037,11 +5104,12 @@ function ModMatrix(param) {
|
|
|
5037
5104
|
acc === null || acc === void 0 ? void 0 : acc.push(item);
|
|
5038
5105
|
}
|
|
5039
5106
|
return acc;
|
|
5040
|
-
}, [])
|
|
5107
|
+
}, []);
|
|
5108
|
+
// .sort();
|
|
5041
5109
|
var unassignedModSlots = modSlotIds === null || modSlotIds === void 0 ? void 0 : modSlotIds.filter(function(item) {
|
|
5042
5110
|
return modSlotTargets[item] <= 0;
|
|
5043
5111
|
});
|
|
5044
|
-
if (unassignedModSlots.length > 0) {
|
|
5112
|
+
if (unassignedModSlots.length > 0 && modSlotPreview.slotId) {
|
|
5045
5113
|
setDisplayedModSlots(_to_consumable_array(displayedSlots).concat([
|
|
5046
5114
|
modSlotPreview.slotId
|
|
5047
5115
|
]));
|
|
@@ -5088,6 +5156,7 @@ function ModMatrix(param) {
|
|
|
5088
5156
|
automatableParamsListReceived(automatableParamsList === null || automatableParamsList === void 0 ? void 0 : automatableParamsList[0]);
|
|
5089
5157
|
automatableParamLabelsReceived(automatableParamsList === null || automatableParamsList === void 0 ? void 0 : automatableParamsList[1]);
|
|
5090
5158
|
modSlotsReceived(modSlotsData || []);
|
|
5159
|
+
modSlotRowTargetsReceived(modSlotsData || []);
|
|
5091
5160
|
modSlotParamsListReceived(modSlotParams === null || modSlotParams === void 0 ? void 0 : modSlotParams[0]);
|
|
5092
5161
|
modSlotParamLabelsReceived(modSlotParams === null || modSlotParams === void 0 ? void 0 : modSlotParams[1]);
|
|
5093
5162
|
return [
|
|
@@ -5116,7 +5185,9 @@ function ModMatrix(param) {
|
|
|
5116
5185
|
]);
|
|
5117
5186
|
var headers = [
|
|
5118
5187
|
'Target'
|
|
5119
|
-
].concat(_to_consumable_array(modSlotParamLabels)
|
|
5188
|
+
].concat(_to_consumable_array(modSlotParamLabels), [
|
|
5189
|
+
''
|
|
5190
|
+
]);
|
|
5120
5191
|
return /*#__PURE__*/ React__default.createElement(Box, {
|
|
5121
5192
|
gap: Box.gap.medium,
|
|
5122
5193
|
padding: [
|
|
@@ -5135,7 +5206,7 @@ function ModMatrix(param) {
|
|
|
5135
5206
|
return /*#__PURE__*/ React__default.createElement(Box, {
|
|
5136
5207
|
style: {
|
|
5137
5208
|
color: targetColors[i],
|
|
5138
|
-
flex: i === 0 ? "0 0 ".concat(ComboboxCellWidth) : '
|
|
5209
|
+
flex: i === 0 ? "0 0 ".concat(ComboboxCellWidth) : i === headers.length - 1 ? "0 0 ".concat(DeleteButtonCellWidth) : '2'
|
|
5139
5210
|
},
|
|
5140
5211
|
key: item,
|
|
5141
5212
|
className: "ModMatrixHeaderCell",
|
|
@@ -5151,7 +5222,7 @@ function ModMatrix(param) {
|
|
|
5151
5222
|
}, (displayedModSlots === null || displayedModSlots === void 0 ? void 0 : displayedModSlots.length) ? displayedModSlots === null || displayedModSlots === void 0 ? void 0 : displayedModSlots.map(function(item, i) {
|
|
5152
5223
|
return /*#__PURE__*/ React__default.createElement(ModMatrixRow, {
|
|
5153
5224
|
rowId: item,
|
|
5154
|
-
key: item
|
|
5225
|
+
key: "".concat(item + i)
|
|
5155
5226
|
});
|
|
5156
5227
|
}) : null));
|
|
5157
5228
|
}
|