@mulsense/xnew 0.1.6 → 0.1.7
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/dist/types/audio/audio.d.ts +16 -10
- package/dist/types/audio/loader.d.ts +16 -0
- package/dist/types/audio/synthesizer.d.ts +10 -24
- package/dist/types/basics/Controller.d.ts +18 -16
- package/dist/types/basics/Drag.d.ts +6 -0
- package/dist/types/basics/KeyEvent.d.ts +2 -0
- package/dist/types/basics/KeyboardEvent.d.ts +2 -0
- package/dist/types/basics/PointerEvent.d.ts +2 -0
- package/dist/types/basics/Screen.d.ts +0 -4
- package/dist/types/basics/Tab.d.ts +2 -2
- package/dist/types/basics/UserEvent.d.ts +1 -1
- package/dist/types/core/unit.d.ts +7 -7
- package/dist/types/index.d.ts +10 -7
- package/dist/xnew.d.ts +58 -60
- package/dist/xnew.js +341 -296
- package/dist/xnew.mjs +341 -296
- package/package.json +1 -1
|
@@ -1,13 +1,19 @@
|
|
|
1
|
-
export
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
export declare const context: AudioContext;
|
|
2
|
+
export declare const master: GainNode;
|
|
3
|
+
export declare class AudioNodeClass {
|
|
4
|
+
nodes: {
|
|
5
|
+
[key: string]: AudioNode & {
|
|
6
|
+
[key: string]: any;
|
|
7
|
+
};
|
|
4
8
|
};
|
|
5
|
-
|
|
6
|
-
export declare class Audio {
|
|
7
|
-
static context: AudioContext | null;
|
|
8
|
-
static master: GainNode | null;
|
|
9
|
-
static initialize(): void;
|
|
10
|
-
static connect(params: {
|
|
9
|
+
constructor(params: {
|
|
11
10
|
[key: string]: any[];
|
|
12
|
-
})
|
|
11
|
+
});
|
|
12
|
+
cleanup(): void;
|
|
13
13
|
}
|
|
14
|
+
export type AudioNodeMap = {
|
|
15
|
+
[key: string]: AudioNode;
|
|
16
|
+
};
|
|
17
|
+
export declare function connect(params: {
|
|
18
|
+
[key: string]: any[];
|
|
19
|
+
}): AudioNodeMap;
|
|
@@ -1 +1,17 @@
|
|
|
1
|
+
import { AudioNodeMap } from './audio';
|
|
2
|
+
export declare function load(path: string): AudioFile;
|
|
3
|
+
declare class AudioFile {
|
|
4
|
+
data: any;
|
|
5
|
+
startTime: number | null;
|
|
6
|
+
nodes: AudioNodeMap;
|
|
7
|
+
constructor(path: string);
|
|
8
|
+
isReady(): boolean;
|
|
9
|
+
get promise(): Promise<void>;
|
|
10
|
+
set volume(value: number);
|
|
11
|
+
get volume(): number;
|
|
12
|
+
set loop(value: boolean);
|
|
13
|
+
get loop(): boolean;
|
|
14
|
+
play(offset?: number): void;
|
|
15
|
+
pause(): number | undefined;
|
|
16
|
+
}
|
|
1
17
|
export {};
|
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
type SynthProps = {
|
|
2
|
+
oscillator?: OscillatorOptions | null;
|
|
3
|
+
filter?: FilterOptions | null;
|
|
4
|
+
amp?: AmpOptions | null;
|
|
5
|
+
};
|
|
6
|
+
type SynthEffects = {
|
|
7
|
+
bmp?: number | null;
|
|
8
|
+
reverb?: ReverbOptions | null;
|
|
9
|
+
};
|
|
1
10
|
type Envelope = {
|
|
2
11
|
amount: number;
|
|
3
12
|
ADSR: [number, number, number, number];
|
|
@@ -14,34 +23,15 @@ type OscillatorOptions = {
|
|
|
14
23
|
};
|
|
15
24
|
type FilterOptions = {
|
|
16
25
|
type?: BiquadFilterType;
|
|
17
|
-
Q?: number;
|
|
18
26
|
cutoff?: number;
|
|
19
|
-
envelope?: Envelope | null;
|
|
20
|
-
LFO?: LFO | null;
|
|
21
27
|
};
|
|
22
28
|
type AmpOptions = {
|
|
23
29
|
envelope?: Envelope | null;
|
|
24
|
-
LFO?: LFO | null;
|
|
25
30
|
};
|
|
26
31
|
type ReverbOptions = {
|
|
27
32
|
time?: number;
|
|
28
33
|
mix?: number;
|
|
29
34
|
};
|
|
30
|
-
type DelayOptions = {
|
|
31
|
-
time?: number;
|
|
32
|
-
feedback?: number;
|
|
33
|
-
mix?: number;
|
|
34
|
-
};
|
|
35
|
-
type SynthProps = {
|
|
36
|
-
oscillator?: OscillatorOptions | null;
|
|
37
|
-
filter?: FilterOptions | null;
|
|
38
|
-
amp?: AmpOptions | null;
|
|
39
|
-
};
|
|
40
|
-
type SynthEffects = {
|
|
41
|
-
bmp?: number | null;
|
|
42
|
-
reverb?: ReverbOptions | null;
|
|
43
|
-
delay?: DelayOptions | null;
|
|
44
|
-
};
|
|
45
35
|
export declare function synthesizer(props?: SynthProps, effects?: SynthEffects): Synthesizer;
|
|
46
36
|
declare class Synthesizer {
|
|
47
37
|
oscillator: OscillatorOptions;
|
|
@@ -49,12 +39,8 @@ declare class Synthesizer {
|
|
|
49
39
|
amp: AmpOptions;
|
|
50
40
|
bmp: number;
|
|
51
41
|
reverb: ReverbOptions;
|
|
52
|
-
delay: DelayOptions;
|
|
53
|
-
options: {
|
|
54
|
-
bmp: number;
|
|
55
|
-
};
|
|
56
42
|
static initialize(): void;
|
|
57
|
-
constructor({ oscillator, filter, amp }?: SynthProps, { bmp, reverb
|
|
43
|
+
constructor({ oscillator, filter, amp }?: SynthProps, { bmp, reverb }?: SynthEffects);
|
|
58
44
|
static keymap: {
|
|
59
45
|
[key: string]: number;
|
|
60
46
|
};
|
|
@@ -1,21 +1,23 @@
|
|
|
1
1
|
import { xnew } from '../core/xnew';
|
|
2
|
-
export declare function
|
|
3
|
-
size?: number
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
2
|
+
export declare function AnalogStick(self: xnew.Unit, { size, fill, fillOpacity, stroke, strokeOpacity, strokeWidth, strokeLinejoin }?: {
|
|
3
|
+
size?: number;
|
|
4
|
+
diagonal?: boolean;
|
|
5
|
+
fill?: string;
|
|
6
|
+
fillOpacity?: number;
|
|
7
|
+
stroke?: string;
|
|
8
|
+
strokeOpacity?: number;
|
|
9
|
+
strokeWidth?: number;
|
|
10
|
+
strokeLinejoin?: string;
|
|
10
11
|
}): void;
|
|
11
|
-
export declare function
|
|
12
|
-
size?: number
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
12
|
+
export declare function DirectionalPad(self: xnew.Unit, { size, diagonal, fill, fillOpacity, stroke, strokeOpacity, strokeWidth, strokeLinejoin }?: {
|
|
13
|
+
size?: number;
|
|
14
|
+
diagonal?: boolean;
|
|
15
|
+
fill?: string;
|
|
16
|
+
fillOpacity?: number;
|
|
17
|
+
stroke?: string;
|
|
18
|
+
strokeOpacity?: number;
|
|
19
|
+
strokeWidth?: number;
|
|
20
|
+
strokeLinejoin?: string;
|
|
19
21
|
}): void;
|
|
20
22
|
export declare function TouchButton(self: xnew.Unit, { size, fill, fillOpacity, stroke, strokeOpacity, strokeWidth, strokeLinejoin }?: {
|
|
21
23
|
size?: number | undefined;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { xnew } from '../core/xnew';
|
|
2
|
-
export declare function TabFrame(frame: xnew.Unit, {
|
|
3
|
-
|
|
2
|
+
export declare function TabFrame(frame: xnew.Unit, { select }?: {
|
|
3
|
+
select?: string;
|
|
4
4
|
}): void;
|
|
5
5
|
export declare function TabButton(button: xnew.Unit, { key }?: {
|
|
6
6
|
key?: string;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { xnew } from '../core/xnew';
|
|
2
|
-
export declare function UserEvent(
|
|
2
|
+
export declare function UserEvent(unit: xnew.Unit): void;
|
|
@@ -14,13 +14,6 @@ interface Capture {
|
|
|
14
14
|
checker: (unit: Unit) => boolean;
|
|
15
15
|
execute: (unit: Unit) => any;
|
|
16
16
|
}
|
|
17
|
-
export declare class UnitPromise {
|
|
18
|
-
private promise;
|
|
19
|
-
constructor(promise: Promise<any>);
|
|
20
|
-
then(callback: Function): UnitPromise;
|
|
21
|
-
catch(callback: Function): UnitPromise;
|
|
22
|
-
finally(callback: Function): UnitPromise;
|
|
23
|
-
}
|
|
24
17
|
interface UnitInternal {
|
|
25
18
|
parent: Unit | null;
|
|
26
19
|
target: Object | null;
|
|
@@ -43,6 +36,13 @@ interface UnitInternal {
|
|
|
43
36
|
defines: Record<string, any>;
|
|
44
37
|
systems: Record<string, Function[]>;
|
|
45
38
|
}
|
|
39
|
+
export declare class UnitPromise {
|
|
40
|
+
private promise;
|
|
41
|
+
constructor(promise: Promise<any>);
|
|
42
|
+
then(callback: Function): UnitPromise;
|
|
43
|
+
catch(callback: Function): UnitPromise;
|
|
44
|
+
finally(callback: Function): UnitPromise;
|
|
45
|
+
}
|
|
46
46
|
export declare class Unit {
|
|
47
47
|
[key: string]: any;
|
|
48
48
|
_: UnitInternal;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,18 +1,21 @@
|
|
|
1
1
|
import { ResizeEvent } from './basics/ResizeEvent';
|
|
2
|
-
import {
|
|
2
|
+
import { PointerEvent } from './basics/PointerEvent';
|
|
3
|
+
import { KeyboardEvent } from './basics/KeyboardEvent';
|
|
3
4
|
import { Screen } from './basics/Screen';
|
|
4
5
|
import { InputFrame } from './basics/Input';
|
|
5
6
|
import { ModalFrame, ModalContent } from './basics/Modal';
|
|
6
7
|
import { TabFrame, TabButton, TabContent } from './basics/Tab';
|
|
7
8
|
import { AccordionFrame, AccordionHeader, AccordionBullet, AccordionContent } from './basics/Accordion';
|
|
8
|
-
import { DragFrame, DragTarget } from './basics/
|
|
9
|
-
import {
|
|
9
|
+
import { DragFrame, DragTarget } from './basics/Drag';
|
|
10
|
+
import { AnalogStick, DirectionalPad } from './basics/Controller';
|
|
10
11
|
import { Unit } from './core/unit';
|
|
12
|
+
import { load } from './audio/loader';
|
|
11
13
|
import { synthesizer } from './audio/synthesizer';
|
|
12
14
|
declare const basics: {
|
|
13
15
|
Screen: typeof Screen;
|
|
14
|
-
|
|
16
|
+
PointerEvent: typeof PointerEvent;
|
|
15
17
|
ResizeEvent: typeof ResizeEvent;
|
|
18
|
+
KeyboardEvent: typeof KeyboardEvent;
|
|
16
19
|
ModalFrame: typeof ModalFrame;
|
|
17
20
|
ModalContent: typeof ModalContent;
|
|
18
21
|
AccordionFrame: typeof AccordionFrame;
|
|
@@ -25,12 +28,12 @@ declare const basics: {
|
|
|
25
28
|
InputFrame: typeof InputFrame;
|
|
26
29
|
DragFrame: typeof DragFrame;
|
|
27
30
|
DragTarget: typeof DragTarget;
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
TouchButton: typeof TouchButton;
|
|
31
|
+
AnalogStick: typeof AnalogStick;
|
|
32
|
+
DirectionalPad: typeof DirectionalPad;
|
|
31
33
|
};
|
|
32
34
|
declare const audio: {
|
|
33
35
|
synthesizer: typeof synthesizer;
|
|
36
|
+
load: typeof load;
|
|
34
37
|
};
|
|
35
38
|
export interface xnew_interface {
|
|
36
39
|
(...args: any[]): Unit;
|
package/dist/xnew.d.ts
CHANGED
|
@@ -100,7 +100,9 @@ declare namespace xnew$1 {
|
|
|
100
100
|
}
|
|
101
101
|
declare const xnew$1: any;
|
|
102
102
|
|
|
103
|
-
declare function
|
|
103
|
+
declare function PointerEvent(unit: xnew$1.Unit): void;
|
|
104
|
+
|
|
105
|
+
declare function KeyboardEvent(unit: xnew$1.Unit): void;
|
|
104
106
|
|
|
105
107
|
declare function Screen(screen: xnew$1.Unit, { width, height, fit }?: {
|
|
106
108
|
width?: number | undefined;
|
|
@@ -109,10 +111,6 @@ declare function Screen(screen: xnew$1.Unit, { width, height, fit }?: {
|
|
|
109
111
|
}): {
|
|
110
112
|
readonly canvas: any;
|
|
111
113
|
resize(width: number, height: number): void;
|
|
112
|
-
readonly scale: {
|
|
113
|
-
x: number;
|
|
114
|
-
y: number;
|
|
115
|
-
};
|
|
116
114
|
};
|
|
117
115
|
|
|
118
116
|
declare function InputFrame(frame: xnew$1.Unit, {}?: {}): void;
|
|
@@ -132,8 +130,8 @@ declare function ModalContent(content: xnew$1.Unit, { background }?: {
|
|
|
132
130
|
}): void;
|
|
133
131
|
};
|
|
134
132
|
|
|
135
|
-
declare function TabFrame(frame: xnew$1.Unit, {
|
|
136
|
-
|
|
133
|
+
declare function TabFrame(frame: xnew$1.Unit, { select }?: {
|
|
134
|
+
select?: string;
|
|
137
135
|
}): void;
|
|
138
136
|
declare function TabButton(button: xnew$1.Unit, { key }?: {
|
|
139
137
|
key?: string;
|
|
@@ -182,34 +180,56 @@ declare function DragFrame(frame: xnew$1.Unit, { x, y }?: {
|
|
|
182
180
|
}): void;
|
|
183
181
|
declare function DragTarget(target: xnew$1.Unit, {}?: {}): void;
|
|
184
182
|
|
|
185
|
-
declare function
|
|
186
|
-
size?: number
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
183
|
+
declare function AnalogStick(self: xnew$1.Unit, { size, fill, fillOpacity, stroke, strokeOpacity, strokeWidth, strokeLinejoin }?: {
|
|
184
|
+
size?: number;
|
|
185
|
+
diagonal?: boolean;
|
|
186
|
+
fill?: string;
|
|
187
|
+
fillOpacity?: number;
|
|
188
|
+
stroke?: string;
|
|
189
|
+
strokeOpacity?: number;
|
|
190
|
+
strokeWidth?: number;
|
|
191
|
+
strokeLinejoin?: string;
|
|
193
192
|
}): void;
|
|
194
|
-
declare function
|
|
195
|
-
size?: number
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
declare function TouchButton(self: xnew$1.Unit, { size, fill, fillOpacity, stroke, strokeOpacity, strokeWidth, strokeLinejoin }?: {
|
|
204
|
-
size?: number | undefined;
|
|
205
|
-
fill?: string | undefined;
|
|
206
|
-
fillOpacity?: number | undefined;
|
|
207
|
-
stroke?: string | undefined;
|
|
208
|
-
strokeOpacity?: number | undefined;
|
|
209
|
-
strokeWidth?: number | undefined;
|
|
210
|
-
strokeLinejoin?: string | undefined;
|
|
193
|
+
declare function DirectionalPad(self: xnew$1.Unit, { size, diagonal, fill, fillOpacity, stroke, strokeOpacity, strokeWidth, strokeLinejoin }?: {
|
|
194
|
+
size?: number;
|
|
195
|
+
diagonal?: boolean;
|
|
196
|
+
fill?: string;
|
|
197
|
+
fillOpacity?: number;
|
|
198
|
+
stroke?: string;
|
|
199
|
+
strokeOpacity?: number;
|
|
200
|
+
strokeWidth?: number;
|
|
201
|
+
strokeLinejoin?: string;
|
|
211
202
|
}): void;
|
|
212
203
|
|
|
204
|
+
type AudioNodeMap = {
|
|
205
|
+
[key: string]: AudioNode;
|
|
206
|
+
};
|
|
207
|
+
|
|
208
|
+
declare function load(path: string): AudioFile;
|
|
209
|
+
declare class AudioFile {
|
|
210
|
+
data: any;
|
|
211
|
+
startTime: number | null;
|
|
212
|
+
nodes: AudioNodeMap;
|
|
213
|
+
constructor(path: string);
|
|
214
|
+
isReady(): boolean;
|
|
215
|
+
get promise(): Promise<void>;
|
|
216
|
+
set volume(value: number);
|
|
217
|
+
get volume(): number;
|
|
218
|
+
set loop(value: boolean);
|
|
219
|
+
get loop(): boolean;
|
|
220
|
+
play(offset?: number): void;
|
|
221
|
+
pause(): number | undefined;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
type SynthProps = {
|
|
225
|
+
oscillator?: OscillatorOptions | null;
|
|
226
|
+
filter?: FilterOptions | null;
|
|
227
|
+
amp?: AmpOptions | null;
|
|
228
|
+
};
|
|
229
|
+
type SynthEffects = {
|
|
230
|
+
bmp?: number | null;
|
|
231
|
+
reverb?: ReverbOptions | null;
|
|
232
|
+
};
|
|
213
233
|
type Envelope = {
|
|
214
234
|
amount: number;
|
|
215
235
|
ADSR: [number, number, number, number];
|
|
@@ -226,34 +246,15 @@ type OscillatorOptions = {
|
|
|
226
246
|
};
|
|
227
247
|
type FilterOptions = {
|
|
228
248
|
type?: BiquadFilterType;
|
|
229
|
-
Q?: number;
|
|
230
249
|
cutoff?: number;
|
|
231
|
-
envelope?: Envelope | null;
|
|
232
|
-
LFO?: LFO | null;
|
|
233
250
|
};
|
|
234
251
|
type AmpOptions = {
|
|
235
252
|
envelope?: Envelope | null;
|
|
236
|
-
LFO?: LFO | null;
|
|
237
253
|
};
|
|
238
254
|
type ReverbOptions = {
|
|
239
255
|
time?: number;
|
|
240
256
|
mix?: number;
|
|
241
257
|
};
|
|
242
|
-
type DelayOptions = {
|
|
243
|
-
time?: number;
|
|
244
|
-
feedback?: number;
|
|
245
|
-
mix?: number;
|
|
246
|
-
};
|
|
247
|
-
type SynthProps = {
|
|
248
|
-
oscillator?: OscillatorOptions | null;
|
|
249
|
-
filter?: FilterOptions | null;
|
|
250
|
-
amp?: AmpOptions | null;
|
|
251
|
-
};
|
|
252
|
-
type SynthEffects = {
|
|
253
|
-
bmp?: number | null;
|
|
254
|
-
reverb?: ReverbOptions | null;
|
|
255
|
-
delay?: DelayOptions | null;
|
|
256
|
-
};
|
|
257
258
|
declare function synthesizer(props?: SynthProps, effects?: SynthEffects): Synthesizer;
|
|
258
259
|
declare class Synthesizer {
|
|
259
260
|
oscillator: OscillatorOptions;
|
|
@@ -261,12 +262,8 @@ declare class Synthesizer {
|
|
|
261
262
|
amp: AmpOptions;
|
|
262
263
|
bmp: number;
|
|
263
264
|
reverb: ReverbOptions;
|
|
264
|
-
delay: DelayOptions;
|
|
265
|
-
options: {
|
|
266
|
-
bmp: number;
|
|
267
|
-
};
|
|
268
265
|
static initialize(): void;
|
|
269
|
-
constructor({ oscillator, filter, amp }?: SynthProps, { bmp, reverb
|
|
266
|
+
constructor({ oscillator, filter, amp }?: SynthProps, { bmp, reverb }?: SynthEffects);
|
|
270
267
|
static keymap: {
|
|
271
268
|
[key: string]: number;
|
|
272
269
|
};
|
|
@@ -280,8 +277,9 @@ declare class Synthesizer {
|
|
|
280
277
|
|
|
281
278
|
declare const basics: {
|
|
282
279
|
Screen: typeof Screen;
|
|
283
|
-
|
|
280
|
+
PointerEvent: typeof PointerEvent;
|
|
284
281
|
ResizeEvent: typeof ResizeEvent;
|
|
282
|
+
KeyboardEvent: typeof KeyboardEvent;
|
|
285
283
|
ModalFrame: typeof ModalFrame;
|
|
286
284
|
ModalContent: typeof ModalContent;
|
|
287
285
|
AccordionFrame: typeof AccordionFrame;
|
|
@@ -294,12 +292,12 @@ declare const basics: {
|
|
|
294
292
|
InputFrame: typeof InputFrame;
|
|
295
293
|
DragFrame: typeof DragFrame;
|
|
296
294
|
DragTarget: typeof DragTarget;
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
TouchButton: typeof TouchButton;
|
|
295
|
+
AnalogStick: typeof AnalogStick;
|
|
296
|
+
DirectionalPad: typeof DirectionalPad;
|
|
300
297
|
};
|
|
301
298
|
declare const audio: {
|
|
302
299
|
synthesizer: typeof synthesizer;
|
|
300
|
+
load: typeof load;
|
|
303
301
|
};
|
|
304
302
|
interface xnew_interface {
|
|
305
303
|
(...args: any[]): Unit;
|