compelem 0.2.6-beta → 0.3.0-b1

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/CompElem.d.ts CHANGED
@@ -2,7 +2,7 @@ import { Directive } from "./directive/Directive";
2
2
  import { IComponent } from "./IComponent";
3
3
  import { IView } from "./render/RenderContext";
4
4
  import { Template } from "./render/Template";
5
- import { TmplFn } from "./types";
5
+ import { DefaultProps, TmplFn } from "./types";
6
6
  declare const CompElem_base: {
7
7
  new (...args: any[]): {
8
8
  [x: string]: any;
@@ -24,6 +24,7 @@ declare const CompElem_base: {
24
24
  export declare class CompElem extends CompElem_base implements IComponent {
25
25
  #private;
26
26
  static __l_globalRule: HTMLStyleElement;
27
+ static defaults(options: DefaultProps): void;
27
28
  __events: Record<string, Array<Node | ((e: Event) => void)>[]>;
28
29
  get [Symbol.toStringTag](): string;
29
30
  get reactiveData(): Record<string, any>;
@@ -101,7 +102,7 @@ export declare class CompElem extends CompElem_base implements IComponent {
101
102
  * @param rootStateKey 如果是对象内部属性变更,会返回根属性名
102
103
  * @returns
103
104
  */
104
- _notify(ov: any, chain: string[]): void;
105
+ _notify(ov: any, chain: string[]): any;
105
106
  /**
106
107
  * @deprecated
107
108
  */
package/constants.d.ts CHANGED
@@ -3,3 +3,14 @@
3
3
  */
4
4
  export declare const ChangedMap: WeakMap<WeakKey, any>;
5
5
  export declare const EXP_KEY: RegExp;
6
+ export declare enum CollectorType {
7
+ CSS = 1,
8
+ COMPUTED = 2
9
+ }
10
+ export declare enum DecoratorKey {
11
+ PROPS = "__deco_props",
12
+ STATES = "__deco_states",
13
+ COMPUTED = "__deco_computed",
14
+ WATCH = "__deco_watch",
15
+ EVENTS = "__deco_events"
16
+ }
@@ -6,5 +6,4 @@
6
6
  * @param immediate 立即执行
7
7
  * @param deep 深度监控
8
8
  */
9
- export declare function computed(arg?: any): void;
10
- export declare function computed(target: any, propertyKey: string): void;
9
+ export declare function computed(...args: any[]): void;
@@ -15,12 +15,5 @@ export type WatchOptions = {
15
15
  */
16
16
  once?: boolean;
17
17
  };
18
+ export declare function watch(source: string | string[], options?: WatchOptions): (target: any, name: any) => void;
18
19
  export type WatchHandler = (newValue: any, oldValue: any, source: string) => any;
19
- /**
20
- * 装饰器
21
- */
22
- export type DecoratorWatch = {
23
- handler: WatchHandler;
24
- options: WatchOptions;
25
- };
26
- export declare const watch: (source: string | string[], options?: WatchOptions | undefined, handler?: WatchHandler | undefined) => (...metadata: any[]) => any;
package/events/event.d.ts CHANGED
@@ -10,4 +10,5 @@ import { CompElem } from "../CompElem";
10
10
  *
11
11
  * 部分修饰符支持参数,使用冒号传参如:throttle:100 / debounce:100
12
12
  *************************************************************/
13
- export declare function addEvent(fullName: string, cbk: (ev: Event) => any, node: Element, component: CompElem): (ev: Event) => any;
13
+ export type EvHadler = (ev: Event, node: Element) => any;
14
+ export declare function addEvent(fullName: string, cbk: EvHadler, node: Element, component: CompElem): EvHadler;
@@ -1,2 +1,3 @@
1
+ import { EvHadler } from "./event";
1
2
  export declare function isExtEvent(evName: string): boolean;
2
- export declare function addExtEvent(evName: string, node: Element, cbk: (ev: Event) => any, parts: string[]): void;
3
+ export declare function addExtEvent(evName: string, node: Element, cbk: EvHadler, parts: string[]): void;