@antimatter-audio/antimatter-ui 16.2.9 → 16.2.11
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.js +470 -369
- package/dist/index.js.map +1 -1
- package/dist/types/advanced/ControlGroup/ControlGroup.d.ts.map +1 -1
- package/dist/types/advanced/ModMatrix/ModMatrixCell.d.ts.map +1 -1
- package/dist/types/common/types.d.ts +5 -0
- package/dist/types/common/types.d.ts.map +1 -1
- package/dist/types/common/utils.d.ts +52 -11
- package/dist/types/common/utils.d.ts.map +1 -1
- package/dist/types/core/DataViz/SingleBarViz.d.ts +2 -0
- package/dist/types/core/DataViz/SingleBarViz.d.ts.map +1 -1
- package/dist/types/core/Slider/BarSlider.d.ts.map +1 -1
- package/dist/types/core/Slider/RotaryCircle.d.ts.map +1 -1
- package/dist/types/core/Slider/RotarySlider.d.ts.map +1 -1
- package/dist/types/core/Slider/SliderSVG.d.ts.map +1 -1
- package/dist/types/hooks/useCombobox.d.ts.map +1 -1
- package/dist/types/hooks/useSlider.d.ts +4 -4
- package/dist/types/hooks/useSlider.d.ts.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -34,8 +34,8 @@ function styleInject(css, ref) {
|
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
-
var css_248z$
|
|
38
|
-
styleInject(css_248z$
|
|
37
|
+
var css_248z$k = "@theme static {\n /* Default theme colors */\n --color-brand: #bb68d9;\n --color-brand-900: #1b181c;\n /* --color-brand-900: #443342; */\n --color-brand-700: #932eb8;\n --color-brand-600: #ac47d1;\n --color-brand-400: #d199e6;\n --color-brand-300: #f3d4f4;\n --color-brand-secondary: #18d6d6;\n --color-alert: #8a0101;\n --color-text: #bab6cf;\n --color-gray-100: #c7c3de;\n --color-gray-200: #9a96ab;\n --color-gray-300: #838091;\n --color-gray-400: #595763;\n --color-gray-500: #4c4a54;\n --color-gray-600: #2e2c33;\n --color-gray-700: #1e1d21;\n --color-gray-800: #101012;\n --color-gray-900: #09090a;\n\n /* Main section theme colors */\n --color-GreenScreen-100: #1b4b3d;\n --color-GreenScreen-200: #29705b;\n --color-GreenScreen-300: #369679;\n --color-GreenScreen-400: #44bb97;\n --color-GreenScreen-500: #61c6a7;\n --color-GreenScreen-600: #7cd0b7;\n --color-GreenScreen-700: #a1ddcb;\n --color-GreenScreen-1000: #c7ebe0;\n\n --color-AmberScreen-100: #371815;\n --color-AmberScreen-200: #5c2824;\n --color-AmberScreen-300: #813932;\n --color-AmberScreen-400: #a54940;\n --color-AmberScreen-500: #bd5e56;\n --color-AmberScreen-600: #c6746c;\n --color-AmberScreen-700: #d49691;\n --color-AmberScreen-1000: #e2b9b6;\n\n --color-BlackScreen-100: #000000;\n --color-BlackScreen-200: #0b0b0f;\n --color-BlackScreen-300: #16161d;\n --color-BlackScreen-400: #21212c;\n --color-BlackScreen-500: #2c2c3a;\n --color-BlackScreen-600: #373749;\n --color-BlackScreen-700: #424257;\n --color-BlackScreen-1000: #4d4d66;\n\n --color-GreenAccent-100: #082b20;\n --color-GreenAccent-200: #105640;\n --color-GreenAccent-300: #188160;\n --color-GreenAccent-400: #21ab7f;\n --color-GreenAccent-500: #27ca96;\n --color-GreenAccent-600: #3edaa9;\n --color-GreenAccent-700: #69e2bc;\n --color-GreenAccent-1000: #94ebcf;\n\n --color-YellowAccent-100: #ad6a05;\n --color-YellowAccent-200: #df8807;\n --color-YellowAccent-300: #f8a220;\n --color-YellowAccent-400: #fab752;\n --color-YellowAccent-500: #faba58;\n --color-YellowAccent-600: #fac16b;\n --color-YellowAccent-700: #fbcb83;\n --color-YellowAccent-1000: #fcd69c;\n\n --color-RedAccent-100: #260d10;\n --color-RedAccent-200: #391318;\n --color-RedAccent-300: #4d191f;\n --color-RedAccent-400: #602027;\n --color-RedAccent-500: #73262f;\n --color-RedAccent-600: #862d37;\n --color-RedAccent-700: #99333f;\n --color-RedAccent-1000: #bf404f;\n\n --spacing-none: 0px;\n --spacing-xs: 2px;\n --spacing-sm: 4px;\n --spacing-ms: 6px;\n --spacing-md: 8px;\n --spacing-ml: 12px;\n --spacing-lg: 16px;\n --spacing-xl: 20px;\n --m-none: 0px;\n --m-xs: 2px;\n --m-sm: 4px;\n --m-ms: 6px;\n --m-md: 8px;\n --m-ml: 12px;\n --m-lg: 16px;\n --m-xl: 20px;\n --mt-none: 0px;\n --mt-xs: 2px;\n --mt-sm: 4px;\n --mt-ms: 6px;\n --mt-md: 8px;\n --mt-ml: 12px;\n --mt-lg: 16px;\n --mt-xl: 20px;\n --mr-none: 0px;\n --mr-xs: 2px;\n --mr-sm: 4px;\n --mr-ms: 6px;\n --mr-md: 8px;\n --mr-ml: 12px;\n --mr-lg: 16px;\n --mr-xl: 20px;\n --mb-none: 0px;\n --mb-xs: 2px;\n --mb-sm: 4px;\n --mb-ms: 6px;\n --mb-md: 8px;\n --mb-ml: 12px;\n --mb-lg: 16px;\n --mb-xl: 20px;\n --ml-none: 0px;\n --ml-xs: 2px;\n --ml-sm: 4px;\n --ml-ms: 6px;\n --ml-md: 8px;\n --ml-ml: 12px;\n --ml-lg: 16px;\n --ml-xl: 20px;\n --p-none: 0px;\n --p-xs: 2px;\n --p-sm: 4px;\n --p-ms: 6px;\n --p-md: 8px;\n --p-ml: 12px;\n --p-lg: 16px;\n --p-xl: 20px;\n --pt-none: 0px;\n --pt-xs: 2px;\n --pt-sm: 4px;\n --pt-ms: 6px;\n --pt-md: 8px;\n --pt-ml: 12px;\n --pt-lg: 16px;\n --pt-xl: 20px;\n --pr-none: 0px;\n --pr-xs: 2px;\n --pr-sm: 4px;\n --pr-ms: 6px;\n --pr-md: 8px;\n --pr-ml: 12px;\n --pr-lg: 16px;\n --pr-xl: 20px;\n --pb-none: 0px;\n --pb-xs: 2px;\n --pb-sm: 4px;\n --pb-ms: 6px;\n --pb-md: 8px;\n --pb-ml: 12px;\n --pb-lg: 16px;\n --pb-xl: 20px;\n --pl-none: 0px;\n --pl-xs: 2px;\n --pl-sm: 4px;\n --pl-ms: 6px;\n --pl-md: 8px;\n --pl-ml: 12px;\n --pl-lg: 16px;\n --pl-xl: 20px;\n --bg-lv1: #0e0e12;\n --bg-lv2: #121216;\n --bg-lv3: #16171d;\n --bg-lv4: #212128;\n --bg-lv5: #2b2b31;\n --bg-lv6: #3b3b44;\n --bg-lv7: #4c4a54;\n --bg-lv8: #595763;\n --bg-lv9: #838091;\n --bg-lv10: #9a96ab;\n --bg-lv11: #9999a7;\n --bg-lv12: #c1c1c1;\n --bg-selected: #2e2c33;\n\n /* --bg-lv3-brightened: #1a1b21; */\n\n --font-leagueSpartan: 'LeagueSpartan';\n --text-xxs: 0.5rem;\n --text-xs: 0.625rem;\n --text-sm: 0.7rem;\n --text-ms: 0.813rem;\n --text-md: 0.875rem;\n --text-lg: 1rem;\n --text-xl: 1.25rem;\n --text-title: 1.75rem;\n --gap-none: 0px;\n --gap-xs: 2px;\n --gap-sm: 4px;\n --gap-ms: 6px;\n --gap-md: 8px;\n --gap-ml: 12px;\n --gap-lg: 16px;\n --gap-xl: 20px;\n}\n\ninput,\ninput:hover,\ninput:focus,\ninput:focus-visible {\n background: transparent;\n border: none;\n outline: none;\n appearance: textfield;\n}\n\nbutton,\nbutton:hover,\nbutton:focus,\nbutton:focus-visible {\n outline: none;\n}\n\nbutton:disabled,\ninput:disabled {\n cursor: default;\n}\n\ndiv:focus,\ndiv:focus-visible {\n outline: none;\n appearance: textfield;\n}\n\n/* .cursor-hidden * {\n cursor: none !important;\n} */\n::-webkit-scrollbar,\n::-webkit-scrollbar-track {\n background-color: var(--bg-lv4);\n scrollbar-width: 3px;\n}\n\n::-webkit-scrollbar-thumb {\n background-color: var(--bg-lv7);\n border-radius: 6px;\n width: 3px;\n}\n\n* {\n -ms-overflow-style: none;\n}\n\n/* div::-webkit-scrollbar {\n display: none;\n} */\n\n@font-face {\n font-family: LeagueSpartan;\n /* ascent-override: 70%; */\n src: url('./common/assets/fonts/LeagueSpartan-Regular.ttf');\n}\n\n@font-face {\n font-family: LeagueSpartan;\n /* ascent-override: 70%; */\n src: url('./common/assets/fonts/LeagueSpartan-Thin.ttf');\n font-weight: lighter;\n}\n";
|
|
38
|
+
styleInject(css_248z$k);
|
|
39
39
|
|
|
40
40
|
var Spacing;
|
|
41
41
|
(function(Spacing) {
|
|
@@ -182,14 +182,63 @@ var StrokeStyle;
|
|
|
182
182
|
StrokeStyle["dashed"] = "dashed";
|
|
183
183
|
StrokeStyle["dotted"] = "dotted";
|
|
184
184
|
})(StrokeStyle || (StrokeStyle = {}));
|
|
185
|
+
var IncrementType;
|
|
186
|
+
(function(IncrementType) {
|
|
187
|
+
IncrementType["fine"] = "fine";
|
|
188
|
+
IncrementType["standard"] = "standard";
|
|
189
|
+
IncrementType["button"] = "button";
|
|
190
|
+
})(IncrementType || (IncrementType = {}));
|
|
191
|
+
|
|
192
|
+
var SliderType;
|
|
193
|
+
(function(SliderType) {
|
|
194
|
+
SliderType["bar"] = "bar";
|
|
195
|
+
SliderType["rotary"] = "rotary";
|
|
196
|
+
SliderType["custom"] = "custom";
|
|
197
|
+
})(SliderType || (SliderType = {}));
|
|
198
|
+
var SliderRotationBehavior;
|
|
199
|
+
(function(SliderRotationBehavior) {
|
|
200
|
+
SliderRotationBehavior["rotateIndicator"] = "rotateIndicator";
|
|
201
|
+
SliderRotationBehavior["rotatehandle"] = "rotatehandle";
|
|
202
|
+
SliderRotationBehavior["noRotation"] = "noRotation";
|
|
203
|
+
})(SliderRotationBehavior || (SliderRotationBehavior = {}));
|
|
204
|
+
var RotarySliderHandleShapes;
|
|
205
|
+
(function(RotarySliderHandleShapes) {
|
|
206
|
+
RotarySliderHandleShapes["circle"] = "circle";
|
|
207
|
+
RotarySliderHandleShapes["rectangle"] = "rectangle";
|
|
208
|
+
})(RotarySliderHandleShapes || (RotarySliderHandleShapes = {}));
|
|
209
|
+
var RotarySliderSizes;
|
|
210
|
+
(function(RotarySliderSizes) {
|
|
211
|
+
RotarySliderSizes["small"] = "small";
|
|
212
|
+
RotarySliderSizes["large"] = "large";
|
|
213
|
+
})(RotarySliderSizes || (RotarySliderSizes = {}));
|
|
214
|
+
const rotarySliderSizeMap = {
|
|
215
|
+
[RotarySliderSizes.small]: {
|
|
216
|
+
width: 40,
|
|
217
|
+
height: 40
|
|
218
|
+
},
|
|
219
|
+
[RotarySliderSizes.large]: {
|
|
220
|
+
width: 65,
|
|
221
|
+
height: 65
|
|
222
|
+
}
|
|
223
|
+
};
|
|
224
|
+
var TrackWidths;
|
|
225
|
+
(function(TrackWidths) {
|
|
226
|
+
TrackWidths["small"] = "small";
|
|
227
|
+
TrackWidths["large"] = "large";
|
|
228
|
+
TrackWidths["full"] = "full";
|
|
229
|
+
})(TrackWidths || (TrackWidths = {}));
|
|
185
230
|
|
|
186
231
|
// export const roundUpToTwoDecimals = (val: number) => Math.ceil(val * 100) / 100;
|
|
187
232
|
// mocks the `normalisedToScaledValue` internal method from JUCE
|
|
188
233
|
// This will allow us to test the JS UI without needing access to the JUCE backend
|
|
189
234
|
// ValueType rangeStart, ValueType rangeEnd, ValueType intervalValue, ValueType skewFactor, bool useSymmetricSkew=false)
|
|
190
235
|
function normalisedToScaled({ normalisedValue, properties }) {
|
|
191
|
-
|
|
192
|
-
|
|
236
|
+
if (properties) {
|
|
237
|
+
const { skew, end, start } = properties;
|
|
238
|
+
return Math.pow(normalisedValue, 1 / skew) * (end - start) + start;
|
|
239
|
+
} else {
|
|
240
|
+
return;
|
|
241
|
+
}
|
|
193
242
|
}
|
|
194
243
|
// mocks the `getnormalisedValue` method from JUCE
|
|
195
244
|
// This will allow us to test the JS UI without needing access to the JUCE backend
|
|
@@ -241,24 +290,23 @@ const getValidValueForInput = ({ value, oldValue, properties })=>{
|
|
|
241
290
|
return parseFloat(oldValue.toFixed(2));
|
|
242
291
|
}
|
|
243
292
|
};
|
|
244
|
-
const getBarTransformStyles = ({ polarity, orientation,
|
|
245
|
-
const wholeNumberNormalisedValue = normalisedValue * 100;
|
|
246
|
-
const unipolarValue = wholeNumberNormalisedValue ? parseFloat(wholeNumberNormalisedValue?.toFixed(2)) : 0;
|
|
247
|
-
const bipolarValue = (wholeNumberNormalisedValue - 50) / 100;
|
|
293
|
+
const getBarTransformStyles = ({ polarity, orientation, isDisabled })=>{
|
|
248
294
|
if (!isDisabled) {
|
|
249
295
|
if (polarity === Polarity.unipolar) {
|
|
250
296
|
return orientation === Orientation.horizontal ? {
|
|
251
|
-
width:
|
|
297
|
+
width: '100%',
|
|
252
298
|
height: '100%',
|
|
253
|
-
transform: unipolarValue
|
|
299
|
+
// transform: unipolarValue
|
|
300
|
+
// ? `scale(${Math.ceil(unipolarValue) * 0.01}, 1)`
|
|
301
|
+
// : 'none',
|
|
254
302
|
transformOrigin: 'center left',
|
|
255
303
|
top: '0',
|
|
256
304
|
bottom: '0',
|
|
257
305
|
left: '0'
|
|
258
306
|
} : {
|
|
259
307
|
width: `100%`,
|
|
260
|
-
height:
|
|
261
|
-
transform: `scale(1, ${Math.ceil(unipolarValue) * 0.01})`,
|
|
308
|
+
height: '100%',
|
|
309
|
+
// transform: `scale(1, ${Math.ceil(unipolarValue) * 0.01})`,
|
|
262
310
|
transformOrigin: 'bottom center',
|
|
263
311
|
top: '0',
|
|
264
312
|
bottom: '0',
|
|
@@ -266,17 +314,17 @@ const getBarTransformStyles = ({ polarity, orientation, normalisedValue, isDisab
|
|
|
266
314
|
};
|
|
267
315
|
} else {
|
|
268
316
|
return orientation === Orientation.horizontal ? {
|
|
269
|
-
width:
|
|
317
|
+
width: '100%',
|
|
270
318
|
height: '100%',
|
|
271
|
-
transform: bipolarValue ? `scale(${bipolarValue}, 1)` : 'none',
|
|
319
|
+
// transform: bipolarValue ? `scale(${bipolarValue}, 1)` : 'none',
|
|
272
320
|
transformOrigin: 'left center',
|
|
273
321
|
top: '0',
|
|
274
322
|
bottom: '0',
|
|
275
323
|
left: '50%'
|
|
276
324
|
} : {
|
|
277
325
|
width: `100%`,
|
|
278
|
-
height:
|
|
279
|
-
transform: bipolarValue ? `scale(1, ${bipolarValue})` : 'none',
|
|
326
|
+
height: '100%',
|
|
327
|
+
// transform: bipolarValue ? `scale(1, ${bipolarValue})` : 'none',
|
|
280
328
|
transformOrigin: 'bottom center',
|
|
281
329
|
bottom: '50%',
|
|
282
330
|
left: '0',
|
|
@@ -288,36 +336,76 @@ const getBarTransformStyles = ({ polarity, orientation, normalisedValue, isDisab
|
|
|
288
336
|
const randomizeValue = (min, max)=>{
|
|
289
337
|
return Math.random() * (max - min) + min;
|
|
290
338
|
};
|
|
291
|
-
const
|
|
292
|
-
const
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
} else {
|
|
297
|
-
return interval;
|
|
298
|
-
}
|
|
339
|
+
const getNormalisedInterval = (interval)=>{
|
|
340
|
+
const roundedInterval = Number(interval.toFixed(2));
|
|
341
|
+
if (roundedInterval) {
|
|
342
|
+
if (roundedInterval >= 1) {
|
|
343
|
+
return roundedInterval * 0.01;
|
|
299
344
|
} else {
|
|
300
|
-
return
|
|
345
|
+
return roundedInterval;
|
|
301
346
|
}
|
|
302
|
-
}
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
347
|
+
} else {
|
|
348
|
+
return 0.01;
|
|
349
|
+
}
|
|
350
|
+
};
|
|
351
|
+
// export type IncrementPropsByType =
|
|
352
|
+
// | {
|
|
353
|
+
// incrementType: IncrementType.fine | IncrementType.standard;
|
|
354
|
+
// delta?: number;
|
|
355
|
+
// incrementBy?: never;
|
|
356
|
+
// }
|
|
357
|
+
// | {
|
|
358
|
+
// incrementType: IncrementType.buttonUp | IncrementType.buttonDown;
|
|
359
|
+
// delta?: never;
|
|
360
|
+
// incrementBy?: number;
|
|
361
|
+
// };
|
|
362
|
+
// interface CommonIncrementProps {
|
|
363
|
+
// prevVal: number;
|
|
364
|
+
// interval?: number;
|
|
365
|
+
// min?: number;
|
|
366
|
+
// max?: number;
|
|
367
|
+
// }
|
|
368
|
+
const incrementValue = ({ incrementType, numSteps, delta, prevVal, interval, incrementBy, min = 0, max = 1 })=>{
|
|
369
|
+
const spreadDigitCount = Math.round(Math.abs(numSteps * interval)).toString().length;
|
|
370
|
+
const spread = numSteps * interval;
|
|
371
|
+
let initialSpreadMultiplier = 0.01;
|
|
372
|
+
let velocityMultiplier;
|
|
373
|
+
// let spreadMultiplier;
|
|
374
|
+
let spreadMultiplier;
|
|
375
|
+
if (spreadDigitCount <= 1) {
|
|
376
|
+
spreadMultiplier = 1;
|
|
377
|
+
} else if (spreadDigitCount === 2) {
|
|
378
|
+
spreadMultiplier = 10;
|
|
379
|
+
} else if (spreadDigitCount > 2 && spreadDigitCount > 5) {
|
|
380
|
+
spreadMultiplier = 20;
|
|
381
|
+
} else {
|
|
382
|
+
spreadMultiplier = 30;
|
|
383
|
+
}
|
|
384
|
+
if (delta && incrementType === IncrementType.fine) {
|
|
385
|
+
velocityMultiplier = Math.sign(delta);
|
|
386
|
+
} else if (delta && incrementType === IncrementType.standard) {
|
|
387
|
+
velocityMultiplier = delta * Math.max((spread ?? 0) * initialSpreadMultiplier, 0.7);
|
|
388
|
+
} else if (incrementBy && incrementType === IncrementType.button) {
|
|
389
|
+
velocityMultiplier = incrementBy;
|
|
390
|
+
} else {
|
|
391
|
+
velocityMultiplier = 0;
|
|
392
|
+
}
|
|
393
|
+
const normalisedInterval = getNormalisedInterval(interval ?? 0);
|
|
394
|
+
const newValue = (prevVal ?? 0) + velocityMultiplier * spreadMultiplier * normalisedInterval;
|
|
395
|
+
return parseFloat(newValue.toFixed(2));
|
|
396
|
+
};
|
|
397
|
+
const incrementIndex = ({ velocity = 0, numOptions, incrementBy, selectedIndex })=>{
|
|
398
|
+
let spreadMultiplier;
|
|
399
|
+
if (numOptions < 50) {
|
|
400
|
+
spreadMultiplier = 0.7;
|
|
401
|
+
} else if (numOptions >= 50 && numOptions < 150) {
|
|
402
|
+
spreadMultiplier = 3;
|
|
403
|
+
} else {
|
|
404
|
+
spreadMultiplier = 4;
|
|
405
|
+
}
|
|
406
|
+
const velocityMultiplier = Math.max(velocity, 1);
|
|
407
|
+
return velocity > 0.5 ? selectedIndex + incrementBy * velocityMultiplier * spreadMultiplier : selectedIndex + incrementBy;
|
|
309
408
|
};
|
|
310
|
-
let timerFlag = null;
|
|
311
|
-
function throttle(mainFunction, delay) {
|
|
312
|
-
return (...args)=>{
|
|
313
|
-
if (timerFlag === null) {
|
|
314
|
-
mainFunction(...args);
|
|
315
|
-
timerFlag = setTimeout(()=>{
|
|
316
|
-
timerFlag = null;
|
|
317
|
-
}, delay);
|
|
318
|
-
}
|
|
319
|
-
};
|
|
320
|
-
}
|
|
321
409
|
const generateDropShadowFilterString = (colors, radius)=>{
|
|
322
410
|
let output = [];
|
|
323
411
|
if (radius) {
|
|
@@ -348,6 +436,66 @@ const getBorderValue = (borderArray, borderDirection, returnNumericValue)=>{
|
|
|
348
436
|
return borderArray[0];
|
|
349
437
|
}
|
|
350
438
|
};
|
|
439
|
+
const animateBarChart = ({ animationFrameRef, elementRef, prevValRef, polarity, orientation })=>{
|
|
440
|
+
return (value)=>{
|
|
441
|
+
if (animationFrameRef.current) return;
|
|
442
|
+
const wholeNumberNormalisedValue = value * 100;
|
|
443
|
+
const unipolarValue = wholeNumberNormalisedValue ? parseFloat(wholeNumberNormalisedValue?.toFixed(2)) : 0;
|
|
444
|
+
const bipolarValue = (wholeNumberNormalisedValue - 50) / 100;
|
|
445
|
+
const scaleValue = value !== null && value !== undefined ? polarity === Polarity.unipolar ? orientation === Orientation.horizontal ? `scale(${Math.ceil(unipolarValue) * 0.01}, 1)` : `scale(1, ${Math.ceil(unipolarValue) * 0.01})` : orientation === Orientation.horizontal ? `scale(${bipolarValue}, 1)` : `scale(1, ${bipolarValue})` : 'none';
|
|
446
|
+
animationFrameRef.current = requestAnimationFrame(()=>{
|
|
447
|
+
if (elementRef.current) {
|
|
448
|
+
elementRef.current.style.transform = scaleValue;
|
|
449
|
+
}
|
|
450
|
+
});
|
|
451
|
+
prevValRef.current = value;
|
|
452
|
+
animationFrameRef.current = null;
|
|
453
|
+
};
|
|
454
|
+
};
|
|
455
|
+
const animateBarSliderHandle = ({ animationFrameRef, elementRef, prevValRef, margin, // polarity,
|
|
456
|
+
orientation })=>{
|
|
457
|
+
return (value)=>{
|
|
458
|
+
if (animationFrameRef.current) return;
|
|
459
|
+
const wholeNumberNormalisedValue = value * 100;
|
|
460
|
+
const normalisedValue = wholeNumberNormalisedValue ? parseFloat(wholeNumberNormalisedValue?.toFixed(2)) : 0;
|
|
461
|
+
const bottomValue = orientation === Orientation.horizontal ? `calc(50% - ${margin}px)` : `calc(${normalisedValue}% - ${margin}px)`;
|
|
462
|
+
const leftValue = orientation === Orientation.horizontal ? `calc(${normalisedValue}% - ${margin}px)` : `calc(50% - ${margin}px)`;
|
|
463
|
+
animationFrameRef.current = requestAnimationFrame(()=>{
|
|
464
|
+
if (elementRef.current) {
|
|
465
|
+
elementRef.current.style.bottom = bottomValue;
|
|
466
|
+
elementRef.current.style.left = leftValue;
|
|
467
|
+
}
|
|
468
|
+
});
|
|
469
|
+
prevValRef.current = value;
|
|
470
|
+
animationFrameRef.current = null;
|
|
471
|
+
};
|
|
472
|
+
};
|
|
473
|
+
const animateRotaryCircle = ({ animationFrameRef, elementRef, prevValRef, activeZone, polarity, circ })=>{
|
|
474
|
+
return (value)=>{
|
|
475
|
+
if (animationFrameRef.current) return;
|
|
476
|
+
const unipolarOffset = circ - activeZone * (value * 100) / 100;
|
|
477
|
+
const bipolarOffset = circ - activeZone * (value * 100 - 50) / 100;
|
|
478
|
+
animationFrameRef.current = requestAnimationFrame(()=>{
|
|
479
|
+
if (elementRef.current) {
|
|
480
|
+
elementRef.current.style.strokeDashoffset = `${polarity === Polarity.unipolar ? unipolarOffset : bipolarOffset}`;
|
|
481
|
+
}
|
|
482
|
+
});
|
|
483
|
+
prevValRef.current = value;
|
|
484
|
+
animationFrameRef.current = null;
|
|
485
|
+
};
|
|
486
|
+
};
|
|
487
|
+
const animateRotaryHandle = ({ animationFrameRef, elementRef, prevValRef, handleShape })=>{
|
|
488
|
+
return (value)=>{
|
|
489
|
+
if (animationFrameRef.current) return;
|
|
490
|
+
animationFrameRef.current = requestAnimationFrame(()=>{
|
|
491
|
+
if (elementRef.current) {
|
|
492
|
+
elementRef.current.style.transform = `${handleShape === RotarySliderHandleShapes.circle ? `rotate(${ -90 + value * 270}deg)` : `rotate(${ -225 + value * 270}deg)`}`;
|
|
493
|
+
}
|
|
494
|
+
});
|
|
495
|
+
prevValRef.current = value;
|
|
496
|
+
animationFrameRef.current = null;
|
|
497
|
+
};
|
|
498
|
+
};
|
|
351
499
|
|
|
352
500
|
//This component is a hack to create beveled edges on an element.
|
|
353
501
|
//This will be obsolete if/when Juce's browser supports
|
|
@@ -458,11 +606,11 @@ function BevelContainer({ width, height, fillColor, highlightFillColor, cornerBe
|
|
|
458
606
|
}
|
|
459
607
|
}
|
|
460
608
|
|
|
461
|
-
var css_248z$
|
|
462
|
-
styleInject(css_248z$
|
|
609
|
+
var css_248z$j = ".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: default;\n }\n}\n\n.Tabs-item::-moz-selection {\n background: transparent;\n}\n.Tabs-item::selection {\n background: transparent;\n}\n\n/* Tab styles */\n/* TODO: Refactor to use utility classes? */\n/* TODO: Clean up */\n/* TODO how do we want to style the scrollbars? */\n\n/* .Tabs-item {\n color: var(--bg-lv11);\n font-family: var(--font-leagueSpartan);\n background: var(--bg-lv2);\n} */\n\n.Tabs-item[data-headlessui-state='hover'],\n.Tabs-item[data-headlessui-state='hover active'],\n.tabs-item:focus,\n.tabs-item:focus-visible {\n filter: brightness(80%);\n}\n/* \n.Tabs-item[data-headlessui-state='selected hover'],\n.Tabs-item[data-headlessui-state='selected hover active'],\n.Tabs-item[data-headlessui-state='selected'],\n.Tabs-item[data-headlessui-state='selected focus'] {\n background: var(--bg-lv3);\n}\n\n.LFOTab .Tabs-item[data-headlessui-state='selected hover'] svg path,\n.LFOTab .Tabs-item[data-headlessui-state='selected hover active'] svg path,\n.LFOTab .Tabs-item[data-headlessui-state='selected'] svg path,\n.LFOTab .Tabs-item[data-headlessui-state='selected focus'] svg path,\n.LFOTab .Tabs-item[data-headlessui-state='selected hover'] svg line,\n.LFOTab .Tabs-item[data-headlessui-state='selected hover active'] svg line,\n.LFOTab .Tabs-item[data-headlessui-state='selected'] svg line,\n.LFOTab .Tabs-item[data-headlessui-state='selected focus'] svg line,\n.LFOTab .Tabs-item[data-headlessui-state='selected hover'] svg polyline,\n.LFOTab .Tabs-item[data-headlessui-state='selected hover active'] svg polyline,\n.LFOTab .Tabs-item[data-headlessui-state='selected'] svg polyline,\n.LFOTab .Tabs-item[data-headlessui-state='selected focus'] svg polyline {\n stroke: var(--color-brand) !important;\n}\n\n.LFOTab .Tabs-item[data-headlessui-state='selected hover'] .Label,\n.LFOTab .Tabs-item[data-headlessui-state='selected hover active'] .Label,\n.LFOTab .Tabs-item[data-headlessui-state='selected'] .Label,\n.LFOTab .Tabs-item[data-headlessui-state='selected focus'] .Label {\n color: var(--color-brand) !important;\n} */\n";
|
|
610
|
+
styleInject(css_248z$j);
|
|
463
611
|
|
|
464
|
-
var css_248z$
|
|
465
|
-
styleInject(css_248z$
|
|
612
|
+
var css_248z$i = ".Button {\n font-size: var(--text-xs);\n display: flex;\n align-items: center;\n justify-content: center;\n padding-right: var(--spacing-ms);\n padding-left: var(--spacing-ms);\n cursor: pointer;\n vertical-align: middle;\n white-space: nowrap;\n text-decoration: none;\n text-align: enter;\n border: 0;\n appearance: none;\n user-select: none;\n -webkit-user-select: none;\n &.xSmall {\n width: var(--spacing-ml);\n height: var(--spacing-ml);\n }\n &.small {\n font-size: var(--text-xs);\n min-width: 1rem;\n min-height: var(--spacing-sm);\n }\n &.large {\n border-radius: var(--radius-sm);\n min-width: 1rem;\n min-height: var(--spacing-xl);\n }\n}\n";
|
|
613
|
+
styleInject(css_248z$i);
|
|
466
614
|
|
|
467
615
|
var ButtonType;
|
|
468
616
|
(function(ButtonType) {
|
|
@@ -603,8 +751,8 @@ Button.type = ButtonType;
|
|
|
603
751
|
Button.width = ButtonSize;
|
|
604
752
|
Button.height = ButtonSize;
|
|
605
753
|
|
|
606
|
-
var css_248z$
|
|
607
|
-
styleInject(css_248z$
|
|
754
|
+
var css_248z$h = ".IconButton {\n cursor: pointer;\n}\n.IconButton:hover:not(:disabled) {\n filter: brightness(80%);\n}\n";
|
|
755
|
+
styleInject(css_248z$h);
|
|
608
756
|
|
|
609
757
|
var FlexDirection;
|
|
610
758
|
(function(FlexDirection) {
|
|
@@ -650,8 +798,8 @@ var LayoutTags;
|
|
|
650
798
|
LayoutTags["li"] = "li";
|
|
651
799
|
})(LayoutTags || (LayoutTags = {}));
|
|
652
800
|
|
|
653
|
-
var css_248z$
|
|
654
|
-
styleInject(css_248z$
|
|
801
|
+
var css_248z$g = ".divider-right:after {\n content: '';\n border-color: inherit;\n border-right-width: 1px;\n border-style: solid;\n position: absolute;\n right: 0;\n height: var(--spacing-xl);\n top: 50%;\n}\n\n.divider-left:after {\n content: '';\n border-color: inherit;\n border-left-width: 1px;\n border-style: solid;\n position: absolute;\n height: var(--spacing-xl);\n right: 0;\n top: 50%;\n}\n";
|
|
802
|
+
styleInject(css_248z$g);
|
|
655
803
|
|
|
656
804
|
var BoxDisplay;
|
|
657
805
|
(function(BoxDisplay) {
|
|
@@ -734,8 +882,8 @@ Box.padding = Spacing;
|
|
|
734
882
|
Box.flexWrap = FlexWrap;
|
|
735
883
|
Box.tag = LayoutTags;
|
|
736
884
|
|
|
737
|
-
var css_248z$
|
|
738
|
-
styleInject(css_248z$
|
|
885
|
+
var css_248z$f = ".Icon svg {\n width: 100%;\n}\n";
|
|
886
|
+
styleInject(css_248z$f);
|
|
739
887
|
|
|
740
888
|
var Icons;
|
|
741
889
|
(function(Icons) {
|
|
@@ -1833,14 +1981,6 @@ const useCombobox = ({ id, label, items = [], filter, onChange, displayValInHead
|
|
|
1833
1981
|
return filteredItems;
|
|
1834
1982
|
};
|
|
1835
1983
|
const filteredChoices = getFilteredChoices(items, filter);
|
|
1836
|
-
const incrementIndex = (velocity = 0)=>throttle(()=>{
|
|
1837
|
-
const returnVal = velocity > 0.25 ? selectedIndex + 1 + velocity : selectedIndex + 1;
|
|
1838
|
-
nextIndex.current = returnVal;
|
|
1839
|
-
}, 90)();
|
|
1840
|
-
const decrementIndex = (velocity = 0)=>throttle(()=>{
|
|
1841
|
-
const returnVal = velocity > 0.5 ? selectedIndex - 1 - velocity * 10 : selectedIndex - 1;
|
|
1842
|
-
nextIndex.current = returnVal;
|
|
1843
|
-
}, 90)();
|
|
1844
1984
|
// Used in RotaryCombobox
|
|
1845
1985
|
const bindDrag = useGesture({
|
|
1846
1986
|
onDrag: ({ direction, velocity })=>{
|
|
@@ -1859,9 +1999,23 @@ const useCombobox = ({ id, label, items = [], filter, onChange, displayValInHead
|
|
|
1859
1999
|
directionY = -1;
|
|
1860
2000
|
}
|
|
1861
2001
|
if (selectedIndex < choices.length && directionY && directionY === 1) {
|
|
1862
|
-
|
|
2002
|
+
// throttle(() => {
|
|
2003
|
+
nextIndex.current = incrementIndex({
|
|
2004
|
+
velocity: velocity[1],
|
|
2005
|
+
incrementBy: 1,
|
|
2006
|
+
numOptions: properties?.choices?.length,
|
|
2007
|
+
selectedIndex
|
|
2008
|
+
});
|
|
2009
|
+
// }, 90);
|
|
1863
2010
|
} else if (selectedIndex > 0 && directionY && directionY === -1) {
|
|
1864
|
-
|
|
2011
|
+
// throttle(() => {
|
|
2012
|
+
nextIndex.current = incrementIndex({
|
|
2013
|
+
velocity: velocity[1],
|
|
2014
|
+
incrementBy: -1,
|
|
2015
|
+
numOptions: properties?.choices?.length,
|
|
2016
|
+
selectedIndex
|
|
2017
|
+
});
|
|
2018
|
+
// }, 90);
|
|
1865
2019
|
}
|
|
1866
2020
|
// console.log(nextIndex.current, 'nextIndexnextIndexnextIndex');
|
|
1867
2021
|
if (nextIndex.current !== null && nextIndex.current !== undefined && nextIndex.current !== selectedIndex.current) {
|
|
@@ -2083,8 +2237,8 @@ function ComboboxComponent({ id, anchorTo, excludeItems = [], items, onChange, c
|
|
|
2083
2237
|
}, key);
|
|
2084
2238
|
}
|
|
2085
2239
|
|
|
2086
|
-
var css_248z$
|
|
2087
|
-
styleInject(css_248z$
|
|
2240
|
+
var css_248z$e = ".Combobox-items {\n box-shadow: rgba(0, 0, 0, 0.25) 0px 0px 5px 3px;\n border-radius: 4px;\n z-index: 50;\n scrollbar-width: thin;\n overflow-y: scroll;\n overflow-x: hidden;\n cursor: pointer;\n}\n.Combobox-items::-webkit-scrollbar {\n width: 10px;\n}\n\n.Combobox-item {\n display: flex;\n align-items: center;\n font-size: var(--text-sm);\n padding: var(--spacing-md) var(--spacing-xl);\n cursor: pointer;\n /* text-align: center; */\n}\n\n.Combobox-button:not(:disabled),\n.Combobox-arrow:not(:disabled),\n.Combobox-button-element:not(:disabled) {\n cursor: pointer;\n}\n";
|
|
2241
|
+
styleInject(css_248z$e);
|
|
2088
2242
|
|
|
2089
2243
|
function Combobox$1({ label, showLabel, color = 'var(--color-text)', labelColor, dropdownBorderWidth, dropdownBorderColor, dropdownBackgroundColor = 'var(--bg-lv4)', dropdownItemHighlightBackground, dropdownItemHighlightColor = 'var(--color-text)', dropdownSelectedItemColor, dropdownSelectedItemBackground, buttonHighlightBackground, buttonHighlightBorderColor = 'var(--bg-lv8)', buttonBorderColor = 'var(--bg-lv7)', buttonBorderRadius = 4, buttonBorderWidth = 1, buttonCornerBevel = [
|
|
2090
2244
|
0,
|
|
@@ -2361,8 +2515,8 @@ function Combobox({ id, key, label, showLabel = true, color, labelColor = 'var(-
|
|
|
2361
2515
|
Combobox.componentType = ComponentType;
|
|
2362
2516
|
Combobox.anchorTo = AnchorTo;
|
|
2363
2517
|
|
|
2364
|
-
var css_248z$
|
|
2365
|
-
styleInject(css_248z$
|
|
2518
|
+
var css_248z$d = ".TextInput {\n pointer-events: auto;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n}\n\n.TextInput::-moz-selection {\n background: transparent;\n}\n.TextInput::selection {\n background: transparent;\n}\n\n.TextInput:disabled {\n -webkit-user-select: none;\n user-select: none;\n}\n\n.isActive .TextInput {\n -webkit-user-select: auto;\n -moz-user-select: auto;\n -ms-user-select: auto;\n user-select: auto;\n}\n";
|
|
2519
|
+
styleInject(css_248z$d);
|
|
2366
2520
|
|
|
2367
2521
|
// import { decimalToPercent, percentToDecimal } from '../../common/utils';
|
|
2368
2522
|
// import debounce from 'lodash.debounce';
|
|
@@ -2513,45 +2667,6 @@ Input.type = InputTypes;
|
|
|
2513
2667
|
Input.textAlign = TextAlign;
|
|
2514
2668
|
Input.fontSize = FontSizes;
|
|
2515
2669
|
|
|
2516
|
-
var SliderType;
|
|
2517
|
-
(function(SliderType) {
|
|
2518
|
-
SliderType["bar"] = "bar";
|
|
2519
|
-
SliderType["rotary"] = "rotary";
|
|
2520
|
-
SliderType["custom"] = "custom";
|
|
2521
|
-
})(SliderType || (SliderType = {}));
|
|
2522
|
-
var SliderRotationBehavior;
|
|
2523
|
-
(function(SliderRotationBehavior) {
|
|
2524
|
-
SliderRotationBehavior["rotateIndicator"] = "rotateIndicator";
|
|
2525
|
-
SliderRotationBehavior["rotatehandle"] = "rotatehandle";
|
|
2526
|
-
SliderRotationBehavior["noRotation"] = "noRotation";
|
|
2527
|
-
})(SliderRotationBehavior || (SliderRotationBehavior = {}));
|
|
2528
|
-
var RotarySliderHandleShapes;
|
|
2529
|
-
(function(RotarySliderHandleShapes) {
|
|
2530
|
-
RotarySliderHandleShapes["circle"] = "circle";
|
|
2531
|
-
RotarySliderHandleShapes["rectangle"] = "rectangle";
|
|
2532
|
-
})(RotarySliderHandleShapes || (RotarySliderHandleShapes = {}));
|
|
2533
|
-
var RotarySliderSizes;
|
|
2534
|
-
(function(RotarySliderSizes) {
|
|
2535
|
-
RotarySliderSizes["small"] = "small";
|
|
2536
|
-
RotarySliderSizes["large"] = "large";
|
|
2537
|
-
})(RotarySliderSizes || (RotarySliderSizes = {}));
|
|
2538
|
-
const rotarySliderSizeMap = {
|
|
2539
|
-
[RotarySliderSizes.small]: {
|
|
2540
|
-
width: 40,
|
|
2541
|
-
height: 40
|
|
2542
|
-
},
|
|
2543
|
-
[RotarySliderSizes.large]: {
|
|
2544
|
-
width: 65,
|
|
2545
|
-
height: 65
|
|
2546
|
-
}
|
|
2547
|
-
};
|
|
2548
|
-
var TrackWidths;
|
|
2549
|
-
(function(TrackWidths) {
|
|
2550
|
-
TrackWidths["small"] = "small";
|
|
2551
|
-
TrackWidths["large"] = "large";
|
|
2552
|
-
TrackWidths["full"] = "full";
|
|
2553
|
-
})(TrackWidths || (TrackWidths = {}));
|
|
2554
|
-
|
|
2555
2670
|
// 20.0f, 15000.0f, 0.1f, 0.7f),800.0f
|
|
2556
2671
|
// ValueType rangeStart, ValueType rangeEnd, ValueType intervalValue, ValueType skewFactor, bool useSymmetricSkew=false)
|
|
2557
2672
|
const useSlider = ({ id, rowId, label, displayValInHeader = true, mockProperties = {
|
|
@@ -2559,10 +2674,23 @@ const useSlider = ({ id, rowId, label, displayValInHeader = true, mockProperties
|
|
|
2559
2674
|
end: 15000,
|
|
2560
2675
|
interval: 0.1,
|
|
2561
2676
|
skew: 0.7
|
|
2562
|
-
}, marks, isRandomizable, randomizerObject, resetterObject, isControlGroup = false, orientation = Orientation.vertical, dragOrientation = Orientation.vertical, mockInitialNormalisedValue = 0.0, updateModSlotPreview = true, onChange, sliderElementRef, isDisabled = false })=>{
|
|
2677
|
+
}, marks, isRandomizable, isStandalone, randomizerObject, resetterObject, isControlGroup = false, orientation = Orientation.vertical, dragOrientation = Orientation.vertical, mockInitialNormalisedValue = 0.0, updateModSlotPreview = true, onChange, sliderElementRef, isDisabled = false })=>{
|
|
2563
2678
|
// const sliderState: JuceSlider = Juce.getSliderState(id);
|
|
2564
2679
|
// if isLocalhost is true, the front end app is running outside of JUCE in a browser.
|
|
2680
|
+
const [ctrlIsDown, setCtrlIsDown] = useState(false);
|
|
2565
2681
|
const isLocalhost = window?.location?.hostname === 'localhost';
|
|
2682
|
+
const keyDownListener = (event)=>{
|
|
2683
|
+
if (event.key === 'Alt') {
|
|
2684
|
+
event.preventDefault();
|
|
2685
|
+
setCtrlIsDown(true);
|
|
2686
|
+
}
|
|
2687
|
+
};
|
|
2688
|
+
const keyUpListener = (event)=>{
|
|
2689
|
+
if (event.key === 'Alt') {
|
|
2690
|
+
event.preventDefault();
|
|
2691
|
+
setCtrlIsDown(false);
|
|
2692
|
+
}
|
|
2693
|
+
};
|
|
2566
2694
|
// getNormalisedValue:
|
|
2567
2695
|
/**
|
|
2568
2696
|
* Returns the normalised value of the corresponding backend parameter. This value is always in the
|
|
@@ -2572,16 +2700,14 @@ const useSlider = ({ id, rowId, label, displayValInHeader = true, mockProperties
|
|
|
2572
2700
|
* AudioProcessorParameter::getValue() (C++).
|
|
2573
2701
|
*/ // See https://github.com/juce-framework/JUCE/blob/51d11a2be6d5c97ccf12b4e5e827006e19f0555a/modules/juce_gui_extra/native/javascript/index.js#L230C1-L238C6
|
|
2574
2702
|
// NOTE: We can think of this as a percentage value, in 0 to 1 format
|
|
2575
|
-
const [scaledValue, setScaledValue] = useState(0);
|
|
2576
|
-
// const [normalisedValue, setNormalisedValue] = useState(0);
|
|
2577
2703
|
const [properties, setProperties] = useState();
|
|
2578
|
-
const
|
|
2579
|
-
const normalisedValueRef = useRef(null);
|
|
2704
|
+
const previousScaledValueRef = useRef(null);
|
|
2580
2705
|
const sliderState = Juce.getSliderState(id);
|
|
2581
|
-
const
|
|
2582
|
-
|
|
2583
|
-
const
|
|
2584
|
-
|
|
2706
|
+
// const numSteps = sliderState?.getNumSteps();
|
|
2707
|
+
const [scaledValue, setScaledValue] = useState(0);
|
|
2708
|
+
const [normalisedValue, setNormalisedValue] = useState(0);
|
|
2709
|
+
const dragInProgress = useRef(false);
|
|
2710
|
+
const { highlightedItemChanged, setDefaultParameter, updateModSlotRowTarget, getModSlotPreview, mainPanelrandomizerObject } = useGlobalContext();
|
|
2585
2711
|
const randomizerObjectToUse = randomizerObject && Object.keys(randomizerObject).length > 0 ? randomizerObject : mainPanelrandomizerObject;
|
|
2586
2712
|
const modSlotPreview = getModSlotPreview();
|
|
2587
2713
|
// Set the initial state
|
|
@@ -2589,16 +2715,10 @@ const useSlider = ({ id, rowId, label, displayValInHeader = true, mockProperties
|
|
|
2589
2715
|
useEffect(()=>{
|
|
2590
2716
|
const setRandom = ()=>{
|
|
2591
2717
|
const randomValue = randomizeValue(sliderState?.properties?.start, sliderState?.properties?.end);
|
|
2592
|
-
|
|
2593
|
-
scaledValue: randomValue,
|
|
2594
|
-
start: sliderState?.properties?.start,
|
|
2595
|
-
end: sliderState?.properties?.end,
|
|
2596
|
-
skew: sliderState?.properties?.skew
|
|
2597
|
-
});
|
|
2598
|
-
setNormalisedState(clamp(newValue));
|
|
2718
|
+
setJuceScaledValue(randomValue);
|
|
2599
2719
|
};
|
|
2600
2720
|
const clearValue = ()=>{
|
|
2601
|
-
|
|
2721
|
+
setJuceScaledValue(0);
|
|
2602
2722
|
};
|
|
2603
2723
|
if (!isLocalhost) {
|
|
2604
2724
|
resetterObject?.subscribe(clearValue, id);
|
|
@@ -2613,41 +2733,30 @@ const useSlider = ({ id, rowId, label, displayValInHeader = true, mockProperties
|
|
|
2613
2733
|
} else {
|
|
2614
2734
|
// This sets 'mockProperties' as the value for 'properties' if the app is running in a browser.
|
|
2615
2735
|
setProperties(mockProperties);
|
|
2616
|
-
normalisedValueRef.current = mockInitialNormalisedValue;
|
|
2617
2736
|
}
|
|
2618
2737
|
}, []);
|
|
2619
2738
|
// TODO: take out mod slot logic
|
|
2620
|
-
const changeHandler = (
|
|
2621
|
-
const scaledValue = normalisedToScaled({
|
|
2622
|
-
normalisedValue,
|
|
2623
|
-
properties: sliderState?.properties
|
|
2624
|
-
});
|
|
2739
|
+
const changeHandler = (scaledValue, sliderId)=>{
|
|
2625
2740
|
if (rowId === modSlotPreview?.targetIndex) {
|
|
2626
2741
|
onChange && onChange(parseFloat(scaledValue.toFixed(2)), rowId);
|
|
2627
2742
|
} else {
|
|
2628
2743
|
onChange && onChange(parseFloat(scaledValue.toFixed(2)), sliderId);
|
|
2629
2744
|
}
|
|
2630
2745
|
};
|
|
2631
|
-
// Update
|
|
2632
|
-
const
|
|
2633
|
-
|
|
2634
|
-
|
|
2635
|
-
|
|
2636
|
-
|
|
2637
|
-
if (scaledValue !== prevValueRef.current) {
|
|
2638
|
-
setScaledValue(scaledValue);
|
|
2639
|
-
if (displayValInHeader && scaledValueRef?.current !== scaledValue && (label || properties?.name)) {
|
|
2640
|
-
highlightedItemChanged({
|
|
2641
|
-
label: label || properties?.name || '',
|
|
2642
|
-
value: scaledValue
|
|
2643
|
-
});
|
|
2644
|
-
}
|
|
2645
|
-
prevValueRef.current = scaledValue;
|
|
2746
|
+
// Update JUCE state
|
|
2747
|
+
const setJuceScaledValue = (newValue)=>{
|
|
2748
|
+
if (previousScaledValueRef?.current !== newValue) {
|
|
2749
|
+
!isLocalhost && sliderState.setScaledValue(clamp(newValue, sliderState?.properties?.start, sliderState?.properties?.end));
|
|
2750
|
+
rowId && changeHandler(newValue, rowId);
|
|
2751
|
+
previousScaledValueRef.current = newValue;
|
|
2646
2752
|
}
|
|
2647
2753
|
};
|
|
2648
|
-
//
|
|
2754
|
+
// Rerender the component when the ID changes
|
|
2649
2755
|
useEffect(()=>{
|
|
2650
|
-
|
|
2756
|
+
const sliderState = Juce.getSliderState(id);
|
|
2757
|
+
setNormalisedValue(sliderState.getNormalisedValue());
|
|
2758
|
+
setScaledValue(sliderState?.scaledValue);
|
|
2759
|
+
setProperties(sliderState.properties);
|
|
2651
2760
|
}, [
|
|
2652
2761
|
id
|
|
2653
2762
|
]);
|
|
@@ -2655,11 +2764,24 @@ const useSlider = ({ id, rowId, label, displayValInHeader = true, mockProperties
|
|
|
2655
2764
|
//@ts-expect-error
|
|
2656
2765
|
useEffect(()=>{
|
|
2657
2766
|
if (!isLocalhost) {
|
|
2767
|
+
document.addEventListener('keydown', keyDownListener);
|
|
2768
|
+
document.addEventListener('keyup', keyUpListener);
|
|
2658
2769
|
const valueListenerId = sliderState?.valueChangedEvent.addListener(()=>{
|
|
2659
|
-
|
|
2770
|
+
const sliderState = Juce.getSliderState(id);
|
|
2771
|
+
setNormalisedValue(sliderState.getNormalisedValue());
|
|
2772
|
+
setScaledValue(parseFloat(sliderState?.scaledValue.toFixed(2)));
|
|
2773
|
+
if (displayValInHeader && (label || properties?.name)) {
|
|
2774
|
+
highlightedItemChanged({
|
|
2775
|
+
label: label || properties?.name || '',
|
|
2776
|
+
value: parseFloat(sliderState?.scaledValue.toFixed(2))
|
|
2777
|
+
});
|
|
2778
|
+
}
|
|
2660
2779
|
});
|
|
2661
2780
|
const propertiesListenerId = sliderState?.propertiesChangedEvent.addListener(()=>setProperties(sliderState?.properties));
|
|
2781
|
+
previousScaledValueRef.current = sliderState.scaledValue;
|
|
2662
2782
|
return ()=>{
|
|
2783
|
+
document.removeEventListener('keydown', keyDownListener);
|
|
2784
|
+
document.removeEventListener('keyup', keyUpListener);
|
|
2663
2785
|
sliderState?.valueChangedEvent.removeListener(valueListenerId);
|
|
2664
2786
|
sliderState?.propertiesChangedEvent.removeListener(propertiesListenerId);
|
|
2665
2787
|
};
|
|
@@ -2668,146 +2790,61 @@ const useSlider = ({ id, rowId, label, displayValInHeader = true, mockProperties
|
|
|
2668
2790
|
window,
|
|
2669
2791
|
changeHandler
|
|
2670
2792
|
]);
|
|
2671
|
-
// Update JUCE state
|
|
2672
|
-
const setNormalisedState = (newValue)=>{
|
|
2673
|
-
const stringValue = parseFloat(`${newValue}`);
|
|
2674
|
-
if (normalisedValueRef?.current !== stringValue) {
|
|
2675
|
-
!isLocalhost && sliderState.setNormalisedValue(clamp(stringValue));
|
|
2676
|
-
rowId && changeHandler(newValue, rowId);
|
|
2677
|
-
normalisedValueRef.current = stringValue;
|
|
2678
|
-
}
|
|
2679
|
-
};
|
|
2680
2793
|
const bindDrag = useGesture({
|
|
2681
|
-
|
|
2682
|
-
if (
|
|
2683
|
-
highlightedItemChanged({
|
|
2684
|
-
label: label || properties?.name || '',
|
|
2685
|
-
value: scaledValue
|
|
2686
|
-
});
|
|
2687
|
-
}
|
|
2688
|
-
},
|
|
2689
|
-
onMouseLeave: ()=>{
|
|
2690
|
-
highlightedItemChanged();
|
|
2691
|
-
},
|
|
2692
|
-
onDrag: ({ event, delta })=>{
|
|
2693
|
-
//TODO: Move this out of useSlider
|
|
2694
|
-
// Sets the slider as a mod slot preview
|
|
2695
|
-
if (updateModSlotPreview) {
|
|
2696
|
-
updateModSlotRowTarget({
|
|
2697
|
-
rowId: modSlotPreview?.rowId,
|
|
2698
|
-
value: id
|
|
2699
|
-
});
|
|
2700
|
-
}
|
|
2701
|
-
if (!dragInProgress) {
|
|
2794
|
+
onMouseDown: ()=>{
|
|
2795
|
+
if (!dragInProgress.current) {
|
|
2702
2796
|
sliderState.sliderDragStarted(id);
|
|
2703
|
-
dragInProgress = true;
|
|
2797
|
+
dragInProgress.current = true;
|
|
2704
2798
|
}
|
|
2705
|
-
const deltaVal = delta[1] * -1;
|
|
2706
|
-
const newValue = incrementValue({
|
|
2707
|
-
incomingVal: deltaVal,
|
|
2708
|
-
prevVal: normalisedValueRef.current || 0,
|
|
2709
|
-
interval: properties?.interval
|
|
2710
|
-
});
|
|
2711
|
-
setNormalisedState(newValue);
|
|
2712
2799
|
},
|
|
2713
|
-
|
|
2714
|
-
|
|
2715
|
-
|
|
2716
|
-
|
|
2717
|
-
|
|
2718
|
-
|
|
2719
|
-
|
|
2720
|
-
|
|
2721
|
-
|
|
2722
|
-
|
|
2723
|
-
|
|
2724
|
-
|
|
2725
|
-
|
|
2726
|
-
|
|
2800
|
+
onDrag: ({ event, delta })=>{
|
|
2801
|
+
if (event?.buttons === 1 && dragInProgress.current) {
|
|
2802
|
+
//TODO: Move this out of useSlider
|
|
2803
|
+
// Sets the slider as a mod slot preview
|
|
2804
|
+
if (updateModSlotPreview) {
|
|
2805
|
+
updateModSlotRowTarget({
|
|
2806
|
+
rowId: modSlotPreview?.rowId,
|
|
2807
|
+
value: id
|
|
2808
|
+
});
|
|
2809
|
+
}
|
|
2810
|
+
if (isStandalone && !dragInProgress?.current) {
|
|
2811
|
+
sliderState.sliderDragStarted(id);
|
|
2812
|
+
}
|
|
2813
|
+
const deltaVal = dragOrientation === Orientation.vertical ? delta[1] * -1 : delta[0];
|
|
2814
|
+
const newValue = incrementValue({
|
|
2815
|
+
delta: deltaVal,
|
|
2816
|
+
numSteps: properties?.numSteps ?? 0,
|
|
2817
|
+
incrementType: ctrlIsDown ? IncrementType.fine : IncrementType.standard,
|
|
2818
|
+
prevVal: previousScaledValueRef.current || 0,
|
|
2819
|
+
interval: properties?.interval ?? 0,
|
|
2820
|
+
min: properties?.start,
|
|
2821
|
+
max: properties?.end
|
|
2727
2822
|
});
|
|
2823
|
+
setJuceScaledValue(newValue);
|
|
2728
2824
|
}
|
|
2729
2825
|
},
|
|
2730
2826
|
onMouseLeave: ()=>{
|
|
2731
2827
|
highlightedItemChanged();
|
|
2732
2828
|
},
|
|
2733
|
-
|
|
2734
|
-
|
|
2735
|
-
|
|
2736
|
-
dragInProgress = true;
|
|
2737
|
-
}
|
|
2738
|
-
},
|
|
2739
|
-
onDrag: ({ event, movement })=>{
|
|
2740
|
-
const parentSlider = event?.target.closest('[data-sliderElement]');
|
|
2741
|
-
const sliderTarget = event?.target.dataset.handle ? parentSlider : event?.target;
|
|
2742
|
-
const rect = sliderTarget?.getBoundingClientRect();
|
|
2743
|
-
const y = event?.clientY - rect.top;
|
|
2744
|
-
const x = event?.clientX - rect.left;
|
|
2745
|
-
// Sets the slider as a mod slot preview
|
|
2746
|
-
if (updateModSlotPreview) {
|
|
2747
|
-
updateModSlotRowTarget({
|
|
2748
|
-
rowId: modSlotPreview?.rowId,
|
|
2749
|
-
value: id
|
|
2750
|
-
});
|
|
2751
|
-
}
|
|
2752
|
-
hasMoved = dragOrientation === Orientation.vertical ? movement[1] !== 0 : movement[0] !== 0;
|
|
2753
|
-
const ignoreMoveStatus = !isControlGroup;
|
|
2754
|
-
if (event.buttons === 1) {
|
|
2755
|
-
if (isControlGroup) {
|
|
2756
|
-
document.body.classList.add('cursor-hidden');
|
|
2757
|
-
}
|
|
2758
|
-
let newValue = null;
|
|
2759
|
-
if (orientation === Orientation.vertical && (hasMoved || ignoreMoveStatus)) {
|
|
2760
|
-
newValue = 1 - y / rect.height;
|
|
2761
|
-
} else if (orientation === Orientation.horizontal && dragOrientation === Orientation.vertical && (hasMoved || ignoreMoveStatus)) {
|
|
2762
|
-
// console.log(movement, hasMoved, 'movementinelesif');
|
|
2763
|
-
newValue = 1 - y / rect.width;
|
|
2764
|
-
} else if (hasMoved || ignoreMoveStatus) {
|
|
2765
|
-
newValue = x / rect.width;
|
|
2766
|
-
}
|
|
2767
|
-
newValue && setNormalisedState(clamp(newValue));
|
|
2768
|
-
}
|
|
2769
|
-
},
|
|
2770
|
-
onMouseUp: ({ event })=>{
|
|
2771
|
-
document.body.classList.remove('cursor-hidden');
|
|
2772
|
-
if (dragInProgress = true) {
|
|
2773
|
-
dragInProgress = false;
|
|
2774
|
-
sliderState.sliderDragEnded();
|
|
2775
|
-
}
|
|
2829
|
+
onMouseUp: ()=>{
|
|
2830
|
+
dragInProgress.current = false;
|
|
2831
|
+
sliderState.sliderDragEnded();
|
|
2776
2832
|
}
|
|
2777
2833
|
}, {
|
|
2778
2834
|
enabled: !isDisabled
|
|
2779
2835
|
});
|
|
2780
|
-
const
|
|
2781
|
-
|
|
2782
|
-
if (
|
|
2783
|
-
highlightedItemChanged({
|
|
2784
|
-
label: label || properties?.name || '',
|
|
2785
|
-
value: scaledValue
|
|
2786
|
-
});
|
|
2787
|
-
}
|
|
2788
|
-
if (event.buttons === 1) {
|
|
2789
|
-
let newValue;
|
|
2790
|
-
const rect = event?.target?.getBoundingClientRect();
|
|
2791
|
-
const y = event?.clientY - rect.top;
|
|
2792
|
-
// const x = event?.clientX - rect.left;
|
|
2793
|
-
newValue = 1 - y / rect.height;
|
|
2794
|
-
setNormalisedState(clamp(newValue));
|
|
2795
|
-
}
|
|
2796
|
-
},
|
|
2797
|
-
onMouseDown: ({ event })=>{
|
|
2798
|
-
if (!dragInProgress) {
|
|
2836
|
+
const bindSequenceDrag = useGesture({
|
|
2837
|
+
onMouseDown: ()=>{
|
|
2838
|
+
if (!dragInProgress.current) {
|
|
2799
2839
|
sliderState.sliderDragStarted(id);
|
|
2800
|
-
dragInProgress = true;
|
|
2840
|
+
dragInProgress.current = true;
|
|
2801
2841
|
}
|
|
2802
2842
|
},
|
|
2803
|
-
|
|
2804
|
-
highlightedItemChanged();
|
|
2805
|
-
},
|
|
2806
|
-
onMouseMove: ({ event })=>{
|
|
2807
|
-
const rect = event?.target?.getBoundingClientRect();
|
|
2808
|
-
const y = event?.clientY - rect.top;
|
|
2809
|
-
const x = event?.clientX - rect.left;
|
|
2843
|
+
onMove: ({ event })=>{
|
|
2810
2844
|
if (event?.buttons === 1) {
|
|
2845
|
+
const rect = event?.target?.getBoundingClientRect();
|
|
2846
|
+
const y = event?.clientY - rect.top;
|
|
2847
|
+
const x = event?.clientX - rect.left;
|
|
2811
2848
|
// TODO: Increments?
|
|
2812
2849
|
let newValue;
|
|
2813
2850
|
if (orientation === Orientation.vertical) {
|
|
@@ -2817,37 +2854,37 @@ const useSlider = ({ id, rowId, label, displayValInHeader = true, mockProperties
|
|
|
2817
2854
|
} else {
|
|
2818
2855
|
newValue = x / rect.width;
|
|
2819
2856
|
}
|
|
2820
|
-
|
|
2857
|
+
setJuceScaledValue(newValue);
|
|
2821
2858
|
}
|
|
2822
2859
|
},
|
|
2823
|
-
|
|
2824
|
-
|
|
2825
|
-
|
|
2826
|
-
|
|
2827
|
-
|
|
2860
|
+
onMouseLeave: ()=>{
|
|
2861
|
+
highlightedItemChanged();
|
|
2862
|
+
},
|
|
2863
|
+
onMouseUp: ()=>{
|
|
2864
|
+
dragInProgress.current = false;
|
|
2865
|
+
sliderState.sliderDragEnded();
|
|
2828
2866
|
}
|
|
2829
2867
|
}, {
|
|
2830
2868
|
enabled: !isDisabled
|
|
2831
2869
|
});
|
|
2832
2870
|
const setToDefaultState = ()=>setDefaultParameter(id);
|
|
2833
2871
|
return {
|
|
2834
|
-
|
|
2872
|
+
setScaledState: setJuceScaledValue,
|
|
2835
2873
|
setToDefaultState,
|
|
2836
2874
|
scaledToNormalised,
|
|
2837
|
-
bindBarSliderDrag,
|
|
2838
|
-
bindSequenceBarSliderDrag,
|
|
2839
2875
|
bindDrag,
|
|
2840
|
-
|
|
2876
|
+
bindSequenceDrag,
|
|
2877
|
+
normalisedValue,
|
|
2841
2878
|
scaledValue,
|
|
2842
2879
|
properties
|
|
2843
2880
|
};
|
|
2844
2881
|
};
|
|
2845
2882
|
|
|
2846
|
-
var css_248z$
|
|
2847
|
-
styleInject(css_248z$
|
|
2883
|
+
var css_248z$c = ".RotarySlider {\n position: relative;\n display: flex;\n flex-direction: column;\n justify-content: center;\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}\n\n.RotarySlider-Indicator-handle {\n position: absolute;\n top: 3px;\n right: 0;\n left: 50%;\n width: 3px;\n height: 50%;\n transform: translate(-50%, 0) rotate(0) skewX(0) skewY(0) scaleX(1) scaleY(1);\n}\n\n.RotarySlider-center-marker {\n width: 3px;\n height: 6px;\n}\n\n.RotarySlider-CenterCircle {\n position: relative;\n border-radius: 100%;\n border: 2px solid var(--color-gray-300);\n /* background: var(--color-gray-800); */\n background: radial-gradient(\n circle at center,\n var(--bg-lv4) 50%,\n var(--bg-lv3) 80%\n );\n}\n\n.RotarySlider-CenterCircle:after {\n content: '';\n width: 4px;\n height: 4px;\n background: var(--color-gray-300);\n border-radius: 100%;\n position: absolute;\n left: 8px;\n top: 3px;\n}\n\n.RotarySlider-positioning-wrapper {\n position: absolute;\n height: 100%;\n width: 100%;\n}\n.ProgressCircle {\n fill: none;\n pointer-events: none;\n}\n\n.ProgressCircle-value {\n text-align: center;\n margin-top: -4px;\n height: 0.8rem;\n line-height: 0.8rem;\n}\n\n.ProgressCircle-bg {\n stroke-width: 3px;\n transform-origin: center;\n /* transform: rotate(135deg); */\n font-size: var(--text-sm);\n pointer-events: none;\n}\n.ProgressCircle-fg {\n stroke-width: 3px;\n /* stroke-dasharray: 75; */\n /* stroke-dashoffset: calc(880 - (660 * 0) / 100); */\n transform-origin: center;\n pointer-events: none;\n}\n\n.corner-border {\n --b: 1px; /* thickness of the border */\n --c: var(--color-gray-500); /* color of the border */\n --w: 5px; /* width of border */\n\n border: var(--b) solid #0000; /* space for the border */\n --_g: #0000 90deg, var(--c) 0;\n --_p: var(--w) var(--w) border-box no-repeat;\n background:\n conic-gradient(from 90deg at top var(--b) left var(--b), var(--_g)) 0 0 /\n var(--_p),\n conic-gradient(from 180deg at top var(--b) right var(--b), var(--_g)) 100% 0 /\n var(--_p),\n conic-gradient(from 0deg at bottom var(--b) left var(--b), var(--_g)) 0 100% /\n var(--_p),\n conic-gradient(from -90deg at bottom var(--b) right var(--b), var(--_g))\n 100% 100% / var(--_p);\n}\n";
|
|
2884
|
+
styleInject(css_248z$c);
|
|
2848
2885
|
|
|
2849
|
-
var css_248z$
|
|
2850
|
-
styleInject(css_248z$
|
|
2886
|
+
var css_248z$b = "";
|
|
2887
|
+
styleInject(css_248z$b);
|
|
2851
2888
|
|
|
2852
2889
|
function ControlGroup({ id, isDisabled = false, className, onChangeActiveState, children, width = 'auto' }) {
|
|
2853
2890
|
// EXPECTED CONTROL GROUP STRUCTURE
|
|
@@ -2877,7 +2914,9 @@ function ControlGroup({ id, isDisabled = false, className, onChangeActiveState,
|
|
|
2877
2914
|
const increment = ()=>{
|
|
2878
2915
|
const normalisedVal = sliderState?.getNormalisedValue();
|
|
2879
2916
|
const newValue = incrementValue({
|
|
2880
|
-
|
|
2917
|
+
incrementType: IncrementType.button,
|
|
2918
|
+
incrementBy: 10,
|
|
2919
|
+
numSteps: sliderState?.properties?.numSteps,
|
|
2881
2920
|
prevVal: normalisedVal,
|
|
2882
2921
|
interval: sliderState?.properties?.interval
|
|
2883
2922
|
});
|
|
@@ -2886,7 +2925,9 @@ function ControlGroup({ id, isDisabled = false, className, onChangeActiveState,
|
|
|
2886
2925
|
const decrement = ()=>{
|
|
2887
2926
|
const normalisedVal = sliderState?.getNormalisedValue();
|
|
2888
2927
|
const newValue = incrementValue({
|
|
2889
|
-
|
|
2928
|
+
incrementType: IncrementType.button,
|
|
2929
|
+
incrementBy: -10,
|
|
2930
|
+
numSteps: sliderState?.properties?.numSteps,
|
|
2890
2931
|
prevVal: normalisedVal,
|
|
2891
2932
|
interval: sliderState?.properties?.interval
|
|
2892
2933
|
});
|
|
@@ -2928,8 +2969,24 @@ const ProgressCircle = ({ width, height, polarity = Polarity.unipolar, strokeWid
|
|
|
2928
2969
|
indicatorLineColor, indicatorLineGradient, outerGlowRadius, outerGlowColors = [], blur, indicatorLineRange, trackColor, radius, circ, activeZone, normalisedValue })=>{
|
|
2929
2970
|
const cx = '50%';
|
|
2930
2971
|
const cy = '51%';
|
|
2931
|
-
const
|
|
2932
|
-
const
|
|
2972
|
+
const animationFrameRef = useRef(null);
|
|
2973
|
+
const prevValRef = useRef(null);
|
|
2974
|
+
const sliderElementRef = useRef(null);
|
|
2975
|
+
const animate = animateRotaryCircle({
|
|
2976
|
+
animationFrameRef,
|
|
2977
|
+
elementRef: sliderElementRef,
|
|
2978
|
+
polarity,
|
|
2979
|
+
prevValRef,
|
|
2980
|
+
activeZone,
|
|
2981
|
+
circ
|
|
2982
|
+
});
|
|
2983
|
+
useEffect(()=>{
|
|
2984
|
+
if (normalisedValue !== null && normalisedValue !== undefined && normalisedValue !== prevValRef.current) {
|
|
2985
|
+
animate(normalisedValue);
|
|
2986
|
+
}
|
|
2987
|
+
}, [
|
|
2988
|
+
normalisedValue
|
|
2989
|
+
]);
|
|
2933
2990
|
return jsxs("svg", {
|
|
2934
2991
|
className: "ProgressCircle",
|
|
2935
2992
|
width: width,
|
|
@@ -2961,6 +3018,7 @@ indicatorLineColor, indicatorLineGradient, outerGlowRadius, outerGlowColors = []
|
|
|
2961
3018
|
}
|
|
2962
3019
|
}),
|
|
2963
3020
|
jsx("circle", {
|
|
3021
|
+
ref: sliderElementRef,
|
|
2964
3022
|
id: "circle2",
|
|
2965
3023
|
className: "ProgressCircle-fg",
|
|
2966
3024
|
cx: cx,
|
|
@@ -2972,7 +3030,6 @@ indicatorLineColor, indicatorLineGradient, outerGlowRadius, outerGlowColors = []
|
|
|
2972
3030
|
strokeDasharray: circ,
|
|
2973
3031
|
// transform: `rotate(${polarity === Polarity.unipolar ? '135deg' : '270deg'})`,
|
|
2974
3032
|
transform: polarity === Polarity.unipolar ? 'rotate(135deg)' : 'rotate(270deg)',
|
|
2975
|
-
strokeDashoffset: polarity === Polarity.unipolar ? unipolarOffset : bipolarOffset,
|
|
2976
3033
|
filter: generateDropShadowFilterString(outerGlowColors, outerGlowRadius)
|
|
2977
3034
|
}
|
|
2978
3035
|
}),
|
|
@@ -3023,14 +3080,30 @@ const InnerCircle = ({ size = RotarySliderSizes.small, handleShape = RotarySlide
|
|
|
3023
3080
|
const squareHandleY = size === RotarySliderSizes.small ? -31 : -62;
|
|
3024
3081
|
const circleHandleX = size === RotarySliderSizes.small ? 16 : 20;
|
|
3025
3082
|
const circleHandleY = size === RotarySliderSizes.small ? 16 : 20;
|
|
3083
|
+
const handleElementRef = useRef(null);
|
|
3084
|
+
const animationFrameRef = useRef(null);
|
|
3085
|
+
const prevValRef = useRef(null);
|
|
3086
|
+
const animateHandle = animateRotaryHandle({
|
|
3087
|
+
animationFrameRef,
|
|
3088
|
+
elementRef: handleElementRef,
|
|
3089
|
+
prevValRef,
|
|
3090
|
+
handleShape
|
|
3091
|
+
});
|
|
3092
|
+
useEffect(()=>{
|
|
3093
|
+
if (normalisedValue !== null && normalisedValue !== undefined && normalisedValue !== prevValRef.current) {
|
|
3094
|
+
animateHandle(normalisedValue);
|
|
3095
|
+
}
|
|
3096
|
+
}, [
|
|
3097
|
+
normalisedValue
|
|
3098
|
+
]);
|
|
3026
3099
|
return jsxs("svg", {
|
|
3027
3100
|
className: "InnerCircle",
|
|
3028
3101
|
width: width,
|
|
3029
3102
|
height: height,
|
|
3030
3103
|
style: {
|
|
3031
|
-
filter: `blur(${blur}px)
|
|
3032
|
-
transform: handleShape === RotarySliderHandleShapes.circle ? `rotate(${ -90 + normalisedValue * 270}deg)` : `rotate(${ -225 + normalisedValue * 270}deg)`
|
|
3104
|
+
filter: `blur(${blur}px)`
|
|
3033
3105
|
},
|
|
3106
|
+
ref: handleElementRef,
|
|
3034
3107
|
children: [
|
|
3035
3108
|
jsx("circle", {
|
|
3036
3109
|
id: "InnerCircle",
|
|
@@ -3263,7 +3336,6 @@ function RotaryCircle({ polarity = Polarity.unipolar, className, id, trackWidth
|
|
|
3263
3336
|
const circ = 2 * 3.14 * radius;
|
|
3264
3337
|
const inactiveArea = 1 - indicatorLineActiveArea;
|
|
3265
3338
|
const activeZone = circ - circ * inactiveArea;
|
|
3266
|
-
// console.log(handleShape, 'MARKERSHAPE');
|
|
3267
3339
|
return jsx(Box, {
|
|
3268
3340
|
id: id,
|
|
3269
3341
|
tabIndex: 0,
|
|
@@ -3396,8 +3468,8 @@ function AnimationDataWrapper({ renderFunction, eventId, children }) {
|
|
|
3396
3468
|
});
|
|
3397
3469
|
}
|
|
3398
3470
|
|
|
3399
|
-
var css_248z$
|
|
3400
|
-
styleInject(css_248z$
|
|
3471
|
+
var css_248z$a = ".canvasContainer {\n --color-brand: #bb68d9;\n}\n";
|
|
3472
|
+
styleInject(css_248z$a);
|
|
3401
3473
|
|
|
3402
3474
|
// import * as d3 from 'd3';
|
|
3403
3475
|
// import * as Juce from '@antimatter-audio/juce-framework-frontend';
|
|
@@ -3511,7 +3583,7 @@ indicatorId, indicatorLineColor, indicatorLineGradient = GradientStyles.unicolor
|
|
|
3511
3583
|
interval: 0.1,
|
|
3512
3584
|
skew: 0.7
|
|
3513
3585
|
}, style }) {
|
|
3514
|
-
const { bindDrag, normalisedValue, scaledValue, setToDefaultState,
|
|
3586
|
+
const { bindDrag, normalisedValue, scaledValue, setToDefaultState, setScaledState, properties } = useSlider({
|
|
3515
3587
|
id,
|
|
3516
3588
|
label,
|
|
3517
3589
|
resetterObject,
|
|
@@ -3521,6 +3593,11 @@ indicatorId, indicatorLineColor, indicatorLineGradient = GradientStyles.unicolor
|
|
|
3521
3593
|
isRandomizable,
|
|
3522
3594
|
randomizerObject
|
|
3523
3595
|
});
|
|
3596
|
+
// console.log(
|
|
3597
|
+
// normalisedValue,
|
|
3598
|
+
// scaledValue,
|
|
3599
|
+
// 'normalisedValuenormalisedValuenormalisedValuenormalisedValuenormalisedValue',
|
|
3600
|
+
// );
|
|
3524
3601
|
// const defaultGradientColor =
|
|
3525
3602
|
// size === RotarySliderSizes.large
|
|
3526
3603
|
// ? GradientStyles.multicolor
|
|
@@ -3600,13 +3677,7 @@ indicatorId, indicatorLineColor, indicatorLineGradient = GradientStyles.unicolor
|
|
|
3600
3677
|
maxWidth: `${rotarySliderSizeMap?.[size]?.width}px`
|
|
3601
3678
|
},
|
|
3602
3679
|
onComplete: (value)=>{
|
|
3603
|
-
|
|
3604
|
-
scaledValue: value,
|
|
3605
|
-
start: properties?.start,
|
|
3606
|
-
end: properties?.end,
|
|
3607
|
-
skew: properties?.skew
|
|
3608
|
-
});
|
|
3609
|
-
normalisedVal !== undefined && setNormalisedState(normalisedVal);
|
|
3680
|
+
value !== undefined && setScaledState(value);
|
|
3610
3681
|
}
|
|
3611
3682
|
})
|
|
3612
3683
|
]
|
|
@@ -3619,8 +3690,8 @@ RotarySlider.handleShape = RotarySliderHandleShapes;
|
|
|
3619
3690
|
RotarySlider.gradient = GradientStyles;
|
|
3620
3691
|
RotarySlider.trackWidth = TrackWidths;
|
|
3621
3692
|
|
|
3622
|
-
var css_248z$
|
|
3623
|
-
styleInject(css_248z$
|
|
3693
|
+
var css_248z$9 = ".BarSlider-innerWrapper:hover {\n cursor: pointer;\n}\n\n.BarSlider-Track {\n touch-action: none;\n position: relative;\n width: 100%;\n height: 100%;\n max-height: 100%;\n max-width: 100%;\n background-color: var(--bg-lv5);\n}\n\n.BarSlider-Track.isHighlighted {\n background-color: var(--bg-lv6);\n}\n.Barslider-IndicatorLineWrapper,\n.BarSlider-HandleWrapper {\n position: absolute;\n pointer-events: none;\n}\n\n.BarSlider-IndicatorLine {\n position: absolute;\n top: 0;\n /* left: 0; */\n right: 0;\n bottom: 0;\n pointer-events: none;\n}\n.BarSlider-Handle {\n position: absolute;\n pointer-events: none;\n}\n\n.BarSliderHandle {\n pointer-events: auto;\n}\n.Barslider-IndicatorLineWrapper {\n /* border-radius: var(--trackBorderRadius); */\n overflow: hidden;\n}\n\n.BarSlider-Input {\n font-weight: bold;\n width: 100%;\n}\n\n.BarSlider-Input.includeValueInHeightIsFalse {\n position: absolute;\n bottom: -1.7em;\n left: 0;\n right: 0;\n z-index: 10;\n}\n";
|
|
3694
|
+
styleInject(css_248z$9);
|
|
3624
3695
|
|
|
3625
3696
|
function Slider$1({ polarity = Polarity.unipolar, orientation = Orientation.vertical, dragOrientation, isRandomizable = false, randomizerObject, isStandalone = true, isHighlighted = false, showValue = true, showHandle = true, showLabel = true, showInsetBoxShadow = true, resetterObject, className, id, width, height = '100%', onChange, outerGlowRadius, outerGlowColors, trackBorderRadius = 20, blur, style, indicatorLineColor = 'var(--color-brand)', indicatorLineGradient, trackColor = 'var(--bg-lv3)', markColor = 'var(--bg-lv7)', markHighlightColor = 'var(--color-text)', trackStrokeColor, handleFillColor, handleStrokeColor, trackWidth = TrackWidths.small, label, labelColor, marks = [], inputHighlightColor = 'var(--color-brand)', includeValueInHeight = true, // Mocks the initial scaled value of the slider for web veiws outside of JUCE
|
|
3626
3697
|
mockInitialNormalisedValue = 0, mockProperties = {
|
|
@@ -3630,11 +3701,57 @@ mockInitialNormalisedValue = 0, mockProperties = {
|
|
|
3630
3701
|
skew: 0.7
|
|
3631
3702
|
} }) {
|
|
3632
3703
|
const sliderElementRef = useRef(null);
|
|
3704
|
+
const handleElementRef = useRef(null);
|
|
3705
|
+
const barSliderIndicatorRef = useRef(null);
|
|
3633
3706
|
const isHorizontal = orientation === Orientation.horizontal;
|
|
3634
3707
|
const isVertical = orientation === Orientation.vertical;
|
|
3635
3708
|
const handleWidth = 18;
|
|
3709
|
+
const handleMargin = handleWidth / 2;
|
|
3636
3710
|
const defaultDragOrientation = orientation;
|
|
3637
3711
|
const [hoveredMark, setHoveredMark] = useState();
|
|
3712
|
+
// const elementRef = useRef<HTMLDivElement>(null);
|
|
3713
|
+
const animationFrameRef = useRef(null);
|
|
3714
|
+
const prevValRef = useRef(null);
|
|
3715
|
+
const animate = animateBarChart({
|
|
3716
|
+
animationFrameRef,
|
|
3717
|
+
elementRef: barSliderIndicatorRef,
|
|
3718
|
+
prevValRef,
|
|
3719
|
+
polarity,
|
|
3720
|
+
orientation
|
|
3721
|
+
});
|
|
3722
|
+
const animateHandle = animateBarSliderHandle({
|
|
3723
|
+
animationFrameRef,
|
|
3724
|
+
elementRef: handleElementRef,
|
|
3725
|
+
prevValRef,
|
|
3726
|
+
orientation,
|
|
3727
|
+
margin: handleMargin
|
|
3728
|
+
});
|
|
3729
|
+
const { bindDrag, bindSequenceDrag, // bindSequenceBarSliderDrag,
|
|
3730
|
+
// bindDrag,
|
|
3731
|
+
normalisedValue, scaledValue, setScaledState, properties } = useSlider({
|
|
3732
|
+
id,
|
|
3733
|
+
label,
|
|
3734
|
+
mockProperties,
|
|
3735
|
+
resetterObject,
|
|
3736
|
+
mockInitialNormalisedValue,
|
|
3737
|
+
onChange,
|
|
3738
|
+
isStandalone,
|
|
3739
|
+
isRandomizable,
|
|
3740
|
+
randomizerObject,
|
|
3741
|
+
orientation: orientation,
|
|
3742
|
+
dragOrientation: dragOrientation || defaultDragOrientation,
|
|
3743
|
+
sliderElementRef,
|
|
3744
|
+
marks
|
|
3745
|
+
});
|
|
3746
|
+
const drag = isStandalone ? bindDrag : bindSequenceDrag;
|
|
3747
|
+
useEffect(()=>{
|
|
3748
|
+
if (normalisedValue !== null && normalisedValue !== undefined && normalisedValue !== prevValRef.current) {
|
|
3749
|
+
animate(normalisedValue);
|
|
3750
|
+
animateHandle(normalisedValue);
|
|
3751
|
+
}
|
|
3752
|
+
}, [
|
|
3753
|
+
normalisedValue
|
|
3754
|
+
]);
|
|
3638
3755
|
const trackWidthMap = {
|
|
3639
3756
|
small: 5,
|
|
3640
3757
|
large: 10
|
|
@@ -3646,29 +3763,12 @@ mockInitialNormalisedValue = 0, mockProperties = {
|
|
|
3646
3763
|
// ? trackWidthMap[trackWidth]
|
|
3647
3764
|
// : 0
|
|
3648
3765
|
// : trackWidth;
|
|
3649
|
-
const handleMargin = handleWidth / 2;
|
|
3650
3766
|
const multiColorGradient = `linear-gradient(${isHorizontal ? 'to right' : 'to top'}, var(--color-brand) 0%, var(--color-brand-secondary) 100%`;
|
|
3651
3767
|
const singleColorGradient = `linear-gradient(${isHorizontal ? 'to right' : 'to top'}, var(--color-brand-700) 0%, var(--color-brand) 100%`;
|
|
3652
3768
|
const selectedGradientMap = {
|
|
3653
3769
|
[GradientStyles.multicolor]: multiColorGradient,
|
|
3654
3770
|
[GradientStyles.unicolor]: singleColorGradient
|
|
3655
3771
|
};
|
|
3656
|
-
const { bindBarSliderDrag, bindSequenceBarSliderDrag, // bindDrag,
|
|
3657
|
-
normalisedValue, scaledValue, setNormalisedState, properties } = useSlider({
|
|
3658
|
-
id,
|
|
3659
|
-
label,
|
|
3660
|
-
mockProperties,
|
|
3661
|
-
resetterObject,
|
|
3662
|
-
mockInitialNormalisedValue,
|
|
3663
|
-
onChange,
|
|
3664
|
-
isRandomizable,
|
|
3665
|
-
randomizerObject,
|
|
3666
|
-
orientation: orientation,
|
|
3667
|
-
dragOrientation: dragOrientation || defaultDragOrientation,
|
|
3668
|
-
sliderElementRef,
|
|
3669
|
-
marks
|
|
3670
|
-
});
|
|
3671
|
-
const drag = isStandalone ? bindBarSliderDrag : bindSequenceBarSliderDrag;
|
|
3672
3772
|
// const handleRef = useRef(null);
|
|
3673
3773
|
// useEffect(() => {
|
|
3674
3774
|
// console.log(normalisedValue, 'NORMALIZEDVAL');
|
|
@@ -3745,7 +3845,7 @@ mockInitialNormalisedValue = 0, mockProperties = {
|
|
|
3745
3845
|
onMouseEnter: ()=>setHoveredMark(item?.label),
|
|
3746
3846
|
onMouseLeave: ()=>setHoveredMark(null),
|
|
3747
3847
|
onClick: ()=>{
|
|
3748
|
-
|
|
3848
|
+
setScaledState(scaledValue);
|
|
3749
3849
|
}
|
|
3750
3850
|
}),
|
|
3751
3851
|
item?.label ? jsx(Label, {
|
|
@@ -3757,7 +3857,7 @@ mockInitialNormalisedValue = 0, mockProperties = {
|
|
|
3757
3857
|
color: +normalisedValue.toFixed(2) === +item?.value.toFixed(2) || hoveredMark === item?.label ? markHighlightColor : markColor,
|
|
3758
3858
|
highlightColor: markHighlightColor,
|
|
3759
3859
|
onClick: ()=>{
|
|
3760
|
-
|
|
3860
|
+
setScaledState(scaledValue);
|
|
3761
3861
|
},
|
|
3762
3862
|
style: {
|
|
3763
3863
|
cursor: 'pointer',
|
|
@@ -3771,7 +3871,8 @@ mockInitialNormalisedValue = 0, mockProperties = {
|
|
|
3771
3871
|
height: isHorizontal && showHandle ? `${handleWidth}px` : isHorizontal && !showHandle ? 'auto' : '100%',
|
|
3772
3872
|
width: isVertical && showHandle ? `${handleWidth}px` : '100%',
|
|
3773
3873
|
style: {
|
|
3774
|
-
filter: `blur(${blur}px)
|
|
3874
|
+
filter: `blur(${blur}px)`,
|
|
3875
|
+
touchAction: 'none'
|
|
3775
3876
|
},
|
|
3776
3877
|
"data-sliderElement": "true",
|
|
3777
3878
|
...drag(),
|
|
@@ -3802,6 +3903,7 @@ mockInitialNormalisedValue = 0, mockProperties = {
|
|
|
3802
3903
|
children: jsx("div", {
|
|
3803
3904
|
// TODO: Why aren't the Tailwind classes working?
|
|
3804
3905
|
// className={classnames('h-full', 'w-full', 'absolute', 'bg-panel')}
|
|
3906
|
+
ref: barSliderIndicatorRef,
|
|
3805
3907
|
className: "BarSlider-IndicatorLine",
|
|
3806
3908
|
style: {
|
|
3807
3909
|
background: indicatorLineGradient ? selectedGradientMap[indicatorLineGradient] : indicatorLineColor,
|
|
@@ -3811,8 +3913,7 @@ mockInitialNormalisedValue = 0, mockProperties = {
|
|
|
3811
3913
|
filter: generateDropShadowFilterString(outerGlowColors, outerGlowRadius),
|
|
3812
3914
|
...getBarTransformStyles({
|
|
3813
3915
|
orientation: orientation,
|
|
3814
|
-
polarity
|
|
3815
|
-
normalisedValue: normalisedValue
|
|
3916
|
+
polarity
|
|
3816
3917
|
})
|
|
3817
3918
|
}
|
|
3818
3919
|
})
|
|
@@ -3827,11 +3928,10 @@ mockInitialNormalisedValue = 0, mockProperties = {
|
|
|
3827
3928
|
zIndex: 2
|
|
3828
3929
|
},
|
|
3829
3930
|
children: jsx("div", {
|
|
3931
|
+
ref: handleElementRef,
|
|
3830
3932
|
className: "BarSlider-Handle",
|
|
3831
3933
|
style: {
|
|
3832
|
-
borderRadius: trackBorderRadius ? `${trackBorderRadius}px` : 'none'
|
|
3833
|
-
bottom: isHorizontal ? `calc(50% - ${handleMargin}px)` : `calc(${normalisedValue * 100}% - ${handleMargin}px)`,
|
|
3834
|
-
left: isHorizontal ? `calc(${normalisedValue * 100}% - ${handleMargin}px)` : `calc(50% - ${handleMargin}px)`
|
|
3934
|
+
borderRadius: trackBorderRadius ? `${trackBorderRadius}px` : 'none'
|
|
3835
3935
|
},
|
|
3836
3936
|
children: jsx(BarSliderHandle, {
|
|
3837
3937
|
handleFillColor: handleFillColor,
|
|
@@ -3863,14 +3963,8 @@ mockInitialNormalisedValue = 0, mockProperties = {
|
|
|
3863
3963
|
textAlign: Input.textAlign.center,
|
|
3864
3964
|
onComplete: (value)=>{
|
|
3865
3965
|
// normalisedValue !== undefined &&
|
|
3866
|
-
//
|
|
3867
|
-
|
|
3868
|
-
scaledValue: value,
|
|
3869
|
-
start: properties?.start,
|
|
3870
|
-
end: properties?.end,
|
|
3871
|
-
skew: properties?.skew
|
|
3872
|
-
});
|
|
3873
|
-
normalisedVal !== undefined && setNormalisedState(normalisedVal);
|
|
3966
|
+
// setScaledState(normalisedValue);
|
|
3967
|
+
value !== undefined && setScaledState(value);
|
|
3874
3968
|
}
|
|
3875
3969
|
}) : null
|
|
3876
3970
|
]
|
|
@@ -4219,8 +4313,8 @@ function Toggle({ id, isDisabled = false, onChange, className, width = ButtonSiz
|
|
|
4219
4313
|
Toggle.width = ButtonSize;
|
|
4220
4314
|
Toggle.height = ButtonSize;
|
|
4221
4315
|
|
|
4222
|
-
var css_248z$
|
|
4223
|
-
styleInject(css_248z$
|
|
4316
|
+
var css_248z$8 = ".ThemeWrapper {\n position: relative;\n width: 100%;\n}\n.CRTStyle {\n background: radial-gradient(\n circle,\n rgba(165, 73, 64, 0.1) 2%,\n rgba(55, 24, 21, 0.1) 71%,\n rgba(31, 12, 11, 0.1) 80%\n );\n}\n.CRTStyle::before {\n content: ' ';\n position: absolute;\n top: 0;\n left: 0;\n bottom: 0;\n right: 0;\n background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.25) 50%),\n linear-gradient(\n 90deg,\n rgba(255, 0, 0, 0.06),\n rgba(0, 255, 0, 0.02),\n rgba(0, 0, 255, 0.06)\n );\n z-index: 100;\n background-size:\n 100% 2px,\n 3px 100%;\n pointer-events: none;\n}\n";
|
|
4317
|
+
styleInject(css_248z$8);
|
|
4224
4318
|
|
|
4225
4319
|
var Themes;
|
|
4226
4320
|
(function(Themes) {
|
|
@@ -4306,8 +4400,8 @@ function KeyValueDisplayScreen({ className, style, data }) {
|
|
|
4306
4400
|
});
|
|
4307
4401
|
}
|
|
4308
4402
|
|
|
4309
|
-
var css_248z$
|
|
4310
|
-
styleInject(css_248z$
|
|
4403
|
+
var css_248z$7 = ".Oscilloscope {\n background: #1f9b9f;\n height: 200px;\n}\n";
|
|
4404
|
+
styleInject(css_248z$7);
|
|
4311
4405
|
|
|
4312
4406
|
function Ticks({ xScale, yScale, innerHeight, innerWidth, centerLine = true, strokeColor = 'var(--color-brand-900)', strokeStyle, centerLineColor = 'var(--color-brand-900)', tickFormat, numberOfTicks = 25, tickOffset = 0 }) {
|
|
4313
4407
|
const dashArray = '2,3';
|
|
@@ -4958,11 +5052,11 @@ function Oscilloscope({ width = 200, height = 200, className, style, id }) {
|
|
|
4958
5052
|
});
|
|
4959
5053
|
}
|
|
4960
5054
|
|
|
4961
|
-
var css_248z$
|
|
4962
|
-
styleInject(css_248z$
|
|
5055
|
+
var css_248z$6 = "@import '../../styles.css';\n.ModuleHeader {\n background-color: var(--bg-lv3);\n font-weight: normal;\n font-family: var(--font-leagueSpartan);\n max-height: 64px;\n}\n\n/* TODO: Use Tailwind classes */\n#advancedLayoutButton {\n /* border: 2px solid var(--color-brand); */\n border-radius: 3px;\n height: 30px;\n font-size: var(--text-md);\n &:hover,\n &:active {\n background: var(--color-gray-900);\n color: var(--color-brand);\n }\n}\n\n#advancedLayoutButton.selected {\n color: var(--color-brand);\n}\n\n.advancedLayoutButtonLabel {\n cursor: pointer;\n font-family: var(--font-leagueSpartan);\n /* display: inline-block;\n vertical-align: middle;\n height: 1rem;\n line-height: 1.25; */\n}\n";
|
|
5056
|
+
styleInject(css_248z$6);
|
|
4963
5057
|
|
|
4964
|
-
var css_248z$
|
|
4965
|
-
styleInject(css_248z$
|
|
5058
|
+
var css_248z$5 = ".PresetManagerContainer {\n width: 100%;\n height: 100%;\n background-color: var(--bg-lv1);\n color: var(--color-text);\n}\n\n.PresetManagerButton {\n width: 100%;\n height: 100%;\n max-width: 300px;\n display: flex;\n justify-content: space-between;\n align-items: center;\n position: relative;\n cursor: pointer;\n font-family: var(--font-leagueSpartan);\n}\n.PresetManagerButtonLabel {\n cursor: pointer;\n text-align: center;\n font-family: var(--font-leagueSpartan);\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n max-width: 225px;\n display: inline-block;\n vertical-align: middle;\n height: 1rem;\n line-height: 1.25;\n /* position: relative; */\n &:hover,\n &:active {\n background: var(--color-gray-900);\n }\n /* &.isDirty {\n &::after {\n content: '*';\n position: absolute;\n left: 0;\n right: 0;\n top: 0;\n bottom: 0;\n }\n } */\n}\n\n.PresetManagerButtonLabelContainer.isDirty::after {\n content: '*';\n position: absolute;\n height: 1rem;\n width: 1rem;\n right: -0.75rem;\n top: 0;\n}\n\n.PresetManagerButtonLabelOuterContainer {\n position: relative;\n width: auto;\n}\n\n[data-headlessui-state='open active'] .PresetManagerButtonLabel {\n background: var(--color-gray-900);\n}\n.PresetManagerPanel {\n position: absolute;\n font-family: var(--font-leagueSpartan);\n right: 0px;\n left: 0px;\n width: 288px;\n color: var(--color-text);\n background: var(--bg-lv4);\n z-index: 150;\n}\n\n.PresetManagerPanel:focus,\n.PresetManagerPanel:focus-visible {\n outline: none;\n}\n\n.PresetManagerListItem {\n cursor: pointer;\n background: var(--bg-lv4);\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n width: 288px;\n}\n\n.PresetManagerListItem:hover {\n background: var(--bg-lv7);\n}\n.PresetManagerListItem.isSelected {\n color: var(--color-brand);\n}\n\n.PresetManagerListItemText {\n display: inline-block;\n vertical-align: middle;\n height: 1.5rem;\n line-height: 1.75;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n width: calc(288px - 30px);\n}\n";
|
|
5059
|
+
styleInject(css_248z$5);
|
|
4966
5060
|
|
|
4967
5061
|
function PresetManager({}) {
|
|
4968
5062
|
const [presetList, setPresetList] = useState([]);
|
|
@@ -5395,8 +5489,8 @@ function ModuleHeader({ ModuleTitle, className, style }) {
|
|
|
5395
5489
|
});
|
|
5396
5490
|
}
|
|
5397
5491
|
|
|
5398
|
-
var css_248z$
|
|
5399
|
-
styleInject(css_248z$
|
|
5492
|
+
var css_248z$4 = ".ModMatrix {\n color: var(--color-text);\n font-size: var(--text-ms);\n}\n\n.ModMatrixCell {\n position: relative;\n}\n\n.ModMatrixBodyCell,\n.ModMatrixComboboxCell {\n background: var(--bg-lv4);\n}\n\n.ModMatrixBodyCell.isDisabled,\n.ModMatrixDeleteCell.isDisabled {\n opacity: 0.4;\n}\n\n.ModMatrixCell.isDisabled {\n color: var(--color-gray-400);\n cursor: default;\n}\n\n/* .isActive .ModMatrixCell {\n background: var(--color-gray-600);\n} */\n.ModMatrixComboboxItems {\n position: absolute;\n z-index: 50;\n left: 0px;\n /* height: 150px; */\n /* width: 100%; */\n color: var(--color-text);\n /* -ms-overflow-style: none; */\n scrollbar-width: thin;\n overflow-y: scroll;\n overflow-x: hidden;\n cursor: pointer;\n}\n\n.ModMatrixComboboxItems::-webkit-scrollbar {\n width: 10px;\n}\n\n.ModMatrixComboboxItem {\n display: flex;\n align-items: center;\n background: var(--bg-lv4);\n padding: 0 var(--spacing-md);\n width: 100%;\n}\n\n.ModMatrixComboboxItem:hover,\n.ModMatrixComboboxItem:active {\n background: var(--bg-lv5);\n}\n\n.ModMatrixComboboxButton {\n cursor: pointer;\n}\n\n.ModMatrixInput {\n text-align: center;\n margin-top: 3px;\n}\n";
|
|
5493
|
+
styleInject(css_248z$4);
|
|
5400
5494
|
|
|
5401
5495
|
const targetColors = [
|
|
5402
5496
|
'var(--color-brand)',
|
|
@@ -5499,9 +5593,29 @@ function ModMatrixToggleCell({ modifier, isDisabled = false, rowId, color, style
|
|
|
5499
5593
|
});
|
|
5500
5594
|
}
|
|
5501
5595
|
|
|
5596
|
+
var css_248z$3 = ".SingleBarViz-Wrapper::after {\n content: '';\n position: absolute;\n left: calc(50% - 1px);\n width: 1px;\n height: 100%;\n background: inherit;\n filter: brightness(1%);\n}\n";
|
|
5597
|
+
styleInject(css_248z$3);
|
|
5598
|
+
|
|
5502
5599
|
function SingleBarViz({ backgroundColor = 'var(--color-gray-600)', sliderColor = 'var(--color-brand)', height = '6px', isDisabled, polarity = Polarity.unipolar, orientation = Orientation.horizontal, value, className, style }) {
|
|
5600
|
+
const elementRef = useRef(null);
|
|
5601
|
+
const animationFrameRef = useRef(null);
|
|
5602
|
+
const prevValRef = useRef(null);
|
|
5603
|
+
const animate = animateBarChart({
|
|
5604
|
+
animationFrameRef,
|
|
5605
|
+
elementRef,
|
|
5606
|
+
prevValRef,
|
|
5607
|
+
polarity,
|
|
5608
|
+
orientation
|
|
5609
|
+
});
|
|
5610
|
+
useEffect(()=>{
|
|
5611
|
+
if (value !== null && value !== undefined && value !== prevValRef.current) {
|
|
5612
|
+
animate(value);
|
|
5613
|
+
}
|
|
5614
|
+
}, [
|
|
5615
|
+
value
|
|
5616
|
+
]);
|
|
5503
5617
|
return jsx("div", {
|
|
5504
|
-
className: className
|
|
5618
|
+
className: `SingleBarViz-Wrapper ${className}`,
|
|
5505
5619
|
style: {
|
|
5506
5620
|
width: '100%',
|
|
5507
5621
|
height,
|
|
@@ -5510,14 +5624,14 @@ function SingleBarViz({ backgroundColor = 'var(--color-gray-600)', sliderColor =
|
|
|
5510
5624
|
},
|
|
5511
5625
|
children: jsx("div", {
|
|
5512
5626
|
className: "SingleBarViz",
|
|
5627
|
+
ref: elementRef,
|
|
5513
5628
|
style: {
|
|
5514
5629
|
position: 'absolute',
|
|
5515
5630
|
background: sliderColor,
|
|
5516
5631
|
...getBarTransformStyles({
|
|
5517
5632
|
isDisabled,
|
|
5518
5633
|
polarity,
|
|
5519
|
-
orientation
|
|
5520
|
-
normalisedValue: value || 0
|
|
5634
|
+
orientation
|
|
5521
5635
|
}),
|
|
5522
5636
|
...style
|
|
5523
5637
|
}
|
|
@@ -5525,11 +5639,12 @@ function SingleBarViz({ backgroundColor = 'var(--color-gray-600)', sliderColor =
|
|
|
5525
5639
|
});
|
|
5526
5640
|
}
|
|
5527
5641
|
SingleBarViz.polarity = Polarity;
|
|
5642
|
+
SingleBarViz.orientation = Orientation;
|
|
5528
5643
|
|
|
5529
5644
|
function ModMatrixCell({ modifier, rowId, isDisabled, color, style }) {
|
|
5530
5645
|
const { setDefaultParameter, updateModSlotRowTarget, globalState: { modSlotTargets } } = useGlobalContext();
|
|
5531
5646
|
const [_, setIsActive] = useState(false);
|
|
5532
|
-
const {
|
|
5647
|
+
const { bindDrag, normalisedValue, scaledValue, properties, setScaledState } = useSlider({
|
|
5533
5648
|
id: modifier,
|
|
5534
5649
|
rowId,
|
|
5535
5650
|
updateModSlotPreview: false,
|
|
@@ -5562,7 +5677,7 @@ function ModMatrixCell({ modifier, rowId, isDisabled, color, style }) {
|
|
|
5562
5677
|
...style
|
|
5563
5678
|
},
|
|
5564
5679
|
height: '2.5rem',
|
|
5565
|
-
...
|
|
5680
|
+
...bindDrag(),
|
|
5566
5681
|
onDoubleClick: ()=>setDefaultParameter(modifier),
|
|
5567
5682
|
children: [
|
|
5568
5683
|
jsx(Box, {
|
|
@@ -5586,13 +5701,7 @@ function ModMatrixCell({ modifier, rowId, isDisabled, color, style }) {
|
|
|
5586
5701
|
marginBottom: 'var(--spacing-sm)'
|
|
5587
5702
|
},
|
|
5588
5703
|
onComplete: (value)=>{
|
|
5589
|
-
|
|
5590
|
-
scaledValue: value,
|
|
5591
|
-
start: properties?.start,
|
|
5592
|
-
end: properties?.end,
|
|
5593
|
-
skew: properties?.skew
|
|
5594
|
-
});
|
|
5595
|
-
normalisedVal !== undefined && setNormalisedState(normalisedVal);
|
|
5704
|
+
value !== undefined && setScaledState(value);
|
|
5596
5705
|
}
|
|
5597
5706
|
})
|
|
5598
5707
|
}),
|
|
@@ -5602,21 +5711,13 @@ function ModMatrixCell({ modifier, rowId, isDisabled, color, style }) {
|
|
|
5602
5711
|
pointerEvents: 'none'
|
|
5603
5712
|
},
|
|
5604
5713
|
children: jsx(SingleBarViz, {
|
|
5605
|
-
value:
|
|
5714
|
+
value: normalisedValue || 0,
|
|
5606
5715
|
polarity: SingleBarViz?.polarity?.bipolar,
|
|
5716
|
+
orientation: SingleBarViz?.orientation?.horizontal,
|
|
5607
5717
|
// backgroundColor={
|
|
5608
5718
|
// isActive ? 'var(--color-gray-500)' : 'var(--color-gray-600)'
|
|
5609
5719
|
// }
|
|
5610
|
-
sliderColor: color
|
|
5611
|
-
style: {
|
|
5612
|
-
alignSelf: 'flex-end',
|
|
5613
|
-
pointerEvents: 'none',
|
|
5614
|
-
...getBarTransformStyles({
|
|
5615
|
-
orientation: Orientation?.horizontal,
|
|
5616
|
-
polarity: Polarity?.bipolar,
|
|
5617
|
-
normalisedValue
|
|
5618
|
-
})
|
|
5619
|
-
}
|
|
5720
|
+
sliderColor: color
|
|
5620
5721
|
})
|
|
5621
5722
|
})
|
|
5622
5723
|
]
|