@grame/faustwasm 0.5.2 → 0.5.4
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/README.md +2 -2
- package/assets/standalone/create-node.js +35 -2
- package/assets/standalone/faust-ui/index.css +2 -1
- package/assets/standalone/faust-ui/index.css.map +1 -1
- package/assets/standalone/faust-ui/index.js +252 -129
- package/assets/standalone/faust-ui/index.js.map +1 -1
- package/assets/standalone/faustwasm/index.js.map +2 -2
- package/assets/standalone/index-pwa.js +16 -56
- package/assets/standalone/index.js +17 -30
- package/dist/cjs/index.js.map +2 -2
- package/dist/cjs-bundle/index.js.map +2 -2
- package/dist/esm/index.js.map +2 -2
- package/dist/esm-bundle/index.js.map +2 -2
- package/foo.cpp +3312 -0
- package/package.json +2 -2
- package/src/FaustSensors.ts +0 -2
- package/test/faustlive-wasm/faust-ui/index.css +2 -1
- package/test/faustlive-wasm/faust-ui/index.css.map +1 -1
- package/test/faustlive-wasm/faust-ui/index.js +252 -129
- package/test/faustlive-wasm/faust-ui/index.js.map +1 -1
- package/test/faustlive-wasm/faustwasm/index.js.map +2 -2
|
@@ -161,7 +161,8 @@ class FaustUI {
|
|
|
161
161
|
* Can be overriden, called by components when its value is changed by user.
|
|
162
162
|
*/
|
|
163
163
|
this.paramChangeByUI = (path, value) => {
|
|
164
|
-
if (!this.hostWindow)
|
|
164
|
+
if (!this.hostWindow)
|
|
165
|
+
return;
|
|
165
166
|
this.hostWindow.postMessage({ path, value, type: "param" }, "*");
|
|
166
167
|
};
|
|
167
168
|
const { root, ui: uiIn, listenWindowResize, listenWindowMessage } = options;
|
|
@@ -177,7 +178,8 @@ class FaustUI {
|
|
|
177
178
|
const { data, source } = e;
|
|
178
179
|
this.hostWindow = source;
|
|
179
180
|
const { type } = data;
|
|
180
|
-
if (!type)
|
|
181
|
+
if (!type)
|
|
182
|
+
return;
|
|
181
183
|
if (type === "ui") {
|
|
182
184
|
this.ui = data.ui;
|
|
183
185
|
} else if (type === "param") {
|
|
@@ -217,14 +219,17 @@ class FaustUI {
|
|
|
217
219
|
* This method should be called by components to register itself to map.
|
|
218
220
|
*/
|
|
219
221
|
register(path, item) {
|
|
220
|
-
if (this.componentMap[path])
|
|
221
|
-
|
|
222
|
+
if (this.componentMap[path])
|
|
223
|
+
this.componentMap[path].push(item);
|
|
224
|
+
else
|
|
225
|
+
this.componentMap[path] = [item];
|
|
222
226
|
}
|
|
223
227
|
/**
|
|
224
228
|
* Notify the component to change its value.
|
|
225
229
|
*/
|
|
226
230
|
paramChangeByDSP(path, value) {
|
|
227
|
-
if (this.componentMap[path])
|
|
231
|
+
if (this.componentMap[path])
|
|
232
|
+
this.componentMap[path].forEach((item) => item.setState({ value }));
|
|
228
233
|
}
|
|
229
234
|
/**
|
|
230
235
|
* Calculate UI layout in grid then calculate grid size.
|
|
@@ -248,7 +253,8 @@ class FaustUI {
|
|
|
248
253
|
* Force recalculate grid size and resize UI
|
|
249
254
|
*/
|
|
250
255
|
resize() {
|
|
251
|
-
if (!this.faustUIRoot)
|
|
256
|
+
if (!this.faustUIRoot)
|
|
257
|
+
return;
|
|
252
258
|
this.calcGrid();
|
|
253
259
|
this.faustUIRoot.setState({ style: { grid: this.grid } });
|
|
254
260
|
}
|
|
@@ -256,12 +262,14 @@ class FaustUI {
|
|
|
256
262
|
filter(ui) {
|
|
257
263
|
const callback = (items, item) => {
|
|
258
264
|
var _a;
|
|
259
|
-
if (item.type === "soundfile")
|
|
265
|
+
if (item.type === "soundfile")
|
|
266
|
+
return items;
|
|
260
267
|
if (item.type === "hgroup" || item.type === "vgroup" || item.type === "tgroup") {
|
|
261
268
|
items.push(__spreadProps(__spreadValues({}, item), { items: item.items.reduce(callback, []) }));
|
|
262
269
|
return items;
|
|
263
270
|
}
|
|
264
|
-
if ((_a = item.meta) == null ? void 0 : _a.find((m) => m.hidden && m.hidden === "1"))
|
|
271
|
+
if ((_a = item.meta) == null ? void 0 : _a.find((m) => m.hidden && m.hidden === "1"))
|
|
272
|
+
return items;
|
|
265
273
|
items.push(item);
|
|
266
274
|
return items;
|
|
267
275
|
};
|
|
@@ -363,8 +371,10 @@ class AbstractComponent extends _shren_typed_event_emitter__WEBPACK_IMPORTED_MOD
|
|
|
363
371
|
if (stateKey in this.state && this.state[stateKey] !== stateValue) {
|
|
364
372
|
this.state[stateKey] = stateValue;
|
|
365
373
|
shouldUpdate = true;
|
|
366
|
-
} else
|
|
367
|
-
|
|
374
|
+
} else
|
|
375
|
+
return;
|
|
376
|
+
if (shouldUpdate)
|
|
377
|
+
this.emit(stateKey, this.state[stateKey]);
|
|
368
378
|
}
|
|
369
379
|
}
|
|
370
380
|
/**
|
|
@@ -372,8 +382,10 @@ class AbstractComponent extends _shren_typed_event_emitter__WEBPACK_IMPORTED_MOD
|
|
|
372
382
|
* schedule what you need to do in next render tick in `raf` callback
|
|
373
383
|
*/
|
|
374
384
|
schedule(func) {
|
|
375
|
-
if (this.tasks.indexOf(func) === -1)
|
|
376
|
-
|
|
385
|
+
if (this.tasks.indexOf(func) === -1)
|
|
386
|
+
this.tasks.push(func);
|
|
387
|
+
if (this.$raf)
|
|
388
|
+
return;
|
|
377
389
|
this.$raf = window.requestAnimationFrame(this.raf);
|
|
378
390
|
}
|
|
379
391
|
}
|
|
@@ -417,7 +429,7 @@ var __spreadValues = (a, b) => {
|
|
|
417
429
|
|
|
418
430
|
|
|
419
431
|
|
|
420
|
-
const _AbstractItem = class
|
|
432
|
+
const _AbstractItem = class extends _AbstractComponent__WEBPACK_IMPORTED_MODULE_0__["default"] {
|
|
421
433
|
/**
|
|
422
434
|
* Initiate default state with incoming state.
|
|
423
435
|
*/
|
|
@@ -509,14 +521,16 @@ const _AbstractItem = class _AbstractItem extends _AbstractComponent__WEBPACK_IM
|
|
|
509
521
|
const prevValue = this.state.value;
|
|
510
522
|
this.handleMouseOrTouchDown({ pointerId, x: fromX, y: fromY, originalEvent: e });
|
|
511
523
|
const handlePointerMove = (e2) => {
|
|
512
|
-
if (e2.pointerId !== pointerId)
|
|
524
|
+
if (e2.pointerId !== pointerId)
|
|
525
|
+
return;
|
|
513
526
|
e2.preventDefault();
|
|
514
527
|
const x = e2.clientX - rect.left;
|
|
515
528
|
const y = e2.clientY - rect.top;
|
|
516
529
|
this.handleMouseOrTouchMove({ pointerId, prevValue, x, y, fromX, fromY, movementX: e2.movementX, movementY: e2.movementY, originalEvent: e2 });
|
|
517
530
|
};
|
|
518
531
|
const handlePointerUp = (e2) => {
|
|
519
|
-
if (e2.pointerId !== pointerId)
|
|
532
|
+
if (e2.pointerId !== pointerId)
|
|
533
|
+
return;
|
|
520
534
|
e2.preventDefault();
|
|
521
535
|
const x = e2.clientX - rect.left;
|
|
522
536
|
const y = e2.clientY - rect.top;
|
|
@@ -536,16 +550,19 @@ const _AbstractItem = class _AbstractItem extends _AbstractComponent__WEBPACK_IM
|
|
|
536
550
|
this.handleFocusIn = (e) => this.setState({ focus: true });
|
|
537
551
|
this.handleFocusOut = (e) => this.setState({ focus: false });
|
|
538
552
|
this.state.style = __spreadValues(__spreadValues({}, this.defaultProps.style), props.style);
|
|
539
|
-
if (this.state.emitter)
|
|
553
|
+
if (this.state.emitter)
|
|
554
|
+
this.state.emitter.register(this.state.address, this);
|
|
540
555
|
}
|
|
541
556
|
/**
|
|
542
557
|
* Get a nearest valid number
|
|
543
558
|
*/
|
|
544
559
|
toValidNumber(value) {
|
|
545
560
|
const { min, max, step } = this.state;
|
|
546
|
-
if (typeof min !== "number" || typeof max !== "number")
|
|
561
|
+
if (typeof min !== "number" || typeof max !== "number")
|
|
562
|
+
return value;
|
|
547
563
|
const v = Math.min(max, Math.max(min, value));
|
|
548
|
-
if (!step)
|
|
564
|
+
if (!step)
|
|
565
|
+
return v;
|
|
549
566
|
return min + Math.floor((v - min) / step) * step;
|
|
550
567
|
}
|
|
551
568
|
/**
|
|
@@ -554,14 +571,16 @@ const _AbstractItem = class _AbstractItem extends _AbstractComponent__WEBPACK_IM
|
|
|
554
571
|
setValue(valueIn) {
|
|
555
572
|
const value = this.toValidNumber(valueIn);
|
|
556
573
|
const changed = this.setState({ value });
|
|
557
|
-
if (changed)
|
|
574
|
+
if (changed)
|
|
575
|
+
this.change(value);
|
|
558
576
|
return changed;
|
|
559
577
|
}
|
|
560
578
|
/**
|
|
561
579
|
* Send value to DSP
|
|
562
580
|
*/
|
|
563
581
|
change(valueIn) {
|
|
564
|
-
if (this.state.emitter)
|
|
582
|
+
if (this.state.emitter)
|
|
583
|
+
this.state.emitter.paramChangeByUI(this.state.address, typeof valueIn === "number" ? valueIn : this.state.value);
|
|
565
584
|
}
|
|
566
585
|
/**
|
|
567
586
|
* set internal state and fire events for UI parts subscribed
|
|
@@ -583,8 +602,10 @@ const _AbstractItem = class _AbstractItem extends _AbstractComponent__WEBPACK_IM
|
|
|
583
602
|
} else if (stateKey in this.state && this.state[stateKey] !== stateValue) {
|
|
584
603
|
this.state[stateKey] = stateValue;
|
|
585
604
|
shouldUpdate = true;
|
|
586
|
-
} else
|
|
587
|
-
|
|
605
|
+
} else
|
|
606
|
+
return false;
|
|
607
|
+
if (shouldUpdate)
|
|
608
|
+
this.emit(stateKey, this.state[stateKey]);
|
|
588
609
|
}
|
|
589
610
|
return shouldUpdate;
|
|
590
611
|
}
|
|
@@ -597,7 +618,8 @@ const _AbstractItem = class _AbstractItem extends _AbstractComponent__WEBPACK_IM
|
|
|
597
618
|
this.container.className = ["faust-ui-component", "faust-ui-component-" + this.className].join(" ");
|
|
598
619
|
this.container.tabIndex = 1;
|
|
599
620
|
this.container.id = this.state.address;
|
|
600
|
-
if (this.state.tooltip)
|
|
621
|
+
if (this.state.tooltip)
|
|
622
|
+
this.container.title = this.state.tooltip;
|
|
601
623
|
this.label = document.createElement("div");
|
|
602
624
|
this.label.className = "faust-ui-component-label";
|
|
603
625
|
this.labelCanvas = document.createElement("canvas");
|
|
@@ -618,7 +640,8 @@ const _AbstractItem = class _AbstractItem extends _AbstractComponent__WEBPACK_IM
|
|
|
618
640
|
const canvas = this.labelCanvas;
|
|
619
641
|
const ratio = window.devicePixelRatio || 1;
|
|
620
642
|
let { width, height } = this.label.getBoundingClientRect();
|
|
621
|
-
if (!width || !height)
|
|
643
|
+
if (!width || !height)
|
|
644
|
+
return this;
|
|
622
645
|
width = Math.floor(width);
|
|
623
646
|
height = Math.floor(height);
|
|
624
647
|
const scaledWidth = Math.floor(width * ratio);
|
|
@@ -658,8 +681,10 @@ const _AbstractItem = class _AbstractItem extends _AbstractComponent__WEBPACK_IM
|
|
|
658
681
|
const { type, max, min, step, enums } = this.state;
|
|
659
682
|
const maxSteps = type === "enum" ? enums.length : type === "int" ? max - min : (max - min) / step;
|
|
660
683
|
if (step) {
|
|
661
|
-
if (type === "enum")
|
|
662
|
-
|
|
684
|
+
if (type === "enum")
|
|
685
|
+
return enums.length;
|
|
686
|
+
if (type === "int")
|
|
687
|
+
return Math.min(Math.floor((max - min) / (Math.round(step) || 1)), maxSteps);
|
|
663
688
|
return Math.floor((max - min) / step);
|
|
664
689
|
}
|
|
665
690
|
return maxSteps;
|
|
@@ -673,7 +698,8 @@ const _AbstractItem = class _AbstractItem extends _AbstractComponent__WEBPACK_IM
|
|
|
673
698
|
}
|
|
674
699
|
static getDistance(state) {
|
|
675
700
|
const { type, max, min, value, enums, scale } = state;
|
|
676
|
-
if (type === "enum")
|
|
701
|
+
if (type === "enum")
|
|
702
|
+
return value / (enums.length - 1);
|
|
677
703
|
const v = scale === "exp" ? (0,_utils__WEBPACK_IMPORTED_MODULE_1__.normLog)(value, min, max) : scale === "log" ? (0,_utils__WEBPACK_IMPORTED_MODULE_1__.normExp)(value, min, max) : value;
|
|
678
704
|
return (0,_utils__WEBPACK_IMPORTED_MODULE_1__.normalize)(v, min, max);
|
|
679
705
|
}
|
|
@@ -686,10 +712,11 @@ const _AbstractItem = class _AbstractItem extends _AbstractComponent__WEBPACK_IM
|
|
|
686
712
|
return full / stepsCount;
|
|
687
713
|
}
|
|
688
714
|
};
|
|
715
|
+
let AbstractItem = _AbstractItem;
|
|
689
716
|
/**
|
|
690
717
|
* The default state of the component.
|
|
691
718
|
*/
|
|
692
|
-
|
|
719
|
+
AbstractItem.defaultProps = {
|
|
693
720
|
value: 0,
|
|
694
721
|
active: true,
|
|
695
722
|
focus: false,
|
|
@@ -704,7 +731,6 @@ _AbstractItem.defaultProps = {
|
|
|
704
731
|
step: 0.01,
|
|
705
732
|
style: { width: 45, height: 15, left: 0, top: 0, labelcolor: "rgba(226, 222, 255, 0.5)" }
|
|
706
733
|
};
|
|
707
|
-
let AbstractItem = _AbstractItem;
|
|
708
734
|
|
|
709
735
|
|
|
710
736
|
|
|
@@ -889,7 +915,8 @@ class Group extends _AbstractComponent__WEBPACK_IMPORTED_MODULE_0__["default"] {
|
|
|
889
915
|
this.children = [];
|
|
890
916
|
const { style, type, items, emitter, isRoot } = this.state;
|
|
891
917
|
const { grid, left, top, width, height } = style;
|
|
892
|
-
if (!this.state.isRoot)
|
|
918
|
+
if (!this.state.isRoot)
|
|
919
|
+
this.label.style.height = `${grid * 0.3}px`;
|
|
893
920
|
this.container.style.left = `${left * grid}px`;
|
|
894
921
|
this.container.style.top = `${top * grid}px`;
|
|
895
922
|
this.container.style.width = `${width * grid}px`;
|
|
@@ -898,11 +925,13 @@ class Group extends _AbstractComponent__WEBPACK_IMPORTED_MODULE_0__["default"] {
|
|
|
898
925
|
items.forEach((item) => {
|
|
899
926
|
if (item.type.endsWith("group")) {
|
|
900
927
|
const component = Group.getComponent(item, emitter, grid);
|
|
901
|
-
if (component)
|
|
928
|
+
if (component)
|
|
929
|
+
this.children.push(component);
|
|
902
930
|
} else {
|
|
903
931
|
const ioItem = item;
|
|
904
932
|
const itemComponent = Group.getComponent(ioItem, this.state.emitter, grid);
|
|
905
|
-
if (itemComponent)
|
|
933
|
+
if (itemComponent)
|
|
934
|
+
this.children.push(itemComponent);
|
|
906
935
|
}
|
|
907
936
|
});
|
|
908
937
|
if (type === "tgroup") {
|
|
@@ -922,7 +951,8 @@ class Group extends _AbstractComponent__WEBPACK_IMPORTED_MODULE_0__["default"] {
|
|
|
922
951
|
const groups = [];
|
|
923
952
|
for (let j = 0; j < this.container.children.length; j++) {
|
|
924
953
|
const element = this.container.children[j];
|
|
925
|
-
if (j > 1)
|
|
954
|
+
if (j > 1)
|
|
955
|
+
groups.push(element);
|
|
926
956
|
}
|
|
927
957
|
for (let j = 0; j < groups.length; j++) {
|
|
928
958
|
const element = groups[j];
|
|
@@ -931,8 +961,10 @@ class Group extends _AbstractComponent__WEBPACK_IMPORTED_MODULE_0__["default"] {
|
|
|
931
961
|
for (let j = 0; j < this.tabs.children.length; j++) {
|
|
932
962
|
const e = this.tabs.children[j];
|
|
933
963
|
if (i !== j) {
|
|
934
|
-
if (e.classList.contains("active"))
|
|
935
|
-
|
|
964
|
+
if (e.classList.contains("active"))
|
|
965
|
+
e.classList.remove("active");
|
|
966
|
+
} else
|
|
967
|
+
e.classList.add("active");
|
|
936
968
|
}
|
|
937
969
|
});
|
|
938
970
|
this.tabs.appendChild(tab);
|
|
@@ -942,7 +974,8 @@ class Group extends _AbstractComponent__WEBPACK_IMPORTED_MODULE_0__["default"] {
|
|
|
942
974
|
}
|
|
943
975
|
static parseMeta(metaIn) {
|
|
944
976
|
const metaObject = {};
|
|
945
|
-
if (!metaIn)
|
|
977
|
+
if (!metaIn)
|
|
978
|
+
return { metaObject };
|
|
946
979
|
metaIn.forEach((m) => Object.assign(metaObject, m));
|
|
947
980
|
if (metaObject.style) {
|
|
948
981
|
const enumsRegex = /\{(?:(?:'|_|-)(.+?)(?:'|_|-):([-+]?[0-9]*\.?[0-9]+?);)+(?:(?:'|_|-)(.+?)(?:'|_|-):([-+]?[0-9]*\.?[0-9]+?))\}/;
|
|
@@ -1004,19 +1037,32 @@ class Group extends _AbstractComponent__WEBPACK_IMPORTED_MODULE_0__["default"] {
|
|
|
1004
1037
|
step: "step" in item ? +item.step : 1,
|
|
1005
1038
|
value: "init" in item ? +item.init || 0 : 0
|
|
1006
1039
|
};
|
|
1007
|
-
if (type === "button")
|
|
1008
|
-
|
|
1009
|
-
if (type === "
|
|
1010
|
-
|
|
1011
|
-
if (type === "
|
|
1012
|
-
|
|
1013
|
-
if (type === "
|
|
1014
|
-
|
|
1015
|
-
if (type === "
|
|
1016
|
-
|
|
1017
|
-
if (type === "
|
|
1018
|
-
|
|
1019
|
-
if (type === "
|
|
1040
|
+
if (type === "button")
|
|
1041
|
+
return new _Button__WEBPACK_IMPORTED_MODULE_5__["default"](props);
|
|
1042
|
+
if (type === "checkbox")
|
|
1043
|
+
return new _Checkbox__WEBPACK_IMPORTED_MODULE_6__["default"](props);
|
|
1044
|
+
if (type === "nentry")
|
|
1045
|
+
return new _Nentry__WEBPACK_IMPORTED_MODULE_3__["default"](props);
|
|
1046
|
+
if (type === "soundfile")
|
|
1047
|
+
return new _Soundfile__WEBPACK_IMPORTED_MODULE_4__["default"](props);
|
|
1048
|
+
if (type === "knob")
|
|
1049
|
+
return new _Knob__WEBPACK_IMPORTED_MODULE_7__["default"](props);
|
|
1050
|
+
if (type === "menu")
|
|
1051
|
+
return new _Menu__WEBPACK_IMPORTED_MODULE_8__["default"](props);
|
|
1052
|
+
if (type === "radio")
|
|
1053
|
+
return new _Radio__WEBPACK_IMPORTED_MODULE_9__["default"](props);
|
|
1054
|
+
if (type === "hslider")
|
|
1055
|
+
return new _HSlider__WEBPACK_IMPORTED_MODULE_1__["default"](props);
|
|
1056
|
+
if (type === "vslider")
|
|
1057
|
+
return new _VSlider__WEBPACK_IMPORTED_MODULE_2__["default"](props);
|
|
1058
|
+
if (type === "hbargraph")
|
|
1059
|
+
return new _HBargraph__WEBPACK_IMPORTED_MODULE_12__["default"](props);
|
|
1060
|
+
if (type === "vbargraph")
|
|
1061
|
+
return new _VBargraph__WEBPACK_IMPORTED_MODULE_13__["default"](props);
|
|
1062
|
+
if (type === "numerical")
|
|
1063
|
+
return new _Numerical__WEBPACK_IMPORTED_MODULE_11__["default"](props);
|
|
1064
|
+
if (type === "led")
|
|
1065
|
+
return new _Led__WEBPACK_IMPORTED_MODULE_10__["default"](props);
|
|
1020
1066
|
return null;
|
|
1021
1067
|
}
|
|
1022
1068
|
setState(newState) {
|
|
@@ -1035,8 +1081,10 @@ class Group extends _AbstractComponent__WEBPACK_IMPORTED_MODULE_0__["default"] {
|
|
|
1035
1081
|
} else if (stateKey in this.state && this.state[stateKey] !== stateValue) {
|
|
1036
1082
|
this.state[stateKey] = stateValue;
|
|
1037
1083
|
shouldUpdate = true;
|
|
1038
|
-
} else
|
|
1039
|
-
|
|
1084
|
+
} else
|
|
1085
|
+
return;
|
|
1086
|
+
if (shouldUpdate)
|
|
1087
|
+
this.emit(stateKey, this.state[stateKey]);
|
|
1040
1088
|
}
|
|
1041
1089
|
}
|
|
1042
1090
|
componentWillMount() {
|
|
@@ -1054,14 +1102,16 @@ class Group extends _AbstractComponent__WEBPACK_IMPORTED_MODULE_0__["default"] {
|
|
|
1054
1102
|
return this;
|
|
1055
1103
|
}
|
|
1056
1104
|
paintLabel() {
|
|
1057
|
-
if (this.state.isRoot)
|
|
1105
|
+
if (this.state.isRoot)
|
|
1106
|
+
return this;
|
|
1058
1107
|
const label = this.state.label;
|
|
1059
1108
|
const color = this.state.style.labelcolor;
|
|
1060
1109
|
const ctx = this.labelCtx;
|
|
1061
1110
|
const canvas = this.labelCanvas;
|
|
1062
1111
|
const ratio = window.devicePixelRatio || 1;
|
|
1063
1112
|
let { width, height } = this.label.getBoundingClientRect();
|
|
1064
|
-
if (!width || !height)
|
|
1113
|
+
if (!width || !height)
|
|
1114
|
+
return this;
|
|
1065
1115
|
width = Math.floor(width);
|
|
1066
1116
|
height = Math.floor(height);
|
|
1067
1117
|
const scaledWidth = Math.floor(width * ratio);
|
|
@@ -1082,7 +1132,8 @@ class Group extends _AbstractComponent__WEBPACK_IMPORTED_MODULE_0__["default"] {
|
|
|
1082
1132
|
this.label.appendChild(this.labelCanvas);
|
|
1083
1133
|
this.container.appendChild(this.label);
|
|
1084
1134
|
}
|
|
1085
|
-
if (this.tabs.children.length)
|
|
1135
|
+
if (this.tabs.children.length)
|
|
1136
|
+
this.container.appendChild(this.tabs);
|
|
1086
1137
|
this.children.forEach((item) => {
|
|
1087
1138
|
item.mount();
|
|
1088
1139
|
this.container.appendChild(item.container);
|
|
@@ -1093,7 +1144,8 @@ class Group extends _AbstractComponent__WEBPACK_IMPORTED_MODULE_0__["default"] {
|
|
|
1093
1144
|
var _a;
|
|
1094
1145
|
const handleResize = () => {
|
|
1095
1146
|
const { grid, left, top, width, height } = this.state.style;
|
|
1096
|
-
if (!this.state.isRoot)
|
|
1147
|
+
if (!this.state.isRoot)
|
|
1148
|
+
this.label.style.height = `${grid * 0.3}px`;
|
|
1097
1149
|
this.container.style.width = `${width * grid}px`;
|
|
1098
1150
|
this.container.style.height = `${height * grid}px`;
|
|
1099
1151
|
this.container.style.left = `${left * grid}px`;
|
|
@@ -1124,7 +1176,8 @@ class Group extends _AbstractComponent__WEBPACK_IMPORTED_MODULE_0__["default"] {
|
|
|
1124
1176
|
};
|
|
1125
1177
|
this.on("label", () => this.schedule(labelChange));
|
|
1126
1178
|
this.paintLabel();
|
|
1127
|
-
if ((_a = this.tabs) == null ? void 0 : _a.children.length)
|
|
1179
|
+
if ((_a = this.tabs) == null ? void 0 : _a.children.length)
|
|
1180
|
+
this.tabs.children[0].click();
|
|
1128
1181
|
this.children.forEach((item) => item.componentDidMount());
|
|
1129
1182
|
return this;
|
|
1130
1183
|
}
|
|
@@ -1182,7 +1235,8 @@ class HBargraph extends _VBargraph__WEBPACK_IMPORTED_MODULE_1__["default"] {
|
|
|
1182
1235
|
const paintValue = this.paintValue;
|
|
1183
1236
|
if (paintValue > this.maxValue) {
|
|
1184
1237
|
this.maxValue = paintValue;
|
|
1185
|
-
if (this.maxTimer)
|
|
1238
|
+
if (this.maxTimer)
|
|
1239
|
+
window.clearTimeout(this.maxTimer);
|
|
1186
1240
|
this.maxTimer = window.setTimeout(() => {
|
|
1187
1241
|
this.maxValue = this.paintValue;
|
|
1188
1242
|
this.maxTimer = void 0;
|
|
@@ -1202,15 +1256,23 @@ class HBargraph extends _VBargraph__WEBPACK_IMPORTED_MODULE_1__["default"] {
|
|
|
1202
1256
|
const hotStop = (-3 - min) / (max - min);
|
|
1203
1257
|
const overloadStop = Math.max(0, -min / (max - min));
|
|
1204
1258
|
const gradient = ctx.createLinearGradient(left, 0, drawWidth, 0);
|
|
1205
|
-
if (coldStop <= 1 && coldStop >= 0)
|
|
1206
|
-
|
|
1207
|
-
if (
|
|
1208
|
-
|
|
1209
|
-
if (
|
|
1210
|
-
|
|
1259
|
+
if (coldStop <= 1 && coldStop >= 0)
|
|
1260
|
+
gradient.addColorStop(coldStop, coldcolor);
|
|
1261
|
+
else if (coldStop > 1)
|
|
1262
|
+
gradient.addColorStop(1, coldcolor);
|
|
1263
|
+
if (warmStop <= 1 && warmStop >= 0)
|
|
1264
|
+
gradient.addColorStop(warmStop, warmcolor);
|
|
1265
|
+
if (hotStop <= 1 && hotStop >= 0)
|
|
1266
|
+
gradient.addColorStop(hotStop, hotcolor);
|
|
1267
|
+
if (overloadStop <= 1 && overloadStop >= 0)
|
|
1268
|
+
gradient.addColorStop(overloadStop, overloadcolor);
|
|
1269
|
+
else if (overloadStop < 0)
|
|
1270
|
+
gradient.addColorStop(0, coldcolor);
|
|
1211
1271
|
ctx.fillStyle = barbgcolor;
|
|
1212
|
-
if (paintValue < 0)
|
|
1213
|
-
|
|
1272
|
+
if (paintValue < 0)
|
|
1273
|
+
ctx.fillRect(left, top, drawWidth * overloadStop, drawHeight);
|
|
1274
|
+
if (paintValue < max)
|
|
1275
|
+
ctx.fillRect(left + drawWidth * overloadStop + 1, top, drawWidth * (1 - overloadStop) - 1, drawHeight);
|
|
1214
1276
|
ctx.fillStyle = gradient;
|
|
1215
1277
|
if (paintValue > min) {
|
|
1216
1278
|
const distance = Math.max(0, _AbstractItem__WEBPACK_IMPORTED_MODULE_0__["default"].getDistance({ type, max, min, enums, scale, value: Math.min(0, paintValue) }));
|
|
@@ -1347,7 +1409,8 @@ class Knob extends _AbstractItem__WEBPACK_IMPORTED_MODULE_0__["default"] {
|
|
|
1347
1409
|
const value = parseFloat(e.currentTarget.value);
|
|
1348
1410
|
if (isFinite(value)) {
|
|
1349
1411
|
const changed = this.setValue(+value);
|
|
1350
|
-
if (changed)
|
|
1412
|
+
if (changed)
|
|
1413
|
+
return;
|
|
1351
1414
|
}
|
|
1352
1415
|
this.input.value = this.inputNumber.value + (this.state.unit || "");
|
|
1353
1416
|
};
|
|
@@ -1402,7 +1465,8 @@ class Knob extends _AbstractItem__WEBPACK_IMPORTED_MODULE_0__["default"] {
|
|
|
1402
1465
|
};
|
|
1403
1466
|
this.handleMouseOrTouchMove = (e) => {
|
|
1404
1467
|
const newValue = this.getValueFromDelta(e);
|
|
1405
|
-
if (newValue !== this.state.value)
|
|
1468
|
+
if (newValue !== this.state.value)
|
|
1469
|
+
this.setValue(newValue);
|
|
1406
1470
|
};
|
|
1407
1471
|
}
|
|
1408
1472
|
static get defaultProps() {
|
|
@@ -1494,8 +1558,10 @@ class Knob extends _AbstractItem__WEBPACK_IMPORTED_MODULE_0__["default"] {
|
|
|
1494
1558
|
const v = scale === "exp" ? (0,_utils__WEBPACK_IMPORTED_MODULE_1__.normExp)(denormalized, min, max) : scale === "log" ? (0,_utils__WEBPACK_IMPORTED_MODULE_1__.normLog)(denormalized, min, max) : denormalized;
|
|
1495
1559
|
let steps = Math.round((0,_utils__WEBPACK_IMPORTED_MODULE_1__.normalize)(v, min, max) * range / stepRange);
|
|
1496
1560
|
steps = Math.min(stepsCount, Math.max(0, steps));
|
|
1497
|
-
if (type === "enum")
|
|
1498
|
-
|
|
1561
|
+
if (type === "enum")
|
|
1562
|
+
return steps;
|
|
1563
|
+
if (type === "int")
|
|
1564
|
+
return Math.round(steps * step + min);
|
|
1499
1565
|
return steps * step + min;
|
|
1500
1566
|
}
|
|
1501
1567
|
}
|
|
@@ -1567,19 +1633,29 @@ class Led extends _AbstractItem__WEBPACK_IMPORTED_MODULE_0__["default"] {
|
|
|
1567
1633
|
const hotStop = (-3 - min) / (max - min);
|
|
1568
1634
|
const overloadStop = -min / (max - min);
|
|
1569
1635
|
const gradient = tempCtx.createLinearGradient(0, 0, tempCanvas.width, 0);
|
|
1570
|
-
if (coldStop <= 1 && coldStop >= 0)
|
|
1571
|
-
|
|
1572
|
-
if (
|
|
1573
|
-
|
|
1574
|
-
if (
|
|
1575
|
-
|
|
1636
|
+
if (coldStop <= 1 && coldStop >= 0)
|
|
1637
|
+
gradient.addColorStop(coldStop, coldcolor);
|
|
1638
|
+
else if (coldStop > 1)
|
|
1639
|
+
gradient.addColorStop(1, coldcolor);
|
|
1640
|
+
if (warmStop <= 1 && warmStop >= 0)
|
|
1641
|
+
gradient.addColorStop(warmStop, warmcolor);
|
|
1642
|
+
if (hotStop <= 1 && hotStop >= 0)
|
|
1643
|
+
gradient.addColorStop(hotStop, hotcolor);
|
|
1644
|
+
if (overloadStop <= 1 && overloadStop >= 0)
|
|
1645
|
+
gradient.addColorStop(overloadStop, overloadcolor);
|
|
1646
|
+
else if (overloadStop < 0)
|
|
1647
|
+
gradient.addColorStop(0, coldcolor);
|
|
1576
1648
|
tempCtx.fillStyle = gradient;
|
|
1577
1649
|
tempCtx.fillRect(0, 0, tempCanvas.width, 10);
|
|
1578
1650
|
const d = tempCtx.getImageData(Math.min(tempCanvas.width - 1, distance * tempCanvas.width), 0, 1, 1).data;
|
|
1579
|
-
if (distance)
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1651
|
+
if (distance)
|
|
1652
|
+
ctx.fillStyle = `rgb(${d[0]}, ${d[1]}, ${d[2]})`;
|
|
1653
|
+
else
|
|
1654
|
+
ctx.fillStyle = ledbgcolor;
|
|
1655
|
+
if (shape === "circle")
|
|
1656
|
+
ctx.arc(width / 2, height / 2, width / 2 - left, 0, 2 * Math.PI);
|
|
1657
|
+
else
|
|
1658
|
+
ctx.rect(left, top, drawWidth, drawHeight);
|
|
1583
1659
|
ctx.fill();
|
|
1584
1660
|
};
|
|
1585
1661
|
}
|
|
@@ -1719,7 +1795,8 @@ class Menu extends _AbstractItem__WEBPACK_IMPORTED_MODULE_0__["default"] {
|
|
|
1719
1795
|
const option = document.createElement("option");
|
|
1720
1796
|
option.value = enums[key].toString();
|
|
1721
1797
|
option.text = key;
|
|
1722
|
-
if (i === 0)
|
|
1798
|
+
if (i === 0)
|
|
1799
|
+
option.selected = true;
|
|
1723
1800
|
this.select.appendChild(option);
|
|
1724
1801
|
i++;
|
|
1725
1802
|
}
|
|
@@ -1734,7 +1811,8 @@ class Menu extends _AbstractItem__WEBPACK_IMPORTED_MODULE_0__["default"] {
|
|
|
1734
1811
|
const valueChange = () => {
|
|
1735
1812
|
for (let i = this.select.children.length - 1; i >= 0; i--) {
|
|
1736
1813
|
const option = this.select.children[i];
|
|
1737
|
-
if (+option.value === this.state.value)
|
|
1814
|
+
if (+option.value === this.state.value)
|
|
1815
|
+
this.select.selectedIndex = i;
|
|
1738
1816
|
}
|
|
1739
1817
|
};
|
|
1740
1818
|
this.on("value", () => this.schedule(valueChange));
|
|
@@ -1982,9 +2060,11 @@ class Radio extends _AbstractItem__WEBPACK_IMPORTED_MODULE_0__["default"] {
|
|
|
1982
2060
|
input.value = enums[key].toString();
|
|
1983
2061
|
input.name = address;
|
|
1984
2062
|
input.type = "radio";
|
|
1985
|
-
if (i === 0)
|
|
2063
|
+
if (i === 0)
|
|
2064
|
+
input.checked = true;
|
|
1986
2065
|
input.addEventListener("change", () => {
|
|
1987
|
-
if (input.checked)
|
|
2066
|
+
if (input.checked)
|
|
2067
|
+
this.setValue(enums[key]);
|
|
1988
2068
|
});
|
|
1989
2069
|
div.appendChild(input);
|
|
1990
2070
|
div.append(key);
|
|
@@ -2032,7 +2112,8 @@ class Radio extends _AbstractItem__WEBPACK_IMPORTED_MODULE_0__["default"] {
|
|
|
2032
2112
|
const valueChange = () => {
|
|
2033
2113
|
for (let i = this.group.children.length - 1; i >= 0; i--) {
|
|
2034
2114
|
const input = this.group.children[i].querySelector("input");
|
|
2035
|
-
if (+input.value === this.state.value)
|
|
2115
|
+
if (+input.value === this.state.value)
|
|
2116
|
+
input.checked = true;
|
|
2036
2117
|
}
|
|
2037
2118
|
};
|
|
2038
2119
|
this.on("value", () => this.schedule(valueChange));
|
|
@@ -2213,7 +2294,8 @@ class VBargraph extends _AbstractItem__WEBPACK_IMPORTED_MODULE_0__["default"] {
|
|
|
2213
2294
|
const paintValue = this.paintValue;
|
|
2214
2295
|
if (paintValue > this.maxValue) {
|
|
2215
2296
|
this.maxValue = paintValue;
|
|
2216
|
-
if (this.maxTimer)
|
|
2297
|
+
if (this.maxTimer)
|
|
2298
|
+
window.clearTimeout(this.maxTimer);
|
|
2217
2299
|
this.maxTimer = window.setTimeout(() => {
|
|
2218
2300
|
this.maxValue = this.paintValue;
|
|
2219
2301
|
this.maxTimer = void 0;
|
|
@@ -2233,15 +2315,23 @@ class VBargraph extends _AbstractItem__WEBPACK_IMPORTED_MODULE_0__["default"] {
|
|
|
2233
2315
|
const hotStop = (-3 - min) / (max - min);
|
|
2234
2316
|
const overloadStop = Math.max(0, -min / (max - min));
|
|
2235
2317
|
const gradient = ctx.createLinearGradient(0, drawHeight, 0, top);
|
|
2236
|
-
if (coldStop <= 1 && coldStop >= 0)
|
|
2237
|
-
|
|
2238
|
-
if (
|
|
2239
|
-
|
|
2240
|
-
if (
|
|
2241
|
-
|
|
2318
|
+
if (coldStop <= 1 && coldStop >= 0)
|
|
2319
|
+
gradient.addColorStop(coldStop, coldcolor);
|
|
2320
|
+
else if (coldStop > 1)
|
|
2321
|
+
gradient.addColorStop(1, coldcolor);
|
|
2322
|
+
if (warmStop <= 1 && warmStop >= 0)
|
|
2323
|
+
gradient.addColorStop(warmStop, warmcolor);
|
|
2324
|
+
if (hotStop <= 1 && hotStop >= 0)
|
|
2325
|
+
gradient.addColorStop(hotStop, hotcolor);
|
|
2326
|
+
if (overloadStop <= 1 && overloadStop >= 0)
|
|
2327
|
+
gradient.addColorStop(overloadStop, overloadcolor);
|
|
2328
|
+
else if (overloadStop < 0)
|
|
2329
|
+
gradient.addColorStop(0, coldcolor);
|
|
2242
2330
|
ctx.fillStyle = barbgcolor;
|
|
2243
|
-
if (paintValue < 0)
|
|
2244
|
-
|
|
2331
|
+
if (paintValue < 0)
|
|
2332
|
+
ctx.fillRect(left, top + (1 - overloadStop) * drawHeight, drawWidth, drawHeight * overloadStop);
|
|
2333
|
+
if (paintValue < max)
|
|
2334
|
+
ctx.fillRect(left, top, drawWidth, (1 - overloadStop) * drawHeight - 1);
|
|
2245
2335
|
ctx.fillStyle = gradient;
|
|
2246
2336
|
if (paintValue > min) {
|
|
2247
2337
|
const distance = Math.max(0, _AbstractItem__WEBPACK_IMPORTED_MODULE_0__["default"].getDistance({ type, max, min, enums, scale, value: Math.min(0, paintValue) }));
|
|
@@ -2375,7 +2465,8 @@ class VSlider extends _AbstractItem__WEBPACK_IMPORTED_MODULE_0__["default"] {
|
|
|
2375
2465
|
const value = parseFloat(e.currentTarget.value);
|
|
2376
2466
|
if (isFinite(value)) {
|
|
2377
2467
|
const changed = this.setValue(+value);
|
|
2378
|
-
if (changed)
|
|
2468
|
+
if (changed)
|
|
2469
|
+
return;
|
|
2379
2470
|
}
|
|
2380
2471
|
this.input.value = this.inputNumber.value + (this.state.unit || "");
|
|
2381
2472
|
};
|
|
@@ -2417,13 +2508,16 @@ class VSlider extends _AbstractItem__WEBPACK_IMPORTED_MODULE_0__["default"] {
|
|
|
2417
2508
|
};
|
|
2418
2509
|
this.handleMouseOrTouchDown = (e) => {
|
|
2419
2510
|
const { value } = this.state;
|
|
2420
|
-
if (e.x < this.interactionRect[0] || e.x > this.interactionRect[0] + this.interactionRect[2] || e.y < this.interactionRect[1] || e.y > this.interactionRect[1] + this.interactionRect[3])
|
|
2511
|
+
if (e.x < this.interactionRect[0] || e.x > this.interactionRect[0] + this.interactionRect[2] || e.y < this.interactionRect[1] || e.y > this.interactionRect[1] + this.interactionRect[3])
|
|
2512
|
+
return;
|
|
2421
2513
|
const newValue = this.getValueFromPos(e);
|
|
2422
|
-
if (newValue !== value)
|
|
2514
|
+
if (newValue !== value)
|
|
2515
|
+
this.setValue(this.getValueFromPos(e));
|
|
2423
2516
|
};
|
|
2424
2517
|
this.handleMouseOrTouchMove = (e) => {
|
|
2425
2518
|
const newValue = this.getValueFromPos(e);
|
|
2426
|
-
if (newValue !== this.state.value)
|
|
2519
|
+
if (newValue !== this.state.value)
|
|
2520
|
+
this.setValue(newValue);
|
|
2427
2521
|
};
|
|
2428
2522
|
}
|
|
2429
2523
|
static get defaultProps() {
|
|
@@ -2513,8 +2607,10 @@ class VSlider extends _AbstractItem__WEBPACK_IMPORTED_MODULE_0__["default"] {
|
|
|
2513
2607
|
const { type, max, min, step, enums } = this.state;
|
|
2514
2608
|
const maxSteps = type === "enum" ? enums.length : type === "int" ? max - min : (max - min) / step;
|
|
2515
2609
|
if (step) {
|
|
2516
|
-
if (type === "enum")
|
|
2517
|
-
|
|
2610
|
+
if (type === "enum")
|
|
2611
|
+
return enums.length;
|
|
2612
|
+
if (type === "int")
|
|
2613
|
+
return Math.min(Math.floor((max - min) / (Math.round(step) || 0)), maxSteps);
|
|
2518
2614
|
return Math.floor((max - min) / step);
|
|
2519
2615
|
}
|
|
2520
2616
|
return maxSteps;
|
|
@@ -2535,8 +2631,10 @@ class VSlider extends _AbstractItem__WEBPACK_IMPORTED_MODULE_0__["default"] {
|
|
|
2535
2631
|
const v = scale === "exp" ? (0,_utils__WEBPACK_IMPORTED_MODULE_1__.normExp)(denormalized, min, max) : scale === "log" ? (0,_utils__WEBPACK_IMPORTED_MODULE_1__.normLog)(denormalized, min, max) : denormalized;
|
|
2536
2632
|
let steps = Math.round((0,_utils__WEBPACK_IMPORTED_MODULE_1__.normalize)(v, min, max) * range / stepRange);
|
|
2537
2633
|
steps = Math.min(stepsCount, Math.max(0, steps));
|
|
2538
|
-
if (type === "enum")
|
|
2539
|
-
|
|
2634
|
+
if (type === "enum")
|
|
2635
|
+
return steps;
|
|
2636
|
+
if (type === "int")
|
|
2637
|
+
return Math.round(steps * step + min);
|
|
2540
2638
|
return steps * step + min;
|
|
2541
2639
|
}
|
|
2542
2640
|
}
|
|
@@ -2591,8 +2689,10 @@ const normExp = iNormLog;
|
|
|
2591
2689
|
const iNormExp = normLog;
|
|
2592
2690
|
const roundedRect = (ctx, x, y, width, height, radius) => {
|
|
2593
2691
|
const radii = [0, 0, 0, 0];
|
|
2594
|
-
if (typeof radius === "number")
|
|
2595
|
-
|
|
2692
|
+
if (typeof radius === "number")
|
|
2693
|
+
radii.fill(radius);
|
|
2694
|
+
else
|
|
2695
|
+
radius.forEach((v, i) => radii[i] = v);
|
|
2596
2696
|
ctx.beginPath();
|
|
2597
2697
|
ctx.moveTo(x + radii[0], y);
|
|
2598
2698
|
ctx.lineTo(x + width - radii[1], y);
|
|
@@ -2608,8 +2708,10 @@ const roundedRect = (ctx, x, y, width, height, radius) => {
|
|
|
2608
2708
|
};
|
|
2609
2709
|
const fillRoundedRect = (ctx, x, y, width, height, radius) => {
|
|
2610
2710
|
const radii = [0, 0, 0, 0];
|
|
2611
|
-
if (typeof radius === "number")
|
|
2612
|
-
|
|
2711
|
+
if (typeof radius === "number")
|
|
2712
|
+
radii.fill(radius);
|
|
2713
|
+
else
|
|
2714
|
+
radius.forEach((v, i) => radii[i] = v);
|
|
2613
2715
|
ctx.beginPath();
|
|
2614
2716
|
ctx.moveTo(x + radii[0], y);
|
|
2615
2717
|
ctx.lineTo(x + width - radii[1], y);
|
|
@@ -2651,10 +2753,12 @@ const instantiate = () => {
|
|
|
2651
2753
|
host = source;
|
|
2652
2754
|
});
|
|
2653
2755
|
window.addEventListener("keydown", (e) => {
|
|
2654
|
-
if (host)
|
|
2756
|
+
if (host)
|
|
2757
|
+
host.postMessage({ type: "keydown", key: e.key }, "*");
|
|
2655
2758
|
});
|
|
2656
2759
|
window.addEventListener("keyup", (e) => {
|
|
2657
|
-
if (host)
|
|
2760
|
+
if (host)
|
|
2761
|
+
host.postMessage({ type: "keyup", key: e.key }, "*");
|
|
2658
2762
|
});
|
|
2659
2763
|
window.faustUI = faustUI;
|
|
2660
2764
|
};
|
|
@@ -2673,7 +2777,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
2673
2777
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
2674
2778
|
/* harmony export */ "default": () => (/* binding */ AbstractGroup)
|
|
2675
2779
|
/* harmony export */ });
|
|
2676
|
-
const _AbstractGroup = class
|
|
2780
|
+
const _AbstractGroup = class {
|
|
2677
2781
|
constructor(group, isRoot) {
|
|
2678
2782
|
this.isRoot = !!isRoot;
|
|
2679
2783
|
Object.assign(this, group);
|
|
@@ -2691,7 +2795,8 @@ const _AbstractGroup = class _AbstractGroup {
|
|
|
2691
2795
|
*/
|
|
2692
2796
|
get hasHSizingDesc() {
|
|
2693
2797
|
return !!this.items.find((item) => {
|
|
2694
|
-
if (item instanceof _AbstractGroup)
|
|
2798
|
+
if (item instanceof _AbstractGroup)
|
|
2799
|
+
return item.hasHSizingDesc;
|
|
2695
2800
|
return item.layout.sizing === "horizontal" || item.layout.sizing === "both";
|
|
2696
2801
|
});
|
|
2697
2802
|
}
|
|
@@ -2700,7 +2805,8 @@ const _AbstractGroup = class _AbstractGroup {
|
|
|
2700
2805
|
*/
|
|
2701
2806
|
get hasVSizingDesc() {
|
|
2702
2807
|
return !!this.items.find((item) => {
|
|
2703
|
-
if (item instanceof _AbstractGroup)
|
|
2808
|
+
if (item instanceof _AbstractGroup)
|
|
2809
|
+
return item.hasVSizingDesc;
|
|
2704
2810
|
return item.layout.sizing === "vertical" || item.layout.sizing === "both";
|
|
2705
2811
|
});
|
|
2706
2812
|
}
|
|
@@ -2714,10 +2820,10 @@ const _AbstractGroup = class _AbstractGroup {
|
|
|
2714
2820
|
return this;
|
|
2715
2821
|
}
|
|
2716
2822
|
};
|
|
2717
|
-
_AbstractGroup.padding = 0.2;
|
|
2718
|
-
_AbstractGroup.labelHeight = 0.25;
|
|
2719
|
-
_AbstractGroup.spaceBetween = 0.1;
|
|
2720
2823
|
let AbstractGroup = _AbstractGroup;
|
|
2824
|
+
AbstractGroup.padding = 0.2;
|
|
2825
|
+
AbstractGroup.labelHeight = 0.25;
|
|
2826
|
+
AbstractGroup.spaceBetween = 0.1;
|
|
2721
2827
|
|
|
2722
2828
|
|
|
2723
2829
|
|
|
@@ -2895,13 +3001,15 @@ class HGroup extends _AbstractGroup__WEBPACK_IMPORTED_MODULE_0__["default"] {
|
|
|
2895
3001
|
this.layout.height = Math.max(this.layout.height, item.layout.height + 2 * _AbstractGroup__WEBPACK_IMPORTED_MODULE_0__["default"].padding + (this.isRoot ? 0 : _AbstractGroup__WEBPACK_IMPORTED_MODULE_0__["default"].labelHeight));
|
|
2896
3002
|
});
|
|
2897
3003
|
this.layout.width += _AbstractGroup__WEBPACK_IMPORTED_MODULE_0__["default"].spaceBetween * (this.items.length - 1);
|
|
2898
|
-
if (this.layout.width < 1)
|
|
3004
|
+
if (this.layout.width < 1)
|
|
3005
|
+
this.layout.width += 1;
|
|
2899
3006
|
return this;
|
|
2900
3007
|
}
|
|
2901
3008
|
expand(dX) {
|
|
2902
3009
|
let hExpandItems = 0;
|
|
2903
3010
|
this.items.forEach((item) => {
|
|
2904
|
-
if (item.layout.sizing === "both" || item.layout.sizing === "horizontal")
|
|
3011
|
+
if (item.layout.sizing === "both" || item.layout.sizing === "horizontal")
|
|
3012
|
+
hExpandItems++;
|
|
2905
3013
|
});
|
|
2906
3014
|
this.items.forEach((item) => {
|
|
2907
3015
|
let dX$ = 0;
|
|
@@ -3045,26 +3153,31 @@ class Layout {
|
|
|
3045
3153
|
if ((_a = item.meta) == null ? void 0 : _a.find((meta) => {
|
|
3046
3154
|
var _a2;
|
|
3047
3155
|
return (_a2 = meta.style) == null ? void 0 : _a2.startsWith("led");
|
|
3048
|
-
}))
|
|
3156
|
+
}))
|
|
3157
|
+
return "led";
|
|
3049
3158
|
if ((_b = item.meta) == null ? void 0 : _b.find((meta) => {
|
|
3050
3159
|
var _a2;
|
|
3051
3160
|
return (_a2 = meta.style) == null ? void 0 : _a2.startsWith("numerical");
|
|
3052
|
-
}))
|
|
3161
|
+
}))
|
|
3162
|
+
return "numerical";
|
|
3053
3163
|
return item.type;
|
|
3054
3164
|
}
|
|
3055
3165
|
if (item.type === "hslider" || item.type === "nentry" || item.type === "vslider") {
|
|
3056
3166
|
if ((_c = item.meta) == null ? void 0 : _c.find((meta) => {
|
|
3057
3167
|
var _a2;
|
|
3058
3168
|
return (_a2 = meta.style) == null ? void 0 : _a2.startsWith("knob");
|
|
3059
|
-
}))
|
|
3169
|
+
}))
|
|
3170
|
+
return "knob";
|
|
3060
3171
|
if ((_d = item.meta) == null ? void 0 : _d.find((meta) => {
|
|
3061
3172
|
var _a2;
|
|
3062
3173
|
return (_a2 = meta.style) == null ? void 0 : _a2.startsWith("menu");
|
|
3063
|
-
}))
|
|
3174
|
+
}))
|
|
3175
|
+
return "menu";
|
|
3064
3176
|
if ((_e = item.meta) == null ? void 0 : _e.find((meta) => {
|
|
3065
3177
|
var _a2;
|
|
3066
3178
|
return (_a2 = meta.style) == null ? void 0 : _a2.startsWith("radio");
|
|
3067
|
-
}))
|
|
3179
|
+
}))
|
|
3180
|
+
return "radio";
|
|
3068
3181
|
}
|
|
3069
3182
|
return item.type;
|
|
3070
3183
|
}
|
|
@@ -3095,7 +3208,8 @@ class Layout {
|
|
|
3095
3208
|
}
|
|
3096
3209
|
static getItems(items) {
|
|
3097
3210
|
return items.map((item) => {
|
|
3098
|
-
if ("items" in item)
|
|
3211
|
+
if ("items" in item)
|
|
3212
|
+
item.items = this.getItems(item.items);
|
|
3099
3213
|
return this.getItem(item);
|
|
3100
3214
|
});
|
|
3101
3215
|
}
|
|
@@ -3286,7 +3400,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
3286
3400
|
/* harmony export */ });
|
|
3287
3401
|
/* harmony import */ var _AbstractGroup__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./AbstractGroup */ "./src/layout/AbstractGroup.ts");
|
|
3288
3402
|
|
|
3289
|
-
const _TGroup = class
|
|
3403
|
+
const _TGroup = class extends _AbstractGroup__WEBPACK_IMPORTED_MODULE_0__["default"] {
|
|
3290
3404
|
adjust() {
|
|
3291
3405
|
this.items.forEach((item) => {
|
|
3292
3406
|
item.adjust();
|
|
@@ -3296,7 +3410,8 @@ const _TGroup = class _TGroup extends _AbstractGroup__WEBPACK_IMPORTED_MODULE_0_
|
|
|
3296
3410
|
const tabsCount = this.items.length;
|
|
3297
3411
|
this.layout.width = Math.max(this.layout.width, tabsCount * _TGroup.tabLayout.width);
|
|
3298
3412
|
this.layout.height += _TGroup.tabLayout.height;
|
|
3299
|
-
if (this.layout.width < 1)
|
|
3413
|
+
if (this.layout.width < 1)
|
|
3414
|
+
this.layout.width += 1;
|
|
3300
3415
|
return this;
|
|
3301
3416
|
}
|
|
3302
3417
|
expand() {
|
|
@@ -3304,8 +3419,10 @@ const _TGroup = class _TGroup extends _AbstractGroup__WEBPACK_IMPORTED_MODULE_0_
|
|
|
3304
3419
|
this.items.forEach((item) => {
|
|
3305
3420
|
let dY$ = 0;
|
|
3306
3421
|
let dX$ = 0;
|
|
3307
|
-
if (item.layout.sizing === "both" || item.layout.sizing === "horizontal")
|
|
3308
|
-
|
|
3422
|
+
if (item.layout.sizing === "both" || item.layout.sizing === "horizontal")
|
|
3423
|
+
dX$ = this.layout.width - 2 * _AbstractGroup__WEBPACK_IMPORTED_MODULE_0__["default"].padding - item.layout.width;
|
|
3424
|
+
if (item.layout.sizing === "both" || item.layout.sizing === "vertical")
|
|
3425
|
+
dY$ = this.layout.height - 2 * _AbstractGroup__WEBPACK_IMPORTED_MODULE_0__["default"].padding - (this.isRoot ? 0 : _AbstractGroup__WEBPACK_IMPORTED_MODULE_0__["default"].labelHeight) - (tabsCount ? _TGroup.tabLayout.height : 0) - item.layout.height;
|
|
3309
3426
|
item.expand(dX$, dY$);
|
|
3310
3427
|
});
|
|
3311
3428
|
return this;
|
|
@@ -3324,11 +3441,11 @@ const _TGroup = class _TGroup extends _AbstractGroup__WEBPACK_IMPORTED_MODULE_0_
|
|
|
3324
3441
|
return this;
|
|
3325
3442
|
}
|
|
3326
3443
|
};
|
|
3327
|
-
|
|
3444
|
+
let TGroup = _TGroup;
|
|
3445
|
+
TGroup.tabLayout = {
|
|
3328
3446
|
width: 2,
|
|
3329
3447
|
height: 1
|
|
3330
3448
|
};
|
|
3331
|
-
let TGroup = _TGroup;
|
|
3332
3449
|
|
|
3333
3450
|
|
|
3334
3451
|
|
|
@@ -3381,13 +3498,15 @@ class VGroup extends _AbstractGroup__WEBPACK_IMPORTED_MODULE_0__["default"] {
|
|
|
3381
3498
|
this.layout.height += item.layout.height;
|
|
3382
3499
|
});
|
|
3383
3500
|
this.layout.height += _AbstractGroup__WEBPACK_IMPORTED_MODULE_0__["default"].spaceBetween * (this.items.length - 1);
|
|
3384
|
-
if (this.layout.width < 1)
|
|
3501
|
+
if (this.layout.width < 1)
|
|
3502
|
+
this.layout.width += 1;
|
|
3385
3503
|
return this;
|
|
3386
3504
|
}
|
|
3387
3505
|
expand(dX, dY) {
|
|
3388
3506
|
let vExpandItems = 0;
|
|
3389
3507
|
this.items.forEach((item) => {
|
|
3390
|
-
if (item.layout.sizing === "both" || item.layout.sizing === "vertical")
|
|
3508
|
+
if (item.layout.sizing === "both" || item.layout.sizing === "vertical")
|
|
3509
|
+
vExpandItems++;
|
|
3391
3510
|
});
|
|
3392
3511
|
this.items.forEach((item) => {
|
|
3393
3512
|
let dX$ = 0;
|
|
@@ -3701,6 +3820,8 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
3701
3820
|
/******/
|
|
3702
3821
|
/************************************************************************/
|
|
3703
3822
|
var __webpack_exports__ = {};
|
|
3823
|
+
// This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
|
|
3824
|
+
(() => {
|
|
3704
3825
|
/*!**********************!*\
|
|
3705
3826
|
!*** ./src/index.ts ***!
|
|
3706
3827
|
\**********************/
|
|
@@ -3714,6 +3835,8 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
3714
3835
|
|
|
3715
3836
|
|
|
3716
3837
|
|
|
3838
|
+
})();
|
|
3839
|
+
|
|
3717
3840
|
var __webpack_exports__FaustUI = __webpack_exports__.FaustUI;
|
|
3718
3841
|
var __webpack_exports__instantiate = __webpack_exports__.instantiate;
|
|
3719
3842
|
export { __webpack_exports__FaustUI as FaustUI, __webpack_exports__instantiate as instantiate };
|