H A D | index.js | 1 (()=>{"use strict";var e={904:(e,t)=>{var n;let o;Object.defineProperty(t,"__esModule",{value:!0}),t.setDomain=t.getDomain=t.Domain=void 0,function(e){e[e.FA=0]="FA",e[e.FORM=1]="FORM",e[e.ETS=2]="ETS"}(n||(n={})),t.Domain=n,t.setDomain=e=>{o=e},t.getDomain=()=>null!=o?o:n.FA},784:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.errorMap=void 0,t.errorMap=new Map([["fileError","Visual file is damaged"],["versionError","Version number of visual file does not match"],["modelError","Visual model in visual file is damaged"],["codegenError","Codegen hml and css failed"]])},117:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ASTNode=void 0,t.ASTNode=class{accept(e){return e.visit(this)}}},862:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Cache=void 0,t.Cache=class{constructor(e,t=0){this.value="",this.indent=t,this.flag=!0,this.INDENT=e}indentOn(){this.flag=!0}indentOff(){this.flag=!1}incIndent(){this.indent++}decIndent(){this.indent--}checkIndent(){return this.indent<0}getIndents(){if(this.flag){let e="";for(let t=0;t<this.indent;t++)e+=this.INDENT;return e}return""}concat(...e){return this.value+=this.getIndents(),this.value=this.value.concat(...e),String(this.value)}toString(){return this.value}}},243:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Style=t.Tag=void 0;const o=n(117);class r extends o.ASTNode{constructor(e,t,n){super(),this.tagName=e,this.attributes=t,this.content=n}}t.Tag=r;class i extends o.ASTNode{constructor(e,t,n,o){super(),this.mediaQuery=void 0,this.kind=e,this.name=t,this.content=n,this.mediaQuery=o}}t.Style=i},573:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ASTNodeGenerator=void 0;const o=n(243),r=n(334);class i{constructor(e){this.cache=e}visit(e){e instanceof o.Tag?this.genTag(e):e instanceof o.Style&&this.genStyle(e)}static getMethodGen(e){return void 0===i.instance?i.instance=new i(e):i.instance.setCache(e),i.instance}setCache(e){this.cache=e}genTag(e){if(this.cache.concat(r.TokenClass.TAG_START,e.tagName),this.cache.indentOff(),e.attributes.forEach(((e,t)=>{let n="";for(const t of e)n+='"'===t?""":"\n"===t?" ":t;this.cache.concat(r.TokenClass.SPACE,t,r.TokenClass.ASSIGN,r.TokenClass.LQUOTE,n,r.TokenClass.RQUOTE)})),null===e.content)this.cache.concat(r.TokenClass.EMPTY_TAG_END);else{if(this.cache.concat(r.TokenClass.TAG_END),"string"==typeof e.content){let t="";for(const n of e.content)t+="<"===n?"<":n;this.cache.concat(t)}else 0!==e.content.length&&(this.cache.concat(r.TokenClass.NEW_LINE),this.cache.indentOn(),this.cache.incIndent(),e.content.forEach((e=>{e.accept(this),this.cache.indentOff(),this.cache.concat(r.TokenClass.NEW_LINE),this.cache.indentOn()})),this.cache.decIndent(),this.cache.indentOn());this.cache.concat(r.TokenClass.END_TAG_START,e.tagName,r.TokenClass.TAG_END)}}genStyle(e){void 0!==e.mediaQuery&&(this.cache.concat("@media"),this.cache.indentOff(),this.cache.concat(r.TokenClass.SPACE,e.mediaQuery,r.TokenClass.SPACE,r.TokenClass.LBRA,r.TokenClass.NEW_LINE),this.cache.indentOn(),this.cache.incIndent()),"IDStyle"===e.kind&&(this.cache.concat(r.TokenClass.ID_STYLE_START),this.cache.indentOff()),this.cache.concat(e.name,r.TokenClass.SPACE,r.TokenClass.LBRA,r.TokenClass.NEW_LINE),this.cache.indentOn(),this.cache.incIndent(),e.content.forEach(((e,t)=>{this.cache.concat(t,r.TokenClass.COLON,r.TokenClass.SPACE,e,r.TokenClass.SEMICOLON,r.TokenClass.NEW_LINE)})),this.cache.decIndent(),this.cache.concat(r.TokenClass.RBRA,r.TokenClass.NEW_LINE),void 0!==e.mediaQuery&&(this.cache.decIndent(),this.cache.concat(r.TokenClass.RBRA,r.TokenClass.NEW_LINE)),this.cache.concat(r.TokenClass.NEW_LINE)}}t.ASTNodeGenerator=i,i.instance=void 0},844:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CSSBridge=t.HMLBridge=void 0;const o=n(243),r=n(571);t.HMLBridge=class{constructor(){this.errors=0}error(e){console.error("Code generating error: "+e),this.errors+=1}getErrorCount(){return this.errors}visit(e){const t=new Map([["id",e.id]]);let n="";for(let[o,i]of e.property)(0,r.isAttribute)(o,e.type)?("string"!=typeof i&&(i=JSON.stringify(i)),t.set(o,i)):(0,r.isContent)(o)&&(n=i);if(e.children.length>0){n=[];for(const t of e.children)n.push(t.accept(this))}const i=new o.Tag(e.type,t,n);return"wrapper"===t.get("id")?new o.Tag("div",new Map,[i]):i}},t.CSSBridge=class{constructor(){this.errors=0,this.styles=[]}error(e){console.error("Code generating error: "+e),this.errors+=1}getErrorCount(){return this.errors}genIDStyle(e){var t;const n=t=>{const n=new Map;for(const[o,i]of t)(0,r.isStyle)(o,e.type)&&n.set(o,i);return n},i=n(e.property);i.size>0&&this.styles.push(new o.Style("IDStyle",e.id,i)),(null!==(t=e.mediaProperty)&&void 0!==t?t:new Map).forEach(((t,r)=>{const i=n(t);i.size>0&&this.styles.push(new o.Style("IDStyle",e.id,i,r))}));for(const t of e.children)t.accept(this)}visit(e){return this.genIDStyle(e),this.styles}}},55:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.genFACSS=t.genFAHML=void 0;const o=n(573),r=n(862);t.genFAHML=function(e){const t=o.ASTNodeGenerator.getMethodGen(new r.Cache(" "));return e.accept(t),t.cache.toString()},t.genFACSS=function(e){const t=o.ASTNodeGenerator.getMethodGen(new r.Cache(" "));return e.forEach((e=>{e.accept(t)})),t.cache.toString()}},571:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.isEvent=t.isData=t.isUnknown=t.isContent=t.isAttribute=t.isStyle=t.styleMap=void 0;const n=["width","height","min-width","min-height","max-width","max-height","padding","padding-start","padding-end","padding-top","padding-right","padding-bottom","padding-left","margin","margin-start","margin-end","margin-top","margin-right","margin-bottom","margin-left","border-width","border-style","border-color","border-radius","border-top-width","border-top-style","border-top-color","border-top-left-radius","border-right-width","border-right-style","border-right-color","border-top-right-radius","border-bottom-width","border-bottom-style","border-bottom-color","border-bottom-right-radius","border-left-width","border-left-style","border-left-color","border-bottom-left-radius","background-color","background","background-image","background-size","background-position","background-repeat","display","opacity","visibility","flex","flex-grow","flex-shrink","flex-basis","position","display","top","right","bottom","left","display-index","flex-weight","aspect-ratio"],o=["font-size","font-family","font-style","font-weight"],r=["text-align","line-height","text-decoration","letter-spacing","max-lines","text-overflow","allow-scale","min-font-size","max-font-size","font-size-step","prefer-font-sizes","color",...o],i=["allow-scale","text-decoration","color",...o],a=["text-color","allow-scale","icon-width","icon-height","radius",...o],s=["texton-color","textoff-color","text-padding","allow-scale",...o],c=["column-height","text-color","allow-scale","letter-spacing","text-decoration","line-height","opacity",...o],l=["text-color","allow-scale","letter-spacing",...o];t.styleMap=new Map([["common",new Set([...n])],["div",new Set(["flex-direction","overflow","flex-wrap","justify-content","align-items","align-content","grid-template-columns","grid-template-rows","grid-row-start","grid-row-end","grid-column-start","grid-column-end","grid-gap","grid-columns-gap","grid-rows-gap"])],["text",new Set([...r])],["image",new Set(["object-fit","match-text-direction","fit-original-size"])],["span",new Set([...i])],["input",new Set(["font-size","font-family","font-weight","color","placeholder-color","allow-scale"])],["button",new Set([...a])],["switch",new Set([...s])],["refresh",new Set(["progress-color"])],["divider",new Set(["stroke-width","line-cap","color"])],["chart",new Set(["stroke-width","radius","start-angle","total-angle","center-x","center-y","colors","weights"])],["picker",new Set([...c])],["picker-view",new Set(["color","font-size","selected-color","selected-font-size","focus-color","focus-font-size","disappear-color","disappear-font-size","font-family"])],["slider",new Set(["color","selected-color","block-color"])],["swiper",new Set(["indicator-color","indicator-selected-color","indicator-size","indicator-top","indicator-right","indicator-bottom","indicator-left"])],["list",new Set(["flex-direction","columns","item-extent","fade-color"])],["list-item",new Set(["column-span"])],["progress",new Set(["color","stroke-width","background-color","secondary-color","scale-width","scale-number","start-angle","total-angle","center-x","center-y","radius"])],["select",new Set(["font-family"])],["menu",new Set([...l])],["option",new Set(["color","font-family","allow-scale","font-size","font-weight","text-decoration"])],["video",new Set(["object-fit"])],["clock",new Set(["font-family"])]]);const d=new Map([["common",new Set(["id","ref","disabled","focusable","data","if","for"])],["image",new Set(["src","alt"])],["button",new Set(["type","value","icon","waiting"])],["refresh",new Set(["offset","refreshing","type","lasttime","friction"])],["input",new Set(["type","checked","name","value","placeholder","maxlength","enterkeytype","headericon"])],["switch",new Set(["checked","showtext","texton","textoff"])],["option",new Set(["value","selected","icon"])],["chart",new Set(["type","percent","datasets","options"])],["picker",new Set(["type","range","selected","start","end","lunar","lunarSwitch","columns","hours","containSecond","value","vibrate"])],["picker-view",new Set(["type","range","selected","start","end","lunar","lunarSwitch","columns","hours","containSecond","indicatorprefix","indicatorsuffix","vibrate"])],["slider",new Set(["min","max","step","showtips","showsteps","mode","value"])],["divider",new Set(["vertical"])],["list",new Set(["scrollpage","cachedcount","scrollbar","scrolleffect","shapemode","indexer","itemscale","itemcenter","updateeffect","scrollvibrate","initialindex","initialoffset"])],["list-item",new Set(["type","primary","section","sticky","stickyradius","clickeffect"])],["swiper",new Set(["index","autoplay","interval","indicator","digital","indicatordisabled","loop","duration","vertical"])],["progress",new Set(["type","percent","secondarypercent","clockwise"])],["menu",new Set(["target","title","type"])],["clock",new Set(["clockconfig","showdigit","hourswest"])],["badge",new Set(["placement","count","visible","maxcount","config","label"])],["video",new Set(["muted","src","autoplay","poster","controls","loop","starttime","direction","speed"])],["tabs",new Set(["index","vertical"])],["tab-bar",new Set(["mode"])],["tab-content",new Set(["scrollable"])]]),p=new Map([["common",new Set(["ontouchstart","ontouchmove","ontouchcancel","ontouchend","onclick","onlongpress","onfocus","onblur","onkey","onswipe"])],["image",new Set(["oncomplete","onerror"])],["input",new Set(["onchange","onenterkeyclick"])],["select",new Set(["onchange"])],["refresh",new Set(["onrefresh","onpulldown"])],["swiper",new Set(["onchange","onrotation"])],["list",new Set(["onindexerchange","onscroll","onscrollbottom","onscrolltop","onscrollend","onscrolltouchup","onrequestitem"])],["list-item",new Set(["onsticky"])],["menu",new Set(["onselected","oncancel"])],["picker",new Set(["oncolumnchange","onchange","oncancel"])],["picker-view",new Set(["oncolumnchange","onchange"])],["video",new Set(["onprepared","onstart","onpause","onfinish","onerror","onseeking","onseeked","ontimeupdate","onfullscreenchange","onstop"])],["tabs",new Set(["onchange"])],["switch",new Set(["onchange"])],["dialog",new Set(["oncancel"])],["slider",new Set(["onchange"])]]);function h(e,t,n){const o=t.get(n);return void 0!==o&&o.has(e)}function u(e,n){return h(e,t.styleMap,"common")||h(e,t.styleMap,n)}function f(e,t){return g(e,t)||m(e,t)}function g(e,t){return h(e,d,"common")||h(e,d,t)}function m(e,t){return h(e,p,"common")||h(e,p,t)}t.isStyle=u,t.isAttribute=f,t.isContent=function(e){return"content"===e},t.isUnknown=function(e,t){return!u(e,t)&&!f(e,t)},t.isData=g,t.isEvent=m},334:(e,t)=>{var n;Object.definePrope (…) function
|