@grame/faustwasm 0.16.4 → 0.16.6

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