@mulsense/xnew 0.6.5 → 0.6.6

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.
@@ -51,7 +51,6 @@
51
51
  antialias: true, backgroundAlpha: 0,
52
52
  })).then((value) => {
53
53
  renderer = value;
54
- xnew.resolve();
55
54
  });
56
55
  let scene = new PIXI__namespace.Container();
57
56
  return {
@@ -29,7 +29,6 @@ function Root(unit, { canvas }) {
29
29
  antialias: true, backgroundAlpha: 0,
30
30
  })).then((value) => {
31
31
  renderer = value;
32
- xnew.resolve();
33
32
  });
34
33
  let scene = new PIXI.Container();
35
34
  return {
@@ -53,7 +53,6 @@
53
53
  renderer.setClearColor(0x000000, 0);
54
54
  camera = camera !== null && camera !== void 0 ? camera : new THREE__namespace.PerspectiveCamera(45, renderer.domElement.width / renderer.domElement.height);
55
55
  const scene = new THREE__namespace.Scene();
56
- xnew.resolve();
57
56
  return {
58
57
  get canvas() { return canvas; },
59
58
  get camera() { return camera; },
@@ -31,7 +31,6 @@ function Root(unit, { canvas, camera }) {
31
31
  renderer.setClearColor(0x000000, 0);
32
32
  camera = camera !== null && camera !== void 0 ? camera : new THREE.PerspectiveCamera(45, renderer.domElement.width / renderer.domElement.height);
33
33
  const scene = new THREE.Scene();
34
- xnew.resolve();
35
34
  return {
36
35
  get canvas() { return canvas; },
37
36
  get camera() { return camera; },
package/dist/xnew.d.ts CHANGED
@@ -44,28 +44,8 @@ declare class Eventor {
44
44
  }
45
45
 
46
46
  type UnitElement = HTMLElement | SVGElement;
47
- declare class UnitPromise {
48
- promise: Promise<any>;
49
- Component: Function | null;
50
- constructor(promise: Promise<any>, Component: Function | null);
51
- then(callback: Function): UnitPromise;
52
- catch(callback: Function): UnitPromise;
53
- finally(callback: Function): UnitPromise;
54
- private wrap;
55
- }
56
- declare class UnitTimer {
57
- private unit;
58
- private stack;
59
- clear(): void;
60
- timeout(callback: Function, duration?: number): UnitTimer;
61
- interval(callback: Function, duration?: number, iterations?: number): UnitTimer;
62
- transition(transition: Function, duration?: number, easing?: string): UnitTimer;
63
- private static execute;
64
- private static next;
65
- private static Component;
66
- }
67
47
  interface Context {
68
- stack: Context | null;
48
+ previous: Context | null;
69
49
  key?: any;
70
50
  value?: any;
71
51
  }
@@ -73,38 +53,28 @@ interface Snapshot {
73
53
  unit: Unit;
74
54
  context: Context;
75
55
  element: UnitElement;
76
- component: Function | null;
56
+ Component: Function | null;
77
57
  }
78
58
  interface Internal {
79
59
  parent: Unit | null;
80
- target: Object | null;
81
- props?: Object;
82
- baseElement: UnitElement;
83
- baseContext: Context;
84
- baseComponent: Function;
85
- currentElement: UnitElement;
86
- currentContext: Context;
87
- currentComponent: Function | null;
88
- anchor: UnitElement | null;
89
60
  state: string;
90
61
  tostart: boolean;
91
62
  protected: boolean;
63
+ currentElement: UnitElement;
64
+ currentContext: Context;
65
+ currentComponent: Function | null;
92
66
  ancestors: Unit[];
93
67
  children: Unit[];
94
68
  promises: UnitPromise[];
95
- done: {
96
- promise: Promise<any>;
97
- resolve: Function;
98
- reject: Function;
99
- };
69
+ results: Record<string, any>;
100
70
  nestElements: {
101
71
  element: UnitElement;
102
72
  owned: boolean;
103
73
  }[];
104
- components: Function[];
74
+ Components: Function[];
105
75
  listeners: MapMap<string, Function, {
106
76
  element: UnitElement;
107
- component: Function | null;
77
+ Component: Function | null;
108
78
  execute: Function;
109
79
  }>;
110
80
  defines: Record<string, any>;
@@ -117,13 +87,11 @@ interface Internal {
117
87
  declare class Unit {
118
88
  [key: string]: any;
119
89
  _: Internal;
120
- constructor(parent: Unit | null, target: UnitElement | string | null, component?: Function | string | number, props?: Object);
90
+ constructor(parent: Unit | null, target: UnitElement | string | null, Component?: Function | string | number, props?: Object);
121
91
  get element(): UnitElement;
122
92
  start(): void;
123
93
  stop(): void;
124
94
  finalize(): void;
125
- reboot(): void;
126
- static initialize(unit: Unit, anchor: UnitElement | null): void;
127
95
  static finalize(unit: Unit): void;
128
96
  static nest(unit: Unit, target: UnitElement | string, textContent?: string | number): UnitElement;
129
97
  static currentComponent: Function;
@@ -139,7 +107,9 @@ declare class Unit {
139
107
  static reset(): void;
140
108
  static scope(snapshot: Snapshot, func: Function, ...args: any[]): any;
141
109
  static snapshot(unit: Unit): Snapshot;
142
- static context(unit: Unit, key: any, value?: any): any;
110
+ static unit2Contexts: MapSet<Unit, Context>;
111
+ static addContext(unit: Unit, orner: Unit, key: any, value?: Unit): void;
112
+ static getContext(unit: Unit, key: any): any;
143
113
  static component2units: MapSet<Function, Unit>;
144
114
  static find(Component: Function): Unit[];
145
115
  static type2units: MapSet<string, Unit>;
@@ -149,6 +119,26 @@ declare class Unit {
149
119
  static off(unit: Unit, type: string, listener?: Function): void;
150
120
  static emit(type: string, props?: object): void;
151
121
  }
122
+ declare class UnitPromise {
123
+ promise: Promise<any>;
124
+ Component: Function | null;
125
+ constructor(promise: Promise<any>, Component: Function | null);
126
+ then(callback: Function): UnitPromise;
127
+ catch(callback: Function): UnitPromise;
128
+ finally(callback: Function): UnitPromise;
129
+ private wrap;
130
+ }
131
+ declare class UnitTimer {
132
+ private unit;
133
+ private queue;
134
+ clear(): void;
135
+ timeout(callback: Function, duration?: number): UnitTimer;
136
+ interval(callback: Function, duration?: number, iterations?: number): UnitTimer;
137
+ transition(transition: Function, duration?: number, easing?: string): UnitTimer;
138
+ private static execute;
139
+ private static next;
140
+ private static Component;
141
+ }
152
142
 
153
143
  interface CreateUnit {
154
144
  /**
@@ -221,15 +211,19 @@ interface PanelOptions {
221
211
  declare function Panel(unit: Unit, { name, open, params }: PanelOptions): {
222
212
  group({ name, open, params }: PanelOptions, inner: Function): Unit;
223
213
  button(key: string): Unit;
224
- select(key: string, { options }?: {
225
- options?: string[];
214
+ select(key: string, { value, items }?: {
215
+ value?: string;
216
+ items?: string[];
226
217
  }): Unit;
227
- range(key: string, options?: {
218
+ range(key: string, { value, min, max, step }?: {
219
+ value?: number;
228
220
  min?: number;
229
221
  max?: number;
230
222
  step?: number;
231
223
  }): Unit;
232
- checkbox(key: string): Unit;
224
+ checkbox(key: string, { value }?: {
225
+ value?: boolean;
226
+ }): Unit;
233
227
  separator(): void;
234
228
  };
235
229
 
@@ -283,7 +277,7 @@ declare const xnew: CreateUnit & {
283
277
  [key: string]: any;
284
278
  };
285
279
  context(component: Function): any;
286
- promise(promise: Promise<any> | Unit): UnitPromise;
280
+ promise(promise: Function | Promise<any> | Unit): UnitPromise;
287
281
  then(callback: Function): UnitPromise;
288
282
  catch(callback: Function): UnitPromise;
289
283
  resolve(value?: any): void;