@mulsense/xnew 0.3.7 → 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 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.3.x/dist/xnew.js"></script>
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.3.x/dist/xnew.mjs"
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.3.x
40
+ npm install @mulsense/xnew@0.4.x
41
41
  ```
42
42
 
43
43
  Then import it in your JavaScript file:
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 UnitInternal {
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
- _: UnitInternal;
98
+ _: Internal;
69
99
  constructor(parent: Unit | null, ...args: any[]);
70
100
  get element(): UnitElement;
71
101
  start(): void;
@@ -275,10 +305,7 @@ declare function AccordionContent(content: Unit, {}?: {}): {
275
305
  }): void;
276
306
  };
277
307
 
278
- declare function ResizeEvent(resize: Unit): void;
279
- declare function DirectEvent(unit: Unit): void;
280
-
281
- declare function Screen(screen: Unit, { width, height, fit }?: {
308
+ declare function Screen(unit: Unit, { width, height, fit }?: {
282
309
  width?: number | undefined;
283
310
  height?: number | undefined;
284
311
  fit?: string | undefined;
@@ -330,7 +357,7 @@ declare function DragFrame(frame: Unit, { x, y }?: {
330
357
  x?: number;
331
358
  y?: number;
332
359
  }): void;
333
- declare function DragTarget(target: Unit, {}?: {}): void;
360
+ declare function DragTarget(unit: Unit, {}?: {}): void;
334
361
 
335
362
  declare function AnalogStick(unit: Unit, { stroke, strokeOpacity, strokeWidth, strokeLinejoin, fill, fillOpacity }?: {
336
363
  stroke?: string;
@@ -357,8 +384,6 @@ declare function TextStream(unit: Unit, { text, speed, fade }?: {
357
384
  fade?: number;
358
385
  }): void;
359
386
 
360
- declare function VolumeController(unit: Unit, {}?: {}): void;
361
-
362
387
  declare const icons: {
363
388
  AcademicCap(unit: Unit, props: Object): void;
364
389
  AdjustmentsHorizontal(unit: Unit, props: Object): void;
@@ -728,8 +753,6 @@ declare class Synthesizer {
728
753
 
729
754
  declare const basics: {
730
755
  Screen: typeof Screen;
731
- DirectEvent: typeof DirectEvent;
732
- ResizeEvent: typeof ResizeEvent;
733
756
  ModalFrame: typeof ModalFrame;
734
757
  ModalContent: typeof ModalContent;
735
758
  AccordionFrame: typeof AccordionFrame;
@@ -744,7 +767,6 @@ declare const basics: {
744
767
  DragTarget: typeof DragTarget;
745
768
  AnalogStick: typeof AnalogStick;
746
769
  DirectionalPad: typeof DirectionalPad;
747
- VolumeController: typeof VolumeController;
748
770
  };
749
771
 
750
772
  declare const audio: {