@mulsense/xnew 0.6.3 → 0.6.5
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 +1 -1
- package/dist/addons/xmatter.mjs +1 -1
- package/dist/addons/xpixi.js +5 -2
- package/dist/addons/xpixi.mjs +5 -2
- package/dist/addons/xrapier2d.js +1 -1
- package/dist/addons/xrapier2d.mjs +1 -1
- package/dist/addons/xrapier3d.js +1 -1
- package/dist/addons/xrapier3d.mjs +1 -1
- package/dist/addons/xthree.js +2 -1
- package/dist/addons/xthree.mjs +2 -1
- package/dist/xnew.d.ts +26 -30
- package/dist/xnew.js +272 -226
- package/dist/xnew.mjs +272 -226
- package/package.json +1 -1
package/dist/addons/xmatter.js
CHANGED
package/dist/addons/xmatter.mjs
CHANGED
package/dist/addons/xpixi.js
CHANGED
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
|
|
26
26
|
var xpixi = {
|
|
27
27
|
initialize({ canvas = null } = {}) {
|
|
28
|
-
xnew(Root, { canvas });
|
|
28
|
+
xnew.promise(xnew(Root, { canvas }));
|
|
29
29
|
},
|
|
30
30
|
nest(object) {
|
|
31
31
|
xnew(Nest, { object });
|
|
@@ -49,7 +49,10 @@
|
|
|
49
49
|
xnew.promise(PIXI__namespace.autoDetectRenderer({
|
|
50
50
|
width: canvas.width, height: canvas.height, view: canvas,
|
|
51
51
|
antialias: true, backgroundAlpha: 0,
|
|
52
|
-
})).then((value) =>
|
|
52
|
+
})).then((value) => {
|
|
53
|
+
renderer = value;
|
|
54
|
+
xnew.resolve();
|
|
55
|
+
});
|
|
53
56
|
let scene = new PIXI__namespace.Container();
|
|
54
57
|
return {
|
|
55
58
|
get renderer() { return renderer; },
|
package/dist/addons/xpixi.mjs
CHANGED
|
@@ -3,7 +3,7 @@ import * as PIXI from 'pixi.js';
|
|
|
3
3
|
|
|
4
4
|
var xpixi = {
|
|
5
5
|
initialize({ canvas = null } = {}) {
|
|
6
|
-
xnew(Root, { canvas });
|
|
6
|
+
xnew.promise(xnew(Root, { canvas }));
|
|
7
7
|
},
|
|
8
8
|
nest(object) {
|
|
9
9
|
xnew(Nest, { object });
|
|
@@ -27,7 +27,10 @@ function Root(unit, { canvas }) {
|
|
|
27
27
|
xnew.promise(PIXI.autoDetectRenderer({
|
|
28
28
|
width: canvas.width, height: canvas.height, view: canvas,
|
|
29
29
|
antialias: true, backgroundAlpha: 0,
|
|
30
|
-
})).then((value) =>
|
|
30
|
+
})).then((value) => {
|
|
31
|
+
renderer = value;
|
|
32
|
+
xnew.resolve();
|
|
33
|
+
});
|
|
31
34
|
let scene = new PIXI.Container();
|
|
32
35
|
return {
|
|
33
36
|
get renderer() { return renderer; },
|
package/dist/addons/xrapier2d.js
CHANGED
package/dist/addons/xrapier3d.js
CHANGED
package/dist/addons/xthree.js
CHANGED
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
|
|
26
26
|
var xthree = {
|
|
27
27
|
initialize({ canvas = null, camera = null } = {}) {
|
|
28
|
-
xnew(Root, { canvas, camera });
|
|
28
|
+
xnew.promise(xnew(Root, { canvas, camera }));
|
|
29
29
|
},
|
|
30
30
|
nest(object) {
|
|
31
31
|
xnew(Nest, { object });
|
|
@@ -53,6 +53,7 @@
|
|
|
53
53
|
renderer.setClearColor(0x000000, 0);
|
|
54
54
|
camera = camera !== null && camera !== void 0 ? camera : new THREE__namespace.PerspectiveCamera(45, renderer.domElement.width / renderer.domElement.height);
|
|
55
55
|
const scene = new THREE__namespace.Scene();
|
|
56
|
+
xnew.resolve();
|
|
56
57
|
return {
|
|
57
58
|
get canvas() { return canvas; },
|
|
58
59
|
get camera() { return camera; },
|
package/dist/addons/xthree.mjs
CHANGED
|
@@ -3,7 +3,7 @@ import * as THREE from 'three';
|
|
|
3
3
|
|
|
4
4
|
var xthree = {
|
|
5
5
|
initialize({ canvas = null, camera = null } = {}) {
|
|
6
|
-
xnew(Root, { canvas, camera });
|
|
6
|
+
xnew.promise(xnew(Root, { canvas, camera }));
|
|
7
7
|
},
|
|
8
8
|
nest(object) {
|
|
9
9
|
xnew(Nest, { object });
|
|
@@ -31,6 +31,7 @@ function Root(unit, { canvas, camera }) {
|
|
|
31
31
|
renderer.setClearColor(0x000000, 0);
|
|
32
32
|
camera = camera !== null && camera !== void 0 ? camera : new THREE.PerspectiveCamera(45, renderer.domElement.width / renderer.domElement.height);
|
|
33
33
|
const scene = new THREE.Scene();
|
|
34
|
+
xnew.resolve();
|
|
34
35
|
return {
|
|
35
36
|
get canvas() { return canvas; },
|
|
36
37
|
get camera() { return camera; },
|
package/dist/xnew.d.ts
CHANGED
|
@@ -20,14 +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
|
-
interface TimerOptions {
|
|
24
|
-
transition?: Function;
|
|
25
|
-
timeout?: Function;
|
|
26
|
-
duration: number;
|
|
27
|
-
iterations: number;
|
|
28
|
-
easing?: string;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
23
|
declare class Eventor {
|
|
32
24
|
private map;
|
|
33
25
|
add(element: HTMLElement | SVGElement, type: string, listener: Function, options?: boolean | AddEventListenerOptions): void;
|
|
@@ -54,26 +46,23 @@ declare class Eventor {
|
|
|
54
46
|
type UnitElement = HTMLElement | SVGElement;
|
|
55
47
|
declare class UnitPromise {
|
|
56
48
|
promise: Promise<any>;
|
|
57
|
-
|
|
58
|
-
constructor(promise: Promise<any>,
|
|
49
|
+
Component: Function | null;
|
|
50
|
+
constructor(promise: Promise<any>, Component: Function | null);
|
|
59
51
|
then(callback: Function): UnitPromise;
|
|
60
52
|
catch(callback: Function): UnitPromise;
|
|
61
53
|
finally(callback: Function): UnitPromise;
|
|
54
|
+
private wrap;
|
|
62
55
|
}
|
|
63
56
|
declare class UnitTimer {
|
|
64
57
|
private unit;
|
|
65
58
|
private stack;
|
|
66
|
-
constructor(options: TimerOptions);
|
|
67
59
|
clear(): void;
|
|
68
|
-
timeout(
|
|
69
|
-
|
|
70
|
-
transition(transition: Function, duration?: number, easing?: string):
|
|
71
|
-
static execute
|
|
72
|
-
static next
|
|
73
|
-
static Component
|
|
74
|
-
options: TimerOptions;
|
|
75
|
-
snapshot: Snapshot;
|
|
76
|
-
}): void;
|
|
60
|
+
timeout(callback: Function, duration?: number): UnitTimer;
|
|
61
|
+
interval(callback: Function, duration?: number, iterations?: number): UnitTimer;
|
|
62
|
+
transition(transition: Function, duration?: number, easing?: string): UnitTimer;
|
|
63
|
+
private static execute;
|
|
64
|
+
private static next;
|
|
65
|
+
private static Component;
|
|
77
66
|
}
|
|
78
67
|
interface Context {
|
|
79
68
|
stack: Context | null;
|
|
@@ -103,6 +92,11 @@ interface Internal {
|
|
|
103
92
|
ancestors: Unit[];
|
|
104
93
|
children: Unit[];
|
|
105
94
|
promises: UnitPromise[];
|
|
95
|
+
done: {
|
|
96
|
+
promise: Promise<any>;
|
|
97
|
+
resolve: Function;
|
|
98
|
+
reject: Function;
|
|
99
|
+
};
|
|
106
100
|
nestElements: {
|
|
107
101
|
element: UnitElement;
|
|
108
102
|
owned: boolean;
|
|
@@ -133,7 +127,7 @@ declare class Unit {
|
|
|
133
127
|
static finalize(unit: Unit): void;
|
|
134
128
|
static nest(unit: Unit, target: UnitElement | string, textContent?: string | number): UnitElement;
|
|
135
129
|
static currentComponent: Function;
|
|
136
|
-
static extend(unit: Unit,
|
|
130
|
+
static extend(unit: Unit, Component: Function, props?: Object): {
|
|
137
131
|
[key: string]: any;
|
|
138
132
|
};
|
|
139
133
|
static start(unit: Unit): void;
|
|
@@ -147,7 +141,7 @@ declare class Unit {
|
|
|
147
141
|
static snapshot(unit: Unit): Snapshot;
|
|
148
142
|
static context(unit: Unit, key: any, value?: any): any;
|
|
149
143
|
static component2units: MapSet<Function, Unit>;
|
|
150
|
-
static find(
|
|
144
|
+
static find(Component: Function): Unit[];
|
|
151
145
|
static type2units: MapSet<string, Unit>;
|
|
152
146
|
on(type: string, listener: Function, options?: boolean | AddEventListenerOptions): void;
|
|
153
147
|
off(type?: string, listener?: Function): void;
|
|
@@ -158,20 +152,20 @@ declare class Unit {
|
|
|
158
152
|
|
|
159
153
|
interface CreateUnit {
|
|
160
154
|
/**
|
|
161
|
-
*
|
|
155
|
+
* creates a new Unit component
|
|
162
156
|
* @param Component - component function
|
|
163
157
|
* @param props - properties for component function
|
|
164
|
-
* @returns
|
|
158
|
+
* @returns a new Unit instance
|
|
165
159
|
* @example
|
|
166
160
|
* const unit = xnew(MyComponent, { data: 0 })
|
|
167
161
|
*/
|
|
168
162
|
(Component?: Function | string, props?: Object): Unit;
|
|
169
163
|
/**
|
|
170
|
-
*
|
|
164
|
+
* creates a new Unit component
|
|
171
165
|
* @param target - HTMLElement | SVGElement, or HTML tag for new element
|
|
172
166
|
* @param Component - component function
|
|
173
167
|
* @param props - properties for component function
|
|
174
|
-
* @returns
|
|
168
|
+
* @returns a new Unit instance
|
|
175
169
|
* @example
|
|
176
170
|
* const unit = xnew(element, MyComponent, { data: 0 })
|
|
177
171
|
* const unit = xnew('<div>', MyComponent, { data: 0 })
|
|
@@ -285,19 +279,21 @@ declare namespace xnew {
|
|
|
285
279
|
}
|
|
286
280
|
declare const xnew: CreateUnit & {
|
|
287
281
|
nest(target: UnitElement | string): HTMLElement | SVGElement;
|
|
288
|
-
extend(
|
|
282
|
+
extend(Component: Function, props?: Object): {
|
|
289
283
|
[key: string]: any;
|
|
290
284
|
};
|
|
291
285
|
context(component: Function): any;
|
|
292
|
-
promise(promise: Promise<any>): UnitPromise;
|
|
286
|
+
promise(promise: Promise<any> | Unit): UnitPromise;
|
|
293
287
|
then(callback: Function): UnitPromise;
|
|
294
288
|
catch(callback: Function): UnitPromise;
|
|
289
|
+
resolve(value?: any): void;
|
|
290
|
+
reject(reason?: any): void;
|
|
295
291
|
finally(callback: Function): UnitPromise;
|
|
296
292
|
scope(callback: any): any;
|
|
297
293
|
find(component: Function): Unit[];
|
|
298
294
|
emit(type: string, ...args: any[]): void;
|
|
299
|
-
timeout(
|
|
300
|
-
interval(
|
|
295
|
+
timeout(callback: Function, duration?: number): UnitTimer;
|
|
296
|
+
interval(callback: Function, duration: number, iterations?: number): UnitTimer;
|
|
301
297
|
transition(transition: Function, duration?: number, easing?: string): UnitTimer;
|
|
302
298
|
protect(): void;
|
|
303
299
|
} & {
|