UNPKG

@iimm/shared

Version:

shared utils on browser and react env

100 lines (99 loc) 2.92 kB
export interface ObjectStyle<T = string | number> { [key: string]: T; } /** html与json转换时各个节点或属性的转换名称 */ export interface HtmlConvertAttributesConfig { /** 除文本和注释外其他节点的type值(默认为'element') *@default 'element' * ``` * 最终节点对应的属性样式: * { type: [NODETAG] } * ``` */ NODETAG?: string; /** 除文本和注释外其他节点的标签名对应的key(默认为'name') * ``` * 最终节点对应的属性样式 * { [NODENAME]: 'img' } * ``` *@default 'name' */ NODENAME?: string; /** 文本节点的type值(默认为'text') * ``` * 最终节点对应的属性样式: * { type: [TEXTTAG] } * ``` *@default 'text' */ TEXTTAG?: string; /** 文本节点的文本内容对应的key(默认为'text') * ``` * 最终节点对应的属性样式: * { [TEXTVALUE]: '这是文本内容' } * ``` *@default 'text' */ TEXTVALUE?: string; /** 注释节点对应的type值(默认为'comment') * ``` * 最终节点对应的属性样式: * { type: [COMMENTTAG] } * ``` *@default 'comment' */ COMMENTTAG?: string; /** 注释节点的内容对应的key('默认为comment') * ``` * 最终节点对应的属性样式: * { [COMMENTVALUE]: '这是注释内容' } * ``` *@default 'comment' */ COMMENTVALUE?: string; /** 子节点数组项对应的key(默认为'elements') * ``` * 最终节点对应的属性样式: * { [CHILDREN]: [ subNode1, subNode2, ... ] } * ``` *@default 'elements' */ CHILDREN?: string; /** 内联样式的对象形式项点对应的key(默认为'style') * ``` * 最终节点对应的属性样式: * { [STYLE]: { color:'red' } } * ``` *@default 'style' */ STYLE?: string; /** 节点样式class类数组对应的key(默认为'classList') * ``` * 最终节点对应的属性样式: * { [CLASSLIST]: [ 'class1', 'xxtewt' ] } * ``` *@default 'classList' */ CLASSLIST?: string; /** 节点属性项对应的key(默认为'attributes') * ``` * 最终节点对应的属性样式: * { [ATTRIBUTES]: { width: '500px', height: 200 } } * ``` *@default 'attributes' */ ATTRIBUTES?: string; /** 内联样式原文本项对应的key(默认为'inlineStyle') * ``` * 最终节点对应的属性样式: * { [INLINESTYLE]: 'color:red;font-size:12pt' } * ``` *@default 'inlineStyle' */ INLINESTYLE?: string; } /** html转换为的jsNode的节点 */ export interface HtmlJsonNode { type?: string; [key: string]: any; }