@mulsense/xnew 0.1.11 → 0.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.
- package/README.md +3 -3
- package/dist/addons/xmatter.js +2 -2
- package/dist/addons/xmatter.mjs +2 -2
- package/dist/addons/xpixi.js +4 -4
- package/dist/addons/xpixi.mjs +4 -4
- package/dist/addons/xrapier2d.js +2 -2
- package/dist/addons/xrapier2d.mjs +2 -2
- package/dist/addons/xthree.js +2 -2
- package/dist/addons/xthree.mjs +2 -2
- package/dist/types/audio/audio.d.ts +1 -11
- package/dist/types/basics/Event.d.ts +1 -1
- package/dist/types/core/time.d.ts +11 -10
- package/dist/types/core/unit.d.ts +5 -28
- package/dist/types/core/xnew.d.ts +1 -14
- package/dist/xnew.d.ts +5 -34
- package/dist/xnew.js +201 -168
- package/dist/xnew.mjs +201 -168
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -13,7 +13,7 @@ providing a flexible architecture well-suited for applications with dynamic scen
|
|
|
13
13
|
### Via CDN
|
|
14
14
|
Include the following script in your HTML file:
|
|
15
15
|
```html
|
|
16
|
-
<script src="https://unpkg.com/@mulsense/xnew@0.
|
|
16
|
+
<script src="https://unpkg.com/@mulsense/xnew@0.2.x/dist/xnew.js"></script>
|
|
17
17
|
```
|
|
18
18
|
|
|
19
19
|
### Via CDN (ESM)
|
|
@@ -22,7 +22,7 @@ Use the ES module version with an import map:
|
|
|
22
22
|
<script type="importmap">
|
|
23
23
|
{
|
|
24
24
|
"imports": {
|
|
25
|
-
"@mulsense/xnew": "https://unpkg.com/@mulsense/xnew@0.
|
|
25
|
+
"@mulsense/xnew": "https://unpkg.com/@mulsense/xnew@0.2.x/dist/xnew.mjs"
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
28
|
</script>
|
|
@@ -37,7 +37,7 @@ import xnew from '@mulsense/xnew';
|
|
|
37
37
|
### Via npm
|
|
38
38
|
Install `xnew` using npm:
|
|
39
39
|
```bash
|
|
40
|
-
npm install @mulsense/xnew@0.
|
|
40
|
+
npm install @mulsense/xnew@0.2.x
|
|
41
41
|
```
|
|
42
42
|
|
|
43
43
|
Then import it in your JavaScript file:
|
package/dist/addons/xmatter.js
CHANGED
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
root.isActive = true;
|
|
24
24
|
root.engine = engine !== null && engine !== void 0 ? engine : Matter.Engine.create();
|
|
25
25
|
xnew.context('xmatter.object', root.engine.world);
|
|
26
|
-
self.on('update', () => {
|
|
26
|
+
self.on('-update', () => {
|
|
27
27
|
if (root.isActive) {
|
|
28
28
|
Matter.Engine.update(root.engine);
|
|
29
29
|
}
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
const parent = xnew.context('xmatter.object');
|
|
34
34
|
xnew.context('xmatter.object', object);
|
|
35
35
|
Matter.Composite.add(parent, object);
|
|
36
|
-
self.on('finalize', () => {
|
|
36
|
+
self.on('-finalize', () => {
|
|
37
37
|
Matter.Composite.remove(parent, object);
|
|
38
38
|
});
|
|
39
39
|
}
|
package/dist/addons/xmatter.mjs
CHANGED
|
@@ -20,7 +20,7 @@ function Root(self, { engine }) {
|
|
|
20
20
|
root.isActive = true;
|
|
21
21
|
root.engine = engine !== null && engine !== void 0 ? engine : Matter.Engine.create();
|
|
22
22
|
xnew.context('xmatter.object', root.engine.world);
|
|
23
|
-
self.on('update', () => {
|
|
23
|
+
self.on('-update', () => {
|
|
24
24
|
if (root.isActive) {
|
|
25
25
|
Matter.Engine.update(root.engine);
|
|
26
26
|
}
|
|
@@ -30,7 +30,7 @@ function Nest(self, { object }) {
|
|
|
30
30
|
const parent = xnew.context('xmatter.object');
|
|
31
31
|
xnew.context('xmatter.object', object);
|
|
32
32
|
Matter.Composite.add(parent, object);
|
|
33
|
-
self.on('finalize', () => {
|
|
33
|
+
self.on('-finalize', () => {
|
|
34
34
|
Matter.Composite.remove(parent, object);
|
|
35
35
|
});
|
|
36
36
|
}
|
package/dist/addons/xpixi.js
CHANGED
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
get canvas() {
|
|
50
50
|
var _a;
|
|
51
51
|
return (_a = xnew.context('xpixi.root')) === null || _a === void 0 ? void 0 : _a.canvas;
|
|
52
|
-
}
|
|
52
|
+
},
|
|
53
53
|
};
|
|
54
54
|
function Root(self, { canvas }) {
|
|
55
55
|
const root = {};
|
|
@@ -69,7 +69,7 @@
|
|
|
69
69
|
root.updates = [];
|
|
70
70
|
root.scene = new PIXI__namespace.Container();
|
|
71
71
|
xnew.context('xpixi.object', root.scene);
|
|
72
|
-
self.on('update', () => {
|
|
72
|
+
self.on('-update', () => {
|
|
73
73
|
root.updates.forEach((update) => {
|
|
74
74
|
update();
|
|
75
75
|
});
|
|
@@ -82,14 +82,14 @@
|
|
|
82
82
|
const parent = xnew.context('xpixi.object');
|
|
83
83
|
xnew.context('xpixi.object', object);
|
|
84
84
|
parent.addChild(object);
|
|
85
|
-
self.on('finalize', () => {
|
|
85
|
+
self.on('-finalize', () => {
|
|
86
86
|
parent.removeChild(object);
|
|
87
87
|
});
|
|
88
88
|
}
|
|
89
89
|
function PreUpdate(self, callback) {
|
|
90
90
|
const root = xnew.context('xpixi.root');
|
|
91
91
|
root.updates.push(callback);
|
|
92
|
-
self.on('finalize', () => {
|
|
92
|
+
self.on('-finalize', () => {
|
|
93
93
|
root.updates = root.updates.filter((update) => update !== callback);
|
|
94
94
|
});
|
|
95
95
|
}
|
package/dist/addons/xpixi.mjs
CHANGED
|
@@ -27,7 +27,7 @@ var xpixi = {
|
|
|
27
27
|
get canvas() {
|
|
28
28
|
var _a;
|
|
29
29
|
return (_a = xnew.context('xpixi.root')) === null || _a === void 0 ? void 0 : _a.canvas;
|
|
30
|
-
}
|
|
30
|
+
},
|
|
31
31
|
};
|
|
32
32
|
function Root(self, { canvas }) {
|
|
33
33
|
const root = {};
|
|
@@ -47,7 +47,7 @@ function Root(self, { canvas }) {
|
|
|
47
47
|
root.updates = [];
|
|
48
48
|
root.scene = new PIXI.Container();
|
|
49
49
|
xnew.context('xpixi.object', root.scene);
|
|
50
|
-
self.on('update', () => {
|
|
50
|
+
self.on('-update', () => {
|
|
51
51
|
root.updates.forEach((update) => {
|
|
52
52
|
update();
|
|
53
53
|
});
|
|
@@ -60,14 +60,14 @@ function Nest(self, { object }) {
|
|
|
60
60
|
const parent = xnew.context('xpixi.object');
|
|
61
61
|
xnew.context('xpixi.object', object);
|
|
62
62
|
parent.addChild(object);
|
|
63
|
-
self.on('finalize', () => {
|
|
63
|
+
self.on('-finalize', () => {
|
|
64
64
|
parent.removeChild(object);
|
|
65
65
|
});
|
|
66
66
|
}
|
|
67
67
|
function PreUpdate(self, callback) {
|
|
68
68
|
const root = xnew.context('xpixi.root');
|
|
69
69
|
root.updates.push(callback);
|
|
70
|
-
self.on('finalize', () => {
|
|
70
|
+
self.on('-finalize', () => {
|
|
71
71
|
root.updates = root.updates.filter((update) => update !== callback);
|
|
72
72
|
});
|
|
73
73
|
}
|
package/dist/addons/xrapier2d.js
CHANGED
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
}
|
|
28
28
|
// xnew.extend(Nest, root.world);
|
|
29
29
|
});
|
|
30
|
-
self.on('update', () => {
|
|
30
|
+
self.on('-update', () => {
|
|
31
31
|
if (root.world) {
|
|
32
32
|
root.world.step();
|
|
33
33
|
}
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
console.log(temp, type, object);
|
|
41
41
|
// Rapier2D objects (RigidBody, Collider, etc.) are already added to the world
|
|
42
42
|
// when created, so we only need to handle removal on finalize
|
|
43
|
-
self.on('finalize', () => {
|
|
43
|
+
self.on('-finalize', () => {
|
|
44
44
|
try {
|
|
45
45
|
// Check if object is a RigidBody
|
|
46
46
|
if (type === 'rigidBody') {
|
|
@@ -24,7 +24,7 @@ function Root(self, { gravity, timestep }) {
|
|
|
24
24
|
}
|
|
25
25
|
// xnew.extend(Nest, root.world);
|
|
26
26
|
});
|
|
27
|
-
self.on('update', () => {
|
|
27
|
+
self.on('-update', () => {
|
|
28
28
|
if (root.world) {
|
|
29
29
|
root.world.step();
|
|
30
30
|
}
|
|
@@ -37,7 +37,7 @@ function Connect(self, { type, object }) {
|
|
|
37
37
|
console.log(temp, type, object);
|
|
38
38
|
// Rapier2D objects (RigidBody, Collider, etc.) are already added to the world
|
|
39
39
|
// when created, so we only need to handle removal on finalize
|
|
40
|
-
self.on('finalize', () => {
|
|
40
|
+
self.on('-finalize', () => {
|
|
41
41
|
try {
|
|
42
42
|
// Check if object is a RigidBody
|
|
43
43
|
if (type === 'rigidBody') {
|
package/dist/addons/xthree.js
CHANGED
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
root.camera = camera !== null && camera !== void 0 ? camera : new THREE__namespace.PerspectiveCamera(45, root.renderer.domElement.width / root.renderer.domElement.height);
|
|
58
58
|
root.scene = new THREE__namespace.Scene();
|
|
59
59
|
xnew.context('xthree.object', root.scene);
|
|
60
|
-
self.on('update', () => {
|
|
60
|
+
self.on('-update', () => {
|
|
61
61
|
root.renderer.render(root.scene, root.camera);
|
|
62
62
|
});
|
|
63
63
|
}
|
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
xnew.context('xthree.object', object);
|
|
67
67
|
if (parent) {
|
|
68
68
|
parent === null || parent === void 0 ? void 0 : parent.add(object);
|
|
69
|
-
self.on('finalize', () => {
|
|
69
|
+
self.on('-finalize', () => {
|
|
70
70
|
parent === null || parent === void 0 ? void 0 : parent.remove(object);
|
|
71
71
|
});
|
|
72
72
|
}
|
package/dist/addons/xthree.mjs
CHANGED
|
@@ -35,7 +35,7 @@ function Root(self, { canvas, camera }) {
|
|
|
35
35
|
root.camera = camera !== null && camera !== void 0 ? camera : new THREE.PerspectiveCamera(45, root.renderer.domElement.width / root.renderer.domElement.height);
|
|
36
36
|
root.scene = new THREE.Scene();
|
|
37
37
|
xnew.context('xthree.object', root.scene);
|
|
38
|
-
self.on('update', () => {
|
|
38
|
+
self.on('-update', () => {
|
|
39
39
|
root.renderer.render(root.scene, root.camera);
|
|
40
40
|
});
|
|
41
41
|
}
|
|
@@ -44,7 +44,7 @@ function Nest(self, { object }) {
|
|
|
44
44
|
xnew.context('xthree.object', object);
|
|
45
45
|
if (parent) {
|
|
46
46
|
parent === null || parent === void 0 ? void 0 : parent.add(object);
|
|
47
|
-
self.on('finalize', () => {
|
|
47
|
+
self.on('-finalize', () => {
|
|
48
48
|
parent === null || parent === void 0 ? void 0 : parent.remove(object);
|
|
49
49
|
});
|
|
50
50
|
}
|
|
@@ -1,18 +1,8 @@
|
|
|
1
1
|
export declare const audio: {
|
|
2
|
-
load(path: string):
|
|
2
|
+
load(path: string): import("../core/unit").UnitPromise;
|
|
3
3
|
synthesizer(props: SynthProps): Synthesizer;
|
|
4
4
|
volume: number;
|
|
5
5
|
};
|
|
6
|
-
declare class AudioFile {
|
|
7
|
-
buffer?: AudioBuffer;
|
|
8
|
-
promise: Promise<void>;
|
|
9
|
-
source?: AudioBufferSourceNode;
|
|
10
|
-
amp?: GainNode;
|
|
11
|
-
start: number | null;
|
|
12
|
-
constructor(path: string);
|
|
13
|
-
play(offset?: number, loop?: boolean): void;
|
|
14
|
-
pause(): number | undefined;
|
|
15
|
-
}
|
|
16
6
|
type SynthProps = {
|
|
17
7
|
oscillator: OscillatorOptions;
|
|
18
8
|
amp: AmpOptions;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { Unit } from '../core/unit';
|
|
2
2
|
export declare function ResizeEvent(resize: Unit): void;
|
|
3
|
-
export declare function KeyboardEvent(
|
|
3
|
+
export declare function KeyboardEvent(keyboard: Unit): void;
|
|
4
4
|
export declare function PointerEvent(unit: Unit): void;
|
|
@@ -1,24 +1,25 @@
|
|
|
1
1
|
export declare class Ticker {
|
|
2
2
|
private id;
|
|
3
|
-
constructor(callback: Function);
|
|
3
|
+
constructor(callback: Function, fps?: number);
|
|
4
4
|
clear(): void;
|
|
5
5
|
}
|
|
6
|
+
export interface TimerOptions {
|
|
7
|
+
transition?: Function;
|
|
8
|
+
timeout?: Function;
|
|
9
|
+
duration: number;
|
|
10
|
+
iterations?: number;
|
|
11
|
+
easing?: string;
|
|
12
|
+
}
|
|
6
13
|
export declare class Timer {
|
|
7
|
-
private
|
|
8
|
-
private transition;
|
|
9
|
-
private duration;
|
|
10
|
-
private loop;
|
|
11
|
-
private easing;
|
|
14
|
+
private options;
|
|
12
15
|
private id;
|
|
13
16
|
private time;
|
|
17
|
+
private counter;
|
|
14
18
|
private offset;
|
|
15
19
|
private status;
|
|
16
20
|
private visibilitychange;
|
|
17
21
|
private ticker;
|
|
18
|
-
constructor(
|
|
19
|
-
loop?: boolean;
|
|
20
|
-
easing?: string;
|
|
21
|
-
});
|
|
22
|
+
constructor(options: TimerOptions);
|
|
22
23
|
clear(): void;
|
|
23
24
|
elapsed(): number;
|
|
24
25
|
start(): void;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { MapSet, MapMap } from './map';
|
|
2
|
-
import { Ticker } from './time';
|
|
2
|
+
import { Ticker, TimerOptions } from './time';
|
|
3
3
|
export type UnitElement = HTMLElement | SVGElement;
|
|
4
4
|
interface Context {
|
|
5
5
|
stack: Context | null;
|
|
@@ -27,14 +27,10 @@ interface UnitInternal {
|
|
|
27
27
|
promises: Promise<any>[];
|
|
28
28
|
elements: UnitElement[];
|
|
29
29
|
components: Function[];
|
|
30
|
-
|
|
30
|
+
listeners: MapMap<string, Function, {
|
|
31
31
|
element: UnitElement;
|
|
32
32
|
execute: Function;
|
|
33
33
|
}>;
|
|
34
|
-
listeners2: MapMap<string, Function, {
|
|
35
|
-
element: UnitElement | Window | Document;
|
|
36
|
-
execute: Function;
|
|
37
|
-
}>;
|
|
38
34
|
defines: Record<string, any>;
|
|
39
35
|
systems: Record<string, Function[]>;
|
|
40
36
|
}
|
|
@@ -72,8 +68,6 @@ export declare class Unit {
|
|
|
72
68
|
on(type: string, listener: Function, options?: boolean | AddEventListenerOptions): void;
|
|
73
69
|
off(type?: string, listener?: Function): void;
|
|
74
70
|
emit(type: string, ...args: any[]): void;
|
|
75
|
-
static subon(unit: Unit, target: UnitElement | Window | Document, type: string, listener: Function, options?: boolean | AddEventListenerOptions): void;
|
|
76
|
-
static suboff(unit: Unit, target: UnitElement | Window | Document | null, type?: string, listener?: Function): void;
|
|
77
71
|
}
|
|
78
72
|
export declare class UnitPromise {
|
|
79
73
|
private promise;
|
|
@@ -85,31 +79,14 @@ export declare class UnitPromise {
|
|
|
85
79
|
export declare class UnitTimer {
|
|
86
80
|
private unit;
|
|
87
81
|
private stack;
|
|
88
|
-
constructor(
|
|
89
|
-
transition?: Function;
|
|
90
|
-
timeout?: Function;
|
|
91
|
-
duration: number;
|
|
92
|
-
easing?: string;
|
|
93
|
-
loop?: boolean;
|
|
94
|
-
});
|
|
82
|
+
constructor(options: TimerOptions);
|
|
95
83
|
clear(): void;
|
|
96
84
|
timeout(timeout: Function, duration?: number): this;
|
|
97
85
|
transition(transition: Function, duration?: number, easing?: string): this;
|
|
98
|
-
static execute(timer: UnitTimer,
|
|
99
|
-
transition?: Function;
|
|
100
|
-
timeout?: Function;
|
|
101
|
-
duration: number;
|
|
102
|
-
easing?: string;
|
|
103
|
-
loop?: boolean;
|
|
104
|
-
}): void;
|
|
86
|
+
static execute(timer: UnitTimer, options: TimerOptions): void;
|
|
105
87
|
static next(timer: UnitTimer): void;
|
|
106
|
-
static Component(unit: Unit,
|
|
88
|
+
static Component(unit: Unit, options: TimerOptions & {
|
|
107
89
|
snapshot: Snapshot;
|
|
108
|
-
transition?: Function;
|
|
109
|
-
timeout?: Function;
|
|
110
|
-
duration?: number;
|
|
111
|
-
loop?: boolean;
|
|
112
|
-
easing?: string;
|
|
113
90
|
}): void;
|
|
114
91
|
}
|
|
115
92
|
export {};
|
|
@@ -138,7 +138,7 @@ export declare const xnew: CreateUnit & {
|
|
|
138
138
|
* const timer = xnew.interval(() => console.log('Tick'), 1000)
|
|
139
139
|
* // Stop when needed: timer.clear()
|
|
140
140
|
*/
|
|
141
|
-
interval(timeout: Function, duration: number): any;
|
|
141
|
+
interval(timeout: Function, duration: number, iterations?: number): any;
|
|
142
142
|
/**
|
|
143
143
|
* Creates a transition animation with easing, executing callback with progress values
|
|
144
144
|
* @param callback - Function called with progress value (0.0 to 1.0)
|
|
@@ -153,18 +153,5 @@ export declare const xnew: CreateUnit & {
|
|
|
153
153
|
* }, 300)
|
|
154
154
|
*/
|
|
155
155
|
transition(transition: Function, duration?: number, easing?: string): any;
|
|
156
|
-
/**
|
|
157
|
-
* Creates an event listener manager for a target element with automatic cleanup
|
|
158
|
-
* @param target - Element, Window, or Document to attach listeners to
|
|
159
|
-
* @returns Object with on() and off() methods for managing event listeners
|
|
160
|
-
* @example
|
|
161
|
-
* const mouse = xnew.listener(window)
|
|
162
|
-
* mouse.on('mousemove', (e) => console.log(e.clientX, e.clientY))
|
|
163
|
-
* // Automatically cleaned up when component finalizes
|
|
164
|
-
*/
|
|
165
|
-
listener(target: HTMLElement | SVGElement | Window | Document): {
|
|
166
|
-
on(type: string, listener: Function, options?: boolean | AddEventListenerOptions): void;
|
|
167
|
-
off(type?: string, listener?: Function): void;
|
|
168
|
-
};
|
|
169
156
|
};
|
|
170
157
|
export {};
|
package/dist/xnew.d.ts
CHANGED
|
@@ -22,7 +22,7 @@ declare class MapMap<Key1, Key2, Value> extends Map<Key1, Map<Key2, Value>> {
|
|
|
22
22
|
|
|
23
23
|
declare class Ticker {
|
|
24
24
|
private id;
|
|
25
|
-
constructor(callback: Function);
|
|
25
|
+
constructor(callback: Function, fps?: number);
|
|
26
26
|
clear(): void;
|
|
27
27
|
}
|
|
28
28
|
|
|
@@ -53,14 +53,10 @@ interface UnitInternal {
|
|
|
53
53
|
promises: Promise<any>[];
|
|
54
54
|
elements: UnitElement[];
|
|
55
55
|
components: Function[];
|
|
56
|
-
|
|
56
|
+
listeners: MapMap<string, Function, {
|
|
57
57
|
element: UnitElement;
|
|
58
58
|
execute: Function;
|
|
59
59
|
}>;
|
|
60
|
-
listeners2: MapMap<string, Function, {
|
|
61
|
-
element: UnitElement | Window | Document;
|
|
62
|
-
execute: Function;
|
|
63
|
-
}>;
|
|
64
60
|
defines: Record<string, any>;
|
|
65
61
|
systems: Record<string, Function[]>;
|
|
66
62
|
}
|
|
@@ -98,8 +94,6 @@ declare class Unit {
|
|
|
98
94
|
on(type: string, listener: Function, options?: boolean | AddEventListenerOptions): void;
|
|
99
95
|
off(type?: string, listener?: Function): void;
|
|
100
96
|
emit(type: string, ...args: any[]): void;
|
|
101
|
-
static subon(unit: Unit, target: UnitElement | Window | Document, type: string, listener: Function, options?: boolean | AddEventListenerOptions): void;
|
|
102
|
-
static suboff(unit: Unit, target: UnitElement | Window | Document | null, type?: string, listener?: Function): void;
|
|
103
97
|
}
|
|
104
98
|
declare class UnitPromise {
|
|
105
99
|
private promise;
|
|
@@ -248,7 +242,7 @@ declare const xnew$1: CreateUnit & {
|
|
|
248
242
|
* const timer = xnew.interval(() => console.log('Tick'), 1000)
|
|
249
243
|
* // Stop when needed: timer.clear()
|
|
250
244
|
*/
|
|
251
|
-
interval(timeout: Function, duration: number): any;
|
|
245
|
+
interval(timeout: Function, duration: number, iterations?: number): any;
|
|
252
246
|
/**
|
|
253
247
|
* Creates a transition animation with easing, executing callback with progress values
|
|
254
248
|
* @param callback - Function called with progress value (0.0 to 1.0)
|
|
@@ -263,19 +257,6 @@ declare const xnew$1: CreateUnit & {
|
|
|
263
257
|
* }, 300)
|
|
264
258
|
*/
|
|
265
259
|
transition(transition: Function, duration?: number, easing?: string): any;
|
|
266
|
-
/**
|
|
267
|
-
* Creates an event listener manager for a target element with automatic cleanup
|
|
268
|
-
* @param target - Element, Window, or Document to attach listeners to
|
|
269
|
-
* @returns Object with on() and off() methods for managing event listeners
|
|
270
|
-
* @example
|
|
271
|
-
* const mouse = xnew.listener(window)
|
|
272
|
-
* mouse.on('mousemove', (e) => console.log(e.clientX, e.clientY))
|
|
273
|
-
* // Automatically cleaned up when component finalizes
|
|
274
|
-
*/
|
|
275
|
-
listener(target: HTMLElement | SVGElement | Window | Document): {
|
|
276
|
-
on(type: string, listener: Function, options?: boolean | AddEventListenerOptions): void;
|
|
277
|
-
off(type?: string, listener?: Function): void;
|
|
278
|
-
};
|
|
279
260
|
};
|
|
280
261
|
|
|
281
262
|
declare function AccordionFrame(frame: Unit, { open, duration, easing }?: {
|
|
@@ -299,7 +280,7 @@ declare function AccordionContent(content: Unit, {}?: {}): {
|
|
|
299
280
|
};
|
|
300
281
|
|
|
301
282
|
declare function ResizeEvent(resize: Unit): void;
|
|
302
|
-
declare function KeyboardEvent(
|
|
283
|
+
declare function KeyboardEvent(keyboard: Unit): void;
|
|
303
284
|
declare function PointerEvent(unit: Unit): void;
|
|
304
285
|
|
|
305
286
|
declare function Screen(screen: Unit, { width, height, fit }?: {
|
|
@@ -378,20 +359,10 @@ declare function DirectionalPad(self: Unit, { size, diagonal, fill, fillOpacity,
|
|
|
378
359
|
}): void;
|
|
379
360
|
|
|
380
361
|
declare const audio: {
|
|
381
|
-
load(path: string):
|
|
362
|
+
load(path: string): UnitPromise;
|
|
382
363
|
synthesizer(props: SynthProps): Synthesizer;
|
|
383
364
|
volume: number;
|
|
384
365
|
};
|
|
385
|
-
declare class AudioFile {
|
|
386
|
-
buffer?: AudioBuffer;
|
|
387
|
-
promise: Promise<void>;
|
|
388
|
-
source?: AudioBufferSourceNode;
|
|
389
|
-
amp?: GainNode;
|
|
390
|
-
start: number | null;
|
|
391
|
-
constructor(path: string);
|
|
392
|
-
play(offset?: number, loop?: boolean): void;
|
|
393
|
-
pause(): number | undefined;
|
|
394
|
-
}
|
|
395
366
|
type SynthProps = {
|
|
396
367
|
oscillator: OscillatorOptions;
|
|
397
368
|
amp: AmpOptions;
|