@mulsense/xnew 0.4.0 → 0.4.2
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/addons/xmatter.js +0 -3
- package/dist/addons/xmatter.mjs +0 -3
- package/dist/addons/xpixi.d.ts +6 -4
- package/dist/addons/xpixi.js +0 -23
- package/dist/addons/xpixi.mjs +0 -23
- package/dist/addons/xrapier2d.js +1 -4
- package/dist/addons/xrapier2d.mjs +1 -4
- package/dist/addons/xrapier3d.js +2 -5
- package/dist/addons/xrapier3d.mjs +2 -5
- package/dist/addons/xthree.d.ts +11 -4
- package/dist/addons/xthree.js +4 -7
- package/dist/addons/xthree.mjs +4 -7
- package/dist/xnew.d.ts +14 -46
- package/dist/xnew.js +107 -187
- package/dist/xnew.mjs +107 -187
- package/package.json +8 -6
package/dist/addons/xmatter.js
CHANGED
package/dist/addons/xmatter.mjs
CHANGED
|
@@ -18,9 +18,6 @@ function Root(unit, { engine }) {
|
|
|
18
18
|
const root = {};
|
|
19
19
|
xnew.context('xmatter.root', root);
|
|
20
20
|
root.engine = engine !== null && engine !== void 0 ? engine : Matter.Engine.create();
|
|
21
|
-
unit.on('process', () => {
|
|
22
|
-
Matter.Engine.update(root.engine);
|
|
23
|
-
});
|
|
24
21
|
}
|
|
25
22
|
|
|
26
23
|
export { xmatter as default };
|
package/dist/addons/xpixi.d.ts
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import * as PIXI from 'pixi.js';
|
|
2
2
|
|
|
3
3
|
declare const _default: {
|
|
4
|
-
initialize({ renderer, canvas }?:
|
|
4
|
+
initialize({ renderer, canvas }?: {
|
|
5
|
+
renderer?: any;
|
|
6
|
+
canvas?: HTMLCanvasElement | null;
|
|
7
|
+
}): void;
|
|
5
8
|
nest(object: any): any;
|
|
6
|
-
sync(canvas: any): PIXI.Texture<PIXI.TextureSource<any>>;
|
|
7
9
|
readonly renderer: any;
|
|
8
|
-
readonly scene:
|
|
9
|
-
readonly canvas:
|
|
10
|
+
readonly scene: PIXI.Container;
|
|
11
|
+
readonly canvas: HTMLCanvasElement;
|
|
10
12
|
};
|
|
11
13
|
|
|
12
14
|
export { _default as default };
|
package/dist/addons/xpixi.js
CHANGED
|
@@ -31,13 +31,6 @@
|
|
|
31
31
|
xnew.extend(Nest, { object });
|
|
32
32
|
return object;
|
|
33
33
|
},
|
|
34
|
-
sync(canvas) {
|
|
35
|
-
const texture = PIXI__namespace.Texture.from(canvas);
|
|
36
|
-
xnew(PreUpdate, () => {
|
|
37
|
-
texture.source.update();
|
|
38
|
-
});
|
|
39
|
-
return texture;
|
|
40
|
-
},
|
|
41
34
|
get renderer() {
|
|
42
35
|
var _a;
|
|
43
36
|
return (_a = xnew.context('xpixi.root')) === null || _a === void 0 ? void 0 : _a.renderer;
|
|
@@ -60,17 +53,8 @@
|
|
|
60
53
|
width: canvas.width, height: canvas.height, view: canvas,
|
|
61
54
|
antialias: true, backgroundAlpha: 0,
|
|
62
55
|
})).then((renderer) => root.renderer = renderer);
|
|
63
|
-
root.updates = [];
|
|
64
56
|
root.scene = new PIXI__namespace.Container();
|
|
65
57
|
xnew.context('xpixi.object', root.scene);
|
|
66
|
-
unit.on('update', () => {
|
|
67
|
-
root.updates.forEach((update) => {
|
|
68
|
-
update();
|
|
69
|
-
});
|
|
70
|
-
if (root.renderer && root.scene) {
|
|
71
|
-
root.renderer.render(root.scene);
|
|
72
|
-
}
|
|
73
|
-
});
|
|
74
58
|
}
|
|
75
59
|
function Nest(unit, { object }) {
|
|
76
60
|
const parent = xnew.context('xpixi.object');
|
|
@@ -80,13 +64,6 @@
|
|
|
80
64
|
parent.removeChild(object);
|
|
81
65
|
});
|
|
82
66
|
}
|
|
83
|
-
function PreUpdate(unit, callback) {
|
|
84
|
-
const root = xnew.context('xpixi.root');
|
|
85
|
-
root.updates.push(callback);
|
|
86
|
-
unit.on('finalize', () => {
|
|
87
|
-
root.updates = root.updates.filter((update) => update !== callback);
|
|
88
|
-
});
|
|
89
|
-
}
|
|
90
67
|
|
|
91
68
|
return xpixi;
|
|
92
69
|
|
package/dist/addons/xpixi.mjs
CHANGED
|
@@ -9,13 +9,6 @@ var xpixi = {
|
|
|
9
9
|
xnew.extend(Nest, { object });
|
|
10
10
|
return object;
|
|
11
11
|
},
|
|
12
|
-
sync(canvas) {
|
|
13
|
-
const texture = PIXI.Texture.from(canvas);
|
|
14
|
-
xnew(PreUpdate, () => {
|
|
15
|
-
texture.source.update();
|
|
16
|
-
});
|
|
17
|
-
return texture;
|
|
18
|
-
},
|
|
19
12
|
get renderer() {
|
|
20
13
|
var _a;
|
|
21
14
|
return (_a = xnew.context('xpixi.root')) === null || _a === void 0 ? void 0 : _a.renderer;
|
|
@@ -38,17 +31,8 @@ function Root(unit, { canvas }) {
|
|
|
38
31
|
width: canvas.width, height: canvas.height, view: canvas,
|
|
39
32
|
antialias: true, backgroundAlpha: 0,
|
|
40
33
|
})).then((renderer) => root.renderer = renderer);
|
|
41
|
-
root.updates = [];
|
|
42
34
|
root.scene = new PIXI.Container();
|
|
43
35
|
xnew.context('xpixi.object', root.scene);
|
|
44
|
-
unit.on('update', () => {
|
|
45
|
-
root.updates.forEach((update) => {
|
|
46
|
-
update();
|
|
47
|
-
});
|
|
48
|
-
if (root.renderer && root.scene) {
|
|
49
|
-
root.renderer.render(root.scene);
|
|
50
|
-
}
|
|
51
|
-
});
|
|
52
36
|
}
|
|
53
37
|
function Nest(unit, { object }) {
|
|
54
38
|
const parent = xnew.context('xpixi.object');
|
|
@@ -58,12 +42,5 @@ function Nest(unit, { object }) {
|
|
|
58
42
|
parent.removeChild(object);
|
|
59
43
|
});
|
|
60
44
|
}
|
|
61
|
-
function PreUpdate(unit, callback) {
|
|
62
|
-
const root = xnew.context('xpixi.root');
|
|
63
|
-
root.updates.push(callback);
|
|
64
|
-
unit.on('finalize', () => {
|
|
65
|
-
root.updates = root.updates.filter((update) => update !== callback);
|
|
66
|
-
});
|
|
67
|
-
}
|
|
68
45
|
|
|
69
46
|
export { xpixi as default };
|
package/dist/addons/xrapier2d.js
CHANGED
|
@@ -13,15 +13,12 @@
|
|
|
13
13
|
return (_a = xnew.context('xrapier2d.root')) === null || _a === void 0 ? void 0 : _a.world;
|
|
14
14
|
},
|
|
15
15
|
};
|
|
16
|
-
function Root(
|
|
16
|
+
function Root(unit, { gravity }) {
|
|
17
17
|
const root = {};
|
|
18
18
|
xnew.context('xrapier2d.root', root);
|
|
19
19
|
xnew.promise(RAPIER.init()).then(() => {
|
|
20
20
|
root.world = new RAPIER.World(gravity);
|
|
21
21
|
});
|
|
22
|
-
self.on('process', () => {
|
|
23
|
-
root.world.step();
|
|
24
|
-
});
|
|
25
22
|
}
|
|
26
23
|
|
|
27
24
|
return xrapier2d;
|
|
@@ -10,15 +10,12 @@ var xrapier2d = {
|
|
|
10
10
|
return (_a = xnew.context('xrapier2d.root')) === null || _a === void 0 ? void 0 : _a.world;
|
|
11
11
|
},
|
|
12
12
|
};
|
|
13
|
-
function Root(
|
|
13
|
+
function Root(unit, { gravity }) {
|
|
14
14
|
const root = {};
|
|
15
15
|
xnew.context('xrapier2d.root', root);
|
|
16
16
|
xnew.promise(RAPIER.init()).then(() => {
|
|
17
17
|
root.world = new RAPIER.World(gravity);
|
|
18
18
|
});
|
|
19
|
-
self.on('process', () => {
|
|
20
|
-
root.world.step();
|
|
21
|
-
});
|
|
22
19
|
}
|
|
23
20
|
|
|
24
21
|
export { xrapier2d as default };
|
package/dist/addons/xrapier3d.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
})(this, (function (xnew, RAPIER) { 'use strict';
|
|
6
6
|
|
|
7
7
|
var xrapier3d = {
|
|
8
|
-
initialize({ gravity = { x: 0.0, y: 9.81, z: 0.0 } } = {}) {
|
|
8
|
+
initialize({ gravity = { x: 0.0, y: -9.81, z: 0.0 } } = {}) {
|
|
9
9
|
xnew.extend(Root, { gravity });
|
|
10
10
|
},
|
|
11
11
|
get world() {
|
|
@@ -13,15 +13,12 @@
|
|
|
13
13
|
return (_a = xnew.context('xrapier3d.root')) === null || _a === void 0 ? void 0 : _a.world;
|
|
14
14
|
},
|
|
15
15
|
};
|
|
16
|
-
function Root(
|
|
16
|
+
function Root(unit, { gravity }) {
|
|
17
17
|
const root = {};
|
|
18
18
|
xnew.context('xrapier3d.root', root);
|
|
19
19
|
xnew.promise(RAPIER.init()).then(() => {
|
|
20
20
|
root.world = new RAPIER.World(gravity);
|
|
21
21
|
});
|
|
22
|
-
self.on('process', () => {
|
|
23
|
-
root.world.step();
|
|
24
|
-
});
|
|
25
22
|
}
|
|
26
23
|
|
|
27
24
|
return xrapier3d;
|
|
@@ -2,7 +2,7 @@ import xnew from '@mulsense/xnew';
|
|
|
2
2
|
import RAPIER from '@dimforge/rapier3d-compat';
|
|
3
3
|
|
|
4
4
|
var xrapier3d = {
|
|
5
|
-
initialize({ gravity = { x: 0.0, y: 9.81, z: 0.0 } } = {}) {
|
|
5
|
+
initialize({ gravity = { x: 0.0, y: -9.81, z: 0.0 } } = {}) {
|
|
6
6
|
xnew.extend(Root, { gravity });
|
|
7
7
|
},
|
|
8
8
|
get world() {
|
|
@@ -10,15 +10,12 @@ var xrapier3d = {
|
|
|
10
10
|
return (_a = xnew.context('xrapier3d.root')) === null || _a === void 0 ? void 0 : _a.world;
|
|
11
11
|
},
|
|
12
12
|
};
|
|
13
|
-
function Root(
|
|
13
|
+
function Root(unit, { gravity }) {
|
|
14
14
|
const root = {};
|
|
15
15
|
xnew.context('xrapier3d.root', root);
|
|
16
16
|
xnew.promise(RAPIER.init()).then(() => {
|
|
17
17
|
root.world = new RAPIER.World(gravity);
|
|
18
18
|
});
|
|
19
|
-
self.on('process', () => {
|
|
20
|
-
root.world.step();
|
|
21
|
-
});
|
|
22
19
|
}
|
|
23
20
|
|
|
24
21
|
export { xrapier3d as default };
|
package/dist/addons/xthree.d.ts
CHANGED
|
@@ -1,10 +1,17 @@
|
|
|
1
|
+
import * as THREE from 'three';
|
|
2
|
+
|
|
1
3
|
declare const _default: {
|
|
2
|
-
initialize({ renderer, canvas, camera }?:
|
|
4
|
+
initialize({ renderer, canvas, camera, update }?: {
|
|
5
|
+
renderer?: any;
|
|
6
|
+
canvas?: HTMLCanvasElement | null;
|
|
7
|
+
camera?: THREE.Camera | null;
|
|
8
|
+
update?: boolean;
|
|
9
|
+
}): void;
|
|
3
10
|
nest(object: any): any;
|
|
4
11
|
readonly renderer: any;
|
|
5
|
-
readonly camera:
|
|
6
|
-
readonly scene:
|
|
7
|
-
readonly canvas:
|
|
12
|
+
readonly camera: THREE.Camera;
|
|
13
|
+
readonly scene: THREE.Scene;
|
|
14
|
+
readonly canvas: HTMLCanvasElement;
|
|
8
15
|
};
|
|
9
16
|
|
|
10
17
|
export { _default as default };
|
package/dist/addons/xthree.js
CHANGED
|
@@ -24,8 +24,8 @@
|
|
|
24
24
|
var THREE__namespace = /*#__PURE__*/_interopNamespaceDefault(THREE);
|
|
25
25
|
|
|
26
26
|
var xthree = {
|
|
27
|
-
initialize({ renderer = null, canvas = null, camera = null } = {}) {
|
|
28
|
-
xnew.extend(Root, { renderer, canvas, camera });
|
|
27
|
+
initialize({ renderer = null, canvas = null, camera = null, update = true } = {}) {
|
|
28
|
+
xnew.extend(Root, { renderer, canvas, camera, update });
|
|
29
29
|
},
|
|
30
30
|
nest(object) {
|
|
31
31
|
xnew.extend(Nest, { object });
|
|
@@ -46,9 +46,9 @@
|
|
|
46
46
|
get canvas() {
|
|
47
47
|
var _a;
|
|
48
48
|
return (_a = xnew.context('xthree.root')) === null || _a === void 0 ? void 0 : _a.canvas;
|
|
49
|
-
}
|
|
49
|
+
},
|
|
50
50
|
};
|
|
51
|
-
function Root(unit, { canvas, camera }) {
|
|
51
|
+
function Root(unit, { canvas, camera, update }) {
|
|
52
52
|
const root = {};
|
|
53
53
|
xnew.context('xthree.root', root);
|
|
54
54
|
root.canvas = canvas;
|
|
@@ -57,9 +57,6 @@
|
|
|
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
|
-
unit.on('update', () => {
|
|
61
|
-
root.renderer.render(root.scene, root.camera);
|
|
62
|
-
});
|
|
63
60
|
}
|
|
64
61
|
function Nest(unit, { object }) {
|
|
65
62
|
const parent = xnew.context('xthree.object');
|
package/dist/addons/xthree.mjs
CHANGED
|
@@ -2,8 +2,8 @@ import xnew from '@mulsense/xnew';
|
|
|
2
2
|
import * as THREE from 'three';
|
|
3
3
|
|
|
4
4
|
var xthree = {
|
|
5
|
-
initialize({ renderer = null, canvas = null, camera = null } = {}) {
|
|
6
|
-
xnew.extend(Root, { renderer, canvas, camera });
|
|
5
|
+
initialize({ renderer = null, canvas = null, camera = null, update = true } = {}) {
|
|
6
|
+
xnew.extend(Root, { renderer, canvas, camera, update });
|
|
7
7
|
},
|
|
8
8
|
nest(object) {
|
|
9
9
|
xnew.extend(Nest, { object });
|
|
@@ -24,9 +24,9 @@ var xthree = {
|
|
|
24
24
|
get canvas() {
|
|
25
25
|
var _a;
|
|
26
26
|
return (_a = xnew.context('xthree.root')) === null || _a === void 0 ? void 0 : _a.canvas;
|
|
27
|
-
}
|
|
27
|
+
},
|
|
28
28
|
};
|
|
29
|
-
function Root(unit, { canvas, camera }) {
|
|
29
|
+
function Root(unit, { canvas, camera, update }) {
|
|
30
30
|
const root = {};
|
|
31
31
|
xnew.context('xthree.root', root);
|
|
32
32
|
root.canvas = canvas;
|
|
@@ -35,9 +35,6 @@ function Root(unit, { 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
|
-
unit.on('update', () => {
|
|
39
|
-
root.renderer.render(root.scene, root.camera);
|
|
40
|
-
});
|
|
41
38
|
}
|
|
42
39
|
function Nest(unit, { object }) {
|
|
43
40
|
const parent = xnew.context('xthree.object');
|
package/dist/xnew.d.ts
CHANGED
|
@@ -20,12 +20,6 @@ declare class MapMap<Key1, Key2, Value> extends Map<Key1, Map<Key2, Value>> {
|
|
|
20
20
|
delete(key1: Key1, key2: Key2): boolean;
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
declare class Ticker {
|
|
24
|
-
private id;
|
|
25
|
-
constructor(callback: Function, fps?: number);
|
|
26
|
-
clear(): void;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
23
|
type UnitElement = HTMLElement | SVGElement;
|
|
30
24
|
|
|
31
25
|
interface EventProps {
|
|
@@ -65,6 +59,7 @@ interface Snapshot {
|
|
|
65
59
|
unit: Unit;
|
|
66
60
|
context: Context;
|
|
67
61
|
element: UnitElement;
|
|
62
|
+
component: Function | null;
|
|
68
63
|
}
|
|
69
64
|
interface Internal {
|
|
70
65
|
parent: Unit | null;
|
|
@@ -87,10 +82,14 @@ interface Internal {
|
|
|
87
82
|
components: Function[];
|
|
88
83
|
listeners: MapMap<string, Function, {
|
|
89
84
|
element: UnitElement;
|
|
85
|
+
component: Function | null;
|
|
90
86
|
execute: Function;
|
|
91
87
|
}>;
|
|
92
88
|
defines: Record<string, any>;
|
|
93
|
-
systems: Record<string,
|
|
89
|
+
systems: Record<string, {
|
|
90
|
+
listener: Function;
|
|
91
|
+
execute: Function;
|
|
92
|
+
}[]>;
|
|
94
93
|
eventManager: EventManager;
|
|
95
94
|
}
|
|
96
95
|
declare class Unit {
|
|
@@ -105,16 +104,16 @@ declare class Unit {
|
|
|
105
104
|
static initialize(unit: Unit, anchor: UnitElement | null): void;
|
|
106
105
|
static finalize(unit: Unit): void;
|
|
107
106
|
static nest(unit: Unit, tag: string): UnitElement;
|
|
107
|
+
static currentComponent: Function;
|
|
108
108
|
static extend(unit: Unit, component: Function, props?: Object): {
|
|
109
109
|
[key: string]: any;
|
|
110
110
|
};
|
|
111
111
|
static start(unit: Unit): void;
|
|
112
112
|
static stop(unit: Unit): void;
|
|
113
113
|
static update(unit: Unit): void;
|
|
114
|
-
static
|
|
115
|
-
static
|
|
116
|
-
static
|
|
117
|
-
static ticker: Ticker;
|
|
114
|
+
static render(unit: Unit): void;
|
|
115
|
+
static rootUnit: Unit;
|
|
116
|
+
static currentUnit: Unit;
|
|
118
117
|
static reset(): void;
|
|
119
118
|
static wrap(unit: Unit, listener: Function): (...args: any[]) => any;
|
|
120
119
|
static scope(snapshot: Snapshot, func: Function, ...args: any[]): any;
|
|
@@ -125,6 +124,8 @@ declare class Unit {
|
|
|
125
124
|
static type2units: MapSet<string, Unit>;
|
|
126
125
|
on(type: string, listener: Function, options?: boolean | AddEventListenerOptions): void;
|
|
127
126
|
off(type?: string, listener?: Function): void;
|
|
127
|
+
static on(unit: Unit, type: string, listener: Function, options?: boolean | AddEventListenerOptions): void;
|
|
128
|
+
static off(unit: Unit, type: string, listener?: Function): void;
|
|
128
129
|
static emit(type: string, ...args: any[]): void;
|
|
129
130
|
}
|
|
130
131
|
declare class UnitPromise {
|
|
@@ -285,7 +286,7 @@ declare const xnew$1: CreateUnit & {
|
|
|
285
286
|
protect(): void;
|
|
286
287
|
};
|
|
287
288
|
|
|
288
|
-
declare function AccordionFrame(
|
|
289
|
+
declare function AccordionFrame(unit: Unit, { open, duration, easing }?: {
|
|
289
290
|
open?: boolean;
|
|
290
291
|
duration?: number;
|
|
291
292
|
easing?: string;
|
|
@@ -294,11 +295,7 @@ declare function AccordionFrame(frame: Unit, { open, duration, easing }?: {
|
|
|
294
295
|
open(): void;
|
|
295
296
|
close(): void;
|
|
296
297
|
};
|
|
297
|
-
declare function
|
|
298
|
-
declare function AccordionBullet(bullet: Unit, { type }?: {
|
|
299
|
-
type?: string;
|
|
300
|
-
}): void;
|
|
301
|
-
declare function AccordionContent(content: Unit, {}?: {}): {
|
|
298
|
+
declare function AccordionContent(unit: Unit, {}?: {}): {
|
|
302
299
|
transition({ element, rate }: {
|
|
303
300
|
element: HTMLElement;
|
|
304
301
|
rate: number;
|
|
@@ -329,30 +326,6 @@ declare function ModalContent(content: Unit, { background }?: {
|
|
|
329
326
|
}): void;
|
|
330
327
|
};
|
|
331
328
|
|
|
332
|
-
declare function TabFrame(frame: Unit, { select }?: {
|
|
333
|
-
select?: string;
|
|
334
|
-
}): void;
|
|
335
|
-
declare function TabButton(button: Unit, { key }?: {
|
|
336
|
-
key?: string;
|
|
337
|
-
}): {
|
|
338
|
-
select({ element }: {
|
|
339
|
-
element: HTMLElement;
|
|
340
|
-
}): void;
|
|
341
|
-
deselect({ element }: {
|
|
342
|
-
element: HTMLElement;
|
|
343
|
-
}): void;
|
|
344
|
-
};
|
|
345
|
-
declare function TabContent(content: Unit, { key }?: {
|
|
346
|
-
key?: string;
|
|
347
|
-
}): {
|
|
348
|
-
select({ element }: {
|
|
349
|
-
element: HTMLElement;
|
|
350
|
-
}): void;
|
|
351
|
-
deselect({ element }: {
|
|
352
|
-
element: HTMLElement;
|
|
353
|
-
}): void;
|
|
354
|
-
};
|
|
355
|
-
|
|
356
329
|
declare function DragFrame(frame: Unit, { x, y }?: {
|
|
357
330
|
x?: number;
|
|
358
331
|
y?: number;
|
|
@@ -756,12 +729,7 @@ declare const basics: {
|
|
|
756
729
|
ModalFrame: typeof ModalFrame;
|
|
757
730
|
ModalContent: typeof ModalContent;
|
|
758
731
|
AccordionFrame: typeof AccordionFrame;
|
|
759
|
-
AccordionHeader: typeof AccordionHeader;
|
|
760
|
-
AccordionBullet: typeof AccordionBullet;
|
|
761
732
|
AccordionContent: typeof AccordionContent;
|
|
762
|
-
TabFrame: typeof TabFrame;
|
|
763
|
-
TabButton: typeof TabButton;
|
|
764
|
-
TabContent: typeof TabContent;
|
|
765
733
|
TextStream: typeof TextStream;
|
|
766
734
|
DragFrame: typeof DragFrame;
|
|
767
735
|
DragTarget: typeof DragTarget;
|