@mulsense/xnew 0.6.0 → 0.6.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.
@@ -28,7 +28,7 @@
28
28
  xnew(Root, { canvas });
29
29
  },
30
30
  nest(object) {
31
- xnew.extend(Nest, { object });
31
+ xnew(Nest, { object });
32
32
  return object;
33
33
  },
34
34
  get renderer() {
@@ -6,7 +6,7 @@ var xpixi = {
6
6
  xnew(Root, { canvas });
7
7
  },
8
8
  nest(object) {
9
- xnew.extend(Nest, { object });
9
+ xnew(Nest, { object });
10
10
  return object;
11
11
  },
12
12
  get renderer() {
@@ -6,7 +6,7 @@
6
6
 
7
7
  var xrapier2d = {
8
8
  initialize({ gravity = { x: 0.0, y: -9.81 } } = {}) {
9
- xnew.extend(Root, { gravity });
9
+ xnew(Root, { gravity });
10
10
  },
11
11
  get world() {
12
12
  var _a;
@@ -3,7 +3,7 @@ import RAPIER from '@dimforge/rapier2d-compat';
3
3
 
4
4
  var xrapier2d = {
5
5
  initialize({ gravity = { x: 0.0, y: -9.81 } } = {}) {
6
- xnew.extend(Root, { gravity });
6
+ xnew(Root, { gravity });
7
7
  },
8
8
  get world() {
9
9
  var _a;
@@ -68,6 +68,9 @@
68
68
  unit.on('finalize', () => {
69
69
  parent.remove(object);
70
70
  });
71
+ return {
72
+ get threeObject() { return object; },
73
+ };
71
74
  }
72
75
 
73
76
  return xthree;
@@ -46,6 +46,9 @@ function Nest(unit, { object }) {
46
46
  unit.on('finalize', () => {
47
47
  parent.remove(object);
48
48
  });
49
+ return {
50
+ get threeObject() { return object; },
51
+ };
49
52
  }
50
53
 
51
54
  export { xthree as default };
package/dist/xnew.d.ts CHANGED
@@ -34,6 +34,8 @@ declare class Eventor {
34
34
  remove(type: string, listener: Function): void;
35
35
  private basic;
36
36
  private resize;
37
+ private change;
38
+ private input;
37
39
  private click;
38
40
  private click_outside;
39
41
  private pointer;
@@ -147,7 +149,7 @@ declare class Unit {
147
149
  off(type?: string, listener?: Function): void;
148
150
  static on(unit: Unit, type: string, listener: Function, options?: boolean | AddEventListenerOptions): void;
149
151
  static off(unit: Unit, type: string, listener?: Function): void;
150
- static emit(type: string, ...args: any[]): void;
152
+ static emit(type: string, props?: object): void;
151
153
  }
152
154
 
153
155
  interface CreateUnit {
@@ -173,13 +175,15 @@ interface CreateUnit {
173
175
  (target: HTMLElement | SVGElement | string, Component?: Function | string, props?: Object): Unit;
174
176
  }
175
177
 
176
- declare function OpenAndClose(unit: Unit, { state: initialState }?: {
177
- state?: number;
178
+ declare function OpenAndClose(unit: Unit, { open }: {
179
+ open?: boolean;
178
180
  }): {
179
181
  toggle(duration?: number, easing?: string): void;
180
182
  open(duration?: number, easing?: string): void;
181
183
  close(duration?: number, easing?: string): void;
182
184
  };
185
+ declare function Accordion(unit: Unit): void;
186
+ declare function Modal(unit: Unit): void;
183
187
 
184
188
  type ScreenFit = 'contain' | 'cover';
185
189
  declare function Screen(unit: Unit, { aspect, fit }?: {
@@ -206,6 +210,26 @@ declare function DPad(unit: Unit, { diagonal, stroke, strokeOpacity, strokeWidth
206
210
  fillOpacity?: number;
207
211
  }): void;
208
212
 
213
+ interface PanelOptions {
214
+ name?: string;
215
+ open?: boolean;
216
+ params?: Record<string, any>;
217
+ }
218
+ declare function Panel(unit: Unit, { name, open, params }: PanelOptions): {
219
+ group({ name, open, params }: PanelOptions, inner: Function): Unit;
220
+ button(key: string): Unit;
221
+ select(key: string, { options }?: {
222
+ options?: string[];
223
+ }): Unit;
224
+ range(key: string, options?: {
225
+ min?: number;
226
+ max?: number;
227
+ step?: number;
228
+ }): Unit;
229
+ checkbox(key: string): Unit;
230
+ separator(): void;
231
+ };
232
+
209
233
  type SynthesizerOptions = {
210
234
  oscillator: OscillatorOptions;
211
235
  amp: AmpOptions;
@@ -255,7 +279,7 @@ declare const xnew: CreateUnit & {
255
279
  extend(component: Function, props?: Object): {
256
280
  [key: string]: any;
257
281
  };
258
- context(key: any, value?: any): any;
282
+ context(component: Function): any;
259
283
  promise(promise: Promise<any>): UnitPromise;
260
284
  then(callback: Function): UnitPromise;
261
285
  catch(callback: Function): UnitPromise;
@@ -273,6 +297,9 @@ declare const xnew: CreateUnit & {
273
297
  OpenAndClose: typeof OpenAndClose;
274
298
  AnalogStick: typeof AnalogStick;
275
299
  DPad: typeof DPad;
300
+ Panel: typeof Panel;
301
+ Accordion: typeof Accordion;
302
+ Modal: typeof Modal;
276
303
  };
277
304
  audio: {
278
305
  load(path: string): UnitPromise;