1+ /* eslint-disable @typescript-eslint/ban-types */
12export type NodeElement = HTMLElement | null ;
23
3- export type Render = ( target :NodeElement ) => ( ) => void ;
4+ export type Render < P = { } > = ( target :NodeElement , props ?: P ) => ( ) => void ;
45
5- export type DynamicImport = (
6+ export type DynamicImport < T = { } > = (
67name :string
78) => Promise < {
8- default :Render ;
9+ default :Render < T > ;
910} > ;
1011
1112export type RegistryResponse = Record < string , string > ;
@@ -15,7 +16,7 @@ export interface CacheContainer {
1516setItem ( key :string , value :string ) :Promise < void > | void ;
1617}
1718
18- export interface UseAppOptions {
19+ export interface UseAppOptions < T = { } , P = { } > {
1920/**
2021 *
2122 */
@@ -28,9 +29,17 @@ export interface UseAppOptions {
2829 *
2930 */
3031loader :DynamicImport ;
32+ /**
33+ *
34+ */
35+ attrs ?:T ;
36+ /**
37+ *
38+ */
39+ props ?:P ;
3140}
3241
33- export interface UseIframeOptions {
42+ export interface UseIframeOptions < T = { } > {
3443/**
3544 *
3645 */
@@ -43,9 +52,13 @@ export interface UseIframeOptions {
4352 *
4453 */
4554url ?:string ;
55+ /**
56+ *
57+ */
58+ attrs ?:T ;
4659}
4760
48- export interface UseWebComponentsOptions {
61+ export interface UseWebComponentsOptions < T = { } , P = { } > {
4962/**
5063 *
5164 */
@@ -69,17 +82,27 @@ export interface UseWebComponentsOptions {
6982/**
7083 *
7184 */
72- retargetEvent ?:boolean ;
85+ retargetEvent ?:boolean ;
86+ /**
87+ *
88+ */
89+ attrs ?:T ;
90+ /**
91+ *
92+ */
93+ props ?:P ;
7394}
7495
75- export type UseApp = ( options : UseAppOptions ) => Promise < void | ( ( ) => void ) > ;
76-
77- export type UseIframe = ( options : UseIframeOptions ) => void ; // TODO: fix type with iframe Attributes
96+ export type UseApp = < T = { } , P = { } > (
97+ options : UseAppOptions < T , P >
98+ ) => Promise < void | ( ( ) => void ) > ;
7899
79- export type UseWebComponents = (
80- options :UseWebComponentsOptions
100+ export type UseWebComponents = < T = { } , P = { } > (
101+ options :UseWebComponentsOptions < T , P >
81102) => Promise < void | ( ( ) => void ) > ;
82103
104+ export type UseIframe = < T = { } > ( options :UseIframeOptions < T > ) => void ;
105+
83106export type DefineCustomElementOptions = Pick <
84107UseWebComponentsOptions ,
85108Exclude < keyof UseWebComponentsOptions , 'target' | 'loader' >