@mulsense/xnew 0.1.1 → 0.1.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.
@@ -1,34 +1,21 @@
1
- declare class MapEx<Key, Value> {
2
- protected map: Map<Key, Value>;
3
- get size(): number;
4
- forEach(callback: (value: Value, key: Key, map: Map<Key, Value>) => any): void;
5
- clear(): void;
6
- }
7
- export declare class MapSet<Key, Value> extends MapEx<Key, Set<Value>> {
8
- has(key: Key, value?: Value): boolean;
9
- get(key: Key): Set<Value> | undefined;
10
- keys(): IterableIterator<Key>;
1
+ export declare class MapSet<Key, Value> extends Map<Key, Set<Value>> {
2
+ has(key: Key): boolean;
3
+ has(key: Key, value: Value): boolean;
11
4
  add(key: Key, value: Value): MapSet<Key, Value>;
12
- delete(key: Key, value?: Value): boolean;
5
+ keys(): IterableIterator<Key>;
6
+ keys(key: Key): IterableIterator<Value>;
7
+ delete(key: Key): boolean;
8
+ delete(key: Key, value: Value): boolean;
13
9
  }
14
- export declare class MapMap<Key1, Key2, Value> extends MapEx<Key1, Map<Key2, Value>> {
15
- has(key1: Key1, key2?: Key2): boolean;
16
- set(key1: Key1, key2: Key2, value: Value): MapMap<Key1, Key2, Value>;
10
+ export declare class MapMap<Key1, Key2, Value> extends Map<Key1, Map<Key2, Value>> {
11
+ has(key1: Key1): boolean;
12
+ has(key1: Key1, key2: Key2): boolean;
13
+ set(key1: Key1, value: Map<Key2, Value>): this;
14
+ set(key1: Key1, key2: Key2, value: Value): this;
17
15
  get(key1: Key1): Map<Key2, Value> | undefined;
18
16
  get(key1: Key1, key2: Key2): Value | undefined;
19
17
  keys(): IterableIterator<Key1>;
20
18
  keys(key1: Key1): IterableIterator<Key2>;
21
- delete(key1: Key1, key2?: Key2): boolean;
22
- }
23
- export declare class MapMapMap<Key1, Key2, Key3, Value> extends MapEx<Key1, MapMap<Key2, Key3, Value>> {
24
- has(key1: Key1, key2?: Key2, key3?: Key3): boolean;
25
- set(key1: Key1, key2: Key2, key3: Key3, value: Value): MapMapMap<Key1, Key2, Key3, Value>;
26
- get(key1: Key1): MapMap<Key2, Key3, Value> | undefined;
27
- get(key1: Key1, key2: Key2): Map<Key3, Value> | undefined;
28
- get(key1: Key1, key2: Key2, key3: Key3): Value | undefined;
29
- keys(): IterableIterator<Key1>;
30
- keys(key1: Key1): IterableIterator<Key2>;
31
- keys(key1: Key1, key2: Key2): IterableIterator<Key3>;
32
- delete(key1: Key1, key2?: Key2, key3?: Key3): boolean;
19
+ delete(key1: Key1): boolean;
20
+ delete(key1: Key1, key2: Key2): boolean;
33
21
  }
34
- export {};
@@ -1,6 +1,5 @@
1
- import { MapSet, MapMapMap } from './map';
2
- declare const LIFECYCLE_EVENTS: readonly ["start", "update", "stop", "finalize"];
3
- type LifecycleEvent = typeof LIFECYCLE_EVENTS[number];
1
+ import { MapSet, MapMap } from './map';
2
+ export type UnitElement = HTMLElement | SVGElement;
4
3
  interface Context {
5
4
  stack: Context | null;
6
5
  key: string;
@@ -9,88 +8,77 @@ interface Context {
9
8
  interface Snapshot {
10
9
  unit: Unit | null;
11
10
  context: Context | null;
12
- element: HTMLElement | SVGElement | null;
11
+ element: UnitElement | null;
13
12
  }
14
13
  interface Capture {
15
14
  checker: (unit: Unit) => boolean;
16
15
  execute: (unit: Unit) => any;
17
16
  }
18
17
  interface UnitInternal {
19
- root: Unit;
20
18
  parent: Unit | null;
21
19
  children: Unit[];
22
20
  target: Object | null;
23
21
  props?: Object;
22
+ baseElement: UnitElement;
23
+ baseContext: Context | null;
24
+ baseComponent: Function;
25
+ currentElement: UnitElement;
24
26
  nextNest: {
25
- element: HTMLElement | SVGElement;
27
+ element: UnitElement;
26
28
  position: InsertPosition;
27
29
  };
28
- baseElement: HTMLElement | SVGElement;
29
- currentElement: HTMLElement | SVGElement;
30
- baseContext: Context | null;
31
- baseComponent: Function | null;
32
- components: Function[];
30
+ components: Set<Function>;
31
+ listeners: MapMap<string, Function, [UnitElement, Function]>;
32
+ sublisteners: MapMap<string, Function, [UnitElement | Window | Document, Function]>;
33
33
  captures: Capture[];
34
34
  state: string;
35
35
  tostart: boolean;
36
- upcount: number;
37
- resolved: boolean;
38
36
  defines: Record<string, any>;
39
- system: Record<LifecycleEvent, Function[]>;
37
+ system: Record<string, Function[]>;
40
38
  }
41
39
  export declare class Unit {
42
40
  [key: string]: any;
43
41
  _: UnitInternal;
44
42
  static roots: Unit[];
45
43
  constructor(target: Object | null, component?: Function | string, props?: Object);
46
- get element(): HTMLElement | SVGElement;
44
+ get element(): UnitElement;
47
45
  start(): void;
48
46
  stop(): void;
49
47
  finalize(): void;
50
48
  reboot(): void;
51
- get components(): Function[];
52
- on(type: string, listener: Function, options?: boolean | AddEventListenerOptions): Unit;
53
- off(type?: string, listener?: Function): Unit;
54
- emit(type: string, ...args: any[]): void;
55
- static initialize(unit: Unit): void;
49
+ static initialize(unit: Unit, nextNest: {
50
+ element: UnitElement;
51
+ position: InsertPosition;
52
+ }): void;
56
53
  static finalize(unit: Unit): void;
57
- static nest(unit: Unit, tag: string): HTMLElement | SVGElement | null;
54
+ static nest(unit: Unit, tag: string): UnitElement | null;
58
55
  static extend(unit: Unit, component: Function, props?: Object): void;
59
56
  static start(unit: Unit, time: number): void;
60
57
  static stop(unit: Unit): void;
61
58
  static update(unit: Unit, time: number): void;
62
59
  static ticker(time: number): void;
63
60
  static reset(): void;
61
+ static componentUnits: MapSet<Function, Unit>;
62
+ get components(): Set<Function>;
63
+ static find(component: Function): Unit[];
64
+ static typeUnits: MapSet<string, Unit>;
65
+ on(type: string, listener: Function, options?: boolean | AddEventListenerOptions): void;
66
+ off(type?: string, listener?: Function): void;
67
+ emit(type: string, ...args: any[]): void;
68
+ static subon(unit: any, target: UnitElement | Window | Document, type: string, listener: Function, options?: boolean | AddEventListenerOptions): void;
69
+ static suboff(unit: any, target: UnitElement | Window | Document | null, type?: string, listener?: Function): void;
64
70
  }
65
71
  export declare class UnitScope {
66
72
  static current: Unit | null;
67
73
  static contexts: Map<Unit | null, Context>;
68
74
  static initialize(unit: Unit | null, context: Context | null): void;
69
75
  static finalize(unit: Unit): void;
70
- static set(unit: Unit, context: Context): void;
71
- static get(unit: Unit | null): Context | null;
76
+ static wrap(listener: Function): (...args: any[]) => any;
72
77
  static execute(snapshot: Snapshot | null, func: Function, ...args: any[]): any;
73
78
  static snapshot(unit?: Unit | null): Snapshot | null;
74
79
  static stack(unit: Unit, key: string, value: any): void;
75
80
  static trace(unit: Unit, key: string): any;
76
81
  }
77
- export declare class UnitComponent {
78
- static components: MapSet<Unit, Function>;
79
- static units: MapSet<Function, Unit>;
80
- static finalize(unit: Unit): void;
81
- static add(unit: Unit, component: Function): void;
82
- static find(component: Function): Unit[];
83
- }
84
- export declare class UnitEvent {
85
- static units: MapSet<string, Unit>;
86
- static listeners: MapMapMap<Unit, string, Function, [HTMLElement | SVGElement, (...args: any[]) => void]>;
87
- static on(unit: Unit, type: string, listener: Function, options?: boolean | AddEventListenerOptions): void;
88
- static off(unit: Unit, type?: string, listener?: Function): void;
89
- static emit(unit: Unit, type: string, ...args: any[]): void;
90
- static sublisteners: MapMapMap<Unit | null, string, Function, [HTMLElement | SVGElement | Window | Document, (...args: any[]) => void]>;
91
- static subon(unit: Unit | null, target: HTMLElement | SVGElement | Window | Document, type: string, listener: Function, options?: boolean | AddEventListenerOptions): void;
92
- static suboff(unit: Unit | null, target: HTMLElement | SVGElement | Window | Document | null, type?: string, listener?: Function): void;
93
- }
94
82
  export declare class UnitPromise {
95
83
  private promise;
96
84
  constructor(executor: (resolve: (value: any) => void, reject: (reason?: any) => void) => void);
package/dist/xnew.d.ts CHANGED
@@ -1,7 +1,28 @@
1
1
  declare function ResizeEvent(self: any): void;
2
2
 
3
- declare const LIFECYCLE_EVENTS: readonly ["start", "update", "stop", "finalize"];
4
- type LifecycleEvent = typeof LIFECYCLE_EVENTS[number];
3
+ declare class MapSet<Key, Value> extends Map<Key, Set<Value>> {
4
+ has(key: Key): boolean;
5
+ has(key: Key, value: Value): boolean;
6
+ add(key: Key, value: Value): MapSet<Key, Value>;
7
+ keys(): IterableIterator<Key>;
8
+ keys(key: Key): IterableIterator<Value>;
9
+ delete(key: Key): boolean;
10
+ delete(key: Key, value: Value): boolean;
11
+ }
12
+ declare class MapMap<Key1, Key2, Value> extends Map<Key1, Map<Key2, Value>> {
13
+ has(key1: Key1): boolean;
14
+ has(key1: Key1, key2: Key2): boolean;
15
+ set(key1: Key1, value: Map<Key2, Value>): this;
16
+ set(key1: Key1, key2: Key2, value: Value): this;
17
+ get(key1: Key1): Map<Key2, Value> | undefined;
18
+ get(key1: Key1, key2: Key2): Value | undefined;
19
+ keys(): IterableIterator<Key1>;
20
+ keys(key1: Key1): IterableIterator<Key2>;
21
+ delete(key1: Key1): boolean;
22
+ delete(key1: Key1, key2: Key2): boolean;
23
+ }
24
+
25
+ type UnitElement = HTMLElement | SVGElement;
5
26
  interface Context {
6
27
  stack: Context | null;
7
28
  key: string;
@@ -12,51 +33,58 @@ interface Capture {
12
33
  execute: (unit: Unit) => any;
13
34
  }
14
35
  interface UnitInternal {
15
- root: Unit;
16
36
  parent: Unit | null;
17
37
  children: Unit[];
18
38
  target: Object | null;
19
39
  props?: Object;
40
+ baseElement: UnitElement;
41
+ baseContext: Context | null;
42
+ baseComponent: Function;
43
+ currentElement: UnitElement;
20
44
  nextNest: {
21
- element: HTMLElement | SVGElement;
45
+ element: UnitElement;
22
46
  position: InsertPosition;
23
47
  };
24
- baseElement: HTMLElement | SVGElement;
25
- currentElement: HTMLElement | SVGElement;
26
- baseContext: Context | null;
27
- baseComponent: Function | null;
28
- components: Function[];
48
+ components: Set<Function>;
49
+ listeners: MapMap<string, Function, [UnitElement, Function]>;
50
+ sublisteners: MapMap<string, Function, [UnitElement | Window | Document, Function]>;
29
51
  captures: Capture[];
30
52
  state: string;
31
53
  tostart: boolean;
32
- upcount: number;
33
- resolved: boolean;
34
54
  defines: Record<string, any>;
35
- system: Record<LifecycleEvent, Function[]>;
55
+ system: Record<string, Function[]>;
36
56
  }
37
57
  declare class Unit {
38
58
  [key: string]: any;
39
59
  _: UnitInternal;
40
60
  static roots: Unit[];
41
61
  constructor(target: Object | null, component?: Function | string, props?: Object);
42
- get element(): HTMLElement | SVGElement;
62
+ get element(): UnitElement;
43
63
  start(): void;
44
64
  stop(): void;
45
65
  finalize(): void;
46
66
  reboot(): void;
47
- get components(): Function[];
48
- on(type: string, listener: Function, options?: boolean | AddEventListenerOptions): Unit;
49
- off(type?: string, listener?: Function): Unit;
50
- emit(type: string, ...args: any[]): void;
51
- static initialize(unit: Unit): void;
67
+ static initialize(unit: Unit, nextNest: {
68
+ element: UnitElement;
69
+ position: InsertPosition;
70
+ }): void;
52
71
  static finalize(unit: Unit): void;
53
- static nest(unit: Unit, tag: string): HTMLElement | SVGElement | null;
72
+ static nest(unit: Unit, tag: string): UnitElement | null;
54
73
  static extend(unit: Unit, component: Function, props?: Object): void;
55
74
  static start(unit: Unit, time: number): void;
56
75
  static stop(unit: Unit): void;
57
76
  static update(unit: Unit, time: number): void;
58
77
  static ticker(time: number): void;
59
78
  static reset(): void;
79
+ static componentUnits: MapSet<Function, Unit>;
80
+ get components(): Set<Function>;
81
+ static find(component: Function): Unit[];
82
+ static typeUnits: MapSet<string, Unit>;
83
+ on(type: string, listener: Function, options?: boolean | AddEventListenerOptions): void;
84
+ off(type?: string, listener?: Function): void;
85
+ emit(type: string, ...args: any[]): void;
86
+ static subon(unit: any, target: UnitElement | Window | Document, type: string, listener: Function, options?: boolean | AddEventListenerOptions): void;
87
+ static suboff(unit: any, target: UnitElement | Window | Document | null, type?: string, listener?: Function): void;
60
88
  }
61
89
 
62
90
  interface xnewtype$1 {