@grame/faustwasm 0.0.25

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (111) hide show
  1. package/README.md +181 -0
  2. package/assets/standalone/faust-ui/index.css +414 -0
  3. package/assets/standalone/faust-ui/index.css.map +1 -0
  4. package/assets/standalone/faust-ui/index.d.ts +1 -0
  5. package/assets/standalone/faust-ui/index.js +3478 -0
  6. package/assets/standalone/faust-ui/index.js.map +1 -0
  7. package/assets/standalone/faustwasm/index.d.ts +1252 -0
  8. package/assets/standalone/faustwasm/index.js +3772 -0
  9. package/assets/standalone/faustwasm/index.js.map +7 -0
  10. package/assets/standalone/index.html +73 -0
  11. package/assets/standalone/index.js +198 -0
  12. package/assets/standalone/types.d.ts +9 -0
  13. package/dist/cjs/index.d.ts +1252 -0
  14. package/dist/cjs/index.js +3752 -0
  15. package/dist/cjs/index.js.map +7 -0
  16. package/dist/cjs-bundle/index.d.ts +1259 -0
  17. package/dist/cjs-bundle/index.js +11507 -0
  18. package/dist/cjs-bundle/index.js.map +7 -0
  19. package/dist/esm/index.d.ts +1252 -0
  20. package/dist/esm/index.js +3772 -0
  21. package/dist/esm/index.js.map +7 -0
  22. package/dist/esm-bundle/index.d.ts +1259 -0
  23. package/dist/esm-bundle/index.js +11495 -0
  24. package/dist/esm-bundle/index.js.map +7 -0
  25. package/fileutils.js +40 -0
  26. package/libfaust-wasm/libfaust-wasm.d.cts +3 -0
  27. package/libfaust-wasm/libfaust-wasm.d.ts +3 -0
  28. package/libfaust-wasm/libfaust-wasm.data +0 -0
  29. package/libfaust-wasm/libfaust-wasm.data.d.ts +2 -0
  30. package/libfaust-wasm/libfaust-wasm.js +21 -0
  31. package/libfaust-wasm/libfaust-wasm.wasm +0 -0
  32. package/libfaust-wasm/libfaust-wasm.wasm.d.ts +2 -0
  33. package/library.md +91 -0
  34. package/package.json +43 -0
  35. package/postbuild-bundled.js +11 -0
  36. package/postbuild.js +63 -0
  37. package/prebuild-bundled.js +11 -0
  38. package/rsrc/overview.png +0 -0
  39. package/rsrc/overview.xlsx +0 -0
  40. package/scripts/faust2sndfile.js +43 -0
  41. package/scripts/faust2svg.js +17 -0
  42. package/scripts/faust2wasm.js +29 -0
  43. package/src/FaustAudioWorkletNode.ts +264 -0
  44. package/src/FaustAudioWorkletProcessor.ts +273 -0
  45. package/src/FaustCompiler.ts +252 -0
  46. package/src/FaustDspGenerator.ts +498 -0
  47. package/src/FaustDspInstance.ts +141 -0
  48. package/src/FaustFFTAudioWorkletProcessor.ts +554 -0
  49. package/src/FaustOfflineProcessor.ts +141 -0
  50. package/src/FaustScriptProcessorNode.ts +80 -0
  51. package/src/FaustSvgDiagrams.ts +37 -0
  52. package/src/FaustWasmInstantiator.ts +202 -0
  53. package/src/FaustWebAudioDsp.ts +1060 -0
  54. package/src/LibFaust.ts +57 -0
  55. package/src/WavDecoder.ts +207 -0
  56. package/src/WavEncoder.ts +204 -0
  57. package/src/copyWebStandaloneAssets.d.ts +3 -0
  58. package/src/copyWebStandaloneAssets.js +20 -0
  59. package/src/exports-bundle.ts +5 -0
  60. package/src/exports.ts +24 -0
  61. package/src/faust2svgFiles.d.ts +3 -0
  62. package/src/faust2svgFiles.js +43 -0
  63. package/src/faust2wasmFiles.d.ts +5 -0
  64. package/src/faust2wasmFiles.js +93 -0
  65. package/src/faust2wavFiles.d.ts +3 -0
  66. package/src/faust2wavFiles.js +58 -0
  67. package/src/index-bundle-iife.ts +7 -0
  68. package/src/index-bundle.ts +5 -0
  69. package/src/index.ts +5 -0
  70. package/src/instantiateFaustModule.ts +32 -0
  71. package/src/instantiateFaustModuleFromFile.ts +57 -0
  72. package/src/types.ts +234 -0
  73. package/test/clarinet.dsp +1 -0
  74. package/test/faustlive-wasm/faust-ui/index.css +414 -0
  75. package/test/faustlive-wasm/faust-ui/index.css.map +1 -0
  76. package/test/faustlive-wasm/faust-ui/index.d.ts +1 -0
  77. package/test/faustlive-wasm/faust-ui/index.js +3478 -0
  78. package/test/faustlive-wasm/faust-ui/index.js.map +1 -0
  79. package/test/faustlive-wasm/faustwasm/index.d.ts +1252 -0
  80. package/test/faustlive-wasm/faustwasm/index.js +3772 -0
  81. package/test/faustlive-wasm/faustwasm/index.js.map +7 -0
  82. package/test/faustlive-wasm/index.css +97 -0
  83. package/test/faustlive-wasm/index.html +130 -0
  84. package/test/faustlive-wasm/index.js +638 -0
  85. package/test/guitar.dsp +1 -0
  86. package/test/guitar1.dsp +2 -0
  87. package/test/libfaust-in-worklet/index.html +13 -0
  88. package/test/libfaust-in-worklet/index.js +40 -0
  89. package/test/mono.dsp +8 -0
  90. package/test/node/test.js +17 -0
  91. package/test/noise.dsp +3 -0
  92. package/test/organ.dsp +5 -0
  93. package/test/organ1.dsp +6 -0
  94. package/test/osc.dsp +4 -0
  95. package/test/osc2.dsp +5 -0
  96. package/test/osc3.dsp +4 -0
  97. package/test/p-dj.dsp +4 -0
  98. package/test/poly.dsp +13 -0
  99. package/test/rev.dsp +2 -0
  100. package/test/t1.dsp +1 -0
  101. package/test/web/fft.html +87 -0
  102. package/test/web/fft1.html +88 -0
  103. package/test/web/fft2.html +114 -0
  104. package/test/web/fftw.js +1907 -0
  105. package/test/web/index.html +12 -0
  106. package/test/web/index.js +235 -0
  107. package/test/web/kissfft.js +904 -0
  108. package/test/web/mono.html +46 -0
  109. package/test/web/poly-key.html +62 -0
  110. package/test/web/poly.html +59 -0
  111. package/tsconfig.json +22 -0
@@ -0,0 +1,3478 @@
1
+ /******/ var __webpack_modules__ = ({
2
+
3
+ /***/ "./node_modules/@shren/typed-event-emitter/dist/index.js":
4
+ /*!***************************************************************!*\
5
+ !*** ./node_modules/@shren/typed-event-emitter/dist/index.js ***!
6
+ \***************************************************************/
7
+ /***/ ((__unused_webpack_module, exports) => {
8
+
9
+
10
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
11
+ exports.TypedEventEmitter = exports.$AnyEventType = void 0;
12
+ exports.$AnyEventType = Symbol("__TypedEventListener_AnyEventType");
13
+ class TypedEventEmitter {
14
+ constructor() {
15
+ this._listeners = { [exports.$AnyEventType]: [] };
16
+ }
17
+ get listeners() {
18
+ return this._listeners;
19
+ }
20
+ getListeners(eventName) {
21
+ if (!(eventName in this._listeners))
22
+ this._listeners[eventName] = [];
23
+ return this._listeners[eventName];
24
+ }
25
+ on(eventName, listener) {
26
+ if (this.getListeners(eventName).indexOf(listener) === -1)
27
+ this.getListeners(eventName).push(listener);
28
+ }
29
+ once(eventName, listener) {
30
+ const listenerWithOff = (arg, emitter) => {
31
+ const returnValue = listener(arg, emitter);
32
+ this.off(eventName, listenerWithOff);
33
+ return returnValue;
34
+ };
35
+ this.on(eventName, listenerWithOff);
36
+ }
37
+ onAny(listener) {
38
+ this._listeners[exports.$AnyEventType].push(listener);
39
+ }
40
+ off(eventName, listener) {
41
+ const i = this.getListeners(eventName).indexOf(listener);
42
+ if (i !== -1)
43
+ this.getListeners(eventName).splice(i, 1);
44
+ }
45
+ offAny(listener) {
46
+ const i = this._listeners[exports.$AnyEventType].indexOf(listener);
47
+ if (i !== -1)
48
+ this._listeners[exports.$AnyEventType].splice(i, 1);
49
+ }
50
+ async emit(eventName, eventData, options) {
51
+ var _a;
52
+ let listeners = this.getListeners(eventName);
53
+ let anyListeners = (options === null || options === void 0 ? void 0 : options.excludeAny) ? [] : this._listeners[exports.$AnyEventType];
54
+ if (!listeners.length && !anyListeners.length)
55
+ return [];
56
+ if ((_a = options === null || options === void 0 ? void 0 : options.exclude) === null || _a === void 0 ? void 0 : _a.length) {
57
+ const { exclude } = options;
58
+ listeners = listeners.filter(l => exclude.indexOf(l) === -1);
59
+ anyListeners = anyListeners.filter(l => exclude.indexOf(l) === -1);
60
+ }
61
+ return Promise.all([...listeners.map(f => f(eventData, this)), ...anyListeners.map(f => f(eventName, eventData, this))]);
62
+ }
63
+ async emitSerial(eventName, eventData, options) {
64
+ var _a;
65
+ let listeners = this.getListeners(eventName);
66
+ let anyListeners = (options === null || options === void 0 ? void 0 : options.excludeAny) ? [] : this._listeners[exports.$AnyEventType];
67
+ if (!listeners.length && !anyListeners.length)
68
+ return [];
69
+ if ((_a = options === null || options === void 0 ? void 0 : options.exclude) === null || _a === void 0 ? void 0 : _a.length) {
70
+ const { exclude } = options;
71
+ listeners = listeners.filter(l => exclude.indexOf(l) === -1);
72
+ anyListeners = anyListeners.filter(l => exclude.indexOf(l) === -1);
73
+ }
74
+ const returnValues = [];
75
+ for (let i = 0; i < listeners.length; i++) {
76
+ const listener = listeners[i];
77
+ returnValues[i] = await listener(eventData, this);
78
+ }
79
+ for (let i = 0; i < anyListeners.length; i++) {
80
+ const listener = anyListeners[i];
81
+ returnValues[listeners.length + i] = await listener(eventName, eventData, this);
82
+ }
83
+ return returnValues;
84
+ }
85
+ emitSync(eventName, eventData, options) {
86
+ var _a;
87
+ let listeners = this.getListeners(eventName);
88
+ let anyListeners = (options === null || options === void 0 ? void 0 : options.excludeAny) ? [] : this._listeners[exports.$AnyEventType];
89
+ if (!listeners.length && !anyListeners.length)
90
+ return [];
91
+ if ((_a = options === null || options === void 0 ? void 0 : options.exclude) === null || _a === void 0 ? void 0 : _a.length) {
92
+ const { exclude } = options;
93
+ listeners = listeners.filter(l => exclude.indexOf(l) === -1);
94
+ anyListeners = anyListeners.filter(l => exclude.indexOf(l) === -1);
95
+ }
96
+ return [...listeners.map(f => f(eventData, this)), ...anyListeners.map(f => f(eventName, eventData, this))];
97
+ }
98
+ offAll(eventName) {
99
+ if (eventName) {
100
+ this._listeners[eventName] = [];
101
+ }
102
+ else {
103
+ this._listeners = { [exports.$AnyEventType]: [] };
104
+ }
105
+ }
106
+ listenerCount(eventName) {
107
+ const anyListenerCount = this._listeners[exports.$AnyEventType].length;
108
+ if (!(eventName in this._listeners))
109
+ return anyListenerCount;
110
+ return this._listeners[eventName].length + anyListenerCount;
111
+ }
112
+ }
113
+ exports.TypedEventEmitter = TypedEventEmitter;
114
+ exports["default"] = TypedEventEmitter;
115
+ //# sourceMappingURL=index.js.map
116
+
117
+ /***/ }),
118
+
119
+ /***/ "./src/FaustUI.ts":
120
+ /*!************************!*\
121
+ !*** ./src/FaustUI.ts ***!
122
+ \************************/
123
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
124
+
125
+ __webpack_require__.r(__webpack_exports__);
126
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
127
+ /* harmony export */ "default": () => (/* binding */ FaustUI)
128
+ /* harmony export */ });
129
+ /* harmony import */ var _layout_Layout__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./layout/Layout */ "./src/layout/Layout.ts");
130
+ /* harmony import */ var _components_Group__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./components/Group */ "./src/components/Group.ts");
131
+ /* harmony import */ var _index_scss__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./index.scss */ "./src/index.scss");
132
+
133
+
134
+
135
+ class FaustUI {
136
+ constructor(options) {
137
+ this.componentMap = {};
138
+ this.paramChangeByUI = (path, value) => {
139
+ if (!this.hostWindow)
140
+ return;
141
+ this.hostWindow.postMessage({ path, value, type: "param" }, "*");
142
+ };
143
+ const { root, ui: uiIn, listenWindowResize, listenWindowMessage } = options;
144
+ this.DOMroot = root;
145
+ this.ui = uiIn || [];
146
+ if (typeof listenWindowResize === "undefined" || listenWindowResize === true) {
147
+ window.addEventListener("resize", () => {
148
+ this.resize();
149
+ });
150
+ }
151
+ if (typeof listenWindowMessage === "undefined" || listenWindowMessage === true) {
152
+ window.addEventListener("message", (e) => {
153
+ const { data, source } = e;
154
+ this.hostWindow = source;
155
+ const { type } = data;
156
+ if (!type)
157
+ return;
158
+ if (type === "ui") {
159
+ this.ui = data.ui;
160
+ } else if (type === "param") {
161
+ const { path, value } = data;
162
+ this.paramChangeByDSP(path, value);
163
+ }
164
+ });
165
+ }
166
+ }
167
+ mount() {
168
+ this.componentMap = {};
169
+ this.DOMroot.innerHTML = "";
170
+ const props = {
171
+ label: "",
172
+ type: "vgroup",
173
+ items: this.ui,
174
+ style: {
175
+ grid: this.grid,
176
+ width: this.layout.width,
177
+ height: this.layout.height,
178
+ left: this.layout.offsetLeft,
179
+ top: this.layout.offsetTop
180
+ },
181
+ isRoot: true,
182
+ emitter: this
183
+ };
184
+ this.faustUIRoot = new _components_Group__WEBPACK_IMPORTED_MODULE_1__["default"](props);
185
+ this.faustUIRoot.componentWillMount();
186
+ this.faustUIRoot.mount();
187
+ this.DOMroot.appendChild(this.faustUIRoot.container);
188
+ this.faustUIRoot.componentDidMount();
189
+ }
190
+ register(path, item) {
191
+ if (this.componentMap[path])
192
+ this.componentMap[path].push(item);
193
+ else
194
+ this.componentMap[path] = [item];
195
+ }
196
+ paramChangeByDSP(path, value) {
197
+ if (this.componentMap[path])
198
+ this.componentMap[path].forEach((item) => item.setState({ value }));
199
+ }
200
+ calc() {
201
+ const { items, layout } = _layout_Layout__WEBPACK_IMPORTED_MODULE_0__["default"].calc(this.ui);
202
+ this._ui = items;
203
+ this._layout = layout;
204
+ this.calcGrid();
205
+ }
206
+ calcGrid() {
207
+ const { width, height } = this.DOMroot.getBoundingClientRect();
208
+ const grid = Math.max(40, Math.min(width / this._layout.width, height / this._layout.height));
209
+ this.grid = grid;
210
+ return grid;
211
+ }
212
+ resize() {
213
+ if (!this.faustUIRoot)
214
+ return;
215
+ this.calcGrid();
216
+ this.faustUIRoot.setState({ style: { grid: this.grid } });
217
+ }
218
+ get ui() {
219
+ return this._ui;
220
+ }
221
+ set ui(uiIn) {
222
+ this._ui = uiIn;
223
+ this.calc();
224
+ this.mount();
225
+ }
226
+ get layout() {
227
+ return this._layout;
228
+ }
229
+ get minWidth() {
230
+ return this._layout.width * 40 + 1;
231
+ }
232
+ get minHeight() {
233
+ return this._layout.height * 40 + 1;
234
+ }
235
+ }
236
+
237
+
238
+ /***/ }),
239
+
240
+ /***/ "./src/components/AbstractComponent.ts":
241
+ /*!*********************************************!*\
242
+ !*** ./src/components/AbstractComponent.ts ***!
243
+ \*********************************************/
244
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
245
+
246
+ __webpack_require__.r(__webpack_exports__);
247
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
248
+ /* harmony export */ "default": () => (/* binding */ AbstractComponent)
249
+ /* harmony export */ });
250
+ /* harmony import */ var _shren_typed_event_emitter__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @shren/typed-event-emitter */ "./node_modules/@shren/typed-event-emitter/dist/index.js");
251
+ var __defProp = Object.defineProperty;
252
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
253
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
254
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
255
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
256
+ var __spreadValues = (a, b) => {
257
+ for (var prop in b || (b = {}))
258
+ if (__hasOwnProp.call(b, prop))
259
+ __defNormalProp(a, prop, b[prop]);
260
+ if (__getOwnPropSymbols)
261
+ for (var prop of __getOwnPropSymbols(b)) {
262
+ if (__propIsEnum.call(b, prop))
263
+ __defNormalProp(a, prop, b[prop]);
264
+ }
265
+ return a;
266
+ };
267
+
268
+ class AbstractComponent extends _shren_typed_event_emitter__WEBPACK_IMPORTED_MODULE_0__["default"] {
269
+ constructor(props) {
270
+ super();
271
+ this.$frame = 0;
272
+ this.frameReduce = 1;
273
+ this.raf = () => {
274
+ this.$frame++;
275
+ if (this.$frame % this.frameReduce !== 0) {
276
+ this.$raf = window.requestAnimationFrame(this.raf);
277
+ return;
278
+ }
279
+ this.$raf = void 0;
280
+ this.tasks.forEach((f) => f());
281
+ this.tasks = [];
282
+ };
283
+ this.tasks = [];
284
+ this.state = __spreadValues(__spreadValues({}, this.defaultProps), props);
285
+ }
286
+ get defaultProps() {
287
+ return this.constructor.defaultProps;
288
+ }
289
+ setState(newState) {
290
+ let shouldUpdate = false;
291
+ for (const stateKey in newState) {
292
+ const stateValue = newState[stateKey];
293
+ if (stateKey in this.state && this.state[stateKey] !== stateValue) {
294
+ this.state[stateKey] = stateValue;
295
+ shouldUpdate = true;
296
+ } else
297
+ return;
298
+ if (shouldUpdate)
299
+ this.emit(stateKey, this.state[stateKey]);
300
+ }
301
+ }
302
+ schedule(func) {
303
+ if (this.tasks.indexOf(func) === -1)
304
+ this.tasks.push(func);
305
+ if (this.$raf)
306
+ return;
307
+ this.$raf = window.requestAnimationFrame(this.raf);
308
+ }
309
+ }
310
+ AbstractComponent.defaultProps = {};
311
+
312
+
313
+ /***/ }),
314
+
315
+ /***/ "./src/components/AbstractItem.ts":
316
+ /*!****************************************!*\
317
+ !*** ./src/components/AbstractItem.ts ***!
318
+ \****************************************/
319
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
320
+
321
+ __webpack_require__.r(__webpack_exports__);
322
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
323
+ /* harmony export */ "default": () => (/* binding */ AbstractItem)
324
+ /* harmony export */ });
325
+ /* harmony import */ var _AbstractComponent__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./AbstractComponent */ "./src/components/AbstractComponent.ts");
326
+ /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./utils */ "./src/components/utils.ts");
327
+ /* harmony import */ var _Base_scss__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./Base.scss */ "./src/components/Base.scss");
328
+ var __defProp = Object.defineProperty;
329
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
330
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
331
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
332
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
333
+ var __spreadValues = (a, b) => {
334
+ for (var prop in b || (b = {}))
335
+ if (__hasOwnProp.call(b, prop))
336
+ __defNormalProp(a, prop, b[prop]);
337
+ if (__getOwnPropSymbols)
338
+ for (var prop of __getOwnPropSymbols(b)) {
339
+ if (__propIsEnum.call(b, prop))
340
+ __defNormalProp(a, prop, b[prop]);
341
+ }
342
+ return a;
343
+ };
344
+
345
+
346
+
347
+ const _AbstractItem = class extends _AbstractComponent__WEBPACK_IMPORTED_MODULE_0__["default"] {
348
+ constructor(props) {
349
+ super(props);
350
+ this.frameReduce = 3;
351
+ this.handleKeyDown = (e) => {
352
+ };
353
+ this.handleKeyUp = (e) => {
354
+ };
355
+ this.handleTouchStart = (e) => {
356
+ e.preventDefault();
357
+ const rect = e.currentTarget.getBoundingClientRect();
358
+ let prevX = e.touches[0].clientX;
359
+ let prevY = e.touches[0].clientY;
360
+ const fromX = prevX - rect.left;
361
+ const fromY = prevY - rect.top;
362
+ const prevValue = this.state.value;
363
+ this.handlePointerDown({ x: fromX, y: fromY, originalEvent: e });
364
+ const handleTouchMove = (e2) => {
365
+ e2.preventDefault();
366
+ const clientX = e2.changedTouches[0].clientX;
367
+ const clientY = e2.changedTouches[0].clientY;
368
+ const movementX = clientX - prevX;
369
+ const movementY = clientY - prevY;
370
+ prevX = clientX;
371
+ prevY = clientY;
372
+ const x = clientX - rect.left;
373
+ const y = clientY - rect.top;
374
+ this.handlePointerDrag({ prevValue, x, y, fromX, fromY, movementX, movementY, originalEvent: e2 });
375
+ };
376
+ const handleTouchEnd = (e2) => {
377
+ e2.preventDefault();
378
+ const x = e2.changedTouches[0].clientX - rect.left;
379
+ const y = e2.changedTouches[0].clientY - rect.top;
380
+ this.handlePointerUp({ x, y, originalEvent: e2 });
381
+ document.removeEventListener("touchmove", handleTouchMove);
382
+ document.removeEventListener("touchend", handleTouchEnd);
383
+ };
384
+ document.addEventListener("touchmove", handleTouchMove, { passive: false });
385
+ document.addEventListener("touchend", handleTouchEnd, { passive: false });
386
+ };
387
+ this.handleWheel = (e) => {
388
+ };
389
+ this.handleClick = (e) => {
390
+ };
391
+ this.handleMouseDown = (e) => {
392
+ e.preventDefault();
393
+ e.currentTarget.focus();
394
+ const rect = e.currentTarget.getBoundingClientRect();
395
+ const fromX = e.clientX - rect.left;
396
+ const fromY = e.clientY - rect.top;
397
+ const prevValue = this.state.value;
398
+ this.handlePointerDown({ x: fromX, y: fromY, originalEvent: e });
399
+ const handleMouseMove = (e2) => {
400
+ e2.preventDefault();
401
+ const x = e2.clientX - rect.left;
402
+ const y = e2.clientY - rect.top;
403
+ this.handlePointerDrag({ prevValue, x, y, fromX, fromY, movementX: e2.movementX, movementY: e2.movementY, originalEvent: e2 });
404
+ };
405
+ const handleMouseUp = (e2) => {
406
+ e2.preventDefault();
407
+ const x = e2.clientX - rect.left;
408
+ const y = e2.clientY - rect.top;
409
+ this.handlePointerUp({ x, y, originalEvent: e2 });
410
+ document.removeEventListener("mousemove", handleMouseMove);
411
+ document.removeEventListener("mouseup", handleMouseUp);
412
+ };
413
+ document.addEventListener("mousemove", handleMouseMove);
414
+ document.addEventListener("mouseup", handleMouseUp);
415
+ };
416
+ this.handleMouseOver = (e) => {
417
+ };
418
+ this.handleMouseOut = (e) => {
419
+ };
420
+ this.handleContextMenu = (e) => {
421
+ };
422
+ this.handlePointerDown = (e) => {
423
+ };
424
+ this.handlePointerDrag = (e) => {
425
+ };
426
+ this.handlePointerUp = (e) => {
427
+ };
428
+ this.handleFocusIn = (e) => this.setState({ focus: true });
429
+ this.handleFocusOut = (e) => this.setState({ focus: false });
430
+ this.state.style = __spreadValues(__spreadValues({}, this.defaultProps.style), props.style);
431
+ if (this.state.emitter)
432
+ this.state.emitter.register(this.state.address, this);
433
+ }
434
+ toValidNumber(value) {
435
+ const { min, max, step } = this.state;
436
+ if (typeof min !== "number" || typeof max !== "number")
437
+ return value;
438
+ const v = Math.min(max, Math.max(min, value));
439
+ if (!step)
440
+ return v;
441
+ return min + Math.floor((v - min) / step) * step;
442
+ }
443
+ setValue(valueIn) {
444
+ const value = this.toValidNumber(valueIn);
445
+ const changed = this.setState({ value });
446
+ if (changed)
447
+ this.change(value);
448
+ return changed;
449
+ }
450
+ change(valueIn) {
451
+ if (this.state.emitter)
452
+ this.state.emitter.paramChangeByUI(this.state.address, typeof valueIn === "number" ? valueIn : this.state.value);
453
+ }
454
+ setState(newState) {
455
+ let shouldUpdate = false;
456
+ for (const key in newState) {
457
+ const stateKey = key;
458
+ const stateValue = newState[stateKey];
459
+ if (stateKey === "style") {
460
+ for (const styleKey in newState.style) {
461
+ if (styleKey in this.state.style && this.state.style[styleKey] !== newState.style[styleKey]) {
462
+ this.state.style[styleKey] = newState.style[styleKey];
463
+ shouldUpdate = true;
464
+ }
465
+ }
466
+ } else if (stateKey in this.state && this.state[stateKey] !== stateValue) {
467
+ this.state[stateKey] = stateValue;
468
+ shouldUpdate = true;
469
+ } else
470
+ return false;
471
+ if (shouldUpdate)
472
+ this.emit(stateKey, this.state[stateKey]);
473
+ }
474
+ return shouldUpdate;
475
+ }
476
+ componentWillMount() {
477
+ this.container = document.createElement("div");
478
+ this.container.className = ["faust-ui-component", "faust-ui-component-" + this.className].join(" ");
479
+ this.container.tabIndex = 1;
480
+ this.container.id = this.state.address;
481
+ if (this.state.tooltip)
482
+ this.container.title = this.state.tooltip;
483
+ this.label = document.createElement("div");
484
+ this.label.className = "faust-ui-component-label";
485
+ this.labelCanvas = document.createElement("canvas");
486
+ this.labelCtx = this.labelCanvas.getContext("2d");
487
+ return this;
488
+ }
489
+ mount() {
490
+ this.label.appendChild(this.labelCanvas);
491
+ return this;
492
+ }
493
+ paintLabel(align) {
494
+ const label = this.state.label;
495
+ const color = this.state.style.labelcolor;
496
+ const ctx = this.labelCtx;
497
+ const canvas = this.labelCanvas;
498
+ let { width, height } = this.label.getBoundingClientRect();
499
+ if (!width || !height)
500
+ return this;
501
+ width = Math.floor(width);
502
+ height = Math.floor(height);
503
+ canvas.height = height;
504
+ canvas.width = width;
505
+ ctx.clearRect(0, 0, width, height);
506
+ ctx.fillStyle = color;
507
+ ctx.textBaseline = "middle";
508
+ ctx.textAlign = align || "center";
509
+ ctx.font = `bold ${height * 0.9}px -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"`;
510
+ ctx.fillText(label, align === "left" ? 0 : align === "right" ? width : width / 2, height / 2, width);
511
+ return this;
512
+ }
513
+ componentDidMount() {
514
+ const handleResize = () => {
515
+ const { grid, left, top, width, height } = this.state.style;
516
+ this.container.style.width = `${width * grid}px`;
517
+ this.container.style.height = `${height * grid}px`;
518
+ this.container.style.left = `${left * grid}px`;
519
+ this.container.style.top = `${top * grid}px`;
520
+ this.label.style.height = `${grid * 0.25}px`;
521
+ this.paintLabel();
522
+ };
523
+ this.on("style", () => this.schedule(handleResize));
524
+ handleResize();
525
+ return this;
526
+ }
527
+ get stepsCount() {
528
+ const { type, max, min, step, enums } = this.state;
529
+ const maxSteps = type === "enum" ? enums.length : type === "int" ? max - min : (max - min) / step;
530
+ if (step) {
531
+ if (type === "enum")
532
+ return enums.length;
533
+ if (type === "int")
534
+ return Math.min(Math.floor((max - min) / (Math.round(step) || 1)), maxSteps);
535
+ return Math.floor((max - min) / step);
536
+ }
537
+ return maxSteps;
538
+ }
539
+ get distance() {
540
+ const { type, max, min, value, enums, scale } = this.state;
541
+ return _AbstractItem.getDistance({ type, max, min, value, enums, scale });
542
+ }
543
+ static getDistance(state) {
544
+ const { type, max, min, value, enums, scale } = state;
545
+ if (type === "enum")
546
+ return value / (enums.length - 1);
547
+ 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;
548
+ return (0,_utils__WEBPACK_IMPORTED_MODULE_1__.normalize)(v, min, max);
549
+ }
550
+ get stepRange() {
551
+ const full = 100;
552
+ const stepsCount = this.stepsCount;
553
+ return full / stepsCount;
554
+ }
555
+ };
556
+ let AbstractItem = _AbstractItem;
557
+ AbstractItem.defaultProps = {
558
+ value: 0,
559
+ active: true,
560
+ focus: false,
561
+ label: "",
562
+ address: "",
563
+ min: 0,
564
+ max: 1,
565
+ enums: {},
566
+ type: "float",
567
+ unit: "",
568
+ scale: "linear",
569
+ step: 0.01,
570
+ style: { width: 45, height: 15, left: 0, top: 0, labelcolor: "rgba(226, 222, 255, 0.5)" }
571
+ };
572
+
573
+
574
+
575
+ /***/ }),
576
+
577
+ /***/ "./src/components/Button.ts":
578
+ /*!**********************************!*\
579
+ !*** ./src/components/Button.ts ***!
580
+ \**********************************/
581
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
582
+
583
+ __webpack_require__.r(__webpack_exports__);
584
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
585
+ /* harmony export */ "default": () => (/* binding */ Button)
586
+ /* harmony export */ });
587
+ /* harmony import */ var _AbstractItem__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./AbstractItem */ "./src/components/AbstractItem.ts");
588
+ /* harmony import */ var _Button_scss__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Button.scss */ "./src/components/Button.scss");
589
+ var __defProp = Object.defineProperty;
590
+ var __defProps = Object.defineProperties;
591
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
592
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
593
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
594
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
595
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
596
+ var __spreadValues = (a, b) => {
597
+ for (var prop in b || (b = {}))
598
+ if (__hasOwnProp.call(b, prop))
599
+ __defNormalProp(a, prop, b[prop]);
600
+ if (__getOwnPropSymbols)
601
+ for (var prop of __getOwnPropSymbols(b)) {
602
+ if (__propIsEnum.call(b, prop))
603
+ __defNormalProp(a, prop, b[prop]);
604
+ }
605
+ return a;
606
+ };
607
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
608
+
609
+
610
+ class Button extends _AbstractItem__WEBPACK_IMPORTED_MODULE_0__["default"] {
611
+ constructor() {
612
+ super(...arguments);
613
+ this.className = "button";
614
+ this.setStyle = () => {
615
+ const { value, style } = this.state;
616
+ const { height, grid, fontsize, fontname, fontface, textcolor, textoncolor, bgoncolor, bgcolor, bordercolor, borderoncolor } = style;
617
+ this.btn.style.backgroundColor = value ? bgoncolor : bgcolor;
618
+ this.btn.style.borderColor = value ? borderoncolor : bordercolor;
619
+ this.btn.style.color = value ? textoncolor : textcolor;
620
+ this.btn.style.fontSize = `${fontsize || height * grid / 4}px`;
621
+ this.btn.style.fontFamily = `${fontname}, sans-serif`;
622
+ this.btn.style.fontStyle = fontface;
623
+ };
624
+ this.handlePointerDown = () => {
625
+ this.setValue(1);
626
+ };
627
+ this.handlePointerUp = () => {
628
+ this.setValue(0);
629
+ };
630
+ }
631
+ static get defaultProps() {
632
+ const inherited = super.defaultProps;
633
+ return __spreadProps(__spreadValues({}, inherited), {
634
+ style: __spreadProps(__spreadValues({}, inherited.style), {
635
+ fontname: "Arial",
636
+ fontsize: void 0,
637
+ fontface: "normal",
638
+ bgcolor: "rgba(40, 40, 40, 1)",
639
+ bgoncolor: "rgba(18, 18, 18, 1)",
640
+ bordercolor: "rgba(80, 80, 80, 1)",
641
+ borderoncolor: "rgba(255, 165, 0, 1)",
642
+ textcolor: "rgba(226, 222, 255, 0.5)",
643
+ textoncolor: "rgba(255, 165, 0, 1)"
644
+ })
645
+ });
646
+ }
647
+ componentWillMount() {
648
+ super.componentWillMount();
649
+ this.btn = document.createElement("div");
650
+ this.span = document.createElement("span");
651
+ this.span.innerText = this.state.label;
652
+ this.setStyle();
653
+ return this;
654
+ }
655
+ mount() {
656
+ this.btn.appendChild(this.span);
657
+ this.container.appendChild(this.btn);
658
+ return super.mount();
659
+ }
660
+ componentDidMount() {
661
+ super.componentDidMount();
662
+ this.btn.addEventListener("mousedown", this.handleMouseDown);
663
+ this.btn.addEventListener("touchstart", this.handleTouchStart);
664
+ this.on("style", () => this.schedule(this.setStyle));
665
+ const labelChange = () => this.span.innerText = this.state.label;
666
+ this.on("label", () => this.schedule(labelChange));
667
+ this.on("value", () => this.schedule(this.setStyle));
668
+ return this;
669
+ }
670
+ }
671
+
672
+
673
+ /***/ }),
674
+
675
+ /***/ "./src/components/Checkbox.ts":
676
+ /*!************************************!*\
677
+ !*** ./src/components/Checkbox.ts ***!
678
+ \************************************/
679
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
680
+
681
+ __webpack_require__.r(__webpack_exports__);
682
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
683
+ /* harmony export */ "default": () => (/* binding */ Checkbox)
684
+ /* harmony export */ });
685
+ /* harmony import */ var _Button__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Button */ "./src/components/Button.ts");
686
+ /* harmony import */ var _Checkbox_scss__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Checkbox.scss */ "./src/components/Checkbox.scss");
687
+
688
+
689
+ class Checkbox extends _Button__WEBPACK_IMPORTED_MODULE_0__["default"] {
690
+ constructor() {
691
+ super(...arguments);
692
+ this.className = "checkbox";
693
+ this.handlePointerDown = () => {
694
+ this.setValue(1 - this.state.value);
695
+ };
696
+ this.handlePointerUp = () => {
697
+ };
698
+ }
699
+ }
700
+
701
+
702
+ /***/ }),
703
+
704
+ /***/ "./src/components/Group.ts":
705
+ /*!*********************************!*\
706
+ !*** ./src/components/Group.ts ***!
707
+ \*********************************/
708
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
709
+
710
+ __webpack_require__.r(__webpack_exports__);
711
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
712
+ /* harmony export */ "default": () => (/* binding */ Group)
713
+ /* harmony export */ });
714
+ /* harmony import */ var _AbstractComponent__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./AbstractComponent */ "./src/components/AbstractComponent.ts");
715
+ /* harmony import */ var _HSlider__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./HSlider */ "./src/components/HSlider.ts");
716
+ /* harmony import */ var _VSlider__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./VSlider */ "./src/components/VSlider.ts");
717
+ /* harmony import */ var _Nentry__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./Nentry */ "./src/components/Nentry.ts");
718
+ /* harmony import */ var _Button__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./Button */ "./src/components/Button.ts");
719
+ /* harmony import */ var _Checkbox__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./Checkbox */ "./src/components/Checkbox.ts");
720
+ /* harmony import */ var _Knob__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./Knob */ "./src/components/Knob.ts");
721
+ /* harmony import */ var _Menu__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./Menu */ "./src/components/Menu.ts");
722
+ /* harmony import */ var _Radio__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./Radio */ "./src/components/Radio.ts");
723
+ /* harmony import */ var _Led__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./Led */ "./src/components/Led.ts");
724
+ /* harmony import */ var _Numerical__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./Numerical */ "./src/components/Numerical.ts");
725
+ /* harmony import */ var _HBargraph__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./HBargraph */ "./src/components/HBargraph.ts");
726
+ /* harmony import */ var _VBargraph__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./VBargraph */ "./src/components/VBargraph.ts");
727
+ /* harmony import */ var _layout_Layout__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ../layout/Layout */ "./src/layout/Layout.ts");
728
+ /* harmony import */ var _Group_scss__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./Group.scss */ "./src/components/Group.scss");
729
+
730
+
731
+
732
+
733
+
734
+
735
+
736
+
737
+
738
+
739
+
740
+
741
+
742
+
743
+
744
+ class Group extends _AbstractComponent__WEBPACK_IMPORTED_MODULE_0__["default"] {
745
+ constructor() {
746
+ super(...arguments);
747
+ this.updateUI = () => {
748
+ this.children = [];
749
+ const { style, type, items, emitter, isRoot } = this.state;
750
+ const { grid, left, top, width, height } = style;
751
+ this.label.style.height = `${grid * 0.3}px`;
752
+ this.container.style.left = `${left * grid}px`;
753
+ this.container.style.top = `${top * grid}px`;
754
+ this.container.style.width = `${width * grid}px`;
755
+ this.container.style.height = `${height * grid}px`;
756
+ this.container.className = ["faust-ui-group", `faust-ui-${type}`, `${isRoot ? "faust-ui-root" : ""}`].join(" ");
757
+ items.forEach((item) => {
758
+ if (item.type.endsWith("group")) {
759
+ const component = Group.getComponent(item, emitter, grid);
760
+ if (component)
761
+ this.children.push(component);
762
+ } else {
763
+ const ioItem = item;
764
+ const itemComponent = Group.getComponent(ioItem, this.state.emitter, grid);
765
+ if (itemComponent)
766
+ this.children.push(itemComponent);
767
+ }
768
+ });
769
+ if (type === "tgroup") {
770
+ this.tabs.innerHTML = "";
771
+ this.tabs.style.height = `${grid}px`;
772
+ this.tabs.style.top = `${0.25 * grid}px`;
773
+ this.state.items.forEach((item, i) => {
774
+ const label = item.label;
775
+ const tab = document.createElement("span");
776
+ tab.innerText = label;
777
+ tab.className = "faust-ui-tgroup-tab";
778
+ tab.style.fontSize = `${0.25 * grid}px`;
779
+ tab.style.width = `${2 * grid - 20}px`;
780
+ tab.style.height = `${grid - 20}px`;
781
+ tab.style.lineHeight = `${grid - 20}px`;
782
+ tab.addEventListener("click", () => {
783
+ const groups = [];
784
+ for (let j = 0; j < this.container.children.length; j++) {
785
+ const element = this.container.children[j];
786
+ if (j > 1)
787
+ groups.push(element);
788
+ }
789
+ for (let j = 0; j < groups.length; j++) {
790
+ const element = groups[j];
791
+ element.style.visibility = i === j ? "visible" : "hidden";
792
+ }
793
+ for (let j = 0; j < this.tabs.children.length; j++) {
794
+ const e = this.tabs.children[j];
795
+ if (i !== j) {
796
+ if (e.classList.contains("active"))
797
+ e.classList.remove("active");
798
+ } else
799
+ e.classList.add("active");
800
+ }
801
+ });
802
+ this.tabs.appendChild(tab);
803
+ });
804
+ }
805
+ };
806
+ }
807
+ static parseMeta(metaIn) {
808
+ const metaObject = {};
809
+ if (!metaIn)
810
+ return { metaObject };
811
+ metaIn.forEach((m) => Object.assign(metaObject, m));
812
+ if (metaObject.style) {
813
+ const enumsRegex = /\{(?:(?:'|_|-)(.+?)(?:'|_|-):([-+]?[0-9]*\.?[0-9]+?);)+(?:(?:'|_|-)(.+?)(?:'|_|-):([-+]?[0-9]*\.?[0-9]+?))\}/;
814
+ const matched = metaObject.style.match(enumsRegex);
815
+ if (matched) {
816
+ const itemsRegex = /(?:(?:'|_|-)(.+?)(?:'|_|-):([-+]?[0-9]*\.?[0-9]+?))/g;
817
+ const enums = {};
818
+ let item;
819
+ while (item = itemsRegex.exec(matched[0])) {
820
+ enums[item[1]] = +item[2];
821
+ }
822
+ return { metaObject, enums };
823
+ }
824
+ }
825
+ return { metaObject };
826
+ }
827
+ static getComponent(item, emitter, grid) {
828
+ const type = _layout_Layout__WEBPACK_IMPORTED_MODULE_13__["default"].predictType(item);
829
+ if (type.endsWith("group")) {
830
+ const { label: label2, items, type: type2, layout: layout2 } = item;
831
+ const props2 = {
832
+ label: label2,
833
+ type: type2,
834
+ items,
835
+ style: {
836
+ grid,
837
+ width: layout2.width,
838
+ height: layout2.height,
839
+ left: layout2.offsetLeft,
840
+ top: layout2.offsetTop,
841
+ labelcolor: "rgba(255, 255, 255, 0.7)"
842
+ },
843
+ emitter
844
+ };
845
+ return new Group(props2);
846
+ }
847
+ const ioItem = item;
848
+ const { metaObject, enums } = this.parseMeta(ioItem.meta);
849
+ const { tooltip, unit, scale } = metaObject;
850
+ const { label, min, max, address, layout } = ioItem;
851
+ const props = {
852
+ label,
853
+ address,
854
+ tooltip,
855
+ unit,
856
+ scale: scale || "linear",
857
+ emitter,
858
+ enums,
859
+ style: {
860
+ grid,
861
+ width: layout.width,
862
+ height: layout.height,
863
+ left: layout.offsetLeft,
864
+ top: layout.offsetTop
865
+ },
866
+ type: "float",
867
+ min: isFinite(min) ? min : 0,
868
+ max: isFinite(max) ? max : 1,
869
+ step: "step" in item ? +item.step : 1,
870
+ value: "init" in item ? +item.init || 0 : 0
871
+ };
872
+ if (type === "button")
873
+ return new _Button__WEBPACK_IMPORTED_MODULE_4__["default"](props);
874
+ if (type === "checkbox")
875
+ return new _Checkbox__WEBPACK_IMPORTED_MODULE_5__["default"](props);
876
+ if (type === "nentry")
877
+ return new _Nentry__WEBPACK_IMPORTED_MODULE_3__["default"](props);
878
+ if (type === "knob")
879
+ return new _Knob__WEBPACK_IMPORTED_MODULE_6__["default"](props);
880
+ if (type === "menu")
881
+ return new _Menu__WEBPACK_IMPORTED_MODULE_7__["default"](props);
882
+ if (type === "radio")
883
+ return new _Radio__WEBPACK_IMPORTED_MODULE_8__["default"](props);
884
+ if (type === "hslider")
885
+ return new _HSlider__WEBPACK_IMPORTED_MODULE_1__["default"](props);
886
+ if (type === "vslider")
887
+ return new _VSlider__WEBPACK_IMPORTED_MODULE_2__["default"](props);
888
+ if (type === "hbargraph")
889
+ return new _HBargraph__WEBPACK_IMPORTED_MODULE_11__["default"](props);
890
+ if (type === "vbargraph")
891
+ return new _VBargraph__WEBPACK_IMPORTED_MODULE_12__["default"](props);
892
+ if (type === "numerical")
893
+ return new _Numerical__WEBPACK_IMPORTED_MODULE_10__["default"](props);
894
+ if (type === "led")
895
+ return new _Led__WEBPACK_IMPORTED_MODULE_9__["default"](props);
896
+ return null;
897
+ }
898
+ setState(newState) {
899
+ let shouldUpdate = false;
900
+ for (const key in newState) {
901
+ const stateKey = key;
902
+ const stateValue = newState[stateKey];
903
+ if (stateKey === "style") {
904
+ for (const key2 in newState.style) {
905
+ const styleKey = key2;
906
+ if (styleKey in this.state.style && this.state.style[styleKey] !== newState.style[styleKey]) {
907
+ this.state.style[styleKey] = newState.style[styleKey];
908
+ shouldUpdate = true;
909
+ }
910
+ }
911
+ } else if (stateKey in this.state && this.state[stateKey] !== stateValue) {
912
+ this.state[stateKey] = stateValue;
913
+ shouldUpdate = true;
914
+ } else
915
+ return;
916
+ if (shouldUpdate)
917
+ this.emit(stateKey, this.state[stateKey]);
918
+ }
919
+ }
920
+ componentWillMount() {
921
+ this.container = document.createElement("div");
922
+ this.tabs = document.createElement("div");
923
+ this.tabs.className = "faust-ui-tgroup-tabs";
924
+ this.label = document.createElement("div");
925
+ this.label.className = "faust-ui-group-label";
926
+ this.labelCanvas = document.createElement("canvas");
927
+ this.labelCtx = this.labelCanvas.getContext("2d");
928
+ this.updateUI();
929
+ this.children.forEach((item) => item.componentWillMount());
930
+ return this;
931
+ }
932
+ paintLabel() {
933
+ const label = this.state.label;
934
+ const color = this.state.style.labelcolor;
935
+ const ctx = this.labelCtx;
936
+ const canvas = this.labelCanvas;
937
+ let { width, height } = this.label.getBoundingClientRect();
938
+ if (!width || !height)
939
+ return this;
940
+ width = Math.floor(width);
941
+ height = Math.floor(height);
942
+ canvas.height = height;
943
+ canvas.width = width;
944
+ ctx.clearRect(0, 0, width, height);
945
+ ctx.fillStyle = color;
946
+ ctx.textBaseline = "middle";
947
+ ctx.textAlign = "left";
948
+ ctx.font = `bold ${height * 0.9}px -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"`;
949
+ ctx.fillText(label, 0, height / 2, width);
950
+ return this;
951
+ }
952
+ mount() {
953
+ this.label.appendChild(this.labelCanvas);
954
+ this.container.appendChild(this.label);
955
+ if (this.tabs.children.length)
956
+ this.container.appendChild(this.tabs);
957
+ this.children.forEach((item) => {
958
+ item.mount();
959
+ this.container.appendChild(item.container);
960
+ });
961
+ return this;
962
+ }
963
+ componentDidMount() {
964
+ const handleResize = () => {
965
+ const { grid, left, top, width, height } = this.state.style;
966
+ this.label.style.height = `${grid * 0.3}px`;
967
+ this.container.style.width = `${width * grid}px`;
968
+ this.container.style.height = `${height * grid}px`;
969
+ this.container.style.left = `${left * grid}px`;
970
+ this.container.style.top = `${top * grid}px`;
971
+ if (this.state.type === "tgroup") {
972
+ this.tabs.style.height = `${grid}px`;
973
+ this.tabs.style.top = `${0.25 * grid}px`;
974
+ for (let i = 0; i < this.tabs.children.length; i++) {
975
+ const tab = this.tabs.children[i];
976
+ tab.style.fontSize = `${0.25 * grid}px`;
977
+ tab.style.width = `${2 * grid - 20}px`;
978
+ tab.style.height = `${grid - 20}px`;
979
+ tab.style.lineHeight = `${grid - 20}px`;
980
+ }
981
+ }
982
+ this.paintLabel();
983
+ this.children.forEach((item) => item.setState({ style: { grid } }));
984
+ };
985
+ this.on("style", () => this.schedule(handleResize));
986
+ const itemsChange = () => {
987
+ this.updateUI();
988
+ this.children.forEach((item) => item.componentWillMount());
989
+ };
990
+ this.on("items", () => this.schedule(itemsChange));
991
+ const labelChange = () => {
992
+ this.paintLabel();
993
+ this.label.title = this.state.label;
994
+ };
995
+ this.on("label", () => this.schedule(labelChange));
996
+ this.paintLabel();
997
+ if (this.tabs && this.tabs.children.length)
998
+ this.tabs.children[0].click();
999
+ this.children.forEach((item) => item.componentDidMount());
1000
+ return this;
1001
+ }
1002
+ }
1003
+
1004
+
1005
+ /***/ }),
1006
+
1007
+ /***/ "./src/components/HBargraph.ts":
1008
+ /*!*************************************!*\
1009
+ !*** ./src/components/HBargraph.ts ***!
1010
+ \*************************************/
1011
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
1012
+
1013
+ __webpack_require__.r(__webpack_exports__);
1014
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
1015
+ /* harmony export */ "default": () => (/* binding */ HBargraph)
1016
+ /* harmony export */ });
1017
+ /* harmony import */ var _AbstractItem__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./AbstractItem */ "./src/components/AbstractItem.ts");
1018
+ /* harmony import */ var _VBargraph__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./VBargraph */ "./src/components/VBargraph.ts");
1019
+ /* harmony import */ var _HBargraph_scss__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./HBargraph.scss */ "./src/components/HBargraph.scss");
1020
+
1021
+
1022
+
1023
+ class HBargraph extends _VBargraph__WEBPACK_IMPORTED_MODULE_1__["default"] {
1024
+ constructor() {
1025
+ super(...arguments);
1026
+ this.className = "hbargraph";
1027
+ this.setStyle = () => {
1028
+ const { height, grid, fontsize, textcolor, bgcolor, bordercolor } = this.state.style;
1029
+ this.input.style.fontSize = `${fontsize || height * grid * 0.2}px`;
1030
+ this.input.style.color = textcolor;
1031
+ this.container.style.backgroundColor = bgcolor;
1032
+ this.container.style.borderColor = bordercolor;
1033
+ };
1034
+ this.paint = () => {
1035
+ const { barwidth, barbgcolor, coldcolor, warmcolor, hotcolor, overloadcolor } = this.state.style;
1036
+ const { type, max, min, enums, scale, value } = this.state;
1037
+ const ctx = this.ctx;
1038
+ const canvas = this.canvas;
1039
+ let { width, height } = this.canvasDiv.getBoundingClientRect();
1040
+ width = Math.floor(width);
1041
+ height = Math.floor(height);
1042
+ canvas.width = width;
1043
+ canvas.height = height;
1044
+ const drawWidth = width * 0.9;
1045
+ const drawHeight = barwidth || Math.min(height / 3, drawWidth * 0.05);
1046
+ const left = width * 0.05;
1047
+ const top = (height - drawHeight) * 0.5;
1048
+ this.paintValue = value;
1049
+ const paintValue = this.paintValue;
1050
+ if (paintValue > this.maxValue) {
1051
+ this.maxValue = paintValue;
1052
+ if (this.maxTimer)
1053
+ window.clearTimeout(this.maxTimer);
1054
+ this.maxTimer = window.setTimeout(() => {
1055
+ this.maxValue = this.paintValue;
1056
+ this.maxTimer = void 0;
1057
+ this.schedule(this.paint);
1058
+ }, 1e3);
1059
+ }
1060
+ if (paintValue < this.maxValue && typeof this.maxTimer === "undefined") {
1061
+ this.maxTimer = window.setTimeout(() => {
1062
+ this.maxValue = this.paintValue;
1063
+ this.maxTimer = void 0;
1064
+ this.schedule(this.paint);
1065
+ }, 1e3);
1066
+ }
1067
+ const maxValue = this.maxValue;
1068
+ const coldStop = (-18 - min) / (max - min);
1069
+ const warmStop = (-6 - min) / (max - min);
1070
+ const hotStop = (-3 - min) / (max - min);
1071
+ const overloadStop = Math.max(0, -min / (max - min));
1072
+ const gradient = ctx.createLinearGradient(left, 0, drawWidth, 0);
1073
+ if (coldStop <= 1 && coldStop >= 0)
1074
+ gradient.addColorStop(coldStop, coldcolor);
1075
+ else if (coldStop > 1)
1076
+ gradient.addColorStop(1, coldcolor);
1077
+ if (warmStop <= 1 && warmStop >= 0)
1078
+ gradient.addColorStop(warmStop, warmcolor);
1079
+ if (hotStop <= 1 && hotStop >= 0)
1080
+ gradient.addColorStop(hotStop, hotcolor);
1081
+ if (overloadStop <= 1 && overloadStop >= 0)
1082
+ gradient.addColorStop(overloadStop, overloadcolor);
1083
+ else if (overloadStop < 0)
1084
+ gradient.addColorStop(0, coldcolor);
1085
+ ctx.fillStyle = barbgcolor;
1086
+ if (paintValue < 0)
1087
+ ctx.fillRect(left, top, drawWidth * overloadStop, drawHeight);
1088
+ if (paintValue < max)
1089
+ ctx.fillRect(left + drawWidth * overloadStop + 1, top, drawWidth * (1 - overloadStop) - 1, drawHeight);
1090
+ ctx.fillStyle = gradient;
1091
+ if (paintValue > min) {
1092
+ const distance = Math.max(0, _AbstractItem__WEBPACK_IMPORTED_MODULE_0__["default"].getDistance({ type, max, min, enums, scale, value: Math.min(0, paintValue) }));
1093
+ ctx.fillRect(left, top, distance * drawWidth, drawHeight);
1094
+ }
1095
+ if (paintValue > 0) {
1096
+ const distance = Math.max(0, _AbstractItem__WEBPACK_IMPORTED_MODULE_0__["default"].getDistance({ type, max, min, enums, scale, value: Math.min(max, paintValue) }) - overloadStop);
1097
+ ctx.fillRect(left + overloadStop * drawWidth + 1, top, distance * drawWidth - 1, drawHeight);
1098
+ }
1099
+ if (maxValue > paintValue) {
1100
+ if (maxValue <= 0) {
1101
+ const distance = Math.max(0, _AbstractItem__WEBPACK_IMPORTED_MODULE_0__["default"].getDistance({ type, max, min, enums, scale, value: Math.min(0, maxValue) }));
1102
+ ctx.fillRect(left + distance * drawWidth - 1, top, 1, drawHeight);
1103
+ }
1104
+ if (maxValue > 0) {
1105
+ const distance = Math.max(0, _AbstractItem__WEBPACK_IMPORTED_MODULE_0__["default"].getDistance({ type, max, min, enums, scale, value: Math.min(max, maxValue) }) - overloadStop);
1106
+ ctx.fillRect(left + Math.min(drawWidth - 1, (overloadStop + distance) * drawWidth), top, 1, drawHeight);
1107
+ }
1108
+ }
1109
+ };
1110
+ }
1111
+ paintLabel() {
1112
+ return super.paintLabel("left");
1113
+ }
1114
+ }
1115
+
1116
+
1117
+ /***/ }),
1118
+
1119
+ /***/ "./src/components/HSlider.ts":
1120
+ /*!***********************************!*\
1121
+ !*** ./src/components/HSlider.ts ***!
1122
+ \***********************************/
1123
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
1124
+
1125
+ __webpack_require__.r(__webpack_exports__);
1126
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
1127
+ /* harmony export */ "default": () => (/* binding */ HSlider)
1128
+ /* harmony export */ });
1129
+ /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./utils */ "./src/components/utils.ts");
1130
+ /* harmony import */ var _VSlider__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./VSlider */ "./src/components/VSlider.ts");
1131
+ /* harmony import */ var _HSlider_scss__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./HSlider.scss */ "./src/components/HSlider.scss");
1132
+
1133
+
1134
+
1135
+ class HSlider extends _VSlider__WEBPACK_IMPORTED_MODULE_1__["default"] {
1136
+ constructor() {
1137
+ super(...arguments);
1138
+ this.className = "hslider";
1139
+ this.setStyle = () => {
1140
+ const { height, grid, fontsize, textcolor, bgcolor, bordercolor } = this.state.style;
1141
+ this.input.style.fontSize = `${fontsize || height * grid * 0.2}px`;
1142
+ this.input.style.color = textcolor;
1143
+ this.container.style.backgroundColor = bgcolor;
1144
+ this.container.style.borderColor = bordercolor;
1145
+ };
1146
+ this.paint = () => {
1147
+ const { sliderwidth, sliderbgcolor, sliderbgoncolor, slidercolor } = this.state.style;
1148
+ const ctx = this.ctx;
1149
+ const canvas = this.canvas;
1150
+ const distance = this.distance;
1151
+ let { width, height } = this.canvasDiv.getBoundingClientRect();
1152
+ width = Math.floor(width);
1153
+ height = Math.floor(height);
1154
+ canvas.width = width;
1155
+ canvas.height = height;
1156
+ const drawWidth = width * 0.9;
1157
+ const drawHeight = sliderwidth || Math.min(height / 3, drawWidth * 0.05);
1158
+ const left = width * 0.05;
1159
+ const top = (height - drawHeight) * 0.5;
1160
+ const borderRadius = drawHeight * 0.25;
1161
+ this.interactionRect = [left, 0, drawWidth, height];
1162
+ const grd = ctx.createLinearGradient(left, 0, left + drawWidth, 0);
1163
+ grd.addColorStop(Math.max(0, Math.min(1, distance)), sliderbgoncolor);
1164
+ grd.addColorStop(Math.max(0, Math.min(1, distance)), sliderbgcolor);
1165
+ ctx.fillStyle = grd;
1166
+ (0,_utils__WEBPACK_IMPORTED_MODULE_0__.fillRoundedRect)(ctx, left, top, drawWidth, drawHeight, borderRadius);
1167
+ ctx.fillStyle = slidercolor;
1168
+ (0,_utils__WEBPACK_IMPORTED_MODULE_0__.fillRoundedRect)(ctx, left + drawWidth * distance - drawHeight, top - drawHeight, drawHeight * 2, drawHeight * 3, borderRadius);
1169
+ };
1170
+ }
1171
+ paintLabel() {
1172
+ return super.paintLabel("left");
1173
+ }
1174
+ }
1175
+
1176
+
1177
+ /***/ }),
1178
+
1179
+ /***/ "./src/components/Knob.ts":
1180
+ /*!********************************!*\
1181
+ !*** ./src/components/Knob.ts ***!
1182
+ \********************************/
1183
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
1184
+
1185
+ __webpack_require__.r(__webpack_exports__);
1186
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
1187
+ /* harmony export */ "default": () => (/* binding */ Knob)
1188
+ /* harmony export */ });
1189
+ /* harmony import */ var _AbstractItem__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./AbstractItem */ "./src/components/AbstractItem.ts");
1190
+ /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./utils */ "./src/components/utils.ts");
1191
+ /* harmony import */ var _Knob_scss__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./Knob.scss */ "./src/components/Knob.scss");
1192
+ var __defProp = Object.defineProperty;
1193
+ var __defProps = Object.defineProperties;
1194
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
1195
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
1196
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
1197
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
1198
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1199
+ var __spreadValues = (a, b) => {
1200
+ for (var prop in b || (b = {}))
1201
+ if (__hasOwnProp.call(b, prop))
1202
+ __defNormalProp(a, prop, b[prop]);
1203
+ if (__getOwnPropSymbols)
1204
+ for (var prop of __getOwnPropSymbols(b)) {
1205
+ if (__propIsEnum.call(b, prop))
1206
+ __defNormalProp(a, prop, b[prop]);
1207
+ }
1208
+ return a;
1209
+ };
1210
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
1211
+
1212
+
1213
+
1214
+ class Knob extends _AbstractItem__WEBPACK_IMPORTED_MODULE_0__["default"] {
1215
+ constructor() {
1216
+ super(...arguments);
1217
+ this.className = "knob";
1218
+ this.handleChange = (e) => {
1219
+ const value = parseFloat(e.currentTarget.value);
1220
+ if (isFinite(value)) {
1221
+ const changed = this.setValue(+this.inputNumber.value);
1222
+ if (changed)
1223
+ return;
1224
+ }
1225
+ this.input.value = this.inputNumber.value + (this.state.unit || "");
1226
+ };
1227
+ this.setStyle = () => {
1228
+ const { fontsize, height, grid, textcolor, bgcolor, bordercolor } = this.state.style;
1229
+ this.input.style.fontSize = `${fontsize || height * grid * 0.1}px`;
1230
+ this.input.style.color = textcolor;
1231
+ this.container.style.backgroundColor = bgcolor;
1232
+ this.container.style.borderColor = bordercolor;
1233
+ };
1234
+ this.paint = () => {
1235
+ const { knobwidth, knobcolor, knoboncolor, needlecolor } = this.state.style;
1236
+ const ctx = this.ctx;
1237
+ const canvas = this.canvas;
1238
+ const distance = this.distance;
1239
+ let { width, height } = this.canvas.getBoundingClientRect();
1240
+ width = Math.floor(width);
1241
+ height = Math.floor(height);
1242
+ canvas.width = width;
1243
+ canvas.height = height;
1244
+ const start = 5 / 8 * Math.PI;
1245
+ const end = 19 / 8 * Math.PI;
1246
+ const valPos = start + (0,_utils__WEBPACK_IMPORTED_MODULE_1__.toRad)(distance * 315);
1247
+ const dialHeight = Math.min(width, height) * 0.75;
1248
+ const dialRadius = dialHeight * 0.5;
1249
+ const dialCenterX = width * 0.5;
1250
+ const dialCenterY = height * 0.5;
1251
+ const valuePosX = dialCenterX + dialHeight * 0.5 * Math.cos(valPos);
1252
+ const valuePosY = dialCenterY + dialHeight * 0.5 * Math.sin(valPos);
1253
+ const lineWidth = knobwidth || dialRadius * 0.2;
1254
+ ctx.strokeStyle = knobcolor;
1255
+ ctx.lineWidth = lineWidth;
1256
+ ctx.lineCap = "round";
1257
+ ctx.beginPath();
1258
+ ctx.arc(dialCenterX, dialCenterY, dialRadius, valPos, end);
1259
+ ctx.stroke();
1260
+ if (distance) {
1261
+ ctx.strokeStyle = knoboncolor;
1262
+ ctx.beginPath();
1263
+ ctx.arc(dialCenterX, dialCenterY, dialRadius, start, valPos);
1264
+ ctx.stroke();
1265
+ }
1266
+ ctx.strokeStyle = needlecolor;
1267
+ ctx.beginPath();
1268
+ ctx.moveTo(dialCenterX, dialCenterY);
1269
+ ctx.lineTo(valuePosX, valuePosY);
1270
+ ctx.stroke();
1271
+ };
1272
+ this.handlePointerDrag = (e) => {
1273
+ const newValue = this.getValueFromDelta(e);
1274
+ if (newValue !== this.state.value)
1275
+ this.setValue(newValue);
1276
+ };
1277
+ }
1278
+ static get defaultProps() {
1279
+ const inherited = super.defaultProps;
1280
+ return __spreadProps(__spreadValues({}, inherited), {
1281
+ style: __spreadProps(__spreadValues({}, inherited.style), {
1282
+ fontname: "Arial",
1283
+ fontsize: void 0,
1284
+ fontface: "regular",
1285
+ bgcolor: "rgba(18, 18, 18, 0)",
1286
+ bordercolor: "rgba(80, 80, 80, 0)",
1287
+ labelcolor: "rgba(226, 222, 255, 0.5)",
1288
+ textcolor: "rgba(18, 18, 18, 1)",
1289
+ knobwidth: void 0,
1290
+ knobcolor: "rgba(18, 18, 18, 1)",
1291
+ knoboncolor: "rgba(255, 165, 0, 1)",
1292
+ needlecolor: "rgba(200, 200, 200, 0.75)"
1293
+ })
1294
+ });
1295
+ }
1296
+ componentWillMount() {
1297
+ super.componentWillMount();
1298
+ this.canvas = document.createElement("canvas");
1299
+ this.canvas.width = 10;
1300
+ this.canvas.height = 10;
1301
+ this.ctx = this.canvas.getContext("2d");
1302
+ this.inputNumber = document.createElement("input");
1303
+ this.inputNumber.type = "number";
1304
+ this.inputNumber.value = (+this.state.value.toFixed(3)).toString();
1305
+ this.inputNumber.max = this.state.max.toString();
1306
+ this.inputNumber.min = this.state.min.toString();
1307
+ this.inputNumber.step = this.state.step.toString();
1308
+ this.input = document.createElement("input");
1309
+ this.input.value = this.inputNumber.value + (this.state.unit || "");
1310
+ this.input.spellcheck = false;
1311
+ this.setStyle();
1312
+ return this;
1313
+ }
1314
+ componentDidMount() {
1315
+ super.componentDidMount();
1316
+ this.input.addEventListener("change", this.handleChange);
1317
+ this.canvas.addEventListener("mousedown", this.handleMouseDown);
1318
+ this.canvas.addEventListener("touchstart", this.handleTouchStart, { passive: false });
1319
+ this.on("style", () => {
1320
+ this.schedule(this.setStyle);
1321
+ this.schedule(this.paint);
1322
+ });
1323
+ this.on("label", () => this.schedule(this.paintLabel));
1324
+ const valueChange = () => {
1325
+ this.inputNumber.value = (+this.state.value.toFixed(3)).toString();
1326
+ this.input.value = this.inputNumber.value + (this.state.unit || "");
1327
+ };
1328
+ this.on("value", () => {
1329
+ this.schedule(valueChange);
1330
+ this.schedule(this.paint);
1331
+ });
1332
+ const maxChange = () => this.inputNumber.max = this.state.max.toString();
1333
+ this.on("max", () => {
1334
+ this.schedule(maxChange);
1335
+ this.schedule(this.paint);
1336
+ });
1337
+ const minChange = () => this.inputNumber.min = this.state.min.toString();
1338
+ this.on("min", () => {
1339
+ this.schedule(minChange);
1340
+ this.schedule(this.paint);
1341
+ });
1342
+ const stepChange = () => this.inputNumber.step = this.state.step.toString();
1343
+ this.on("step", () => {
1344
+ this.schedule(stepChange);
1345
+ this.schedule(this.paint);
1346
+ });
1347
+ this.schedule(this.paint);
1348
+ return this;
1349
+ }
1350
+ mount() {
1351
+ this.container.appendChild(this.label);
1352
+ this.container.appendChild(this.canvas);
1353
+ this.container.appendChild(this.input);
1354
+ return super.mount();
1355
+ }
1356
+ getValueFromDelta(e) {
1357
+ const { type, min, max, enums, scale } = this.state;
1358
+ const step = type === "enum" ? 1 : this.state.step || 1;
1359
+ const stepRange = this.stepRange;
1360
+ const stepsCount = this.stepsCount;
1361
+ const range = 100;
1362
+ const prevDistance = _AbstractItem__WEBPACK_IMPORTED_MODULE_0__["default"].getDistance({ value: e.prevValue, type, min, max, enums, scale }) * range;
1363
+ const distance = prevDistance + e.fromY - e.y;
1364
+ const denormalized = (0,_utils__WEBPACK_IMPORTED_MODULE_1__.denormalize)(distance / range, min, max);
1365
+ 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;
1366
+ let steps = Math.round((0,_utils__WEBPACK_IMPORTED_MODULE_1__.normalize)(v, min, max) * range / stepRange);
1367
+ steps = Math.min(stepsCount, Math.max(0, steps));
1368
+ if (type === "enum")
1369
+ return steps;
1370
+ if (type === "int")
1371
+ return Math.round(steps * step + min);
1372
+ return steps * step + min;
1373
+ }
1374
+ }
1375
+
1376
+
1377
+ /***/ }),
1378
+
1379
+ /***/ "./src/components/Led.ts":
1380
+ /*!*******************************!*\
1381
+ !*** ./src/components/Led.ts ***!
1382
+ \*******************************/
1383
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
1384
+
1385
+ __webpack_require__.r(__webpack_exports__);
1386
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
1387
+ /* harmony export */ "default": () => (/* binding */ Led)
1388
+ /* harmony export */ });
1389
+ /* harmony import */ var _AbstractItem__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./AbstractItem */ "./src/components/AbstractItem.ts");
1390
+ /* harmony import */ var _Led_scss__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Led.scss */ "./src/components/Led.scss");
1391
+ var __defProp = Object.defineProperty;
1392
+ var __defProps = Object.defineProperties;
1393
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
1394
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
1395
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
1396
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
1397
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1398
+ var __spreadValues = (a, b) => {
1399
+ for (var prop in b || (b = {}))
1400
+ if (__hasOwnProp.call(b, prop))
1401
+ __defNormalProp(a, prop, b[prop]);
1402
+ if (__getOwnPropSymbols)
1403
+ for (var prop of __getOwnPropSymbols(b)) {
1404
+ if (__propIsEnum.call(b, prop))
1405
+ __defNormalProp(a, prop, b[prop]);
1406
+ }
1407
+ return a;
1408
+ };
1409
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
1410
+
1411
+
1412
+ class Led extends _AbstractItem__WEBPACK_IMPORTED_MODULE_0__["default"] {
1413
+ constructor() {
1414
+ super(...arguments);
1415
+ this.className = "led";
1416
+ this.setStyle = () => {
1417
+ const { bgcolor, bordercolor } = this.state.style;
1418
+ this.container.style.backgroundColor = bgcolor;
1419
+ this.container.style.borderColor = bordercolor;
1420
+ };
1421
+ this.paint = () => {
1422
+ const { shape, ledbgcolor, coldcolor, warmcolor, hotcolor, overloadcolor } = this.state.style;
1423
+ const { min, max } = this.state;
1424
+ const { canvas, ctx, tempCanvas, tempCtx, distance } = this;
1425
+ const { width, height } = canvas.getBoundingClientRect();
1426
+ canvas.width = width;
1427
+ canvas.height = height;
1428
+ const drawHeight = Math.min(height, width) * 0.75;
1429
+ const drawWidth = drawHeight;
1430
+ const left = (width - drawWidth) * 0.5;
1431
+ const top = (height - drawHeight) * 0.5;
1432
+ const coldStop = (-18 - min) / (max - min);
1433
+ const warmStop = (-6 - min) / (max - min);
1434
+ const hotStop = (-3 - min) / (max - min);
1435
+ const overloadStop = -min / (max - min);
1436
+ const gradient = tempCtx.createLinearGradient(0, 0, tempCanvas.width, 0);
1437
+ if (coldStop <= 1 && coldStop >= 0)
1438
+ gradient.addColorStop(coldStop, coldcolor);
1439
+ else if (coldStop > 1)
1440
+ gradient.addColorStop(1, coldcolor);
1441
+ if (warmStop <= 1 && warmStop >= 0)
1442
+ gradient.addColorStop(warmStop, warmcolor);
1443
+ if (hotStop <= 1 && hotStop >= 0)
1444
+ gradient.addColorStop(hotStop, hotcolor);
1445
+ if (overloadStop <= 1 && overloadStop >= 0)
1446
+ gradient.addColorStop(overloadStop, overloadcolor);
1447
+ else if (overloadStop < 0)
1448
+ gradient.addColorStop(0, coldcolor);
1449
+ tempCtx.fillStyle = gradient;
1450
+ tempCtx.fillRect(0, 0, tempCanvas.width, 10);
1451
+ const d = tempCtx.getImageData(Math.min(tempCanvas.width - 1, distance * tempCanvas.width), 0, 1, 1).data;
1452
+ if (distance)
1453
+ ctx.fillStyle = `rgb(${d[0]}, ${d[1]}, ${d[2]})`;
1454
+ else
1455
+ ctx.fillStyle = ledbgcolor;
1456
+ if (shape === "circle")
1457
+ ctx.arc(width / 2, height / 2, width / 2 - left, 0, 2 * Math.PI);
1458
+ else
1459
+ ctx.rect(left, top, drawWidth, drawHeight);
1460
+ ctx.fill();
1461
+ };
1462
+ }
1463
+ static get defaultProps() {
1464
+ const inherited = super.defaultProps;
1465
+ return __spreadProps(__spreadValues({}, inherited), {
1466
+ style: __spreadProps(__spreadValues({}, inherited.style), {
1467
+ fontname: "Arial",
1468
+ fontsize: void 0,
1469
+ fontface: "regular",
1470
+ bgcolor: "rgba(18, 18, 18, 0)",
1471
+ bordercolor: "rgba(80, 80, 80, 0)",
1472
+ labelcolor: "rgba(226, 222, 255, 0.5)",
1473
+ textcolor: "rgba(18, 18, 18, 1)",
1474
+ shape: "circle",
1475
+ ledbgcolor: "rgba(18, 18, 18, 1)",
1476
+ coldcolor: "rgba(12, 248, 100, 1)",
1477
+ warmcolor: "rgba(195, 248, 100, 1)",
1478
+ hotcolor: "rgba(255, 193, 10, 1)",
1479
+ overloadcolor: "rgba(255, 10, 10, 1)"
1480
+ })
1481
+ });
1482
+ }
1483
+ componentWillMount() {
1484
+ super.componentWillMount();
1485
+ this.canvasDiv = document.createElement("div");
1486
+ this.canvasDiv.className = `faust-ui-component-${this.className}-canvasdiv`;
1487
+ this.canvas = document.createElement("canvas");
1488
+ this.canvas.width = 10;
1489
+ this.canvas.height = 10;
1490
+ this.ctx = this.canvas.getContext("2d");
1491
+ this.tempCanvas = document.createElement("canvas");
1492
+ this.tempCtx = this.tempCanvas.getContext("2d");
1493
+ this.tempCanvas.width = 128;
1494
+ this.tempCanvas.height = 1;
1495
+ this.setStyle();
1496
+ return this;
1497
+ }
1498
+ componentDidMount() {
1499
+ super.componentDidMount();
1500
+ this.canvas.addEventListener("mousedown", this.handleMouseDown);
1501
+ this.canvas.addEventListener("touchstart", this.handleTouchStart, { passive: false });
1502
+ this.on("style", () => this.schedule(this.setStyle));
1503
+ this.on("label", () => this.schedule(this.paintLabel));
1504
+ this.on("value", () => this.schedule(this.paint));
1505
+ this.on("max", () => this.schedule(this.paint));
1506
+ this.on("min", () => this.schedule(this.paint));
1507
+ this.on("step", () => this.schedule(this.paint));
1508
+ this.schedule(this.paint);
1509
+ return this;
1510
+ }
1511
+ mount() {
1512
+ this.canvasDiv.appendChild(this.canvas);
1513
+ this.container.appendChild(this.label);
1514
+ this.container.appendChild(this.canvasDiv);
1515
+ return super.mount();
1516
+ }
1517
+ }
1518
+
1519
+
1520
+ /***/ }),
1521
+
1522
+ /***/ "./src/components/Menu.ts":
1523
+ /*!********************************!*\
1524
+ !*** ./src/components/Menu.ts ***!
1525
+ \********************************/
1526
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
1527
+
1528
+ __webpack_require__.r(__webpack_exports__);
1529
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
1530
+ /* harmony export */ "default": () => (/* binding */ Menu)
1531
+ /* harmony export */ });
1532
+ /* harmony import */ var _AbstractItem__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./AbstractItem */ "./src/components/AbstractItem.ts");
1533
+ /* harmony import */ var _Menu_scss__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Menu.scss */ "./src/components/Menu.scss");
1534
+ var __defProp = Object.defineProperty;
1535
+ var __defProps = Object.defineProperties;
1536
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
1537
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
1538
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
1539
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
1540
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1541
+ var __spreadValues = (a, b) => {
1542
+ for (var prop in b || (b = {}))
1543
+ if (__hasOwnProp.call(b, prop))
1544
+ __defNormalProp(a, prop, b[prop]);
1545
+ if (__getOwnPropSymbols)
1546
+ for (var prop of __getOwnPropSymbols(b)) {
1547
+ if (__propIsEnum.call(b, prop))
1548
+ __defNormalProp(a, prop, b[prop]);
1549
+ }
1550
+ return a;
1551
+ };
1552
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
1553
+
1554
+
1555
+ class Menu extends _AbstractItem__WEBPACK_IMPORTED_MODULE_0__["default"] {
1556
+ constructor() {
1557
+ super(...arguments);
1558
+ this.className = "menu";
1559
+ this.handleChange = (e) => {
1560
+ this.setValue(+e.currentTarget.value);
1561
+ };
1562
+ this.setStyle = () => {
1563
+ const { height, grid, fontsize, textcolor, bgcolor, bordercolor } = this.state.style;
1564
+ this.select.style.backgroundColor = bgcolor;
1565
+ this.select.style.borderColor = bordercolor;
1566
+ this.select.style.color = textcolor;
1567
+ this.select.style.fontSize = `${fontsize || height * grid / 4}px`;
1568
+ };
1569
+ }
1570
+ static get defaultProps() {
1571
+ const inherited = super.defaultProps;
1572
+ return __spreadProps(__spreadValues({}, inherited), {
1573
+ style: __spreadProps(__spreadValues({}, inherited.style), {
1574
+ fontname: "Arial",
1575
+ fontsize: void 0,
1576
+ fontface: "regular",
1577
+ bgcolor: "rgba(255, 255, 255, 0.25)",
1578
+ bordercolor: "rgba(80, 80, 80, 0)",
1579
+ labelcolor: "rgba(226, 222, 255, 0.5)",
1580
+ textcolor: "rgba(18, 18, 18, 1)"
1581
+ })
1582
+ });
1583
+ }
1584
+ componentWillMount() {
1585
+ super.componentWillMount();
1586
+ this.select = document.createElement("select");
1587
+ this.getOptions();
1588
+ this.setStyle();
1589
+ return this;
1590
+ }
1591
+ getOptions() {
1592
+ const { enums } = this.state;
1593
+ this.select.innerHTML = "";
1594
+ if (enums) {
1595
+ let i = 0;
1596
+ for (const key in enums) {
1597
+ const option = document.createElement("option");
1598
+ option.value = enums[key].toString();
1599
+ option.text = key;
1600
+ if (i === 0)
1601
+ option.selected = true;
1602
+ this.select.appendChild(option);
1603
+ i++;
1604
+ }
1605
+ }
1606
+ }
1607
+ componentDidMount() {
1608
+ super.componentDidMount();
1609
+ this.select.addEventListener("change", this.handleChange);
1610
+ this.on("style", () => this.schedule(this.setStyle));
1611
+ this.on("label", () => this.schedule(this.paintLabel));
1612
+ this.on("enums", () => this.schedule(this.getOptions));
1613
+ const valueChange = () => {
1614
+ for (let i = this.select.children.length - 1; i >= 0; i--) {
1615
+ const option = this.select.children[i];
1616
+ if (+option.value === this.state.value)
1617
+ this.select.selectedIndex = i;
1618
+ }
1619
+ };
1620
+ this.on("value", () => this.schedule(valueChange));
1621
+ valueChange();
1622
+ return this;
1623
+ }
1624
+ mount() {
1625
+ this.container.appendChild(this.label);
1626
+ this.container.appendChild(this.select);
1627
+ return super.mount();
1628
+ }
1629
+ }
1630
+
1631
+
1632
+ /***/ }),
1633
+
1634
+ /***/ "./src/components/Nentry.ts":
1635
+ /*!**********************************!*\
1636
+ !*** ./src/components/Nentry.ts ***!
1637
+ \**********************************/
1638
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
1639
+
1640
+ __webpack_require__.r(__webpack_exports__);
1641
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
1642
+ /* harmony export */ "default": () => (/* binding */ Nentry)
1643
+ /* harmony export */ });
1644
+ /* harmony import */ var _AbstractItem__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./AbstractItem */ "./src/components/AbstractItem.ts");
1645
+ /* harmony import */ var _Nentry_scss__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Nentry.scss */ "./src/components/Nentry.scss");
1646
+ var __defProp = Object.defineProperty;
1647
+ var __defProps = Object.defineProperties;
1648
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
1649
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
1650
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
1651
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
1652
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1653
+ var __spreadValues = (a, b) => {
1654
+ for (var prop in b || (b = {}))
1655
+ if (__hasOwnProp.call(b, prop))
1656
+ __defNormalProp(a, prop, b[prop]);
1657
+ if (__getOwnPropSymbols)
1658
+ for (var prop of __getOwnPropSymbols(b)) {
1659
+ if (__propIsEnum.call(b, prop))
1660
+ __defNormalProp(a, prop, b[prop]);
1661
+ }
1662
+ return a;
1663
+ };
1664
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
1665
+
1666
+
1667
+ class Nentry extends _AbstractItem__WEBPACK_IMPORTED_MODULE_0__["default"] {
1668
+ constructor() {
1669
+ super(...arguments);
1670
+ this.className = "nentry";
1671
+ this.handleChange = (e) => {
1672
+ this.setValue(+e.currentTarget.value);
1673
+ };
1674
+ this.setStyle = () => {
1675
+ const { height, grid, fontsize, textcolor, bgcolor, bordercolor } = this.state.style;
1676
+ this.input.style.backgroundColor = bgcolor;
1677
+ this.input.style.borderColor = bordercolor;
1678
+ this.input.style.color = textcolor;
1679
+ this.input.style.fontSize = `${fontsize || height * grid / 4}px`;
1680
+ };
1681
+ }
1682
+ static get defaultProps() {
1683
+ const inherited = super.defaultProps;
1684
+ return __spreadProps(__spreadValues({}, inherited), {
1685
+ style: __spreadProps(__spreadValues({}, inherited.style), {
1686
+ fontname: "Arial",
1687
+ fontsize: void 0,
1688
+ fontface: "regular",
1689
+ bgcolor: "rgba(255, 255, 255, 0.25)",
1690
+ bordercolor: "rgba(80, 80, 80, 0)",
1691
+ labelcolor: "rgba(226, 222, 255, 0.5)",
1692
+ textcolor: "rgba(18, 18, 18, 1)"
1693
+ })
1694
+ });
1695
+ }
1696
+ componentWillMount() {
1697
+ super.componentWillMount();
1698
+ this.input = document.createElement("input");
1699
+ this.input.type = "number";
1700
+ this.input.value = (+this.state.value.toFixed(3)).toString();
1701
+ this.input.max = this.state.max.toString();
1702
+ this.input.min = this.state.min.toString();
1703
+ this.input.step = this.state.step.toString();
1704
+ this.setStyle();
1705
+ return this;
1706
+ }
1707
+ componentDidMount() {
1708
+ super.componentDidMount();
1709
+ this.input.addEventListener("change", this.handleChange);
1710
+ this.on("style", () => this.schedule(this.setStyle));
1711
+ this.on("label", () => this.schedule(this.paintLabel));
1712
+ const valueChange = () => this.input.value = (+this.state.value.toFixed(3)).toString();
1713
+ this.on("value", () => this.schedule(valueChange));
1714
+ const maxChange = () => this.input.max = this.state.max.toString();
1715
+ this.on("max", () => this.schedule(maxChange));
1716
+ const minChange = () => this.input.min = this.state.min.toString();
1717
+ this.on("min", () => this.schedule(minChange));
1718
+ const stepChange = () => this.input.step = this.state.step.toString();
1719
+ this.on("step", () => this.schedule(stepChange));
1720
+ return this;
1721
+ }
1722
+ mount() {
1723
+ this.container.appendChild(this.label);
1724
+ this.container.appendChild(this.input);
1725
+ return super.mount();
1726
+ }
1727
+ }
1728
+
1729
+
1730
+ /***/ }),
1731
+
1732
+ /***/ "./src/components/Numerical.ts":
1733
+ /*!*************************************!*\
1734
+ !*** ./src/components/Numerical.ts ***!
1735
+ \*************************************/
1736
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
1737
+
1738
+ __webpack_require__.r(__webpack_exports__);
1739
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
1740
+ /* harmony export */ "default": () => (/* binding */ Numerical)
1741
+ /* harmony export */ });
1742
+ /* harmony import */ var _AbstractItem__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./AbstractItem */ "./src/components/AbstractItem.ts");
1743
+ /* harmony import */ var _Numerical_scss__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Numerical.scss */ "./src/components/Numerical.scss");
1744
+ var __defProp = Object.defineProperty;
1745
+ var __defProps = Object.defineProperties;
1746
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
1747
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
1748
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
1749
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
1750
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1751
+ var __spreadValues = (a, b) => {
1752
+ for (var prop in b || (b = {}))
1753
+ if (__hasOwnProp.call(b, prop))
1754
+ __defNormalProp(a, prop, b[prop]);
1755
+ if (__getOwnPropSymbols)
1756
+ for (var prop of __getOwnPropSymbols(b)) {
1757
+ if (__propIsEnum.call(b, prop))
1758
+ __defNormalProp(a, prop, b[prop]);
1759
+ }
1760
+ return a;
1761
+ };
1762
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
1763
+
1764
+
1765
+ class Numerical extends _AbstractItem__WEBPACK_IMPORTED_MODULE_0__["default"] {
1766
+ constructor() {
1767
+ super(...arguments);
1768
+ this.className = "numerical";
1769
+ this.setStyle = () => {
1770
+ const { height, grid, fontsize, textcolor, bgcolor, bordercolor } = this.state.style;
1771
+ this.input.style.backgroundColor = bgcolor;
1772
+ this.input.style.borderColor = bordercolor;
1773
+ this.input.style.color = textcolor;
1774
+ this.input.style.fontSize = `${fontsize || height * grid / 4}px`;
1775
+ };
1776
+ }
1777
+ static get defaultProps() {
1778
+ const inherited = super.defaultProps;
1779
+ return __spreadProps(__spreadValues({}, inherited), {
1780
+ style: __spreadProps(__spreadValues({}, inherited.style), {
1781
+ fontname: "Arial",
1782
+ fontsize: void 0,
1783
+ fontface: "regular",
1784
+ bgcolor: "rgba(255, 255, 255, 0.25)",
1785
+ bordercolor: "rgba(80, 80, 80, 0)",
1786
+ labelcolor: "rgba(226, 222, 255, 0.5)",
1787
+ textcolor: "rgba(18, 18, 18, 1)"
1788
+ })
1789
+ });
1790
+ }
1791
+ componentWillMount() {
1792
+ super.componentWillMount();
1793
+ this.input = document.createElement("input");
1794
+ this.input.disabled = true;
1795
+ this.input.value = (+this.state.value.toFixed(3)).toString() + (this.state.unit || "");
1796
+ this.setStyle();
1797
+ return this;
1798
+ }
1799
+ componentDidMount() {
1800
+ super.componentDidMount();
1801
+ this.on("style", () => this.schedule(this.setStyle));
1802
+ this.on("label", () => this.schedule(this.paintLabel));
1803
+ const valueChange = () => this.input.value = (+this.state.value.toFixed(3)).toString() + (this.state.unit || "");
1804
+ this.on("value", () => this.schedule(valueChange));
1805
+ return this;
1806
+ }
1807
+ mount() {
1808
+ this.container.appendChild(this.label);
1809
+ this.container.appendChild(this.input);
1810
+ return super.mount();
1811
+ }
1812
+ }
1813
+
1814
+
1815
+ /***/ }),
1816
+
1817
+ /***/ "./src/components/Radio.ts":
1818
+ /*!*********************************!*\
1819
+ !*** ./src/components/Radio.ts ***!
1820
+ \*********************************/
1821
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
1822
+
1823
+ __webpack_require__.r(__webpack_exports__);
1824
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
1825
+ /* harmony export */ "default": () => (/* binding */ Radio)
1826
+ /* harmony export */ });
1827
+ /* harmony import */ var _AbstractItem__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./AbstractItem */ "./src/components/AbstractItem.ts");
1828
+ /* harmony import */ var _Radio_scss__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Radio.scss */ "./src/components/Radio.scss");
1829
+ var __defProp = Object.defineProperty;
1830
+ var __defProps = Object.defineProperties;
1831
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
1832
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
1833
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
1834
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
1835
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1836
+ var __spreadValues = (a, b) => {
1837
+ for (var prop in b || (b = {}))
1838
+ if (__hasOwnProp.call(b, prop))
1839
+ __defNormalProp(a, prop, b[prop]);
1840
+ if (__getOwnPropSymbols)
1841
+ for (var prop of __getOwnPropSymbols(b)) {
1842
+ if (__propIsEnum.call(b, prop))
1843
+ __defNormalProp(a, prop, b[prop]);
1844
+ }
1845
+ return a;
1846
+ };
1847
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
1848
+
1849
+
1850
+ class Radio extends _AbstractItem__WEBPACK_IMPORTED_MODULE_0__["default"] {
1851
+ constructor() {
1852
+ super(...arguments);
1853
+ this.className = "radio";
1854
+ this.getOptions = () => {
1855
+ const { enums, address } = this.state;
1856
+ this.group.innerHTML = "";
1857
+ if (enums) {
1858
+ let i = 0;
1859
+ for (const key in enums) {
1860
+ const input = document.createElement("input");
1861
+ const div = document.createElement("div");
1862
+ input.value = enums[key].toString();
1863
+ input.name = address;
1864
+ input.type = "radio";
1865
+ if (i === 0)
1866
+ input.checked = true;
1867
+ input.addEventListener("change", () => {
1868
+ if (input.checked)
1869
+ this.setValue(enums[key]);
1870
+ });
1871
+ div.appendChild(input);
1872
+ div.append(key);
1873
+ this.group.appendChild(div);
1874
+ i++;
1875
+ }
1876
+ }
1877
+ };
1878
+ this.setStyle = () => {
1879
+ const { height, width, grid, fontsize, textcolor, bgcolor, bordercolor } = this.state.style;
1880
+ const fontSize = Math.min(height * grid * 0.1, width * grid * 0.1);
1881
+ this.group.style.backgroundColor = bgcolor;
1882
+ this.group.style.borderColor = bordercolor;
1883
+ this.group.style.color = textcolor;
1884
+ this.group.style.fontSize = `${fontsize || fontSize}px`;
1885
+ };
1886
+ }
1887
+ static get defaultProps() {
1888
+ const inherited = super.defaultProps;
1889
+ return __spreadProps(__spreadValues({}, inherited), {
1890
+ style: __spreadProps(__spreadValues({}, inherited.style), {
1891
+ fontname: "Arial",
1892
+ fontsize: void 0,
1893
+ fontface: "regular",
1894
+ bgcolor: "rgba(255, 255, 255, 0.25)",
1895
+ bordercolor: "rgba(80, 80, 80, 0)",
1896
+ labelcolor: "rgba(226, 222, 255, 0.5)",
1897
+ textcolor: "rgba(18, 18, 18, 1)"
1898
+ })
1899
+ });
1900
+ }
1901
+ componentWillMount() {
1902
+ super.componentWillMount();
1903
+ this.group = document.createElement("div");
1904
+ this.group.className = "faust-ui-component-radio-group";
1905
+ this.getOptions();
1906
+ this.setStyle();
1907
+ return this;
1908
+ }
1909
+ componentDidMount() {
1910
+ super.componentDidMount();
1911
+ this.on("style", () => this.schedule(this.setStyle));
1912
+ this.on("label", () => this.schedule(this.paintLabel));
1913
+ this.on("enums", () => this.schedule(this.getOptions));
1914
+ const valueChange = () => {
1915
+ for (let i = this.group.children.length - 1; i >= 0; i--) {
1916
+ const input = this.group.children[i].querySelector("input");
1917
+ if (+input.value === this.state.value)
1918
+ input.checked = true;
1919
+ }
1920
+ };
1921
+ this.on("value", () => this.schedule(valueChange));
1922
+ valueChange();
1923
+ return this;
1924
+ }
1925
+ mount() {
1926
+ this.container.appendChild(this.label);
1927
+ this.container.appendChild(this.group);
1928
+ return super.mount();
1929
+ }
1930
+ }
1931
+
1932
+
1933
+ /***/ }),
1934
+
1935
+ /***/ "./src/components/VBargraph.ts":
1936
+ /*!*************************************!*\
1937
+ !*** ./src/components/VBargraph.ts ***!
1938
+ \*************************************/
1939
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
1940
+
1941
+ __webpack_require__.r(__webpack_exports__);
1942
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
1943
+ /* harmony export */ "default": () => (/* binding */ VBargraph)
1944
+ /* harmony export */ });
1945
+ /* harmony import */ var _AbstractItem__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./AbstractItem */ "./src/components/AbstractItem.ts");
1946
+ /* harmony import */ var _VBargraph_scss__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./VBargraph.scss */ "./src/components/VBargraph.scss");
1947
+ var __defProp = Object.defineProperty;
1948
+ var __defProps = Object.defineProperties;
1949
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
1950
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
1951
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
1952
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
1953
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1954
+ var __spreadValues = (a, b) => {
1955
+ for (var prop in b || (b = {}))
1956
+ if (__hasOwnProp.call(b, prop))
1957
+ __defNormalProp(a, prop, b[prop]);
1958
+ if (__getOwnPropSymbols)
1959
+ for (var prop of __getOwnPropSymbols(b)) {
1960
+ if (__propIsEnum.call(b, prop))
1961
+ __defNormalProp(a, prop, b[prop]);
1962
+ }
1963
+ return a;
1964
+ };
1965
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
1966
+
1967
+
1968
+ class VBargraph extends _AbstractItem__WEBPACK_IMPORTED_MODULE_0__["default"] {
1969
+ constructor() {
1970
+ super(...arguments);
1971
+ this.className = "vbargraph";
1972
+ this.setStyle = () => {
1973
+ const { height, width, grid, fontsize, textcolor, bgcolor, bordercolor } = this.state.style;
1974
+ const fontSize = Math.min(height * grid * 0.05, width * grid * 0.2);
1975
+ this.input.style.fontSize = `${fontsize || fontSize}px`;
1976
+ this.input.style.color = textcolor;
1977
+ this.container.style.backgroundColor = bgcolor;
1978
+ this.container.style.borderColor = bordercolor;
1979
+ };
1980
+ this.paintValue = 0;
1981
+ this.maxValue = -Infinity;
1982
+ this.paint = () => {
1983
+ const { barwidth, barbgcolor, coldcolor, warmcolor, hotcolor, overloadcolor } = this.state.style;
1984
+ const { type, max, min, enums, scale, value } = this.state;
1985
+ const ctx = this.ctx;
1986
+ const canvas = this.canvas;
1987
+ let { width, height } = this.canvasDiv.getBoundingClientRect();
1988
+ width = Math.floor(width);
1989
+ height = Math.floor(height);
1990
+ canvas.width = width;
1991
+ canvas.height = height;
1992
+ const drawHeight = height * 0.9;
1993
+ const drawWidth = barwidth || Math.min(width / 3, drawHeight * 0.05);
1994
+ const left = (width - drawWidth) * 0.5;
1995
+ const top = height * 0.05;
1996
+ this.paintValue = value;
1997
+ const paintValue = this.paintValue;
1998
+ if (paintValue > this.maxValue) {
1999
+ this.maxValue = paintValue;
2000
+ if (this.maxTimer)
2001
+ window.clearTimeout(this.maxTimer);
2002
+ this.maxTimer = window.setTimeout(() => {
2003
+ this.maxValue = this.paintValue;
2004
+ this.maxTimer = void 0;
2005
+ this.schedule(this.paint);
2006
+ }, 1e3);
2007
+ }
2008
+ if (paintValue < this.maxValue && typeof this.maxTimer === "undefined") {
2009
+ this.maxTimer = window.setTimeout(() => {
2010
+ this.maxValue = this.paintValue;
2011
+ this.maxTimer = void 0;
2012
+ this.schedule(this.paint);
2013
+ }, 1e3);
2014
+ }
2015
+ const maxValue = this.maxValue;
2016
+ const coldStop = (-18 - min) / (max - min);
2017
+ const warmStop = (-6 - min) / (max - min);
2018
+ const hotStop = (-3 - min) / (max - min);
2019
+ const overloadStop = Math.max(0, -min / (max - min));
2020
+ const gradient = ctx.createLinearGradient(0, drawHeight, 0, top);
2021
+ if (coldStop <= 1 && coldStop >= 0)
2022
+ gradient.addColorStop(coldStop, coldcolor);
2023
+ else if (coldStop > 1)
2024
+ gradient.addColorStop(1, coldcolor);
2025
+ if (warmStop <= 1 && warmStop >= 0)
2026
+ gradient.addColorStop(warmStop, warmcolor);
2027
+ if (hotStop <= 1 && hotStop >= 0)
2028
+ gradient.addColorStop(hotStop, hotcolor);
2029
+ if (overloadStop <= 1 && overloadStop >= 0)
2030
+ gradient.addColorStop(overloadStop, overloadcolor);
2031
+ else if (overloadStop < 0)
2032
+ gradient.addColorStop(0, coldcolor);
2033
+ ctx.fillStyle = barbgcolor;
2034
+ if (paintValue < 0)
2035
+ ctx.fillRect(left, top + (1 - overloadStop) * drawHeight, drawWidth, drawHeight * overloadStop);
2036
+ if (paintValue < max)
2037
+ ctx.fillRect(left, top, drawWidth, (1 - overloadStop) * drawHeight - 1);
2038
+ ctx.fillStyle = gradient;
2039
+ if (paintValue > min) {
2040
+ const distance = Math.max(0, _AbstractItem__WEBPACK_IMPORTED_MODULE_0__["default"].getDistance({ type, max, min, enums, scale, value: Math.min(0, paintValue) }));
2041
+ ctx.fillRect(left, top + (1 - distance) * drawHeight, drawWidth, drawHeight * distance);
2042
+ }
2043
+ if (paintValue > 0) {
2044
+ const distance = Math.max(0, _AbstractItem__WEBPACK_IMPORTED_MODULE_0__["default"].getDistance({ type, max, min, enums, scale, value: Math.min(max, paintValue) }) - overloadStop);
2045
+ ctx.fillRect(left, top + (1 - overloadStop - distance) * drawHeight, drawWidth, drawHeight * distance - 1);
2046
+ }
2047
+ if (maxValue > paintValue) {
2048
+ if (maxValue <= 0) {
2049
+ const distance = Math.max(0, _AbstractItem__WEBPACK_IMPORTED_MODULE_0__["default"].getDistance({ type, max, min, enums, scale, value: Math.min(0, maxValue) }));
2050
+ ctx.fillRect(left, top + (1 - distance) * drawHeight, drawWidth, 1);
2051
+ }
2052
+ if (maxValue > 0) {
2053
+ const distance = Math.max(0, _AbstractItem__WEBPACK_IMPORTED_MODULE_0__["default"].getDistance({ type, max, min, enums, scale, value: Math.min(max, maxValue) }) - overloadStop);
2054
+ ctx.fillRect(left, Math.max(top, top + (1 - overloadStop - distance) * drawHeight - 1), drawWidth, 1);
2055
+ }
2056
+ }
2057
+ };
2058
+ }
2059
+ static get defaultProps() {
2060
+ const inherited = super.defaultProps;
2061
+ return __spreadProps(__spreadValues({}, inherited), {
2062
+ style: __spreadProps(__spreadValues({}, inherited.style), {
2063
+ fontname: "Arial",
2064
+ fontsize: void 0,
2065
+ fontface: "regular",
2066
+ bgcolor: "rgba(18, 18, 18, 0)",
2067
+ bordercolor: "rgba(80, 80, 80, 0)",
2068
+ labelcolor: "rgba(226, 222, 255, 0.5)",
2069
+ textcolor: "rgba(18, 18, 18, 1)",
2070
+ barwidth: void 0,
2071
+ barbgcolor: "rgba(18, 18, 18, 1)",
2072
+ coldcolor: "rgba(12, 248, 100, 1)",
2073
+ warmcolor: "rgba(195, 248, 100, 1)",
2074
+ hotcolor: "rgba(255, 193, 10, 1)",
2075
+ overloadcolor: "rgba(255, 10, 10, 1)"
2076
+ })
2077
+ });
2078
+ }
2079
+ componentWillMount() {
2080
+ super.componentWillMount();
2081
+ this.flexDiv = document.createElement("div");
2082
+ this.flexDiv.className = `faust-ui-component-${this.className}-flexdiv`;
2083
+ this.canvasDiv = document.createElement("div");
2084
+ this.canvasDiv.className = `faust-ui-component-${this.className}-canvasdiv`;
2085
+ this.canvas = document.createElement("canvas");
2086
+ this.canvas.width = 10;
2087
+ this.canvas.height = 10;
2088
+ this.ctx = this.canvas.getContext("2d");
2089
+ this.input = document.createElement("input");
2090
+ this.input.disabled = true;
2091
+ this.input.value = (+this.state.value.toFixed(3)).toString() + (this.state.unit || "");
2092
+ this.setStyle();
2093
+ return this;
2094
+ }
2095
+ componentDidMount() {
2096
+ super.componentDidMount();
2097
+ this.canvas.addEventListener("mousedown", this.handleMouseDown);
2098
+ this.canvas.addEventListener("touchstart", this.handleTouchStart, { passive: false });
2099
+ this.on("style", () => {
2100
+ this.schedule(this.setStyle);
2101
+ this.schedule(this.paint);
2102
+ });
2103
+ this.on("label", () => this.schedule(this.paintLabel));
2104
+ const valueChange = () => this.input.value = (+this.state.value.toFixed(3)).toString() + (this.state.unit || "");
2105
+ this.on("value", () => {
2106
+ this.schedule(valueChange);
2107
+ this.schedule(this.paint);
2108
+ });
2109
+ this.on("max", () => this.schedule(this.paint));
2110
+ this.on("min", () => this.schedule(this.paint));
2111
+ this.on("step", () => this.schedule(this.paint));
2112
+ this.schedule(this.paint);
2113
+ return this;
2114
+ }
2115
+ mount() {
2116
+ this.canvasDiv.appendChild(this.canvas);
2117
+ this.flexDiv.appendChild(this.canvasDiv);
2118
+ this.flexDiv.appendChild(this.input);
2119
+ this.container.appendChild(this.label);
2120
+ this.container.appendChild(this.flexDiv);
2121
+ return super.mount();
2122
+ }
2123
+ }
2124
+
2125
+
2126
+ /***/ }),
2127
+
2128
+ /***/ "./src/components/VSlider.ts":
2129
+ /*!***********************************!*\
2130
+ !*** ./src/components/VSlider.ts ***!
2131
+ \***********************************/
2132
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
2133
+
2134
+ __webpack_require__.r(__webpack_exports__);
2135
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
2136
+ /* harmony export */ "default": () => (/* binding */ VSlider)
2137
+ /* harmony export */ });
2138
+ /* harmony import */ var _AbstractItem__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./AbstractItem */ "./src/components/AbstractItem.ts");
2139
+ /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./utils */ "./src/components/utils.ts");
2140
+ /* harmony import */ var _VSlider_scss__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./VSlider.scss */ "./src/components/VSlider.scss");
2141
+ var __defProp = Object.defineProperty;
2142
+ var __defProps = Object.defineProperties;
2143
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
2144
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
2145
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
2146
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
2147
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
2148
+ var __spreadValues = (a, b) => {
2149
+ for (var prop in b || (b = {}))
2150
+ if (__hasOwnProp.call(b, prop))
2151
+ __defNormalProp(a, prop, b[prop]);
2152
+ if (__getOwnPropSymbols)
2153
+ for (var prop of __getOwnPropSymbols(b)) {
2154
+ if (__propIsEnum.call(b, prop))
2155
+ __defNormalProp(a, prop, b[prop]);
2156
+ }
2157
+ return a;
2158
+ };
2159
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
2160
+
2161
+
2162
+
2163
+ class VSlider extends _AbstractItem__WEBPACK_IMPORTED_MODULE_0__["default"] {
2164
+ constructor() {
2165
+ super(...arguments);
2166
+ this.className = "vslider";
2167
+ this.interactionRect = [0, 0, 0, 0];
2168
+ this.handleChange = (e) => {
2169
+ const value = parseFloat(e.currentTarget.value);
2170
+ if (isFinite(value)) {
2171
+ const changed = this.setValue(+value);
2172
+ if (changed)
2173
+ return;
2174
+ }
2175
+ this.input.value = this.inputNumber.value + (this.state.unit || "");
2176
+ };
2177
+ this.setStyle = () => {
2178
+ const { height, width, grid, fontsize, textcolor, bgcolor, bordercolor } = this.state.style;
2179
+ const fontSize = Math.min(height * grid * 0.05, width * grid * 0.2);
2180
+ this.input.style.fontSize = `${fontsize || fontSize}px`;
2181
+ this.input.style.color = textcolor;
2182
+ this.container.style.backgroundColor = bgcolor;
2183
+ this.container.style.borderColor = bordercolor;
2184
+ };
2185
+ this.paint = () => {
2186
+ const { sliderwidth, sliderbgcolor, sliderbgoncolor, slidercolor } = this.state.style;
2187
+ const ctx = this.ctx;
2188
+ const canvas = this.canvas;
2189
+ const distance = this.distance;
2190
+ let { width, height } = this.canvasDiv.getBoundingClientRect();
2191
+ width = Math.floor(width);
2192
+ height = Math.floor(height);
2193
+ canvas.width = width;
2194
+ canvas.height = height;
2195
+ const drawHeight = height * 0.9;
2196
+ const drawWidth = sliderwidth || Math.min(width / 3, drawHeight * 0.05);
2197
+ const left = (width - drawWidth) * 0.5;
2198
+ const top = height * 0.05;
2199
+ const borderRadius = drawWidth * 0.25;
2200
+ this.interactionRect = [0, top, width, drawHeight];
2201
+ const grd = ctx.createLinearGradient(0, top, 0, top + drawHeight);
2202
+ grd.addColorStop(Math.max(0, Math.min(1, 1 - distance)), sliderbgcolor);
2203
+ grd.addColorStop(Math.max(0, Math.min(1, 1 - distance)), sliderbgoncolor);
2204
+ ctx.fillStyle = grd;
2205
+ (0,_utils__WEBPACK_IMPORTED_MODULE_1__.fillRoundedRect)(ctx, left, top, drawWidth, drawHeight, borderRadius);
2206
+ ctx.fillStyle = slidercolor;
2207
+ (0,_utils__WEBPACK_IMPORTED_MODULE_1__.fillRoundedRect)(ctx, left - drawWidth, top + drawHeight * (1 - distance) - drawWidth, drawWidth * 3, drawWidth * 2, borderRadius);
2208
+ };
2209
+ this.handlePointerDown = (e) => {
2210
+ const { value } = this.state;
2211
+ 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])
2212
+ return;
2213
+ const newValue = this.getValueFromPos(e);
2214
+ if (newValue !== value)
2215
+ this.setValue(this.getValueFromPos(e));
2216
+ };
2217
+ this.handlePointerDrag = (e) => {
2218
+ const newValue = this.getValueFromPos(e);
2219
+ if (newValue !== this.state.value)
2220
+ this.setValue(newValue);
2221
+ };
2222
+ }
2223
+ static get defaultProps() {
2224
+ const inherited = super.defaultProps;
2225
+ return __spreadProps(__spreadValues({}, inherited), {
2226
+ style: __spreadProps(__spreadValues({}, inherited.style), {
2227
+ fontname: "Arial",
2228
+ fontsize: void 0,
2229
+ fontface: "regular",
2230
+ bgcolor: "rgba(18, 18, 18, 0)",
2231
+ bordercolor: "rgba(80, 80, 80, 0)",
2232
+ labelcolor: "rgba(226, 222, 255, 0.5)",
2233
+ textcolor: "rgba(18, 18, 18, 1)",
2234
+ sliderwidth: void 0,
2235
+ sliderbgcolor: "rgba(18, 18, 18, 1)",
2236
+ sliderbgoncolor: "rgba(255, 165, 0, 1)",
2237
+ slidercolor: "rgba(200, 200, 200, 0.75)"
2238
+ })
2239
+ });
2240
+ }
2241
+ componentWillMount() {
2242
+ super.componentWillMount();
2243
+ this.flexDiv = document.createElement("div");
2244
+ this.flexDiv.className = `faust-ui-component-${this.className}-flexdiv`;
2245
+ this.canvasDiv = document.createElement("div");
2246
+ this.canvasDiv.className = `faust-ui-component-${this.className}-canvasdiv`;
2247
+ this.canvas = document.createElement("canvas");
2248
+ this.canvas.width = 10;
2249
+ this.canvas.height = 10;
2250
+ this.ctx = this.canvas.getContext("2d");
2251
+ this.inputNumber = document.createElement("input");
2252
+ this.inputNumber.type = "number";
2253
+ this.inputNumber.value = (+this.state.value.toFixed(3)).toString();
2254
+ this.inputNumber.max = this.state.max.toString();
2255
+ this.inputNumber.min = this.state.min.toString();
2256
+ this.inputNumber.step = this.state.step.toString();
2257
+ this.input = document.createElement("input");
2258
+ this.input.value = this.inputNumber.value + (this.state.unit || "");
2259
+ this.input.spellcheck = false;
2260
+ this.setStyle();
2261
+ return this;
2262
+ }
2263
+ componentDidMount() {
2264
+ super.componentDidMount();
2265
+ this.input.addEventListener("change", this.handleChange);
2266
+ this.canvas.addEventListener("mousedown", this.handleMouseDown);
2267
+ this.canvas.addEventListener("touchstart", this.handleTouchStart, { passive: false });
2268
+ this.on("style", () => {
2269
+ this.schedule(this.setStyle);
2270
+ this.schedule(this.paint);
2271
+ });
2272
+ this.on("label", () => this.schedule(this.paintLabel));
2273
+ const valueChange = () => {
2274
+ this.inputNumber.value = (+this.state.value.toFixed(3)).toString();
2275
+ this.input.value = this.inputNumber.value + (this.state.unit || "");
2276
+ };
2277
+ this.on("value", () => {
2278
+ this.schedule(valueChange);
2279
+ this.schedule(this.paint);
2280
+ });
2281
+ const maxChange = () => this.inputNumber.max = this.state.max.toString();
2282
+ this.on("max", () => {
2283
+ this.schedule(maxChange);
2284
+ this.schedule(this.paint);
2285
+ });
2286
+ const minChange = () => this.inputNumber.min = this.state.min.toString();
2287
+ this.on("min", () => {
2288
+ this.schedule(minChange);
2289
+ this.schedule(this.paint);
2290
+ });
2291
+ const stepChange = () => this.inputNumber.step = this.state.step.toString();
2292
+ this.on("step", () => {
2293
+ this.schedule(stepChange);
2294
+ this.schedule(this.paint);
2295
+ });
2296
+ this.schedule(this.paint);
2297
+ return this;
2298
+ }
2299
+ mount() {
2300
+ this.canvasDiv.appendChild(this.canvas);
2301
+ this.flexDiv.appendChild(this.canvasDiv);
2302
+ this.flexDiv.appendChild(this.input);
2303
+ this.container.appendChild(this.label);
2304
+ this.container.appendChild(this.flexDiv);
2305
+ return super.mount();
2306
+ }
2307
+ get stepsCount() {
2308
+ const { type, max, min, step, enums } = this.state;
2309
+ const maxSteps = type === "enum" ? enums.length : type === "int" ? max - min : (max - min) / step;
2310
+ if (step) {
2311
+ if (type === "enum")
2312
+ return enums.length;
2313
+ if (type === "int")
2314
+ return Math.min(Math.floor((max - min) / (Math.round(step) || 0)), maxSteps);
2315
+ return Math.floor((max - min) / step);
2316
+ }
2317
+ return maxSteps;
2318
+ }
2319
+ get stepRange() {
2320
+ const full = this.interactionRect[this.className === "vslider" ? 3 : 2];
2321
+ const stepsCount = this.stepsCount;
2322
+ return full / stepsCount;
2323
+ }
2324
+ getValueFromPos(e) {
2325
+ const { type, min, max, scale } = this.state;
2326
+ const step = type === "enum" ? 1 : this.state.step || 1;
2327
+ const stepRange = this.stepRange;
2328
+ const stepsCount = this.stepsCount;
2329
+ const distance = this.className === "vslider" ? this.interactionRect[3] - (e.y - this.interactionRect[1]) : e.x - this.interactionRect[0];
2330
+ const range = this.className === "vslider" ? this.interactionRect[3] : this.interactionRect[2];
2331
+ const denormalized = (0,_utils__WEBPACK_IMPORTED_MODULE_1__.denormalize)(distance / range, min, max);
2332
+ 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;
2333
+ let steps = Math.round((0,_utils__WEBPACK_IMPORTED_MODULE_1__.normalize)(v, min, max) * range / stepRange);
2334
+ steps = Math.min(stepsCount, Math.max(0, steps));
2335
+ if (type === "enum")
2336
+ return steps;
2337
+ if (type === "int")
2338
+ return Math.round(steps * step + min);
2339
+ return steps * step + min;
2340
+ }
2341
+ }
2342
+
2343
+
2344
+ /***/ }),
2345
+
2346
+ /***/ "./src/components/utils.ts":
2347
+ /*!*********************************!*\
2348
+ !*** ./src/components/utils.ts ***!
2349
+ \*********************************/
2350
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
2351
+
2352
+ __webpack_require__.r(__webpack_exports__);
2353
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
2354
+ /* harmony export */ "atodb": () => (/* binding */ atodb),
2355
+ /* harmony export */ "dbtoa": () => (/* binding */ dbtoa),
2356
+ /* harmony export */ "denormalize": () => (/* binding */ denormalize),
2357
+ /* harmony export */ "fillRoundedRect": () => (/* binding */ fillRoundedRect),
2358
+ /* harmony export */ "iNormExp": () => (/* binding */ iNormExp),
2359
+ /* harmony export */ "iNormLog": () => (/* binding */ iNormLog),
2360
+ /* harmony export */ "normExp": () => (/* binding */ normExp),
2361
+ /* harmony export */ "normLog": () => (/* binding */ normLog),
2362
+ /* harmony export */ "normalize": () => (/* binding */ normalize),
2363
+ /* harmony export */ "roundedRect": () => (/* binding */ roundedRect),
2364
+ /* harmony export */ "toMIDI": () => (/* binding */ toMIDI),
2365
+ /* harmony export */ "toRad": () => (/* binding */ toRad)
2366
+ /* harmony export */ });
2367
+ const toMIDI = (f) => ["C", "C#", "D", "D#", "E", "F", "F#", "G", "G#", "A", "A#", "B"][(f % 12 + 12) % 12] + Math.round(f / 12 - 2);
2368
+ const toRad = (degrees) => degrees * Math.PI / 180;
2369
+ const atodb = (a) => 20 * Math.log10(a);
2370
+ const dbtoa = (db) => 10 ** (db / 20);
2371
+ const denormalize = (x, min, max) => min + (max - min) * x;
2372
+ const normalize = (x, min, max) => (x - min) / (max - min) || 0;
2373
+ const normLog = (x, min, max) => {
2374
+ const normalized = normalize(x, min, max);
2375
+ const logMin = Math.log(Math.max(Number.EPSILON, min));
2376
+ const logMax = Math.log(Math.max(Number.EPSILON, max));
2377
+ const vLog = denormalize(normalized, logMin, logMax);
2378
+ const v = Math.exp(vLog);
2379
+ return Math.max(min, Math.min(max, v));
2380
+ };
2381
+ const iNormLog = (vIn, min, max) => {
2382
+ const v = Math.max(min, Math.min(max, vIn));
2383
+ const vLog = Math.log(Math.max(Number.EPSILON, v));
2384
+ const logMin = Math.log(Math.max(Number.EPSILON, min));
2385
+ const logMax = Math.log(Math.max(Number.EPSILON, max));
2386
+ const normalized = normalize(vLog, logMin, logMax);
2387
+ return denormalize(normalized, min, max);
2388
+ };
2389
+ const normExp = iNormLog;
2390
+ const iNormExp = normLog;
2391
+ const roundedRect = (ctx, x, y, width, height, radius) => {
2392
+ const radii = [0, 0, 0, 0];
2393
+ if (typeof radius === "number")
2394
+ radii.fill(radius);
2395
+ else
2396
+ radius.forEach((v, i) => radii[i] = v);
2397
+ ctx.beginPath();
2398
+ ctx.moveTo(x + radii[0], y);
2399
+ ctx.lineTo(x + width - radii[1], y);
2400
+ ctx.quadraticCurveTo(x + width, y, x + width, y + radii[1]);
2401
+ ctx.lineTo(x + width, y + height - radii[2]);
2402
+ ctx.quadraticCurveTo(x + width, y + height, x + width - radii[2], y + height);
2403
+ ctx.lineTo(x + radii[3], y + height);
2404
+ ctx.quadraticCurveTo(x, y + height, x, y + height - radii[3]);
2405
+ ctx.lineTo(x, y + radii[0]);
2406
+ ctx.quadraticCurveTo(x, y, x + radii[0], y);
2407
+ ctx.closePath();
2408
+ ctx.stroke();
2409
+ };
2410
+ const fillRoundedRect = (ctx, x, y, width, height, radius) => {
2411
+ const radii = [0, 0, 0, 0];
2412
+ if (typeof radius === "number")
2413
+ radii.fill(radius);
2414
+ else
2415
+ radius.forEach((v, i) => radii[i] = v);
2416
+ ctx.beginPath();
2417
+ ctx.moveTo(x + radii[0], y);
2418
+ ctx.lineTo(x + width - radii[1], y);
2419
+ ctx.quadraticCurveTo(x + width, y, x + width, y + radii[1]);
2420
+ ctx.lineTo(x + width, y + height - radii[2]);
2421
+ ctx.quadraticCurveTo(x + width, y + height, x + width - radii[2], y + height);
2422
+ ctx.lineTo(x + radii[3], y + height);
2423
+ ctx.quadraticCurveTo(x, y + height, x, y + height - radii[3]);
2424
+ ctx.lineTo(x, y + radii[0]);
2425
+ ctx.quadraticCurveTo(x, y, x + radii[0], y);
2426
+ ctx.closePath();
2427
+ ctx.fill();
2428
+ };
2429
+
2430
+
2431
+ /***/ }),
2432
+
2433
+ /***/ "./src/instantiate.ts":
2434
+ /*!****************************!*\
2435
+ !*** ./src/instantiate.ts ***!
2436
+ \****************************/
2437
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
2438
+
2439
+ __webpack_require__.r(__webpack_exports__);
2440
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
2441
+ /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
2442
+ /* harmony export */ });
2443
+ /* harmony import */ var _FaustUI__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./FaustUI */ "./src/FaustUI.ts");
2444
+
2445
+ const instantiate = () => {
2446
+ const faustUI = new _FaustUI__WEBPACK_IMPORTED_MODULE_0__["default"]({
2447
+ root: document.getElementById("root"),
2448
+ listenWindowResize: true,
2449
+ listenWindowMessage: true
2450
+ });
2451
+ let host;
2452
+ window.addEventListener("message", (e) => {
2453
+ const { source } = e;
2454
+ host = source;
2455
+ });
2456
+ window.addEventListener("keydown", (e) => {
2457
+ if (host)
2458
+ host.postMessage({ type: "keydown", key: e.key }, "*");
2459
+ });
2460
+ window.addEventListener("keyup", (e) => {
2461
+ if (host)
2462
+ host.postMessage({ type: "keyup", key: e.key }, "*");
2463
+ });
2464
+ window.faustUI = faustUI;
2465
+ };
2466
+ /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (instantiate);
2467
+
2468
+
2469
+ /***/ }),
2470
+
2471
+ /***/ "./src/layout/AbstractGroup.ts":
2472
+ /*!*************************************!*\
2473
+ !*** ./src/layout/AbstractGroup.ts ***!
2474
+ \*************************************/
2475
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
2476
+
2477
+ __webpack_require__.r(__webpack_exports__);
2478
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
2479
+ /* harmony export */ "default": () => (/* binding */ AbstractGroup)
2480
+ /* harmony export */ });
2481
+ const _AbstractGroup = class {
2482
+ constructor(group, isRoot) {
2483
+ this.isRoot = !!isRoot;
2484
+ Object.assign(this, group);
2485
+ const { hasHSizingDesc, hasVSizingDesc } = this;
2486
+ const sizing = hasHSizingDesc && hasVSizingDesc ? "both" : hasHSizingDesc ? "horizontal" : hasVSizingDesc ? "vertical" : "none";
2487
+ this.layout = {
2488
+ type: group.type,
2489
+ width: _AbstractGroup.padding * 2,
2490
+ height: _AbstractGroup.padding * 2 + _AbstractGroup.labelHeight,
2491
+ sizing
2492
+ };
2493
+ }
2494
+ get hasHSizingDesc() {
2495
+ return !!this.items.find((item) => {
2496
+ if (item instanceof _AbstractGroup)
2497
+ return item.hasHSizingDesc;
2498
+ return item.layout.sizing === "horizontal" || item.layout.sizing === "both";
2499
+ });
2500
+ }
2501
+ get hasVSizingDesc() {
2502
+ return !!this.items.find((item) => {
2503
+ if (item instanceof _AbstractGroup)
2504
+ return item.hasVSizingDesc;
2505
+ return item.layout.sizing === "vertical" || item.layout.sizing === "both";
2506
+ });
2507
+ }
2508
+ adjust() {
2509
+ return this;
2510
+ }
2511
+ expand(dX, dY) {
2512
+ return this;
2513
+ }
2514
+ offset() {
2515
+ return this;
2516
+ }
2517
+ };
2518
+ let AbstractGroup = _AbstractGroup;
2519
+ AbstractGroup.padding = 0.2;
2520
+ AbstractGroup.labelHeight = 0.25;
2521
+ AbstractGroup.spaceBetween = 0.1;
2522
+
2523
+
2524
+
2525
+ /***/ }),
2526
+
2527
+ /***/ "./src/layout/AbstractInputItem.ts":
2528
+ /*!*****************************************!*\
2529
+ !*** ./src/layout/AbstractInputItem.ts ***!
2530
+ \*****************************************/
2531
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
2532
+
2533
+ __webpack_require__.r(__webpack_exports__);
2534
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
2535
+ /* harmony export */ "default": () => (/* binding */ AbstractInputItem)
2536
+ /* harmony export */ });
2537
+ /* harmony import */ var _AbstractItem__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./AbstractItem */ "./src/layout/AbstractItem.ts");
2538
+
2539
+ class AbstractInputItem extends _AbstractItem__WEBPACK_IMPORTED_MODULE_0__["default"] {
2540
+ constructor(item) {
2541
+ super(item);
2542
+ this.init = +item.init || 0;
2543
+ this.step = +item.step || 1;
2544
+ }
2545
+ }
2546
+
2547
+
2548
+ /***/ }),
2549
+
2550
+ /***/ "./src/layout/AbstractItem.ts":
2551
+ /*!************************************!*\
2552
+ !*** ./src/layout/AbstractItem.ts ***!
2553
+ \************************************/
2554
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
2555
+
2556
+ __webpack_require__.r(__webpack_exports__);
2557
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
2558
+ /* harmony export */ "default": () => (/* binding */ AbstractItem)
2559
+ /* harmony export */ });
2560
+ class AbstractItem {
2561
+ constructor(item) {
2562
+ Object.assign(this, item);
2563
+ this.min = isFinite(+this.min) ? +this.min : 0;
2564
+ this.max = isFinite(+this.max) ? +this.max : 1;
2565
+ }
2566
+ adjust() {
2567
+ return this;
2568
+ }
2569
+ expand(dX, dY) {
2570
+ return this;
2571
+ }
2572
+ offset() {
2573
+ return this;
2574
+ }
2575
+ }
2576
+
2577
+
2578
+ /***/ }),
2579
+
2580
+ /***/ "./src/layout/AbstractOutputItem.ts":
2581
+ /*!******************************************!*\
2582
+ !*** ./src/layout/AbstractOutputItem.ts ***!
2583
+ \******************************************/
2584
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
2585
+
2586
+ __webpack_require__.r(__webpack_exports__);
2587
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
2588
+ /* harmony export */ "default": () => (/* binding */ AbstractOutputItem)
2589
+ /* harmony export */ });
2590
+ /* harmony import */ var _AbstractItem__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./AbstractItem */ "./src/layout/AbstractItem.ts");
2591
+
2592
+ class AbstractOutputItem extends _AbstractItem__WEBPACK_IMPORTED_MODULE_0__["default"] {
2593
+ }
2594
+
2595
+
2596
+ /***/ }),
2597
+
2598
+ /***/ "./src/layout/Button.ts":
2599
+ /*!******************************!*\
2600
+ !*** ./src/layout/Button.ts ***!
2601
+ \******************************/
2602
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
2603
+
2604
+ __webpack_require__.r(__webpack_exports__);
2605
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
2606
+ /* harmony export */ "default": () => (/* binding */ Button)
2607
+ /* harmony export */ });
2608
+ /* harmony import */ var _AbstractInputItem__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./AbstractInputItem */ "./src/layout/AbstractInputItem.ts");
2609
+
2610
+ class Button extends _AbstractInputItem__WEBPACK_IMPORTED_MODULE_0__["default"] {
2611
+ constructor() {
2612
+ super(...arguments);
2613
+ this.layout = {
2614
+ type: "button",
2615
+ width: 2,
2616
+ height: 1,
2617
+ sizing: "horizontal"
2618
+ };
2619
+ }
2620
+ }
2621
+
2622
+
2623
+ /***/ }),
2624
+
2625
+ /***/ "./src/layout/Checkbox.ts":
2626
+ /*!********************************!*\
2627
+ !*** ./src/layout/Checkbox.ts ***!
2628
+ \********************************/
2629
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
2630
+
2631
+ __webpack_require__.r(__webpack_exports__);
2632
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
2633
+ /* harmony export */ "default": () => (/* binding */ Checkbox)
2634
+ /* harmony export */ });
2635
+ /* harmony import */ var _AbstractInputItem__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./AbstractInputItem */ "./src/layout/AbstractInputItem.ts");
2636
+
2637
+ class Checkbox extends _AbstractInputItem__WEBPACK_IMPORTED_MODULE_0__["default"] {
2638
+ constructor() {
2639
+ super(...arguments);
2640
+ this.layout = {
2641
+ type: "checkbox",
2642
+ width: 2,
2643
+ height: 1,
2644
+ sizing: "horizontal"
2645
+ };
2646
+ }
2647
+ }
2648
+
2649
+
2650
+ /***/ }),
2651
+
2652
+ /***/ "./src/layout/HBargraph.ts":
2653
+ /*!*********************************!*\
2654
+ !*** ./src/layout/HBargraph.ts ***!
2655
+ \*********************************/
2656
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
2657
+
2658
+ __webpack_require__.r(__webpack_exports__);
2659
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
2660
+ /* harmony export */ "default": () => (/* binding */ HBargraph)
2661
+ /* harmony export */ });
2662
+ /* harmony import */ var _AbstractOutputItem__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./AbstractOutputItem */ "./src/layout/AbstractOutputItem.ts");
2663
+
2664
+ class HBargraph extends _AbstractOutputItem__WEBPACK_IMPORTED_MODULE_0__["default"] {
2665
+ constructor() {
2666
+ super(...arguments);
2667
+ this.layout = {
2668
+ type: "hbargraph",
2669
+ width: 5,
2670
+ height: 1,
2671
+ sizing: "horizontal"
2672
+ };
2673
+ }
2674
+ }
2675
+
2676
+
2677
+ /***/ }),
2678
+
2679
+ /***/ "./src/layout/HGroup.ts":
2680
+ /*!******************************!*\
2681
+ !*** ./src/layout/HGroup.ts ***!
2682
+ \******************************/
2683
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
2684
+
2685
+ __webpack_require__.r(__webpack_exports__);
2686
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
2687
+ /* harmony export */ "default": () => (/* binding */ HGroup)
2688
+ /* harmony export */ });
2689
+ /* harmony import */ var _AbstractGroup__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./AbstractGroup */ "./src/layout/AbstractGroup.ts");
2690
+
2691
+ class HGroup extends _AbstractGroup__WEBPACK_IMPORTED_MODULE_0__["default"] {
2692
+ adjust() {
2693
+ this.items.forEach((item) => {
2694
+ item.adjust();
2695
+ this.layout.width += item.layout.width;
2696
+ this.layout.height = Math.max(this.layout.height, item.layout.height + 2 * _AbstractGroup__WEBPACK_IMPORTED_MODULE_0__["default"].padding + _AbstractGroup__WEBPACK_IMPORTED_MODULE_0__["default"].labelHeight);
2697
+ });
2698
+ this.layout.width += _AbstractGroup__WEBPACK_IMPORTED_MODULE_0__["default"].spaceBetween * (this.items.length - 1);
2699
+ if (this.layout.width < 1)
2700
+ this.layout.width += 1;
2701
+ return this;
2702
+ }
2703
+ expand(dX) {
2704
+ let hExpandItems = 0;
2705
+ this.items.forEach((item) => {
2706
+ if (item.layout.sizing === "both" || item.layout.sizing === "horizontal")
2707
+ hExpandItems++;
2708
+ });
2709
+ this.items.forEach((item) => {
2710
+ let dX$ = 0;
2711
+ let dY$ = 0;
2712
+ if (item.layout.sizing === "both" || item.layout.sizing === "horizontal") {
2713
+ dX$ = hExpandItems ? dX / hExpandItems : 0;
2714
+ item.layout.width += dX$;
2715
+ }
2716
+ if (item.layout.sizing === "both" || item.layout.sizing === "vertical") {
2717
+ dY$ = this.layout.height - 2 * _AbstractGroup__WEBPACK_IMPORTED_MODULE_0__["default"].padding - _AbstractGroup__WEBPACK_IMPORTED_MODULE_0__["default"].labelHeight - item.layout.height;
2718
+ item.layout.height += dY$;
2719
+ }
2720
+ item.expand(dX$, dY$);
2721
+ });
2722
+ this.layout.width += dX;
2723
+ return this;
2724
+ }
2725
+ offset() {
2726
+ const { labelHeight, padding, spaceBetween } = _AbstractGroup__WEBPACK_IMPORTED_MODULE_0__["default"];
2727
+ let $left = padding;
2728
+ const $top = padding + labelHeight;
2729
+ const { height } = this.layout;
2730
+ this.items.forEach((item) => {
2731
+ item.layout.offsetLeft = $left;
2732
+ item.layout.offsetTop = $top;
2733
+ item.layout.offsetTop += (height - labelHeight - item.layout.height) / 2 - padding;
2734
+ item.layout.left = (this.layout.left || 0) + item.layout.offsetLeft;
2735
+ item.layout.top = (this.layout.top || 0) + item.layout.offsetTop;
2736
+ item.offset();
2737
+ $left += item.layout.width + spaceBetween;
2738
+ });
2739
+ return this;
2740
+ }
2741
+ }
2742
+
2743
+
2744
+ /***/ }),
2745
+
2746
+ /***/ "./src/layout/HSlider.ts":
2747
+ /*!*******************************!*\
2748
+ !*** ./src/layout/HSlider.ts ***!
2749
+ \*******************************/
2750
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
2751
+
2752
+ __webpack_require__.r(__webpack_exports__);
2753
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
2754
+ /* harmony export */ "default": () => (/* binding */ HSlider)
2755
+ /* harmony export */ });
2756
+ /* harmony import */ var _AbstractInputItem__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./AbstractInputItem */ "./src/layout/AbstractInputItem.ts");
2757
+
2758
+ class HSlider extends _AbstractInputItem__WEBPACK_IMPORTED_MODULE_0__["default"] {
2759
+ constructor() {
2760
+ super(...arguments);
2761
+ this.layout = {
2762
+ type: "hslider",
2763
+ width: 5,
2764
+ height: 1,
2765
+ sizing: "horizontal"
2766
+ };
2767
+ }
2768
+ }
2769
+
2770
+
2771
+ /***/ }),
2772
+
2773
+ /***/ "./src/layout/Knob.ts":
2774
+ /*!****************************!*\
2775
+ !*** ./src/layout/Knob.ts ***!
2776
+ \****************************/
2777
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
2778
+
2779
+ __webpack_require__.r(__webpack_exports__);
2780
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
2781
+ /* harmony export */ "default": () => (/* binding */ Knob)
2782
+ /* harmony export */ });
2783
+ /* harmony import */ var _AbstractInputItem__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./AbstractInputItem */ "./src/layout/AbstractInputItem.ts");
2784
+
2785
+ class Knob extends _AbstractInputItem__WEBPACK_IMPORTED_MODULE_0__["default"] {
2786
+ constructor() {
2787
+ super(...arguments);
2788
+ this.layout = {
2789
+ type: "knob",
2790
+ width: 1,
2791
+ height: 1.75,
2792
+ sizing: "none"
2793
+ };
2794
+ }
2795
+ }
2796
+
2797
+
2798
+ /***/ }),
2799
+
2800
+ /***/ "./src/layout/Layout.ts":
2801
+ /*!******************************!*\
2802
+ !*** ./src/layout/Layout.ts ***!
2803
+ \******************************/
2804
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
2805
+
2806
+ __webpack_require__.r(__webpack_exports__);
2807
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
2808
+ /* harmony export */ "default": () => (/* binding */ Layout)
2809
+ /* harmony export */ });
2810
+ /* harmony import */ var _HSlider__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./HSlider */ "./src/layout/HSlider.ts");
2811
+ /* harmony import */ var _VSlider__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./VSlider */ "./src/layout/VSlider.ts");
2812
+ /* harmony import */ var _Nentry__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./Nentry */ "./src/layout/Nentry.ts");
2813
+ /* harmony import */ var _Button__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./Button */ "./src/layout/Button.ts");
2814
+ /* harmony import */ var _Checkbox__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./Checkbox */ "./src/layout/Checkbox.ts");
2815
+ /* harmony import */ var _Knob__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./Knob */ "./src/layout/Knob.ts");
2816
+ /* harmony import */ var _Menu__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./Menu */ "./src/layout/Menu.ts");
2817
+ /* harmony import */ var _Radio__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./Radio */ "./src/layout/Radio.ts");
2818
+ /* harmony import */ var _Led__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./Led */ "./src/layout/Led.ts");
2819
+ /* harmony import */ var _Numerical__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./Numerical */ "./src/layout/Numerical.ts");
2820
+ /* harmony import */ var _HBargraph__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./HBargraph */ "./src/layout/HBargraph.ts");
2821
+ /* harmony import */ var _VBargraph__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./VBargraph */ "./src/layout/VBargraph.ts");
2822
+ /* harmony import */ var _HGroup__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./HGroup */ "./src/layout/HGroup.ts");
2823
+ /* harmony import */ var _VGroup__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./VGroup */ "./src/layout/VGroup.ts");
2824
+ /* harmony import */ var _TGroup__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./TGroup */ "./src/layout/TGroup.ts");
2825
+
2826
+
2827
+
2828
+
2829
+
2830
+
2831
+
2832
+
2833
+
2834
+
2835
+
2836
+
2837
+
2838
+
2839
+
2840
+ class Layout {
2841
+ static predictType(item) {
2842
+ if (item.type === "vgroup" || item.type === "hgroup" || item.type === "tgroup" || item.type === "button" || item.type === "checkbox")
2843
+ return item.type;
2844
+ if (item.type === "hbargraph" || item.type === "vbargraph") {
2845
+ if (item.meta && item.meta.find((meta) => meta.style && meta.style.startsWith("led")))
2846
+ return "led";
2847
+ if (item.meta && item.meta.find((meta) => meta.style && meta.style.startsWith("numerical")))
2848
+ return "numerical";
2849
+ return item.type;
2850
+ }
2851
+ if (item.type === "hslider" || item.type === "nentry" || item.type === "vslider") {
2852
+ if (item.meta && item.meta.find((meta) => meta.style && meta.style.startsWith("knob")))
2853
+ return "knob";
2854
+ if (item.meta && item.meta.find((meta) => meta.style && meta.style.startsWith("menu")))
2855
+ return "menu";
2856
+ if (item.meta && item.meta.find((meta) => meta.style && meta.style.startsWith("radio")))
2857
+ return "radio";
2858
+ }
2859
+ return item.type;
2860
+ }
2861
+ static getItem(item) {
2862
+ const Ctor = {
2863
+ hslider: _HSlider__WEBPACK_IMPORTED_MODULE_0__["default"],
2864
+ vslider: _VSlider__WEBPACK_IMPORTED_MODULE_1__["default"],
2865
+ nentry: _Nentry__WEBPACK_IMPORTED_MODULE_2__["default"],
2866
+ button: _Button__WEBPACK_IMPORTED_MODULE_3__["default"],
2867
+ checkbox: _Checkbox__WEBPACK_IMPORTED_MODULE_4__["default"],
2868
+ knob: _Knob__WEBPACK_IMPORTED_MODULE_5__["default"],
2869
+ menu: _Menu__WEBPACK_IMPORTED_MODULE_6__["default"],
2870
+ radio: _Radio__WEBPACK_IMPORTED_MODULE_7__["default"],
2871
+ led: _Led__WEBPACK_IMPORTED_MODULE_8__["default"],
2872
+ numerical: _Numerical__WEBPACK_IMPORTED_MODULE_9__["default"],
2873
+ hbargraph: _HBargraph__WEBPACK_IMPORTED_MODULE_10__["default"],
2874
+ vbargraph: _VBargraph__WEBPACK_IMPORTED_MODULE_11__["default"],
2875
+ hgroup: _HGroup__WEBPACK_IMPORTED_MODULE_12__["default"],
2876
+ vgroup: _VGroup__WEBPACK_IMPORTED_MODULE_13__["default"],
2877
+ tgroup: _TGroup__WEBPACK_IMPORTED_MODULE_14__["default"]
2878
+ };
2879
+ const layoutType = this.predictType(item);
2880
+ return new Ctor[layoutType](item);
2881
+ }
2882
+ static getItems(items) {
2883
+ return items.map((item) => {
2884
+ if ("items" in item)
2885
+ item.items = this.getItems(item.items);
2886
+ return this.getItem(item);
2887
+ });
2888
+ }
2889
+ static calc(ui) {
2890
+ const rootGroup = new _VGroup__WEBPACK_IMPORTED_MODULE_13__["default"]({ items: this.getItems(ui), type: "vgroup", label: "" }, true);
2891
+ rootGroup.adjust();
2892
+ rootGroup.expand(0, 0);
2893
+ rootGroup.offset();
2894
+ return rootGroup;
2895
+ }
2896
+ }
2897
+
2898
+
2899
+ /***/ }),
2900
+
2901
+ /***/ "./src/layout/Led.ts":
2902
+ /*!***************************!*\
2903
+ !*** ./src/layout/Led.ts ***!
2904
+ \***************************/
2905
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
2906
+
2907
+ __webpack_require__.r(__webpack_exports__);
2908
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
2909
+ /* harmony export */ "default": () => (/* binding */ Led)
2910
+ /* harmony export */ });
2911
+ /* harmony import */ var _AbstractOutputItem__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./AbstractOutputItem */ "./src/layout/AbstractOutputItem.ts");
2912
+
2913
+ class Led extends _AbstractOutputItem__WEBPACK_IMPORTED_MODULE_0__["default"] {
2914
+ constructor() {
2915
+ super(...arguments);
2916
+ this.layout = {
2917
+ type: "led",
2918
+ width: 1,
2919
+ height: 1,
2920
+ sizing: "none"
2921
+ };
2922
+ }
2923
+ }
2924
+
2925
+
2926
+ /***/ }),
2927
+
2928
+ /***/ "./src/layout/Menu.ts":
2929
+ /*!****************************!*\
2930
+ !*** ./src/layout/Menu.ts ***!
2931
+ \****************************/
2932
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
2933
+
2934
+ __webpack_require__.r(__webpack_exports__);
2935
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
2936
+ /* harmony export */ "default": () => (/* binding */ Menu)
2937
+ /* harmony export */ });
2938
+ /* harmony import */ var _AbstractInputItem__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./AbstractInputItem */ "./src/layout/AbstractInputItem.ts");
2939
+
2940
+ class Menu extends _AbstractInputItem__WEBPACK_IMPORTED_MODULE_0__["default"] {
2941
+ constructor() {
2942
+ super(...arguments);
2943
+ this.layout = {
2944
+ type: "menu",
2945
+ width: 2,
2946
+ height: 1,
2947
+ sizing: "horizontal"
2948
+ };
2949
+ }
2950
+ }
2951
+
2952
+
2953
+ /***/ }),
2954
+
2955
+ /***/ "./src/layout/Nentry.ts":
2956
+ /*!******************************!*\
2957
+ !*** ./src/layout/Nentry.ts ***!
2958
+ \******************************/
2959
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
2960
+
2961
+ __webpack_require__.r(__webpack_exports__);
2962
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
2963
+ /* harmony export */ "default": () => (/* binding */ Nentry)
2964
+ /* harmony export */ });
2965
+ /* harmony import */ var _AbstractInputItem__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./AbstractInputItem */ "./src/layout/AbstractInputItem.ts");
2966
+
2967
+ class Nentry extends _AbstractInputItem__WEBPACK_IMPORTED_MODULE_0__["default"] {
2968
+ constructor() {
2969
+ super(...arguments);
2970
+ this.layout = {
2971
+ type: "nentry",
2972
+ width: 1,
2973
+ height: 1,
2974
+ sizing: "none"
2975
+ };
2976
+ }
2977
+ }
2978
+
2979
+
2980
+ /***/ }),
2981
+
2982
+ /***/ "./src/layout/Numerical.ts":
2983
+ /*!*********************************!*\
2984
+ !*** ./src/layout/Numerical.ts ***!
2985
+ \*********************************/
2986
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
2987
+
2988
+ __webpack_require__.r(__webpack_exports__);
2989
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
2990
+ /* harmony export */ "default": () => (/* binding */ Numerical)
2991
+ /* harmony export */ });
2992
+ /* harmony import */ var _AbstractOutputItem__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./AbstractOutputItem */ "./src/layout/AbstractOutputItem.ts");
2993
+
2994
+ class Numerical extends _AbstractOutputItem__WEBPACK_IMPORTED_MODULE_0__["default"] {
2995
+ constructor() {
2996
+ super(...arguments);
2997
+ this.layout = {
2998
+ type: "numerical",
2999
+ width: 1,
3000
+ height: 1,
3001
+ sizing: "none"
3002
+ };
3003
+ }
3004
+ }
3005
+
3006
+
3007
+ /***/ }),
3008
+
3009
+ /***/ "./src/layout/Radio.ts":
3010
+ /*!*****************************!*\
3011
+ !*** ./src/layout/Radio.ts ***!
3012
+ \*****************************/
3013
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
3014
+
3015
+ __webpack_require__.r(__webpack_exports__);
3016
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
3017
+ /* harmony export */ "default": () => (/* binding */ Radio)
3018
+ /* harmony export */ });
3019
+ /* harmony import */ var _AbstractInputItem__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./AbstractInputItem */ "./src/layout/AbstractInputItem.ts");
3020
+
3021
+ class Radio extends _AbstractInputItem__WEBPACK_IMPORTED_MODULE_0__["default"] {
3022
+ constructor() {
3023
+ super(...arguments);
3024
+ this.layout = {
3025
+ type: "radio",
3026
+ width: 2,
3027
+ height: 2,
3028
+ sizing: "both"
3029
+ };
3030
+ }
3031
+ }
3032
+
3033
+
3034
+ /***/ }),
3035
+
3036
+ /***/ "./src/layout/TGroup.ts":
3037
+ /*!******************************!*\
3038
+ !*** ./src/layout/TGroup.ts ***!
3039
+ \******************************/
3040
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
3041
+
3042
+ __webpack_require__.r(__webpack_exports__);
3043
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
3044
+ /* harmony export */ "default": () => (/* binding */ TGroup)
3045
+ /* harmony export */ });
3046
+ /* harmony import */ var _AbstractGroup__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./AbstractGroup */ "./src/layout/AbstractGroup.ts");
3047
+
3048
+ const _TGroup = class extends _AbstractGroup__WEBPACK_IMPORTED_MODULE_0__["default"] {
3049
+ adjust() {
3050
+ this.items.forEach((item) => {
3051
+ item.adjust();
3052
+ this.layout.width = Math.max(this.layout.width, item.layout.width + 2 * _AbstractGroup__WEBPACK_IMPORTED_MODULE_0__["default"].padding);
3053
+ this.layout.height = Math.max(this.layout.height, item.layout.height + 2 * _AbstractGroup__WEBPACK_IMPORTED_MODULE_0__["default"].padding + _TGroup.labelHeight);
3054
+ });
3055
+ const tabsCount = this.items.length;
3056
+ this.layout.width = Math.max(this.layout.width, tabsCount * _TGroup.tabLayout.width);
3057
+ this.layout.height += _TGroup.tabLayout.height;
3058
+ if (this.layout.width < 1)
3059
+ this.layout.width += 1;
3060
+ return this;
3061
+ }
3062
+ expand() {
3063
+ const tabsCount = this.items.length;
3064
+ this.items.forEach((item) => {
3065
+ let dY$ = 0;
3066
+ let dX$ = 0;
3067
+ if (item.layout.sizing === "both" || item.layout.sizing === "horizontal")
3068
+ dX$ = this.layout.width - 2 * _AbstractGroup__WEBPACK_IMPORTED_MODULE_0__["default"].padding - item.layout.width;
3069
+ if (item.layout.sizing === "both" || item.layout.sizing === "vertical")
3070
+ dY$ = this.layout.height - 2 * _AbstractGroup__WEBPACK_IMPORTED_MODULE_0__["default"].padding - _AbstractGroup__WEBPACK_IMPORTED_MODULE_0__["default"].labelHeight - (tabsCount ? _TGroup.tabLayout.height : 0) - item.layout.height;
3071
+ item.expand(dX$, dY$);
3072
+ });
3073
+ return this;
3074
+ }
3075
+ offset() {
3076
+ const { labelHeight, padding } = _AbstractGroup__WEBPACK_IMPORTED_MODULE_0__["default"];
3077
+ const $left = padding;
3078
+ const $top = padding + labelHeight + _TGroup.tabLayout.height;
3079
+ this.items.forEach((item) => {
3080
+ item.layout.offsetLeft = $left;
3081
+ item.layout.offsetTop = $top;
3082
+ item.layout.left = (this.layout.left || 0) + item.layout.offsetLeft;
3083
+ item.layout.top = (this.layout.top || 0) + item.layout.offsetTop;
3084
+ item.offset();
3085
+ });
3086
+ return this;
3087
+ }
3088
+ };
3089
+ let TGroup = _TGroup;
3090
+ TGroup.tabLayout = {
3091
+ width: 2,
3092
+ height: 1
3093
+ };
3094
+
3095
+
3096
+
3097
+ /***/ }),
3098
+
3099
+ /***/ "./src/layout/VBargraph.ts":
3100
+ /*!*********************************!*\
3101
+ !*** ./src/layout/VBargraph.ts ***!
3102
+ \*********************************/
3103
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
3104
+
3105
+ __webpack_require__.r(__webpack_exports__);
3106
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
3107
+ /* harmony export */ "default": () => (/* binding */ VBargraph)
3108
+ /* harmony export */ });
3109
+ /* harmony import */ var _AbstractOutputItem__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./AbstractOutputItem */ "./src/layout/AbstractOutputItem.ts");
3110
+
3111
+ class VBargraph extends _AbstractOutputItem__WEBPACK_IMPORTED_MODULE_0__["default"] {
3112
+ constructor() {
3113
+ super(...arguments);
3114
+ this.layout = {
3115
+ type: "vbargraph",
3116
+ width: 1,
3117
+ height: 5,
3118
+ sizing: "vertical"
3119
+ };
3120
+ }
3121
+ }
3122
+
3123
+
3124
+ /***/ }),
3125
+
3126
+ /***/ "./src/layout/VGroup.ts":
3127
+ /*!******************************!*\
3128
+ !*** ./src/layout/VGroup.ts ***!
3129
+ \******************************/
3130
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
3131
+
3132
+ __webpack_require__.r(__webpack_exports__);
3133
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
3134
+ /* harmony export */ "default": () => (/* binding */ VGroup)
3135
+ /* harmony export */ });
3136
+ /* harmony import */ var _AbstractGroup__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./AbstractGroup */ "./src/layout/AbstractGroup.ts");
3137
+
3138
+ class VGroup extends _AbstractGroup__WEBPACK_IMPORTED_MODULE_0__["default"] {
3139
+ adjust() {
3140
+ this.items.forEach((item) => {
3141
+ item.adjust();
3142
+ this.layout.width = Math.max(this.layout.width, item.layout.width + 2 * _AbstractGroup__WEBPACK_IMPORTED_MODULE_0__["default"].padding);
3143
+ this.layout.height += item.layout.height;
3144
+ });
3145
+ this.layout.height += _AbstractGroup__WEBPACK_IMPORTED_MODULE_0__["default"].spaceBetween * (this.items.length - 1);
3146
+ if (this.layout.width < 1)
3147
+ this.layout.width += 1;
3148
+ return this;
3149
+ }
3150
+ expand(dX, dY) {
3151
+ let vExpandItems = 0;
3152
+ this.items.forEach((item) => {
3153
+ if (item.layout.sizing === "both" || item.layout.sizing === "vertical")
3154
+ vExpandItems++;
3155
+ });
3156
+ this.items.forEach((item) => {
3157
+ let dX$ = 0;
3158
+ let dY$ = 0;
3159
+ if (item.layout.sizing === "both" || item.layout.sizing === "horizontal") {
3160
+ dX$ = this.layout.width - 2 * _AbstractGroup__WEBPACK_IMPORTED_MODULE_0__["default"].padding - item.layout.width;
3161
+ item.layout.width += dX$;
3162
+ }
3163
+ if (item.layout.sizing === "both" || item.layout.sizing === "vertical") {
3164
+ dY$ = vExpandItems ? dY / vExpandItems : 0;
3165
+ item.layout.height += dY$;
3166
+ }
3167
+ item.expand(dX$, dY$);
3168
+ });
3169
+ this.layout.height += dY;
3170
+ return this;
3171
+ }
3172
+ offset() {
3173
+ const { labelHeight, padding, spaceBetween } = _AbstractGroup__WEBPACK_IMPORTED_MODULE_0__["default"];
3174
+ const $left = padding;
3175
+ let $top = padding + labelHeight;
3176
+ const { width } = this.layout;
3177
+ this.items.forEach((item) => {
3178
+ item.layout.offsetLeft = $left;
3179
+ item.layout.offsetTop = $top;
3180
+ item.layout.offsetLeft += (width - item.layout.width) / 2 - padding;
3181
+ item.layout.left = (this.layout.left || 0) + item.layout.offsetLeft;
3182
+ item.layout.top = (this.layout.top || 0) + item.layout.offsetTop;
3183
+ item.offset();
3184
+ $top += item.layout.height + spaceBetween;
3185
+ });
3186
+ return this;
3187
+ }
3188
+ }
3189
+
3190
+
3191
+ /***/ }),
3192
+
3193
+ /***/ "./src/layout/VSlider.ts":
3194
+ /*!*******************************!*\
3195
+ !*** ./src/layout/VSlider.ts ***!
3196
+ \*******************************/
3197
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
3198
+
3199
+ __webpack_require__.r(__webpack_exports__);
3200
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
3201
+ /* harmony export */ "default": () => (/* binding */ VSlider)
3202
+ /* harmony export */ });
3203
+ /* harmony import */ var _AbstractInputItem__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./AbstractInputItem */ "./src/layout/AbstractInputItem.ts");
3204
+
3205
+ class VSlider extends _AbstractInputItem__WEBPACK_IMPORTED_MODULE_0__["default"] {
3206
+ constructor() {
3207
+ super(...arguments);
3208
+ this.layout = {
3209
+ type: "vslider",
3210
+ width: 1,
3211
+ height: 5,
3212
+ sizing: "vertical"
3213
+ };
3214
+ }
3215
+ }
3216
+
3217
+
3218
+ /***/ }),
3219
+
3220
+ /***/ "./src/components/Base.scss":
3221
+ /*!**********************************!*\
3222
+ !*** ./src/components/Base.scss ***!
3223
+ \**********************************/
3224
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
3225
+
3226
+ __webpack_require__.r(__webpack_exports__);
3227
+ // extracted by mini-css-extract-plugin
3228
+
3229
+
3230
+ /***/ }),
3231
+
3232
+ /***/ "./src/components/Button.scss":
3233
+ /*!************************************!*\
3234
+ !*** ./src/components/Button.scss ***!
3235
+ \************************************/
3236
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
3237
+
3238
+ __webpack_require__.r(__webpack_exports__);
3239
+ // extracted by mini-css-extract-plugin
3240
+
3241
+
3242
+ /***/ }),
3243
+
3244
+ /***/ "./src/components/Checkbox.scss":
3245
+ /*!**************************************!*\
3246
+ !*** ./src/components/Checkbox.scss ***!
3247
+ \**************************************/
3248
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
3249
+
3250
+ __webpack_require__.r(__webpack_exports__);
3251
+ // extracted by mini-css-extract-plugin
3252
+
3253
+
3254
+ /***/ }),
3255
+
3256
+ /***/ "./src/components/Group.scss":
3257
+ /*!***********************************!*\
3258
+ !*** ./src/components/Group.scss ***!
3259
+ \***********************************/
3260
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
3261
+
3262
+ __webpack_require__.r(__webpack_exports__);
3263
+ // extracted by mini-css-extract-plugin
3264
+
3265
+
3266
+ /***/ }),
3267
+
3268
+ /***/ "./src/components/HBargraph.scss":
3269
+ /*!***************************************!*\
3270
+ !*** ./src/components/HBargraph.scss ***!
3271
+ \***************************************/
3272
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
3273
+
3274
+ __webpack_require__.r(__webpack_exports__);
3275
+ // extracted by mini-css-extract-plugin
3276
+
3277
+
3278
+ /***/ }),
3279
+
3280
+ /***/ "./src/components/HSlider.scss":
3281
+ /*!*************************************!*\
3282
+ !*** ./src/components/HSlider.scss ***!
3283
+ \*************************************/
3284
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
3285
+
3286
+ __webpack_require__.r(__webpack_exports__);
3287
+ // extracted by mini-css-extract-plugin
3288
+
3289
+
3290
+ /***/ }),
3291
+
3292
+ /***/ "./src/components/Knob.scss":
3293
+ /*!**********************************!*\
3294
+ !*** ./src/components/Knob.scss ***!
3295
+ \**********************************/
3296
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
3297
+
3298
+ __webpack_require__.r(__webpack_exports__);
3299
+ // extracted by mini-css-extract-plugin
3300
+
3301
+
3302
+ /***/ }),
3303
+
3304
+ /***/ "./src/components/Led.scss":
3305
+ /*!*********************************!*\
3306
+ !*** ./src/components/Led.scss ***!
3307
+ \*********************************/
3308
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
3309
+
3310
+ __webpack_require__.r(__webpack_exports__);
3311
+ // extracted by mini-css-extract-plugin
3312
+
3313
+
3314
+ /***/ }),
3315
+
3316
+ /***/ "./src/components/Menu.scss":
3317
+ /*!**********************************!*\
3318
+ !*** ./src/components/Menu.scss ***!
3319
+ \**********************************/
3320
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
3321
+
3322
+ __webpack_require__.r(__webpack_exports__);
3323
+ // extracted by mini-css-extract-plugin
3324
+
3325
+
3326
+ /***/ }),
3327
+
3328
+ /***/ "./src/components/Nentry.scss":
3329
+ /*!************************************!*\
3330
+ !*** ./src/components/Nentry.scss ***!
3331
+ \************************************/
3332
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
3333
+
3334
+ __webpack_require__.r(__webpack_exports__);
3335
+ // extracted by mini-css-extract-plugin
3336
+
3337
+
3338
+ /***/ }),
3339
+
3340
+ /***/ "./src/components/Numerical.scss":
3341
+ /*!***************************************!*\
3342
+ !*** ./src/components/Numerical.scss ***!
3343
+ \***************************************/
3344
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
3345
+
3346
+ __webpack_require__.r(__webpack_exports__);
3347
+ // extracted by mini-css-extract-plugin
3348
+
3349
+
3350
+ /***/ }),
3351
+
3352
+ /***/ "./src/components/Radio.scss":
3353
+ /*!***********************************!*\
3354
+ !*** ./src/components/Radio.scss ***!
3355
+ \***********************************/
3356
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
3357
+
3358
+ __webpack_require__.r(__webpack_exports__);
3359
+ // extracted by mini-css-extract-plugin
3360
+
3361
+
3362
+ /***/ }),
3363
+
3364
+ /***/ "./src/components/VBargraph.scss":
3365
+ /*!***************************************!*\
3366
+ !*** ./src/components/VBargraph.scss ***!
3367
+ \***************************************/
3368
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
3369
+
3370
+ __webpack_require__.r(__webpack_exports__);
3371
+ // extracted by mini-css-extract-plugin
3372
+
3373
+
3374
+ /***/ }),
3375
+
3376
+ /***/ "./src/components/VSlider.scss":
3377
+ /*!*************************************!*\
3378
+ !*** ./src/components/VSlider.scss ***!
3379
+ \*************************************/
3380
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
3381
+
3382
+ __webpack_require__.r(__webpack_exports__);
3383
+ // extracted by mini-css-extract-plugin
3384
+
3385
+
3386
+ /***/ }),
3387
+
3388
+ /***/ "./src/index.scss":
3389
+ /*!************************!*\
3390
+ !*** ./src/index.scss ***!
3391
+ \************************/
3392
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
3393
+
3394
+ __webpack_require__.r(__webpack_exports__);
3395
+ // extracted by mini-css-extract-plugin
3396
+
3397
+
3398
+ /***/ })
3399
+
3400
+ /******/ });
3401
+ /************************************************************************/
3402
+ /******/ // The module cache
3403
+ /******/ var __webpack_module_cache__ = {};
3404
+ /******/
3405
+ /******/ // The require function
3406
+ /******/ function __webpack_require__(moduleId) {
3407
+ /******/ // Check if module is in cache
3408
+ /******/ var cachedModule = __webpack_module_cache__[moduleId];
3409
+ /******/ if (cachedModule !== undefined) {
3410
+ /******/ return cachedModule.exports;
3411
+ /******/ }
3412
+ /******/ // Create a new module (and put it into the cache)
3413
+ /******/ var module = __webpack_module_cache__[moduleId] = {
3414
+ /******/ // no module.id needed
3415
+ /******/ // no module.loaded needed
3416
+ /******/ exports: {}
3417
+ /******/ };
3418
+ /******/
3419
+ /******/ // Execute the module function
3420
+ /******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
3421
+ /******/
3422
+ /******/ // Return the exports of the module
3423
+ /******/ return module.exports;
3424
+ /******/ }
3425
+ /******/
3426
+ /************************************************************************/
3427
+ /******/ /* webpack/runtime/define property getters */
3428
+ /******/ (() => {
3429
+ /******/ // define getter functions for harmony exports
3430
+ /******/ __webpack_require__.d = (exports, definition) => {
3431
+ /******/ for(var key in definition) {
3432
+ /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
3433
+ /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
3434
+ /******/ }
3435
+ /******/ }
3436
+ /******/ };
3437
+ /******/ })();
3438
+ /******/
3439
+ /******/ /* webpack/runtime/hasOwnProperty shorthand */
3440
+ /******/ (() => {
3441
+ /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
3442
+ /******/ })();
3443
+ /******/
3444
+ /******/ /* webpack/runtime/make namespace object */
3445
+ /******/ (() => {
3446
+ /******/ // define __esModule on exports
3447
+ /******/ __webpack_require__.r = (exports) => {
3448
+ /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
3449
+ /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
3450
+ /******/ }
3451
+ /******/ Object.defineProperty(exports, '__esModule', { value: true });
3452
+ /******/ };
3453
+ /******/ })();
3454
+ /******/
3455
+ /************************************************************************/
3456
+ var __webpack_exports__ = {};
3457
+ // This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
3458
+ (() => {
3459
+ /*!**********************!*\
3460
+ !*** ./src/index.ts ***!
3461
+ \**********************/
3462
+ __webpack_require__.r(__webpack_exports__);
3463
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
3464
+ /* harmony export */ "FaustUI": () => (/* reexport safe */ _FaustUI__WEBPACK_IMPORTED_MODULE_0__["default"]),
3465
+ /* harmony export */ "instantiate": () => (/* reexport safe */ _instantiate__WEBPACK_IMPORTED_MODULE_1__["default"])
3466
+ /* harmony export */ });
3467
+ /* harmony import */ var _FaustUI__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./FaustUI */ "./src/FaustUI.ts");
3468
+ /* harmony import */ var _instantiate__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./instantiate */ "./src/instantiate.ts");
3469
+
3470
+
3471
+
3472
+ })();
3473
+
3474
+ var __webpack_exports__FaustUI = __webpack_exports__.FaustUI;
3475
+ var __webpack_exports__instantiate = __webpack_exports__.instantiate;
3476
+ export { __webpack_exports__FaustUI as FaustUI, __webpack_exports__instantiate as instantiate };
3477
+
3478
+ //# sourceMappingURL=index.js.map