@mulsense/xnew 0.1.3 → 0.1.4

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.
@@ -2,88 +2,80 @@ import { MapSet, MapMap } from './map';
2
2
  export type UnitElement = HTMLElement | SVGElement;
3
3
  interface Context {
4
4
  stack: Context | null;
5
- key: string;
6
- value: any;
5
+ key?: string;
6
+ value?: any;
7
7
  }
8
8
  interface Snapshot {
9
9
  unit: Unit;
10
- context: Context | null;
11
- element: UnitElement | null;
10
+ context: Context;
11
+ element: UnitElement;
12
12
  }
13
13
  interface Capture {
14
14
  checker: (unit: Unit) => boolean;
15
15
  execute: (unit: Unit) => any;
16
16
  }
17
+ export declare class UnitPromise {
18
+ private promise;
19
+ constructor(promise: Promise<any>);
20
+ then(callback: Function): UnitPromise;
21
+ catch(callback: Function): UnitPromise;
22
+ finally(callback: Function): UnitPromise;
23
+ }
17
24
  interface UnitInternal {
18
25
  parent: Unit | null;
19
- children: Unit[];
20
26
  target: Object | null;
21
27
  props?: Object;
22
28
  baseElement: UnitElement;
23
- baseContext: Context | null;
29
+ baseContext: Context;
24
30
  baseComponent: Function;
25
31
  currentElement: UnitElement;
26
- currentContext: Context | null;
27
- nextNest: {
28
- element: UnitElement;
29
- position: InsertPosition;
30
- };
31
- components: Set<Function>;
32
- listeners: MapMap<string, Function, [UnitElement, Function]>;
33
- sublisteners: MapMap<string, Function, [UnitElement | Window | Document, Function]>;
34
- captures: Capture[];
32
+ currentContext: Context;
33
+ anchor: UnitElement | null;
35
34
  state: string;
36
35
  tostart: boolean;
36
+ children: Unit[];
37
+ promises: Promise<any>[];
38
+ captures: Capture[];
39
+ elements: UnitElement[];
40
+ components: Function[];
41
+ listeners1: MapMap<string, Function, [UnitElement, Function]>;
42
+ listeners2: MapMap<string, Function, [UnitElement | Window | Document, Function]>;
37
43
  defines: Record<string, any>;
38
- system: Record<string, Function[]>;
44
+ systems: Record<string, Function[]>;
39
45
  }
40
46
  export declare class Unit {
41
47
  [key: string]: any;
42
48
  _: UnitInternal;
43
- static roots: Unit[];
44
- static current: Unit | null;
45
- constructor(target: Object | null, component?: Function | string, props?: Object);
49
+ static current: Unit;
50
+ constructor(parent: Unit | null, target: Object | null, component?: Function | string, props?: Object);
46
51
  get element(): UnitElement;
52
+ get components(): Function[];
47
53
  start(): void;
48
54
  stop(): void;
49
55
  finalize(): void;
50
56
  reboot(): void;
51
- static initialize(unit: Unit, nextNest: {
52
- element: UnitElement;
53
- position: InsertPosition;
54
- }): void;
57
+ static initialize(unit: Unit, anchor: UnitElement | null): void;
55
58
  static finalize(unit: Unit): void;
56
- static nest(unit: Unit, tag: string): UnitElement | null;
59
+ static nest(unit: Unit, tag: string): UnitElement;
57
60
  static extend(unit: Unit, component: Function, props?: Object): void;
58
61
  static start(unit: Unit, time: number): void;
59
62
  static stop(unit: Unit): void;
60
63
  static update(unit: Unit, time: number): void;
64
+ static root: Unit | null;
61
65
  static ticker(time: number): void;
62
66
  static reset(): void;
63
- static wrap(listener: Function): (...args: any[]) => any;
64
- static scope(snapshot: Snapshot | null, func: Function, ...args: any[]): any;
65
- static snapshot(unit: Unit): Snapshot | null;
67
+ static wrap(unit: Unit, listener: Function): (...args: any[]) => any;
68
+ static scope(snapshot: Snapshot, func: Function, ...args: any[]): any;
69
+ static snapshot(unit: Unit): Snapshot;
66
70
  static stack(unit: Unit, key: string, value: any): void;
67
71
  static trace(unit: Unit, key: string): any;
68
72
  static componentUnits: MapSet<Function, Unit>;
69
- get components(): Set<Function>;
70
73
  static find(component: Function): Unit[];
71
74
  static typeUnits: MapSet<string, Unit>;
72
75
  on(type: string, listener: Function, options?: boolean | AddEventListenerOptions): void;
73
76
  off(type?: string, listener?: Function): void;
74
77
  emit(type: string, ...args: any[]): void;
75
- static subon(unit: any, target: UnitElement | Window | Document, type: string, listener: Function, options?: boolean | AddEventListenerOptions): void;
76
- static suboff(unit: any, target: UnitElement | Window | Document | null, type?: string, listener?: Function): void;
77
- }
78
- export declare class UnitPromise {
79
- private promise;
80
- constructor(executor: (resolve: (value: any) => void, reject: (reason?: any) => void) => void);
81
- then(callback: Function): UnitPromise;
82
- catch(callback: Function): UnitPromise;
83
- finally(callback: Function): UnitPromise;
84
- static promises: MapSet<Unit, UnitPromise>;
85
- static get(unit: Unit): Promise<any[]>;
86
- static finalize(unit: Unit): void;
87
- static execute(unit: Unit, promise?: Promise<any>): UnitPromise;
78
+ static subon(unit: Unit, target: UnitElement | Window | Document, type: string, listener: Function, options?: boolean | AddEventListenerOptions): void;
79
+ static suboff(unit: Unit, target: UnitElement | Window | Document | null, type?: string, listener?: Function): void;
88
80
  }
89
81
  export {};
@@ -2,8 +2,4 @@ import { Unit } from './unit';
2
2
  export declare namespace xnew {
3
3
  type Unit = InstanceType<typeof Unit>;
4
4
  }
5
- export interface xnewtype {
6
- (...args: any[]): Unit;
7
- [key: string]: any;
8
- }
9
- export declare const xnew: xnewtype;
5
+ export declare const xnew: any;
@@ -8,7 +8,6 @@ import { AccordionFrame, AccordionHeader, AccordionBullet, AccordionContent } fr
8
8
  import { DragFrame, DragTarget } from './basics/SubWIndow';
9
9
  import { TouchStick, TouchDPad, TouchButton } from './basics/Touch';
10
10
  import { Unit } from './core/unit';
11
- import { xnewtype as basetype } from './core/xnew';
12
11
  import { synthesizer } from './audio/synthesizer';
13
12
  declare const basics: {
14
13
  Screen: typeof Screen;
@@ -33,12 +32,14 @@ declare const basics: {
33
32
  declare const audio: {
34
33
  synthesizer: typeof synthesizer;
35
34
  };
36
- interface xnewtype extends basetype {
35
+ export interface xnew_interface {
36
+ (...args: any[]): Unit;
37
+ [key: string]: any;
37
38
  basics: typeof basics;
38
39
  audio: typeof audio;
39
40
  }
40
41
  declare namespace xnew {
41
42
  type Unit = InstanceType<typeof Unit>;
42
43
  }
43
- declare const xnew: xnewtype;
44
+ declare const xnew: xnew_interface;
44
45
  export default xnew;
package/dist/xnew.d.ts CHANGED
@@ -25,13 +25,13 @@ declare class MapMap<Key1, Key2, Value> extends Map<Key1, Map<Key2, Value>> {
25
25
  type UnitElement = HTMLElement | SVGElement;
26
26
  interface Context {
27
27
  stack: Context | null;
28
- key: string;
29
- value: any;
28
+ key?: string;
29
+ value?: any;
30
30
  }
31
31
  interface Snapshot {
32
32
  unit: Unit;
33
- context: Context | null;
34
- element: UnitElement | null;
33
+ context: Context;
34
+ element: UnitElement;
35
35
  }
36
36
  interface Capture {
37
37
  checker: (unit: Unit) => boolean;
@@ -39,74 +39,66 @@ interface Capture {
39
39
  }
40
40
  interface UnitInternal {
41
41
  parent: Unit | null;
42
- children: Unit[];
43
42
  target: Object | null;
44
43
  props?: Object;
45
44
  baseElement: UnitElement;
46
- baseContext: Context | null;
45
+ baseContext: Context;
47
46
  baseComponent: Function;
48
47
  currentElement: UnitElement;
49
- currentContext: Context | null;
50
- nextNest: {
51
- element: UnitElement;
52
- position: InsertPosition;
53
- };
54
- components: Set<Function>;
55
- listeners: MapMap<string, Function, [UnitElement, Function]>;
56
- sublisteners: MapMap<string, Function, [UnitElement | Window | Document, Function]>;
57
- captures: Capture[];
48
+ currentContext: Context;
49
+ anchor: UnitElement | null;
58
50
  state: string;
59
51
  tostart: boolean;
52
+ children: Unit[];
53
+ promises: Promise<any>[];
54
+ captures: Capture[];
55
+ elements: UnitElement[];
56
+ components: Function[];
57
+ listeners1: MapMap<string, Function, [UnitElement, Function]>;
58
+ listeners2: MapMap<string, Function, [UnitElement | Window | Document, Function]>;
60
59
  defines: Record<string, any>;
61
- system: Record<string, Function[]>;
60
+ systems: Record<string, Function[]>;
62
61
  }
63
62
  declare class Unit {
64
63
  [key: string]: any;
65
64
  _: UnitInternal;
66
- static roots: Unit[];
67
- static current: Unit | null;
68
- constructor(target: Object | null, component?: Function | string, props?: Object);
65
+ static current: Unit;
66
+ constructor(parent: Unit | null, target: Object | null, component?: Function | string, props?: Object);
69
67
  get element(): UnitElement;
68
+ get components(): Function[];
70
69
  start(): void;
71
70
  stop(): void;
72
71
  finalize(): void;
73
72
  reboot(): void;
74
- static initialize(unit: Unit, nextNest: {
75
- element: UnitElement;
76
- position: InsertPosition;
77
- }): void;
73
+ static initialize(unit: Unit, anchor: UnitElement | null): void;
78
74
  static finalize(unit: Unit): void;
79
- static nest(unit: Unit, tag: string): UnitElement | null;
75
+ static nest(unit: Unit, tag: string): UnitElement;
80
76
  static extend(unit: Unit, component: Function, props?: Object): void;
81
77
  static start(unit: Unit, time: number): void;
82
78
  static stop(unit: Unit): void;
83
79
  static update(unit: Unit, time: number): void;
80
+ static root: Unit | null;
84
81
  static ticker(time: number): void;
85
82
  static reset(): void;
86
- static wrap(listener: Function): (...args: any[]) => any;
87
- static scope(snapshot: Snapshot | null, func: Function, ...args: any[]): any;
88
- static snapshot(unit: Unit): Snapshot | null;
83
+ static wrap(unit: Unit, listener: Function): (...args: any[]) => any;
84
+ static scope(snapshot: Snapshot, func: Function, ...args: any[]): any;
85
+ static snapshot(unit: Unit): Snapshot;
89
86
  static stack(unit: Unit, key: string, value: any): void;
90
87
  static trace(unit: Unit, key: string): any;
91
88
  static componentUnits: MapSet<Function, Unit>;
92
- get components(): Set<Function>;
93
89
  static find(component: Function): Unit[];
94
90
  static typeUnits: MapSet<string, Unit>;
95
91
  on(type: string, listener: Function, options?: boolean | AddEventListenerOptions): void;
96
92
  off(type?: string, listener?: Function): void;
97
93
  emit(type: string, ...args: any[]): void;
98
- static subon(unit: any, target: UnitElement | Window | Document, type: string, listener: Function, options?: boolean | AddEventListenerOptions): void;
99
- static suboff(unit: any, target: UnitElement | Window | Document | null, type?: string, listener?: Function): void;
94
+ static subon(unit: Unit, target: UnitElement | Window | Document, type: string, listener: Function, options?: boolean | AddEventListenerOptions): void;
95
+ static suboff(unit: Unit, target: UnitElement | Window | Document | null, type?: string, listener?: Function): void;
100
96
  }
101
97
 
102
- interface xnewtype$1 {
103
- (...args: any[]): Unit;
104
- [key: string]: any;
105
- }
106
98
  declare namespace xnew$1 {
107
99
  type Unit = InstanceType<typeof Unit>;
108
100
  }
109
- declare const xnew$1: xnewtype$1;
101
+ declare const xnew$1: any;
110
102
 
111
103
  declare function UserEvent(self: xnew$1.Unit): void;
112
104
 
@@ -291,13 +283,16 @@ declare const basics: {
291
283
  declare const audio: {
292
284
  synthesizer: typeof synthesizer;
293
285
  };
294
- interface xnewtype extends xnewtype$1 {
286
+ interface xnew_interface {
287
+ (...args: any[]): Unit;
288
+ [key: string]: any;
295
289
  basics: typeof basics;
296
290
  audio: typeof audio;
297
291
  }
298
292
  declare namespace xnew {
299
293
  type Unit = InstanceType<typeof Unit>;
300
294
  }
301
- declare const xnew: xnewtype;
295
+ declare const xnew: xnew_interface;
302
296
 
303
297
  export { xnew as default };
298
+ export type { xnew_interface };