@grame/faust-ui 0.0.0-stage → 1.2.0

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.
@@ -0,0 +1,680 @@
1
+ // Generated by dts-bundle-generator v9.5.1
2
+
3
+ import { FaustUIDescriptor, FaustUIGroupType, FaustUIInputItem, FaustUIInputType, FaustUIItem, FaustUIMeta, FaustUIOutputType, FaustUIType } from '@grame/faustwasm';
4
+
5
+ declare const $AnyEventType: unique symbol;
6
+ export interface IEmitOptions {
7
+ excludeAny?: boolean;
8
+ exclude?: ((...args: any[]) => any)[];
9
+ }
10
+ declare class TypedEventEmitter<M> {
11
+ private _listeners;
12
+ get listeners(): {
13
+ [eventName: string]: ((e?: any, emitter?: any) => any)[];
14
+ [$AnyEventType]: ((eventName: string, eventData?: any, emitter?: any) => any)[];
15
+ };
16
+ private getListeners;
17
+ on<K extends keyof M & string>(eventName: K, listener: (e: M[K], emitter?: this) => any): void;
18
+ once<K extends keyof M & string>(eventName: K, listener: (e: M[K], emitter?: this) => any): void;
19
+ onAny<K extends keyof M & string>(listener: <KK extends K>(eventName: KK, eventData?: M[KK], emitter?: this) => any): void;
20
+ off<K extends keyof M & string>(eventName: K, listener: (e: M[K], emitter?: this) => any): void;
21
+ offAny<K extends keyof M & string>(listener: <KK extends K>(eventName: KK, eventData?: M[KK], emitter?: this) => any): void;
22
+ emit<K extends keyof M & string>(eventName: K, eventData?: M[K], options?: IEmitOptions): Promise<any[]>;
23
+ emitSerial<K extends keyof M & string>(eventName: K, eventData?: M[K], options?: IEmitOptions): Promise<any[]>;
24
+ emitSync<K extends keyof M & string>(eventName: K, eventData?: M[K], options?: IEmitOptions): any[];
25
+ offAll(eventName?: keyof M & string): void;
26
+ listenerCount(eventName: keyof M & string): number;
27
+ }
28
+ declare abstract class AbstractComponent<T extends {
29
+ [key: string]: any;
30
+ }> extends TypedEventEmitter<T> {
31
+ /**
32
+ * The default state of the component.
33
+ */
34
+ static defaultProps: Record<string, any>;
35
+ get defaultProps(): T;
36
+ /**
37
+ * Here stores corrent state of component
38
+ * change the state with `setState` method to fire state events
39
+ * then UI parts will get notified and rerender
40
+ */
41
+ state: T;
42
+ /**
43
+ * Frame count in order to reduce frame rate
44
+ */
45
+ private $frame;
46
+ /**
47
+ * Frame reducing factor, 1 = render at every browser rendering tick, 2 will skip one every two ticks.
48
+ */
49
+ frameReduce: number;
50
+ /**
51
+ * Here stores current `requestAnimationFrame` reference
52
+ * if we have a new state to render, we cancel the old one
53
+ */
54
+ private $raf;
55
+ /**
56
+ * `requestAnimationFrame` callback
57
+ */
58
+ private raf;
59
+ /**
60
+ * tasks to execute in next redering tick
61
+ */
62
+ private tasks;
63
+ /**
64
+ * Initiate default state with incoming state.
65
+ */
66
+ constructor(props?: T);
67
+ /**
68
+ * set internal state and fire events for UI parts subscribed
69
+ */
70
+ setState(newState: Partial<T>): void;
71
+ /**
72
+ * Use this method to request a new rendering
73
+ * schedule what you need to do in next render tick in `raf` callback
74
+ */
75
+ schedule(func: () => any): void;
76
+ }
77
+ export interface FaustUIItemProps<T extends FaustUIItemStyle> {
78
+ value?: number;
79
+ active?: boolean;
80
+ focus?: boolean;
81
+ label?: string;
82
+ address: string;
83
+ min?: number;
84
+ max?: number;
85
+ init: number;
86
+ step?: number;
87
+ tooltip?: string;
88
+ enums?: {
89
+ [key: string]: number;
90
+ };
91
+ type?: "enum" | "int" | "float";
92
+ unit?: string;
93
+ scale?: "linear" | "exp" | "log";
94
+ style?: T;
95
+ emitter?: FaustUI;
96
+ }
97
+ export interface FaustUIGroupProps {
98
+ label?: string;
99
+ type?: "tgroup" | "vgroup" | "hgroup";
100
+ style?: FaustUIItemStyle;
101
+ items?: FaustUIItem[];
102
+ isRoot?: boolean;
103
+ emitter?: FaustUI;
104
+ }
105
+ export interface FaustUIItemStyle {
106
+ width?: number;
107
+ height?: number;
108
+ left?: number;
109
+ top?: number;
110
+ grid?: number;
111
+ labelcolor?: string;
112
+ }
113
+ export interface PointerDownEvent {
114
+ pointerId: number;
115
+ x: number;
116
+ y: number;
117
+ originalEvent: MouseEvent | TouchEvent;
118
+ }
119
+ export interface PointerDragEvent {
120
+ pointerId: number;
121
+ prevValue: number;
122
+ x: number;
123
+ y: number;
124
+ fromX: number;
125
+ fromY: number;
126
+ movementX: number;
127
+ movementY: number;
128
+ originalEvent: MouseEvent | TouchEvent;
129
+ }
130
+ export interface PointerUpEvent {
131
+ pointerId: number;
132
+ x: number;
133
+ y: number;
134
+ originalEvent: MouseEvent | TouchEvent;
135
+ }
136
+ declare abstract class AbstractItem<T extends FaustUIItemStyle> extends AbstractComponent<FaustUIItemProps<T>> {
137
+ /**
138
+ * The default state of the component.
139
+ */
140
+ static defaultProps: FaustUIItemProps<FaustUIItemStyle>;
141
+ /**
142
+ * DOM Div container of the component
143
+ */
144
+ container: HTMLDivElement;
145
+ /**
146
+ * DOM Div container of label canvas
147
+ */
148
+ label: HTMLDivElement;
149
+ /**
150
+ * Use canvas as label to fit full text in.
151
+ */
152
+ labelCanvas: HTMLCanvasElement;
153
+ labelCtx: CanvasRenderingContext2D;
154
+ /**
155
+ * Override this to get css work
156
+ */
157
+ className: string;
158
+ frameReduce: number;
159
+ /**
160
+ * Default DOM event listeners, unify mousedown and touchstart events
161
+ * For mouse or touch events, please use `handlePointerDown` `handlePointerUp` `handlePointerDrag` callbacks
162
+ */
163
+ handleKeyDown: (e: KeyboardEvent) => void;
164
+ handleKeyUp: (e: KeyboardEvent) => void;
165
+ handleTouchStart: (e: TouchEvent) => void;
166
+ handleWheel: (e: WheelEvent) => void;
167
+ handleClick: (e: MouseEvent) => void;
168
+ /**
169
+ * Handle double-click events to reset the value to its initial state.
170
+ */
171
+ handleDoubleClick: (e: MouseEvent) => void;
172
+ handleMouseDown: (e: MouseEvent) => void;
173
+ handleMouseOver: (e: MouseEvent) => void;
174
+ handleMouseOut: (e: MouseEvent) => void;
175
+ handleContextMenu: (e: MouseEvent) => void;
176
+ handlePointerDown: (e: PointerEvent) => void;
177
+ handleMouseOrTouchDown: (e: PointerDownEvent) => void;
178
+ handleMouseOrTouchMove: (e: PointerDragEvent) => void;
179
+ handleMouseOrTouchUp: (e: PointerUpEvent) => void;
180
+ handleFocusIn: (e: FocusEvent) => boolean;
181
+ handleFocusOut: (e: FocusEvent) => boolean;
182
+ /**
183
+ * Initiate default state with incoming state.
184
+ */
185
+ constructor(props?: FaustUIItemProps<T>);
186
+ /**
187
+ * Get a nearest valid number
188
+ */
189
+ toValidNumber(value: number): number;
190
+ /**
191
+ * The value as displayed, with 3 decimals or more when the step is finer (0.0001)
192
+ * or the range smaller than 1 (a bargraph from 0 to 0.001), without trailing zeros
193
+ */
194
+ get displayValue(): string;
195
+ /**
196
+ * Use this method if you want the emitter to send value to DSP
197
+ */
198
+ setValue(valueIn: number): boolean;
199
+ setToInitialValue(): void;
200
+ /**
201
+ * Send value to DSP
202
+ */
203
+ change(valueIn?: number): void;
204
+ /**
205
+ * set internal state and fire events for UI parts subscribed
206
+ * This will not send anything to DSP
207
+ * @returns is state updated
208
+ */
209
+ setState(newState: {
210
+ [key in keyof FaustUIItemProps<T>]?: FaustUIItemProps<T>[key];
211
+ }): boolean;
212
+ /**
213
+ * Create container with class name
214
+ * override it with `super.componentWillMount();`
215
+ */
216
+ componentWillMount(): this;
217
+ /**
218
+ * Here append all child DOM to container
219
+ */
220
+ mount(): this;
221
+ paintLabel(align?: CanvasTextAlign): this;
222
+ /**
223
+ * will call this method when mounted
224
+ */
225
+ componentDidMount(): this;
226
+ /**
227
+ * Count steps in range min-max with step
228
+ */
229
+ get stepsCount(): number;
230
+ /**
231
+ * Normalized value between 0 - 1.
232
+ */
233
+ get distance(): number;
234
+ /**
235
+ * Number of steps between the entries of an enum, one less than its entries: `enums` is an object, it has no length
236
+ */
237
+ static enumSteps(enums: {
238
+ [key: string]: number;
239
+ }): number;
240
+ static getDistance(state: {
241
+ value: number;
242
+ min: number;
243
+ max: number;
244
+ enums?: {
245
+ [key: string]: number;
246
+ };
247
+ type: "enum" | "int" | "float";
248
+ scale: "linear" | "exp" | "log";
249
+ }): number;
250
+ /**
251
+ * Mousemove pixels for each step
252
+ */
253
+ get stepRange(): number;
254
+ }
255
+ export interface FaustUINentryStyle extends FaustUIItemStyle {
256
+ fontname?: string;
257
+ fontsize?: number;
258
+ fontface?: "regular" | "bold" | "italic" | "bold italic";
259
+ bgcolor?: string;
260
+ bordercolor?: string;
261
+ labelcolor?: string;
262
+ textcolor?: string;
263
+ }
264
+ declare class Nentry extends AbstractItem<FaustUINentryStyle> {
265
+ static get defaultProps(): FaustUIItemProps<FaustUINentryStyle>;
266
+ className: string;
267
+ input: HTMLInputElement;
268
+ componentWillMount(): this;
269
+ handleChange: (e: Event) => void;
270
+ setStyle: () => void;
271
+ componentDidMount(): this;
272
+ mount(): this;
273
+ }
274
+ export interface FaustUISliderStyle extends FaustUINentryStyle {
275
+ sliderwidth?: number;
276
+ sliderbgcolor?: string;
277
+ sliderbgoncolor?: string;
278
+ slidercolor?: string;
279
+ }
280
+ declare class VSlider extends AbstractItem<FaustUISliderStyle> {
281
+ static get defaultProps(): FaustUIItemProps<FaustUISliderStyle>;
282
+ className: string;
283
+ canvas: HTMLCanvasElement;
284
+ inputNumber: HTMLInputElement;
285
+ input: HTMLInputElement;
286
+ flexDiv: HTMLDivElement;
287
+ canvasDiv: HTMLDivElement;
288
+ ctx: CanvasRenderingContext2D;
289
+ interactionRect: number[];
290
+ componentWillMount(): this;
291
+ handleChange: (e: Event) => void;
292
+ setStyle: () => void;
293
+ componentDidMount(): this;
294
+ mount(): this;
295
+ paint: () => void;
296
+ get stepsCount(): number;
297
+ get stepRange(): number;
298
+ getValueFromPos(e: {
299
+ x: number;
300
+ y: number;
301
+ }): number;
302
+ handleMouseOrTouchDown: (e: PointerDownEvent) => void;
303
+ handleMouseOrTouchMove: (e: PointerDragEvent) => void;
304
+ }
305
+ export interface FaustUISoundfileStyle extends FaustUIItemStyle {
306
+ fontname?: string;
307
+ fontsize?: number;
308
+ fontface?: "normal" | "bold" | "italic" | "bold italic";
309
+ bgcolor?: string;
310
+ bgoncolor?: string;
311
+ bordercolor?: string;
312
+ borderoncolor?: string;
313
+ textcolor?: string;
314
+ textoncolor?: string;
315
+ }
316
+ declare class Soundfile extends AbstractItem<FaustUISoundfileStyle> {
317
+ static get defaultProps(): FaustUIItemProps<FaustUISoundfileStyle>;
318
+ className: string;
319
+ btn: HTMLDivElement;
320
+ span: HTMLSpanElement;
321
+ componentWillMount(): this;
322
+ setStyle: () => void;
323
+ mount(): this;
324
+ componentDidMount(): this;
325
+ handleMouseOrTouchDown: () => void;
326
+ handleMouseOrTouchUp: () => void;
327
+ }
328
+ export interface FaustUIButtonStyle extends FaustUIItemStyle {
329
+ fontname?: string;
330
+ fontsize?: number;
331
+ fontface?: "normal" | "bold" | "italic" | "bold italic";
332
+ bgcolor?: string;
333
+ bgoncolor?: string;
334
+ bordercolor?: string;
335
+ borderoncolor?: string;
336
+ textcolor?: string;
337
+ textoncolor?: string;
338
+ }
339
+ declare class Button extends AbstractItem<FaustUIButtonStyle> {
340
+ static get defaultProps(): FaustUIItemProps<FaustUIButtonStyle>;
341
+ className: string;
342
+ btn: HTMLDivElement;
343
+ span: HTMLSpanElement;
344
+ componentWillMount(): this;
345
+ setStyle: () => void;
346
+ mount(): this;
347
+ componentDidMount(): this;
348
+ handleContextMenu: (e: MouseEvent) => void;
349
+ handleMouseOrTouchDown: () => void;
350
+ handleMouseOrTouchUp: () => void;
351
+ }
352
+ export interface FaustUIKnobStyle extends FaustUINentryStyle {
353
+ knobwidth?: number;
354
+ knobcolor?: string;
355
+ knoboncolor?: string;
356
+ needlecolor?: string;
357
+ }
358
+ declare class Knob extends AbstractItem<FaustUIKnobStyle> {
359
+ static get defaultProps(): FaustUIItemProps<FaustUIKnobStyle>;
360
+ className: string;
361
+ canvas: HTMLCanvasElement;
362
+ inputNumber: HTMLInputElement;
363
+ input: HTMLInputElement;
364
+ ctx: CanvasRenderingContext2D;
365
+ componentWillMount(): this;
366
+ handleChange: (e: Event) => void;
367
+ setStyle: () => void;
368
+ componentDidMount(): this;
369
+ mount(): this;
370
+ paint: () => void;
371
+ getValueFromDelta(e: PointerDragEvent): number;
372
+ handleMouseOrTouchMove: (e: PointerDragEvent) => void;
373
+ }
374
+ export interface FaustUIMenuStyle extends FaustUIItemStyle {
375
+ fontname?: string;
376
+ fontsize?: number;
377
+ fontface?: "regular" | "bold" | "italic" | "bold italic";
378
+ bgcolor?: string;
379
+ bordercolor?: string;
380
+ labelcolor?: string;
381
+ textcolor?: string;
382
+ }
383
+ declare class Menu extends AbstractItem<FaustUIMenuStyle> {
384
+ static get defaultProps(): FaustUIItemProps<FaustUIMenuStyle>;
385
+ className: string;
386
+ select: HTMLSelectElement;
387
+ componentWillMount(): this;
388
+ getOptions(): void;
389
+ handleChange: (e: Event) => void;
390
+ setStyle: () => void;
391
+ componentDidMount(): this;
392
+ mount(): this;
393
+ }
394
+ export interface FaustUIRadioStyle extends FaustUIItemStyle {
395
+ fontname?: string;
396
+ fontsize?: number;
397
+ fontface?: "regular" | "bold" | "italic" | "bold italic";
398
+ bgcolor?: string;
399
+ bordercolor?: string;
400
+ labelcolor?: string;
401
+ textcolor?: string;
402
+ }
403
+ declare class Radio extends AbstractItem<FaustUIRadioStyle> {
404
+ static get defaultProps(): FaustUIItemProps<FaustUIRadioStyle>;
405
+ className: string;
406
+ group: HTMLDivElement;
407
+ componentWillMount(): this;
408
+ getOptions: () => void;
409
+ setStyle: () => void;
410
+ componentDidMount(): this;
411
+ mount(): this;
412
+ }
413
+ export interface FaustUILedStyle extends FaustUINentryStyle {
414
+ shape?: "circle" | "square";
415
+ ledbgcolor?: string;
416
+ coldcolor?: string;
417
+ warmcolor?: string;
418
+ hotcolor?: string;
419
+ overloadcolor?: string;
420
+ }
421
+ declare class Led extends AbstractItem<FaustUILedStyle> {
422
+ static get defaultProps(): FaustUIItemProps<FaustUILedStyle>;
423
+ className: string;
424
+ canvasDiv: HTMLDivElement;
425
+ canvas: HTMLCanvasElement;
426
+ tempCanvas: HTMLCanvasElement;
427
+ ctx: CanvasRenderingContext2D;
428
+ tempCtx: CanvasRenderingContext2D;
429
+ componentWillMount(): this;
430
+ setStyle: () => void;
431
+ componentDidMount(): this;
432
+ mount(): this;
433
+ paint: () => void;
434
+ }
435
+ declare class Numerical extends AbstractItem<FaustUINentryStyle> {
436
+ static get defaultProps(): FaustUIItemProps<FaustUINentryStyle>;
437
+ className: string;
438
+ input: HTMLInputElement;
439
+ componentWillMount(): this;
440
+ setStyle: () => void;
441
+ componentDidMount(): this;
442
+ mount(): this;
443
+ }
444
+ export interface FaustUIBargraphStyle extends FaustUINentryStyle {
445
+ barwidth?: number;
446
+ barbgcolor?: string;
447
+ coldcolor?: string;
448
+ warmcolor?: string;
449
+ hotcolor?: string;
450
+ overloadcolor?: string;
451
+ }
452
+ declare class VBargraph extends AbstractItem<FaustUIBargraphStyle> {
453
+ static get defaultProps(): FaustUIItemProps<FaustUIBargraphStyle>;
454
+ className: string;
455
+ canvas: HTMLCanvasElement;
456
+ input: HTMLInputElement;
457
+ flexDiv: HTMLDivElement;
458
+ canvasDiv: HTMLDivElement;
459
+ ctx: CanvasRenderingContext2D;
460
+ componentWillMount(): this;
461
+ setStyle: () => void;
462
+ componentDidMount(): this;
463
+ mount(): this;
464
+ paintValue: number;
465
+ maxValue: number;
466
+ maxTimer: number;
467
+ paint: () => void;
468
+ }
469
+ export interface LayoutProps {
470
+ type: TLayoutType;
471
+ left?: number;
472
+ top?: number;
473
+ offsetLeft?: number; // relative to parent group
474
+ offsetTop?: number;
475
+ width: number;
476
+ height: number;
477
+ sizing: "horizontal" | "vertical" | "both" | "none";
478
+ }
479
+ export type TLayoutType = "vgroup" | "hgroup" | "tgroup" | "hbargraph" | "vbargraph" | "vslider" | "hslider" | "button" | "checkbox" | "nentry" | "soundfile" | "knob" | "menu" | "radio" | "led" | "numerical";
480
+ export interface IItem {
481
+ /**
482
+ * Initial type of item given by Faust compiler
483
+ */
484
+ type: FaustUIType;
485
+ /**
486
+ * Initial item label given by Faust compiler
487
+ */
488
+ label: string;
489
+ /**
490
+ * Calculated layout
491
+ */
492
+ layout: LayoutProps;
493
+ /**
494
+ * Adjust group width and height by its items' dimensions
495
+ */
496
+ adjust(): this;
497
+ /**
498
+ * Expand flexible items within a group
499
+ *
500
+ * @param dX - Extra horizontal spaces that this group could take
501
+ * @param dY - Extra vertical spaces that this group could take
502
+ */
503
+ expand(dX: number, dY: number): this;
504
+ /**
505
+ * calculate all the items' absolute coordination (in grids)
506
+ */
507
+ offset(): this;
508
+ }
509
+ declare abstract class AbstractItem$1 implements IItem {
510
+ type: FaustUIInputType | FaustUIOutputType;
511
+ label: string;
512
+ address: string;
513
+ url: string;
514
+ index: number;
515
+ init: number;
516
+ min: number;
517
+ max: number;
518
+ meta?: FaustUIMeta[];
519
+ layout: LayoutProps;
520
+ constructor(item: FaustUIItem);
521
+ adjust(): this;
522
+ expand(dX: number, dY: number): this;
523
+ offset(): this;
524
+ }
525
+ declare abstract class AbstractGroup implements IItem {
526
+ static padding: number;
527
+ static labelHeight: number;
528
+ static spaceBetween: number;
529
+ isRoot: boolean;
530
+ type: FaustUIGroupType;
531
+ label: string;
532
+ items: (AbstractGroup | AbstractItem$1)[];
533
+ layout: LayoutProps;
534
+ constructor(group: {
535
+ type: FaustUIGroupType;
536
+ label: string;
537
+ items: (AbstractGroup | AbstractItem$1)[];
538
+ }, isRoot?: boolean);
539
+ /**
540
+ * find recursively if the group has horizontal-sizable item
541
+ */
542
+ get hasHSizingDesc(): boolean;
543
+ /**
544
+ * find recursively if the group has vertical-sizable item
545
+ */
546
+ get hasVSizingDesc(): boolean;
547
+ adjust(): this;
548
+ expand(dX: number, dY: number): this;
549
+ offset(): this;
550
+ }
551
+ declare abstract class AbstractInputItem extends AbstractItem$1 {
552
+ init: number;
553
+ step: number;
554
+ constructor(item: FaustUIInputItem);
555
+ }
556
+ declare abstract class AbstractOutputItem extends AbstractItem$1 {
557
+ }
558
+ declare class Group extends AbstractComponent<FaustUIGroupProps> {
559
+ static parseMeta(metaIn: FaustUIMeta[]): {
560
+ metaObject: FaustUIMeta;
561
+ enums?: {
562
+ [key: string]: number;
563
+ };
564
+ };
565
+ static getComponent(item: AbstractGroup | AbstractInputItem | AbstractOutputItem, emitter: FaustUI, grid: number): Nentry | VSlider | Soundfile | Button | Knob | Menu | Radio | Led | Numerical | VBargraph | Group;
566
+ /**
567
+ * DOM Div container of the group
568
+ */
569
+ container: HTMLDivElement;
570
+ /**
571
+ * DOM Div container of label canvas
572
+ */
573
+ label: HTMLDivElement;
574
+ /**
575
+ * Use canvas as label to fit full text in.
576
+ */
577
+ labelCanvas: HTMLCanvasElement;
578
+ labelCtx: CanvasRenderingContext2D;
579
+ tabs: HTMLDivElement;
580
+ children: (AbstractItem<FaustUIItemStyle> | Group)[];
581
+ layout: LayoutProps;
582
+ /**
583
+ * Handle double-click events to reset all children's value to its initial state.
584
+ */
585
+ handleDoubleClick: (e: MouseEvent) => void;
586
+ setToInitialValue(): void;
587
+ setState(newState: {
588
+ [key in keyof FaustUIGroupProps]?: FaustUIGroupProps[key];
589
+ }): void;
590
+ componentWillMount(): this;
591
+ paintLabel(): this;
592
+ updateUI: () => void;
593
+ mount(): this;
594
+ /**
595
+ * Unregister the widgets of this group and of its subgroups from the emitter, before they are replaced
596
+ */
597
+ unregisterChildren(): this;
598
+ /**
599
+ * Append the tab bar and the children after the label: the tab click handler counts on this order
600
+ */
601
+ mountChildren(): this;
602
+ componentDidMount(): this;
603
+ }
604
+ export interface IOptions {
605
+ root: HTMLDivElement;
606
+ ui?: FaustUIDescriptor;
607
+ listenWindowResize?: boolean;
608
+ listenWindowMessage?: boolean;
609
+ }
610
+ /**
611
+ * The main class of UI constructor,
612
+ * listening to `resize` window event to resize component,
613
+ * listening to `message` window event to change UI or param value.
614
+ * See readme.
615
+ */
616
+ export declare class FaustUI {
617
+ componentMap: {
618
+ [path: string]: AbstractItem<any>[];
619
+ };
620
+ DOMroot: HTMLDivElement;
621
+ faustUIRoot: Group;
622
+ hostWindow: Window;
623
+ grid: number;
624
+ private _ui;
625
+ private _layout;
626
+ /**
627
+ * Calculate incoming UI's layout, bind window events
628
+ */
629
+ constructor(options: IOptions);
630
+ private handleWindowResize;
631
+ private handleWindowMessage;
632
+ /**
633
+ * Stop listening to the window and remove the UI from the DOM root.
634
+ * Call it before dropping a FaustUI, or creating another one in the same root:
635
+ * otherwise it keeps receiving the window messages, and mounts the UIs they bring.
636
+ */
637
+ destroy(): void;
638
+ /**
639
+ * Render the UI to DOM root
640
+ */
641
+ mount(): void;
642
+ /**
643
+ * This method should be called by components to register itself to map.
644
+ */
645
+ register(path: string, item: AbstractItem<any>): void;
646
+ /**
647
+ * Called by groups for the components they remove, so that the DSP no longer updates them.
648
+ */
649
+ unregister(path: string, item: AbstractItem<any>): void;
650
+ /**
651
+ * Notify the component to change its value.
652
+ */
653
+ paramChangeByDSP(path: string, value: number): void;
654
+ /**
655
+ * Can be overriden, called by components when its value is changed by user.
656
+ */
657
+ paramChangeByUI: (path: string, value: number) => void;
658
+ /**
659
+ * Calculate UI layout in grid then calculate grid size.
660
+ */
661
+ calc(): void;
662
+ /**
663
+ * Calculate grid size by DOM root size and layout size in grids.
664
+ */
665
+ calcGrid(): number;
666
+ /**
667
+ * Force recalculate grid size and resize UI
668
+ */
669
+ resize(): void;
670
+ /** Filter out items with `hidden` metadata and `soundfile` items */
671
+ filter(ui: FaustUIItem[]): FaustUIItem[];
672
+ get ui(): FaustUIItem[];
673
+ set ui(uiIn: FaustUIItem[]);
674
+ get layout(): LayoutProps;
675
+ get minWidth(): number;
676
+ get minHeight(): number;
677
+ }
678
+ export declare const instantiate: () => void;
679
+
680
+ export {};
@@ -0,0 +1,17 @@
1
+ <!doctype html>
2
+ <html xmlns="http://www.w3.org/1999/xhtml">
3
+
4
+ <head>
5
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
6
+ <meta name="apple-mobile-web-app-capable" content="yes">
7
+ <meta name="mobile-web-app-capable" content="yes">
8
+ <title>FaustUI</title>
9
+ </head>
10
+
11
+ <body style="margin: 0; position: absolute; width: 100%; height: 100%; overflow: hidden; background-color: black;">
12
+ <div id="root" style="width: 100%; height: 100%; margin: 0; position: absolute; overflow: auto; display: flex; flex-direction: column;"></div>
13
+ </body>
14
+
15
+ <script type="text/javascript" src="./index.js"></script>
16
+ <script>FaustUI.instantiate()</script>
17
+ </html>