@@ -163,6 +163,17 @@ declare enum StyleOpType {
163163 Set = 0 ,
164164 Delete = 1
165165}
166+ declare class ElementClassList {
167+ tokens : Set < string > ;
168+ private element ;
169+ constructor ( ele : Element , initialTokens : string [ ] ) ;
170+ get length ( ) : number ;
171+ get value ( ) : string ;
172+ private changeHandler ;
173+ add ( className : string ) : void ;
174+ contains ( className : string ) : boolean ;
175+ remove ( className : string ) : void ;
176+ }
166177declare class Element {
167178 /**
168179 * 子节点列表
@@ -180,10 +191,6 @@ declare class Element {
180191 * 在 xml 模板里面声明的 id 属性,一般用于节点查询
181192 */
182193 idName : string ;
183- /**
184- * 在 xml 模板里面声明的 class 属性,一般用于模板插件
185- */
186- className : string ;
187194 /**
188195 * 当前节点所在节点树的根节点,指向 Layout
189196 */
@@ -208,7 +215,6 @@ declare class Element {
208215 * 执行 getBoundingClientRect 的结果缓存,如果业务高频调用,可以减少 GC
209216 */
210217 private rect ;
211- classNameList : string [ ] | null ;
212218 layoutBox : ILayoutBox ;
213219 backgroundImage : any ;
214220 ctx : CanvasRenderingContext2D | null ;
@@ -228,7 +234,12 @@ declare class Element {
228234 * 当前节点在 xml 的标签名称,比如 image、view
229235 */
230236 tagName ?: string ;
231- private originStyle ;
237+ classList : ElementClassList | null ;
238+ originStyle : IStyle ;
239+ /**
240+ * 在 xml 模板里面声明的 class 属性,一般用于模板插件
241+ */
242+ className : string ;
232243 /**
233244 * 有些 style 属性并不能直接用来渲染,需要经过解析之后才能进行渲染,这些值不会存储在 style 上
234245 * 比如 style.transform,如果每次都解析性能太差了
@@ -237,6 +248,7 @@ declare class Element {
237248 protected styleChangeHandler ( prop : string , styleOpType : StyleOpType , val ?: any ) : void ;
238249 constructor ( { style, idName, className, id, dataset, } : IElementOptions ) ;
239250 private calculateRenderForLayout ;
251+ innerStyle : Record < string , IStyle > ;
240252 observeStyleAndEvent ( ) : void ;
241253 protected cacheStyle : IStyle ;
242254 activeHandler ( e ?: any ) : void ;
@@ -613,6 +625,7 @@ declare class Layout extends Element {
613625 isNeedRepaint : boolean ;
614626 ticker : Ticker ;
615627 tickerFunc : ( ) => void ;
628+ styleSheet : Record < string , IStyle > ;
616629 private eventHandlerData ;
617630 protected activeElements : Element [ ] ;
618631 constructor ( { style, } : {
0 commit comments