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