@mulsense/xnew 0.1.2 → 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.
@@ -4,7 +4,7 @@ export declare function AccordionFrame(frame: xnew.Unit, {}?: {}): {
4
4
  open(): void;
5
5
  close(): void;
6
6
  };
7
- export declare function AccordionButton(button: xnew.Unit, {}?: {}): void;
7
+ export declare function AccordionHeader(header: xnew.Unit, {}?: {}): void;
8
8
  export declare function AccordionBullet(bullet: xnew.Unit, { type }?: {
9
9
  type?: string;
10
10
  }): {
@@ -1,5 +1,5 @@
1
1
  import { xnew } from '../core/xnew';
2
- export declare function VirtualStick(self: xnew.Unit, { size, fill, fillOpacity, stroke, strokeOpacity, strokeWidth, strokeLinejoin }?: {
2
+ export declare function TouchStick(self: xnew.Unit, { size, fill, fillOpacity, stroke, strokeOpacity, strokeWidth, strokeLinejoin }?: {
3
3
  size?: number | undefined;
4
4
  fill?: string | undefined;
5
5
  fillOpacity?: number | undefined;
@@ -8,7 +8,7 @@ export declare function VirtualStick(self: xnew.Unit, { size, fill, fillOpacity,
8
8
  strokeWidth?: number | undefined;
9
9
  strokeLinejoin?: string | undefined;
10
10
  }): void;
11
- export declare function VirtualDPad(self: xnew.Unit, { size, fill, fillOpacity, stroke, strokeOpacity, strokeWidth, strokeLinejoin }?: {
11
+ export declare function TouchDPad(self: xnew.Unit, { size, fill, fillOpacity, stroke, strokeOpacity, strokeWidth, strokeLinejoin }?: {
12
12
  size?: number | undefined;
13
13
  fill?: string | undefined;
14
14
  fillOpacity?: number | undefined;
@@ -17,7 +17,7 @@ export declare function VirtualDPad(self: xnew.Unit, { size, fill, fillOpacity,
17
17
  strokeWidth?: number | undefined;
18
18
  strokeLinejoin?: string | undefined;
19
19
  }): void;
20
- export declare function VirtualButton(self: xnew.Unit, { size, fill, fillOpacity, stroke, strokeOpacity, strokeWidth, strokeLinejoin }?: {
20
+ export declare function TouchButton(self: xnew.Unit, { size, fill, fillOpacity, stroke, strokeOpacity, strokeWidth, strokeLinejoin }?: {
21
21
  size?: number | undefined;
22
22
  fill?: string | undefined;
23
23
  fillOpacity?: number | undefined;
@@ -6,6 +6,4 @@ export declare function ModalContent(content: xnew.Unit, { duration, easing, bac
6
6
  duration?: number;
7
7
  easing?: string;
8
8
  background?: string;
9
- }): {
10
- transition(status: number): void;
11
- };
9
+ }): void;
@@ -1 +1 @@
1
- export declare function ResizeEvent(self: any): void;
1
+ export declare function ResizeEvent(resize: any): void;
@@ -0,0 +1,28 @@
1
+ import { xnew } from '../core/xnew';
2
+ export declare function TouchStick(self: xnew.Unit, { size, fill, fillOpacity, stroke, strokeOpacity, strokeWidth, strokeLinejoin }?: {
3
+ size?: number | undefined;
4
+ fill?: string | undefined;
5
+ fillOpacity?: number | undefined;
6
+ stroke?: string | undefined;
7
+ strokeOpacity?: number | undefined;
8
+ strokeWidth?: number | undefined;
9
+ strokeLinejoin?: string | undefined;
10
+ }): void;
11
+ export declare function TouchDPad(self: xnew.Unit, { size, fill, fillOpacity, stroke, strokeOpacity, strokeWidth, strokeLinejoin }?: {
12
+ size?: number | undefined;
13
+ fill?: string | undefined;
14
+ fillOpacity?: number | undefined;
15
+ stroke?: string | undefined;
16
+ strokeOpacity?: number | undefined;
17
+ strokeWidth?: number | undefined;
18
+ strokeLinejoin?: string | undefined;
19
+ }): void;
20
+ export declare function TouchButton(self: xnew.Unit, { size, fill, fillOpacity, stroke, strokeOpacity, strokeWidth, strokeLinejoin }?: {
21
+ size?: number | undefined;
22
+ fill?: string | undefined;
23
+ fillOpacity?: number | undefined;
24
+ stroke?: string | undefined;
25
+ strokeOpacity?: number | undefined;
26
+ strokeWidth?: number | undefined;
27
+ strokeLinejoin?: string | undefined;
28
+ }): void;
@@ -2,92 +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
- unit: Unit | null;
10
- context: Context | null;
11
- element: UnitElement | null;
9
+ unit: Unit;
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
- nextNest: {
27
- element: UnitElement;
28
- position: InsertPosition;
29
- };
30
- components: Set<Function>;
31
- listeners: MapMap<string, Function, [UnitElement, Function]>;
32
- sublisteners: MapMap<string, Function, [UnitElement | Window | Document, Function]>;
33
- captures: Capture[];
32
+ currentContext: Context;
33
+ anchor: UnitElement | null;
34
34
  state: string;
35
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]>;
36
43
  defines: Record<string, any>;
37
- system: Record<string, Function[]>;
44
+ systems: Record<string, Function[]>;
38
45
  }
39
46
  export declare class Unit {
40
47
  [key: string]: any;
41
48
  _: UnitInternal;
42
- static roots: Unit[];
43
- 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);
44
51
  get element(): UnitElement;
52
+ get components(): Function[];
45
53
  start(): void;
46
54
  stop(): void;
47
55
  finalize(): void;
48
56
  reboot(): void;
49
- static initialize(unit: Unit, nextNest: {
50
- element: UnitElement;
51
- position: InsertPosition;
52
- }): void;
57
+ static initialize(unit: Unit, anchor: UnitElement | null): void;
53
58
  static finalize(unit: Unit): void;
54
- static nest(unit: Unit, tag: string): UnitElement | null;
59
+ static nest(unit: Unit, tag: string): UnitElement;
55
60
  static extend(unit: Unit, component: Function, props?: Object): void;
56
61
  static start(unit: Unit, time: number): void;
57
62
  static stop(unit: Unit): void;
58
63
  static update(unit: Unit, time: number): void;
64
+ static root: Unit | null;
59
65
  static ticker(time: number): void;
60
66
  static reset(): void;
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;
70
+ static stack(unit: Unit, key: string, value: any): void;
71
+ static trace(unit: Unit, key: string): any;
61
72
  static componentUnits: MapSet<Function, Unit>;
62
- get components(): Set<Function>;
63
73
  static find(component: Function): Unit[];
64
74
  static typeUnits: MapSet<string, Unit>;
65
75
  on(type: string, listener: Function, options?: boolean | AddEventListenerOptions): void;
66
76
  off(type?: string, listener?: Function): void;
67
77
  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;
70
- }
71
- export declare class UnitScope {
72
- static current: Unit | null;
73
- static contexts: Map<Unit | null, Context>;
74
- static initialize(unit: Unit | null, context: Context | null): void;
75
- static finalize(unit: Unit): void;
76
- static wrap(listener: Function): (...args: any[]) => any;
77
- static execute(snapshot: Snapshot | null, func: Function, ...args: any[]): any;
78
- static snapshot(unit?: Unit | null): Snapshot | null;
79
- static stack(unit: Unit, key: string, value: any): void;
80
- static trace(unit: Unit, key: string): any;
81
- }
82
- export declare class UnitPromise {
83
- private promise;
84
- constructor(executor: (resolve: (value: any) => void, reject: (reason?: any) => void) => void);
85
- then(callback: Function): UnitPromise;
86
- catch(callback: Function): UnitPromise;
87
- finally(callback: Function): UnitPromise;
88
- static promises: MapSet<Unit, UnitPromise>;
89
- static get(unit: Unit): Promise<any[]>;
90
- static finalize(unit: Unit): void;
91
- 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;
92
80
  }
93
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;
@@ -4,12 +4,10 @@ import { Screen } from './basics/Screen';
4
4
  import { InputFrame } from './basics/Input';
5
5
  import { ModalFrame, ModalContent } from './basics/Modal';
6
6
  import { TabFrame, TabButton, TabContent } from './basics/Tab';
7
- import { AccordionFrame, AccordionButton, AccordionBullet, AccordionContent } from './basics/Accordion';
8
- import { PanelFrame, PanelGroup } from './basics/Panel';
7
+ import { AccordionFrame, AccordionHeader, AccordionBullet, AccordionContent } from './basics/Accordion';
9
8
  import { DragFrame, DragTarget } from './basics/SubWIndow';
10
- import { VirtualStick, VirtualDPad, VirtualButton } from './basics/Controller';
9
+ import { TouchStick, TouchDPad, TouchButton } from './basics/Touch';
11
10
  import { Unit } from './core/unit';
12
- import { xnewtype as basetype } from './core/xnew';
13
11
  import { synthesizer } from './audio/synthesizer';
14
12
  declare const basics: {
15
13
  Screen: typeof Screen;
@@ -18,30 +16,30 @@ declare const basics: {
18
16
  ModalFrame: typeof ModalFrame;
19
17
  ModalContent: typeof ModalContent;
20
18
  AccordionFrame: typeof AccordionFrame;
21
- AccordionButton: typeof AccordionButton;
19
+ AccordionHeader: typeof AccordionHeader;
22
20
  AccordionBullet: typeof AccordionBullet;
23
21
  AccordionContent: typeof AccordionContent;
24
22
  TabFrame: typeof TabFrame;
25
23
  TabButton: typeof TabButton;
26
24
  TabContent: typeof TabContent;
27
- PanelFrame: typeof PanelFrame;
28
- PanelGroup: typeof PanelGroup;
29
25
  InputFrame: typeof InputFrame;
30
26
  DragFrame: typeof DragFrame;
31
27
  DragTarget: typeof DragTarget;
32
- VirtualStick: typeof VirtualStick;
33
- VirtualDPad: typeof VirtualDPad;
34
- VirtualButton: typeof VirtualButton;
28
+ TouchStick: typeof TouchStick;
29
+ TouchDPad: typeof TouchDPad;
30
+ TouchButton: typeof TouchButton;
35
31
  };
36
32
  declare const audio: {
37
33
  synthesizer: typeof synthesizer;
38
34
  };
39
- interface xnewtype extends basetype {
35
+ export interface xnew_interface {
36
+ (...args: any[]): Unit;
37
+ [key: string]: any;
40
38
  basics: typeof basics;
41
39
  audio: typeof audio;
42
40
  }
43
41
  declare namespace xnew {
44
42
  type Unit = InstanceType<typeof Unit>;
45
43
  }
46
- declare const xnew: xnewtype;
44
+ declare const xnew: xnew_interface;
47
45
  export default xnew;
package/dist/xnew.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- declare function ResizeEvent(self: any): void;
1
+ declare function ResizeEvent(resize: any): void;
2
2
 
3
3
  declare class MapSet<Key, Value> extends Map<Key, Set<Value>> {
4
4
  has(key: Key): boolean;
@@ -25,8 +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
+ }
31
+ interface Snapshot {
32
+ unit: Unit;
33
+ context: Context;
34
+ element: UnitElement;
30
35
  }
31
36
  interface Capture {
32
37
  checker: (unit: Unit) => boolean;
@@ -34,67 +39,66 @@ interface Capture {
34
39
  }
35
40
  interface UnitInternal {
36
41
  parent: Unit | null;
37
- children: Unit[];
38
42
  target: Object | null;
39
43
  props?: Object;
40
44
  baseElement: UnitElement;
41
- baseContext: Context | null;
45
+ baseContext: Context;
42
46
  baseComponent: Function;
43
47
  currentElement: UnitElement;
44
- nextNest: {
45
- element: UnitElement;
46
- position: InsertPosition;
47
- };
48
- components: Set<Function>;
49
- listeners: MapMap<string, Function, [UnitElement, Function]>;
50
- sublisteners: MapMap<string, Function, [UnitElement | Window | Document, Function]>;
51
- captures: Capture[];
48
+ currentContext: Context;
49
+ anchor: UnitElement | null;
52
50
  state: string;
53
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]>;
54
59
  defines: Record<string, any>;
55
- system: Record<string, Function[]>;
60
+ systems: Record<string, Function[]>;
56
61
  }
57
62
  declare class Unit {
58
63
  [key: string]: any;
59
64
  _: UnitInternal;
60
- static roots: Unit[];
61
- 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);
62
67
  get element(): UnitElement;
68
+ get components(): Function[];
63
69
  start(): void;
64
70
  stop(): void;
65
71
  finalize(): void;
66
72
  reboot(): void;
67
- static initialize(unit: Unit, nextNest: {
68
- element: UnitElement;
69
- position: InsertPosition;
70
- }): void;
73
+ static initialize(unit: Unit, anchor: UnitElement | null): void;
71
74
  static finalize(unit: Unit): void;
72
- static nest(unit: Unit, tag: string): UnitElement | null;
75
+ static nest(unit: Unit, tag: string): UnitElement;
73
76
  static extend(unit: Unit, component: Function, props?: Object): void;
74
77
  static start(unit: Unit, time: number): void;
75
78
  static stop(unit: Unit): void;
76
79
  static update(unit: Unit, time: number): void;
80
+ static root: Unit | null;
77
81
  static ticker(time: number): void;
78
82
  static reset(): void;
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;
86
+ static stack(unit: Unit, key: string, value: any): void;
87
+ static trace(unit: Unit, key: string): any;
79
88
  static componentUnits: MapSet<Function, Unit>;
80
- get components(): Set<Function>;
81
89
  static find(component: Function): Unit[];
82
90
  static typeUnits: MapSet<string, Unit>;
83
91
  on(type: string, listener: Function, options?: boolean | AddEventListenerOptions): void;
84
92
  off(type?: string, listener?: Function): void;
85
93
  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;
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;
88
96
  }
89
97
 
90
- interface xnewtype$1 {
91
- (...args: any[]): Unit;
92
- [key: string]: any;
93
- }
94
98
  declare namespace xnew$1 {
95
99
  type Unit = InstanceType<typeof Unit>;
96
100
  }
97
- declare const xnew$1: xnewtype$1;
101
+ declare const xnew$1: any;
98
102
 
99
103
  declare function UserEvent(self: xnew$1.Unit): void;
100
104
 
@@ -120,9 +124,7 @@ declare function ModalContent(content: xnew$1.Unit, { duration, easing, backgrou
120
124
  duration?: number;
121
125
  easing?: string;
122
126
  background?: string;
123
- }): {
124
- transition(status: number): void;
125
- };
127
+ }): void;
126
128
 
127
129
  declare function TabFrame(frame: xnew$1.Unit, { select }?: {
128
130
  select?: number | undefined;
@@ -141,7 +143,7 @@ declare function AccordionFrame(frame: xnew$1.Unit, {}?: {}): {
141
143
  open(): void;
142
144
  close(): void;
143
145
  };
144
- declare function AccordionButton(button: xnew$1.Unit, {}?: {}): void;
146
+ declare function AccordionHeader(header: xnew$1.Unit, {}?: {}): void;
145
147
  declare function AccordionBullet(bullet: xnew$1.Unit, { type }?: {
146
148
  type?: string;
147
149
  }): {
@@ -156,19 +158,13 @@ declare function AccordionContent(content: xnew$1.Unit, { open, duration, easing
156
158
  transition(status: number): void;
157
159
  };
158
160
 
159
- declare function PanelFrame(frame: xnew$1.Unit): void;
160
- declare function PanelGroup(group: xnew$1.Unit, { name, open }?: {
161
- name?: string;
162
- open?: boolean;
163
- }): void;
164
-
165
161
  declare function DragFrame(frame: xnew$1.Unit, { x, y }?: {
166
162
  x?: number;
167
163
  y?: number;
168
164
  }): void;
169
165
  declare function DragTarget(target: xnew$1.Unit, {}?: {}): void;
170
166
 
171
- declare function VirtualStick(self: xnew$1.Unit, { size, fill, fillOpacity, stroke, strokeOpacity, strokeWidth, strokeLinejoin }?: {
167
+ declare function TouchStick(self: xnew$1.Unit, { size, fill, fillOpacity, stroke, strokeOpacity, strokeWidth, strokeLinejoin }?: {
172
168
  size?: number | undefined;
173
169
  fill?: string | undefined;
174
170
  fillOpacity?: number | undefined;
@@ -177,7 +173,7 @@ declare function VirtualStick(self: xnew$1.Unit, { size, fill, fillOpacity, stro
177
173
  strokeWidth?: number | undefined;
178
174
  strokeLinejoin?: string | undefined;
179
175
  }): void;
180
- declare function VirtualDPad(self: xnew$1.Unit, { size, fill, fillOpacity, stroke, strokeOpacity, strokeWidth, strokeLinejoin }?: {
176
+ declare function TouchDPad(self: xnew$1.Unit, { size, fill, fillOpacity, stroke, strokeOpacity, strokeWidth, strokeLinejoin }?: {
181
177
  size?: number | undefined;
182
178
  fill?: string | undefined;
183
179
  fillOpacity?: number | undefined;
@@ -186,7 +182,7 @@ declare function VirtualDPad(self: xnew$1.Unit, { size, fill, fillOpacity, strok
186
182
  strokeWidth?: number | undefined;
187
183
  strokeLinejoin?: string | undefined;
188
184
  }): void;
189
- declare function VirtualButton(self: xnew$1.Unit, { size, fill, fillOpacity, stroke, strokeOpacity, strokeWidth, strokeLinejoin }?: {
185
+ declare function TouchButton(self: xnew$1.Unit, { size, fill, fillOpacity, stroke, strokeOpacity, strokeWidth, strokeLinejoin }?: {
190
186
  size?: number | undefined;
191
187
  fill?: string | undefined;
192
188
  fillOpacity?: number | undefined;
@@ -271,31 +267,32 @@ declare const basics: {
271
267
  ModalFrame: typeof ModalFrame;
272
268
  ModalContent: typeof ModalContent;
273
269
  AccordionFrame: typeof AccordionFrame;
274
- AccordionButton: typeof AccordionButton;
270
+ AccordionHeader: typeof AccordionHeader;
275
271
  AccordionBullet: typeof AccordionBullet;
276
272
  AccordionContent: typeof AccordionContent;
277
273
  TabFrame: typeof TabFrame;
278
274
  TabButton: typeof TabButton;
279
275
  TabContent: typeof TabContent;
280
- PanelFrame: typeof PanelFrame;
281
- PanelGroup: typeof PanelGroup;
282
276
  InputFrame: typeof InputFrame;
283
277
  DragFrame: typeof DragFrame;
284
278
  DragTarget: typeof DragTarget;
285
- VirtualStick: typeof VirtualStick;
286
- VirtualDPad: typeof VirtualDPad;
287
- VirtualButton: typeof VirtualButton;
279
+ TouchStick: typeof TouchStick;
280
+ TouchDPad: typeof TouchDPad;
281
+ TouchButton: typeof TouchButton;
288
282
  };
289
283
  declare const audio: {
290
284
  synthesizer: typeof synthesizer;
291
285
  };
292
- interface xnewtype extends xnewtype$1 {
286
+ interface xnew_interface {
287
+ (...args: any[]): Unit;
288
+ [key: string]: any;
293
289
  basics: typeof basics;
294
290
  audio: typeof audio;
295
291
  }
296
292
  declare namespace xnew {
297
293
  type Unit = InstanceType<typeof Unit>;
298
294
  }
299
- declare const xnew: xnewtype;
295
+ declare const xnew: xnew_interface;
300
296
 
301
297
  export { xnew as default };
298
+ export type { xnew_interface };