site
Version:
Site Engine is the world's first all-in-one engine to build a modern web site, game, or blog. No HTML or CSS knowledge required.
1 lines • 3.21 kB
JavaScript
;Object.defineProperty(exports,"__esModule",{value:!0}),exports.RoundedCorners=exports.Border=exports.Padding=exports.parseLength=exports.NoneLength=exports.AutoLength=exports.RatioLength=exports.EmLength=exports.RemLength=exports.Length=exports.LayoutXY=void 0;var t,e=require("./shared.manifest"),s=require("./shared.color"),r=(t=s)&&t.__esModule?t:{default:t};var o,n,i,h,a,u,p,x,c,d,l,g=function(t){return null!=t};exports.LayoutXY=o=class{constructor(t,e){((t,e)=>(()=>{this.x=n.from(t),this.y=n.from(e)})())(t,e)}static from(t){return(t=>(()=>t instanceof Array?(()=>new this(t[0],t[1]))():(()=>t instanceof this?(()=>t)():(()=>(0,e.fail)())())())())(t)}equals(t){return(t=>(()=>this.x.equals(t.x)&&this.y.equals(t.y))())(t)}},exports.Length=n=class{static from(t,s){return((t,s)=>(void 0===s&&(s=!1),(()=>"string"==typeof t?(()=>x(t))():(()=>"number"==typeof t?(()=>s?(()=>new i(t))():(()=>new a(t))())():(()=>t instanceof n?(()=>t)():(()=>(0,e.fail)())())())())()))(t,s)}equals(t){return(t=>(()=>this.constructor===t.constructor&&this.value===t.value)())(t)}},exports.RemLength=i=class extends n{constructor(t){(t=>(()=>{super(),this.value=t})())(t)}toString(){return(()=>(()=>this.value+"rem")())()}},exports.EmLength=h=class extends n{constructor(t){(t=>(()=>{super(),this.value=t})())(t)}toString(){return(()=>(()=>this.value+"em")())()}},exports.RatioLength=a=class extends n{constructor(t){(t=>(()=>{super(),this.value=t})())(t)}toString(){return(()=>(()=>100*this.value+"%")())()}},exports.AutoLength=u=class extends n{toString(){return"auto"}},exports.NoneLength=p=class extends n{toString(){return"none"}},exports.parseLength=x=function(t){return s=parseFloat(t),"auto"===t?(()=>new u)():(()=>t.endsWith("rem")?(()=>new i(s))():(()=>t.endsWith("em")?(()=>new h(s))():(()=>t.endsWith("%")?(()=>new a(s/100))():(()=>"none"===t?(()=>new p)():(()=>(0,e.fail)())())())())())();var s},exports.Padding=c=class{constructor(t,e,s,r){((t,e,s,r)=>(()=>{this.x1=n.from(t),this.y1=g(e)?(()=>n.from(e))():(()=>this.x1)(),this.x2=g(s)?(()=>n.from(s))():(()=>this.x1)(),this.y2=g(r)?(()=>n.from(r))():(()=>this.y1)()})())(t,e,s,r)}},exports.Border=d=class{constructor(t,s,o,a){((t,s,o,a)=>(()=>{var u;u=(t=>(void 0===t&&(t={}),(()=>{var s,o,a,u;return s=n.from(void 0===(o=t.width)?"0rem":o),(0,e.assert)(s instanceof i||s instanceof h),{width:s,style:void 0===(a=t.style)?"solid":a,paint:r.default.from(void 0===(u=t.paint)?"rgb(0,0,0)":u)}})())),this.x1=u(t),this.y1=g(s)?(()=>u(s))():(()=>this.x1)(),this.x2=g(o)?(()=>u(o))():(()=>this.x1)(),this.y2=g(a)?(()=>u(a))():(()=>this.y1)()})())(t,s,o,a)}},exports.RoundedCorners=l=class{constructor(t,e,s,r){((t,e,s,r)=>(()=>{var i;i=(t=>(void 0===t&&(t=0),(()=>t instanceof o?(()=>t)():(()=>new o(n.from(t),n.from(t)))())())),this.topLeft=i(t),this.topRight=g(e)?(()=>i(e))():(()=>this.topLeft)(),this.bottomRight=g(s)?(()=>i(s))():(()=>this.topLeft)(),this.bottomLeft=g(r)?(()=>i(r))():(()=>this.topRight)()})())(t,e,s,r)}},exports.LayoutXY=o,exports.Length=n,exports.RemLength=i,exports.EmLength=h,exports.RatioLength=a,exports.AutoLength=u,exports.NoneLength=p,exports.parseLength=x,exports.Padding=c,exports.Border=d,exports.RoundedCorners=l;