@mulsense/xnew 0.6.3 → 0.6.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.
package/dist/xnew.d.ts CHANGED
@@ -20,14 +20,6 @@ declare class MapMap<Key1, Key2, Value> extends Map<Key1, Map<Key2, Value>> {
20
20
  delete(key1: Key1, key2: Key2): boolean;
21
21
  }
22
22
 
23
- interface TimerOptions {
24
- transition?: Function;
25
- timeout?: Function;
26
- duration: number;
27
- iterations: number;
28
- easing?: string;
29
- }
30
-
31
23
  declare class Eventor {
32
24
  private map;
33
25
  add(element: HTMLElement | SVGElement, type: string, listener: Function, options?: boolean | AddEventListenerOptions): void;
@@ -54,26 +46,23 @@ declare class Eventor {
54
46
  type UnitElement = HTMLElement | SVGElement;
55
47
  declare class UnitPromise {
56
48
  promise: Promise<any>;
57
- component: Function | null;
58
- constructor(promise: Promise<any>, component: Function | null);
49
+ Component: Function | null;
50
+ constructor(promise: Promise<any>, Component: Function | null);
59
51
  then(callback: Function): UnitPromise;
60
52
  catch(callback: Function): UnitPromise;
61
53
  finally(callback: Function): UnitPromise;
54
+ private wrap;
62
55
  }
63
56
  declare class UnitTimer {
64
57
  private unit;
65
58
  private stack;
66
- constructor(options: TimerOptions);
67
59
  clear(): void;
68
- timeout(timeout: Function, duration?: number): this;
69
- iteration(timeout: Function, duration?: number, iterations?: number): this;
70
- transition(transition: Function, duration?: number, easing?: string): this;
71
- static execute(timer: UnitTimer, options: TimerOptions): void;
72
- static next(timer: UnitTimer): void;
73
- static Component(unit: Unit, { options, snapshot }: {
74
- options: TimerOptions;
75
- snapshot: Snapshot;
76
- }): 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;
77
66
  }
78
67
  interface Context {
79
68
  stack: Context | null;
@@ -133,7 +122,7 @@ declare class Unit {
133
122
  static finalize(unit: Unit): void;
134
123
  static nest(unit: Unit, target: UnitElement | string, textContent?: string | number): UnitElement;
135
124
  static currentComponent: Function;
136
- static extend(unit: Unit, component: Function, props?: Object): {
125
+ static extend(unit: Unit, Component: Function, props?: Object): {
137
126
  [key: string]: any;
138
127
  };
139
128
  static start(unit: Unit): void;
@@ -147,7 +136,7 @@ declare class Unit {
147
136
  static snapshot(unit: Unit): Snapshot;
148
137
  static context(unit: Unit, key: any, value?: any): any;
149
138
  static component2units: MapSet<Function, Unit>;
150
- static find(component: Function): Unit[];
139
+ static find(Component: Function): Unit[];
151
140
  static type2units: MapSet<string, Unit>;
152
141
  on(type: string, listener: Function, options?: boolean | AddEventListenerOptions): void;
153
142
  off(type?: string, listener?: Function): void;
@@ -158,20 +147,20 @@ declare class Unit {
158
147
 
159
148
  interface CreateUnit {
160
149
  /**
161
- * Creates a new Unit component
150
+ * creates a new Unit component
162
151
  * @param Component - component function
163
152
  * @param props - properties for component function
164
- * @returns A new Unit instance
153
+ * @returns a new Unit instance
165
154
  * @example
166
155
  * const unit = xnew(MyComponent, { data: 0 })
167
156
  */
168
157
  (Component?: Function | string, props?: Object): Unit;
169
158
  /**
170
- * Creates a new Unit component
159
+ * creates a new Unit component
171
160
  * @param target - HTMLElement | SVGElement, or HTML tag for new element
172
161
  * @param Component - component function
173
162
  * @param props - properties for component function
174
- * @returns A new Unit instance
163
+ * @returns a new Unit instance
175
164
  * @example
176
165
  * const unit = xnew(element, MyComponent, { data: 0 })
177
166
  * const unit = xnew('<div>', MyComponent, { data: 0 })
@@ -285,11 +274,11 @@ declare namespace xnew {
285
274
  }
286
275
  declare const xnew: CreateUnit & {
287
276
  nest(target: UnitElement | string): HTMLElement | SVGElement;
288
- extend(component: Function, props?: Object): {
277
+ extend(Component: Function, props?: Object): {
289
278
  [key: string]: any;
290
279
  };
291
280
  context(component: Function): any;
292
- promise(promise: Promise<any>): UnitPromise;
281
+ promise(promise: Promise<any> | Unit): UnitPromise;
293
282
  then(callback: Function): UnitPromise;
294
283
  catch(callback: Function): UnitPromise;
295
284
  finally(callback: Function): UnitPromise;
@@ -297,7 +286,7 @@ declare const xnew: CreateUnit & {
297
286
  find(component: Function): Unit[];
298
287
  emit(type: string, ...args: any[]): void;
299
288
  timeout(timeout: Function, duration?: number): UnitTimer;
300
- interval(timeout: Function, duration: number, iterations?: number): UnitTimer;
289
+ interval(interval: Function, duration: number, iterations?: number): UnitTimer;
301
290
  transition(transition: Function, duration?: number, easing?: string): UnitTimer;
302
291
  protect(): void;
303
292
  } & {