@@ -3,7 +3,6 @@ export type VElement<T extends Props = Props> = Record<any, any> // TODO
33export type Ref < T > = { current : T | null }
44export type Methods = Record < string , ( ...args : any [ ] ) => any >
55export type EventHandler < T > = ( ev : T ) => void
6-
76export type UIEvent < T extends string , D = null > = CustomEvent < D > & { type : T }
87
98export type VNode =
@@ -17,7 +16,11 @@ export type VNode =
1716export type Task = ( ) => void
1817export type Message = { type : string } & Record < string , any >
1918export type State = Record < string , any >
20- export type Component < P > = ( props ?: P , ...children : VNode [ ] ) => VElement < P >
19+
20+ export type Component < P > = {
21+ ( props ?: P , ...children : VNode [ ] ) : VElement < P >
22+ tagName : string
23+ }
2124
2225export type MethodsOf < C > = C extends Component < infer P >
2326 ? P extends { ref ?: Ref < infer M > }
@@ -26,8 +29,8 @@ export type MethodsOf<C> = C extends Component<infer P>
2629 : never
2730
2831export type Ctrl = {
29- // library agnostic component control functions
3032 getName ( ) : string
33+ getHost ( ) : HTMLElement
3134 isInitialized ( ) : boolean
3235 isMounted ( ) : boolean
3336 hasUpdated ( ) : boolean
@@ -37,12 +40,11 @@ export type Ctrl = {
3740 beforeUpdate ( task : Task ) : void
3841 afterUpdate ( task : Task ) : void
3942 beforeUnmount ( task : Task ) : void
40- getHost ( ) : HTMLElement
4143}
4244
4345export type Store < S extends State > = {
4446 getState ( ) : S
45- subscribe ( listener : ( ) => void ) : ( ) => void
47+ subscribe ( subscriber : ( ) => void ) : ( ) => void
4648 dispatch ( msg : Message ) : void
4749 destroy ?( ) : void
4850}
0 commit comments