@mulsense/xnew 0.6.5 → 0.6.7

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,57 +53,45 @@ 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;
60
+ ancestors: Unit[];
61
+ children: Unit[];
89
62
  state: string;
90
63
  tostart: boolean;
91
64
  protected: boolean;
92
- ancestors: Unit[];
93
- children: Unit[];
94
65
  promises: UnitPromise[];
95
- done: {
96
- promise: Promise<any>;
97
- resolve: Function;
98
- reject: Function;
99
- };
66
+ results: Record<string, any>;
67
+ defines: Record<string, any>;
68
+ systems: Record<string, {
69
+ listener: Function;
70
+ execute: Function;
71
+ }[]>;
72
+ currentElement: UnitElement;
73
+ currentContext: Context;
74
+ currentComponent: Function | null;
100
75
  nestElements: {
101
76
  element: UnitElement;
102
77
  owned: boolean;
103
78
  }[];
104
- components: Function[];
79
+ Components: Function[];
105
80
  listeners: MapMap<string, Function, {
106
81
  element: UnitElement;
107
- component: Function | null;
82
+ Component: Function | null;
108
83
  execute: Function;
109
84
  }>;
110
- defines: Record<string, any>;
111
- systems: Record<string, {
112
- listener: Function;
113
- execute: Function;
114
- }[]>;
115
85
  eventor: Eventor;
116
86
  }
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
  /**
@@ -218,21 +208,31 @@ interface PanelOptions {
218
208
  open?: boolean;
219
209
  params?: Record<string, any>;
220
210
  }
221
- declare function Panel(unit: Unit, { name, open, params }: PanelOptions): {
211
+ declare function Panel(unit: Unit, { 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
 
230
+ declare function Flow(unit: Unit): {
231
+ get scene(): Unit | null;
232
+ set scene(value: Unit);
233
+ next(Component: Function, props?: any): void;
234
+ };
235
+
236
236
  type SynthesizerOptions = {
237
237
  oscillator: OscillatorOptions;
238
238
  amp: AmpOptions;
@@ -282,15 +282,14 @@ declare const xnew: CreateUnit & {
282
282
  extend(Component: Function, props?: Object): {
283
283
  [key: string]: any;
284
284
  };
285
- context(component: Function): any;
286
- promise(promise: Promise<any> | Unit): UnitPromise;
285
+ context(key: any): any;
286
+ promise(promise: Function | Promise<any> | Unit): UnitPromise;
287
287
  then(callback: Function): UnitPromise;
288
288
  catch(callback: Function): UnitPromise;
289
- resolve(value?: any): void;
290
- reject(reason?: any): void;
289
+ commit(object?: Record<string, any>): void;
291
290
  finally(callback: Function): UnitPromise;
292
291
  scope(callback: any): any;
293
- find(component: Function): Unit[];
292
+ find(Component: Function): Unit[];
294
293
  emit(type: string, ...args: any[]): void;
295
294
  timeout(callback: Function, duration?: number): UnitTimer;
296
295
  interval(callback: Function, duration: number, iterations?: number): UnitTimer;
@@ -305,6 +304,7 @@ declare const xnew: CreateUnit & {
305
304
  Panel: typeof Panel;
306
305
  Accordion: typeof Accordion;
307
306
  Popup: typeof Popup;
307
+ Flow: typeof Flow;
308
308
  };
309
309
  audio: {
310
310
  load(path: string): UnitPromise;