@mulsense/xnew 0.3.6 → 0.4.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 +1 -1
- package/dist/addons/xmatter.mjs +1 -1
- 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/xnew.d.ts +35 -17
- package/dist/xnew.js +584 -569
- package/dist/xnew.mjs +584 -569
- 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.4.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.4.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.4.x
|
|
41
41
|
```
|
|
42
42
|
|
|
43
43
|
Then import it in your JavaScript file:
|
package/dist/addons/xmatter.js
CHANGED
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
const root = {};
|
|
22
22
|
xnew.context('xmatter.root', root);
|
|
23
23
|
root.engine = engine !== null && engine !== void 0 ? engine : Matter.Engine.create();
|
|
24
|
-
unit.on('
|
|
24
|
+
unit.on('process', () => {
|
|
25
25
|
Matter.Engine.update(root.engine);
|
|
26
26
|
});
|
|
27
27
|
}
|
package/dist/addons/xmatter.mjs
CHANGED
|
@@ -18,7 +18,7 @@ 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('
|
|
21
|
+
unit.on('process', () => {
|
|
22
22
|
Matter.Engine.update(root.engine);
|
|
23
23
|
});
|
|
24
24
|
}
|
package/dist/addons/xrapier2d.js
CHANGED
package/dist/addons/xrapier3d.js
CHANGED
package/dist/xnew.d.ts
CHANGED
|
@@ -27,6 +27,35 @@ declare class Ticker {
|
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
type UnitElement = HTMLElement | SVGElement;
|
|
30
|
+
|
|
31
|
+
interface EventProps {
|
|
32
|
+
element: UnitElement;
|
|
33
|
+
type: string;
|
|
34
|
+
listener: Function;
|
|
35
|
+
options?: boolean | AddEventListenerOptions;
|
|
36
|
+
}
|
|
37
|
+
declare class EventManager {
|
|
38
|
+
private map;
|
|
39
|
+
add(props: EventProps): void;
|
|
40
|
+
remove({ type, listener }: {
|
|
41
|
+
type: string;
|
|
42
|
+
listener: Function;
|
|
43
|
+
}): void;
|
|
44
|
+
private basic;
|
|
45
|
+
private resize;
|
|
46
|
+
private click;
|
|
47
|
+
private click_outside;
|
|
48
|
+
private pointer;
|
|
49
|
+
private mouse;
|
|
50
|
+
private touch;
|
|
51
|
+
private pointer_outside;
|
|
52
|
+
private wheel;
|
|
53
|
+
private drag;
|
|
54
|
+
private gesture;
|
|
55
|
+
private key;
|
|
56
|
+
private key_arrow;
|
|
57
|
+
}
|
|
58
|
+
|
|
30
59
|
interface Context {
|
|
31
60
|
stack: Context | null;
|
|
32
61
|
key?: string;
|
|
@@ -37,7 +66,7 @@ interface Snapshot {
|
|
|
37
66
|
context: Context;
|
|
38
67
|
element: UnitElement;
|
|
39
68
|
}
|
|
40
|
-
interface
|
|
69
|
+
interface Internal {
|
|
41
70
|
parent: Unit | null;
|
|
42
71
|
target: Object | null;
|
|
43
72
|
props?: Object;
|
|
@@ -62,10 +91,11 @@ interface UnitInternal {
|
|
|
62
91
|
}>;
|
|
63
92
|
defines: Record<string, any>;
|
|
64
93
|
systems: Record<string, Function[]>;
|
|
94
|
+
eventManager: EventManager;
|
|
65
95
|
}
|
|
66
96
|
declare class Unit {
|
|
67
97
|
[key: string]: any;
|
|
68
|
-
_:
|
|
98
|
+
_: Internal;
|
|
69
99
|
constructor(parent: Unit | null, ...args: any[]);
|
|
70
100
|
get element(): UnitElement;
|
|
71
101
|
start(): void;
|
|
@@ -81,7 +111,7 @@ declare class Unit {
|
|
|
81
111
|
static start(unit: Unit): void;
|
|
82
112
|
static stop(unit: Unit): void;
|
|
83
113
|
static update(unit: Unit): void;
|
|
84
|
-
static
|
|
114
|
+
static process(unit: Unit): void;
|
|
85
115
|
static root: Unit;
|
|
86
116
|
static current: Unit;
|
|
87
117
|
static ticker: Ticker;
|
|
@@ -275,12 +305,7 @@ declare function AccordionContent(content: Unit, {}?: {}): {
|
|
|
275
305
|
}): void;
|
|
276
306
|
};
|
|
277
307
|
|
|
278
|
-
declare function
|
|
279
|
-
declare function DirectEvent(unit: Unit): void;
|
|
280
|
-
declare function KeyboardEvent(keyboard: Unit): void;
|
|
281
|
-
declare function PointerEvent(unit: Unit): void;
|
|
282
|
-
|
|
283
|
-
declare function Screen(screen: Unit, { width, height, fit }?: {
|
|
308
|
+
declare function Screen(unit: Unit, { width, height, fit }?: {
|
|
284
309
|
width?: number | undefined;
|
|
285
310
|
height?: number | undefined;
|
|
286
311
|
fit?: string | undefined;
|
|
@@ -332,7 +357,7 @@ declare function DragFrame(frame: Unit, { x, y }?: {
|
|
|
332
357
|
x?: number;
|
|
333
358
|
y?: number;
|
|
334
359
|
}): void;
|
|
335
|
-
declare function DragTarget(
|
|
360
|
+
declare function DragTarget(unit: Unit, {}?: {}): void;
|
|
336
361
|
|
|
337
362
|
declare function AnalogStick(unit: Unit, { stroke, strokeOpacity, strokeWidth, strokeLinejoin, fill, fillOpacity }?: {
|
|
338
363
|
stroke?: string;
|
|
@@ -359,8 +384,6 @@ declare function TextStream(unit: Unit, { text, speed, fade }?: {
|
|
|
359
384
|
fade?: number;
|
|
360
385
|
}): void;
|
|
361
386
|
|
|
362
|
-
declare function VolumeController(unit: Unit, {}?: {}): void;
|
|
363
|
-
|
|
364
387
|
declare const icons: {
|
|
365
388
|
AcademicCap(unit: Unit, props: Object): void;
|
|
366
389
|
AdjustmentsHorizontal(unit: Unit, props: Object): void;
|
|
@@ -730,10 +753,6 @@ declare class Synthesizer {
|
|
|
730
753
|
|
|
731
754
|
declare const basics: {
|
|
732
755
|
Screen: typeof Screen;
|
|
733
|
-
PointerEvent: typeof PointerEvent;
|
|
734
|
-
DirectEvent: typeof DirectEvent;
|
|
735
|
-
ResizeEvent: typeof ResizeEvent;
|
|
736
|
-
KeyboardEvent: typeof KeyboardEvent;
|
|
737
756
|
ModalFrame: typeof ModalFrame;
|
|
738
757
|
ModalContent: typeof ModalContent;
|
|
739
758
|
AccordionFrame: typeof AccordionFrame;
|
|
@@ -748,7 +767,6 @@ declare const basics: {
|
|
|
748
767
|
DragTarget: typeof DragTarget;
|
|
749
768
|
AnalogStick: typeof AnalogStick;
|
|
750
769
|
DirectionalPad: typeof DirectionalPad;
|
|
751
|
-
VolumeController: typeof VolumeController;
|
|
752
770
|
};
|
|
753
771
|
|
|
754
772
|
declare const audio: {
|