@leafer-ui/draw 1.6.3 → 1.6.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/draw.cjs +4 -1
- package/lib/draw.esm.js +4 -1
- package/lib/draw.esm.min.js +1 -1
- package/lib/draw.esm.min.js.map +1 -1
- package/lib/draw.min.cjs +1 -1
- package/lib/draw.min.cjs.map +1 -1
- package/package.json +6 -6
package/lib/draw.min.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var t=require("@leafer/core");function e(t,e,s,r){var o,i=arguments.length,a=i<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,s):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,s,r);else for(var n=t.length-1;n>=0;n--)(o=t[n])&&(a=(i<3?o(a):i>3?o(e,s,a):o(e,s))||a);return i>3&&a&&Object.defineProperty(e,s,a),a}function s(e){return t.decorateLeafAttr(e,(e=>t.attr({set(t){this.__setAttr(e,t),t&&(this.__.__useEffect=!0),this.__layout.renderChanged||this.__layout.renderChange()}})))}function r(e){return t.decorateLeafAttr(e,(e=>t.attr({set(t){this.__setAttr(e,t),this.__layout.boxChanged||this.__layout.boxChange(),this.__updateSize()}})))}function o(){return(e,s)=>{const r="_"+s;t.defineKey(e,s,{set(t){this.isLeafer&&(this[r]=t)},get(){return this.isApp?this.tree.zoomLayer:this.isLeafer?this[r]||this:this.leafer&&this.leafer.zoomLayer}})}}"function"==typeof SuppressedError&&SuppressedError;const i={},a={hasTransparent:function(t){if(!t||7===t.length||4===t.length)return!1;if("transparent"===t)return!0;const e=t[0];if("#"===e)switch(t.length){case 5:return"f"!==t[4]&&"F"!==t[4];case 9:return"f"!==t[7]&&"F"!==t[7]||"f"!==t[8]&&"F"!==t[8]}else if(("r"===e||"h"===e)&&"a"===t[3]){const e=t.lastIndexOf(",");if(e>-1)return parseFloat(t.slice(e+1))<1}return!1}},n={number:(t,e)=>"object"==typeof t?"percent"===t.type?t.value*e:t.value:t},p={},h={},_={},d={},l={apply(){t.Plugin.need("filter")}},u={},c={setStyleName:()=>t.Plugin.need("state"),set:()=>t.Plugin.need("state")},x={list:{},register(t,e){x.list[t]=e},get:t=>x.list[t]},{parse:y,objectToCanvasData:g}=t.PathConvert,{stintSet:v}=t.DataHelper,{hasTransparent:f}=a,w={},T=t.Debug.get("UIData");class m extends t.LeafData{get scale(){const{scaleX:t,scaleY:e}=this;return t!==e?{x:t,y:e}:t}get __strokeWidth(){const{strokeWidth:t,strokeWidthFixed:e}=this;if(e){const e=this.__leaf;let{scaleX:s}=e.__nowWorld||e.__world;return s<0&&(s=-s),s>1?t/s:t}return t}get __hasStroke(){return this.stroke&&this.strokeWidth}get __hasHalf(){const t=this;return t.stroke&&"center"===t.strokeAlign&&t.strokeWidth%2||void 0}get __hasMultiPaint(){const t=this;return!!(t.__isFills&&t.fill.length>1||t.__isStrokes&&t.stroke.length>1||t.__useEffect)||t.fill&&this.__hasStroke}get __clipAfterFill(){const t=this;return t.cornerRadius||t.innerShadow||t.__pathInputed}get __hasSurface(){return this.fill||this.stroke}get __autoWidth(){return!this._width}get __autoHeight(){return!this._height}get __autoSide(){return!this._width||!this._height}get __autoSize(){return!this._width&&!this._height}setVisible(t){this._visible=t;const{leafer:e}=this.__leaf;e&&(e.watcher.hasVisible=!0)}setWidth(t){t<0?(this._width=-t,this.__leaf.scaleX*=-1,T.warn("width < 0, instead -scaleX ",this)):this._width=t}setHeight(t){t<0?(this._height=-t,this.__leaf.scaleY*=-1,T.warn("height < 0, instead -scaleY",this)):this._height=t}setFill(t){this.__naturalWidth&&this.__removeNaturalSize(),"string"!=typeof t&&t?"object"==typeof t&&this.__setPaint("fill",t):(v(this,"__isTransparentFill",f(t)),this.__isFills&&this.__removePaint("fill",!0),this._fill=t)}setStroke(t){"string"!=typeof t&&t?"object"==typeof t&&this.__setPaint("stroke",t):(v(this,"__isTransparentStroke",f(t)),this.__isStrokes&&this.__removePaint("stroke",!0),this._stroke=t)}setPath(t){const e="string"==typeof t;e||t&&"object"==typeof t[0]?(this.__setInput("path",t),this._path=e?y(t):g(t)):(this.__input&&this.__removeInput("path"),this._path=t)}setShadow(t){I(this,"shadow",t)}setInnerShadow(t){I(this,"innerShadow",t)}setFilter(t){I(this,"filter",t)}__computePaint(){const{fill:t,stroke:e}=this.__input;t&&h.compute("fill",this.__leaf),e&&h.compute("stroke",this.__leaf),this.__needComputePaint=void 0}__setPaint(t,e){this.__setInput(t,e);const s=this.__leaf.__layout;s.boxChanged||s.boxChange(),e instanceof Array&&!e.length?this.__removePaint(t):"fill"===t?(this.__isFills=!0,this._fill||(this._fill=w)):(this.__isStrokes=!0,this._stroke||(this._stroke=w))}__removePaint(t,e){e&&this.__removeInput(t),_.recycleImage(t,this),"fill"===t?(v(this,"__isAlphaPixelFill",void 0),this._fill=this.__isFills=void 0):(v(this,"__isAlphaPixelStroke",void 0),this._stroke=this.__isStrokes=void 0)}}function I(t,e,s){t.__setInput(e,s),s instanceof Array?(s.some((t=>!1===t.visible))&&(s=s.filter((t=>!1!==t.visible))),s.length||(s=void 0)):s=s&&!1!==s.visible?[s]:void 0,t["_"+e]=s}class R extends m{}class S extends R{get __boxStroke(){return!this.__pathInputed}get __drawAfterFill(){const t=this;return"hide"===t.overflow&&(t.__clipAfterFill||t.innerShadow)&&t.__leaf.children.length}get __clipAfterFill(){return this.__leaf.isOverflow||super.__clipAfterFill}}class P extends R{__getInputData(e,s){const r=super.__getInputData(e,s);return t.canvasSizeAttrs.forEach((t=>delete r[t])),r}}class b extends S{}class k extends m{}class B extends m{get __boxStroke(){return!this.__pathInputed}}class C extends m{get __boxStroke(){return!this.__pathInputed}}class U extends m{}class A extends m{}class L extends m{get __pathInputed(){return 2}}class D extends R{}const E={thin:100,"extra-light":200,light:300,normal:400,medium:500,"semi-bold":600,bold:700,"extra-bold":800,black:900};class F extends m{get __useNaturalRatio(){return!1}setFontWeight(t){"string"==typeof t?(this.__setInput("fontWeight",t),t=E[t]||400):this.__input&&this.__removeInput("fontWeight"),this._fontWeight=t}setBoxStyle(e){let s=this.__leaf,r=s.__box;if(e){const{boxStyle:o}=this;if(r)for(let t in o)r[t]=void 0;else r=s.__box=t.UICreator.get("Rect",0);const i=s.__layout,a=r.__layout;o||(r.parent=s,r.__world=s.__world,a.boxBounds=i.boxBounds),r.set(e),a.strokeChanged&&i.strokeChange(),a.renderChanged&&i.renderChange(),r.__updateChange()}else r&&(s.__box=r.parent=null,r.destroy());this._boxStyle=e}}class W extends B{setUrl(t){this.__setImageFill(t),this._url=t}__setImageFill(t){this.fill=t?{type:"image",mode:"stretch",url:t}:void 0}__getData(){const t=super.__getData();return delete t.fill,t}__getInputData(t,e){const s=super.__getInputData(t,e);return delete s.fill,s}}class z extends B{get __isCanvas(){return!0}get __drawAfterFill(){return!0}__getInputData(t,e){const s=super.__getInputData(t,e);return s.url=this.__leaf.canvas.toDataURL("image/png"),s}}const M={__updateStrokeSpread(){let t=0,e=0;const s=this.__,{strokeAlign:r,strokeWidth:o}=s,i=this.__box;if((s.stroke||"all"===s.hitStroke)&&o&&"inside"!==r&&(e=t="center"===r?o/2:o,!s.__boxStroke)){const e=s.__isLinePath?0:10*t,r="none"===s.strokeCap?0:o;t+=Math.max(e,r)}return s.__useArrow&&(t+=5*o),i&&(t=Math.max(i.__layout.strokeSpread=i.__updateStrokeSpread(),t),e=i.__layout.strokeBoxSpread),this.__layout.strokeBoxSpread=e,t},__updateRenderSpread(){let t=0;const{shadow:e,innerShadow:s,blur:r,backgroundBlur:o,filter:i}=this.__;e&&e.forEach((e=>t=Math.max(t,Math.max(Math.abs(e.y),Math.abs(e.x))+(e.spread>0?e.spread:0)+1.5*e.blur))),r&&(t=Math.max(t,r)),i&&(t+=l.getSpread(i));let a=t=Math.ceil(t);return s&&s.forEach((t=>a=Math.max(a,Math.max(Math.abs(t.y),Math.abs(t.x))+(t.spread<0?-t.spread:0)+1.5*t.blur))),o&&(a=Math.max(a,o)),this.__layout.renderShapeSpread=a,t+=this.__layout.strokeSpread||0,this.__box?Math.max(this.__box.__updateRenderSpread(),t):t}},{stintSet:H}=t.DataHelper,O={__updateChange(){const t=this.__;if(t.__useEffect){const{shadow:e,fill:s,stroke:r}=t,o=t.innerShadow||t.blur||t.backgroundBlur||t.filter;H(t,"__isFastShadow",e&&!o&&e.length<2&&!e[0].spread&&!(e[0].box&&t.__isTransparentFill)&&s&&!(s instanceof Array&&s.length>1)&&(this.useFastShadow||!r||r&&"inside"===t.strokeAlign)),t.__useEffect=!(!e&&!o)}H(this.__world,"half",t.__hasHalf),H(t,"__fillAfterStroke",t.stroke&&"outside"===t.strokeAlign&&t.fill&&!t.__isTransparentFill),t.__checkSingle(),H(t,"__complex",t.__isFills||t.__isStrokes||t.cornerRadius||t.__useEffect)},__drawFast(t,e){N(this,t,e)},__draw(t,e,s){const r=this.__;if(r.__complex){r.__needComputePaint&&r.__computePaint();const{fill:o,stroke:i,__drawAfterFill:n,__fillAfterStroke:p,__isFastShadow:_}=r;if(this.__drawRenderPath(t),r.__useEffect&&!_){const a=h.shape(this,t,e);this.__nowWorld=this.__getNowWorld(e);const{shadow:_,innerShadow:u,filter:c}=r;_&&d.shadow(this,t,a),p&&(r.__isStrokes?h.strokes(i,this,t):h.stroke(i,this,t)),o&&(r.__isFills?h.fills(o,this,t):h.fill(o,this,t)),n&&this.__drawAfterFill(t,e),u&&d.innerShadow(this,t,a),i&&!p&&(r.__isStrokes?h.strokes(i,this,t):h.stroke(i,this,t)),c&&l.apply(c,this,this.__nowWorld,t,s,a),a.worldCanvas&&a.worldCanvas.recycle(),a.canvas.recycle()}else{if(p&&(r.__isStrokes?h.strokes(i,this,t):h.stroke(i,this,t)),_){const e=r.shadow[0],{scaleX:s,scaleY:o}=this.__nowWorld;t.save(),t.setWorldShadow(e.x*s,e.y*o,e.blur*s,a.string(e.color))}o&&(r.__isFills?h.fills(o,this,t):h.fill(o,this,t)),_&&t.restore(),n&&this.__drawAfterFill(t,e),i&&!p&&(r.__isStrokes?h.strokes(i,this,t):h.stroke(i,this,t))}}else r.__pathInputed?N(this,t,e):this.__drawFast(t,e)},__renderShape(t,e,s,r){if(this.__worldOpacity){t.setWorld(this.__nowWorld=this.__getNowWorld(e));const{fill:o,stroke:i}=this.__;this.__drawRenderPath(t),o&&!s&&(this.__.__isAlphaPixelFill?h.fills(o,this,t):h.fill("#000000",this,t)),this.__.__isCanvas&&this.__drawAfterFill(t,e),i&&!r&&(this.__.__isAlphaPixelStroke?h.strokes(i,this,t):h.stroke("#000000",this,t))}},__drawAfterFill(t,e){this.__.__clipAfterFill?(t.save(),this.windingRule?t.clip(this.windingRule):t.clip(),this.__drawContent(t,e),t.restore()):this.__drawContent(t,e)}};function N(t,e,s){const{fill:r,stroke:o,__drawAfterFill:i,__fillAfterStroke:a}=t.__;t.__drawRenderPath(e),a&&h.stroke(o,t,e),r&&h.fill(r,t,e),i&&t.__drawAfterFill(e,s),o&&!a&&h.stroke(o,t,e)}const G={__drawFast(t,e){let{x:s,y:r,width:o,height:i}=this.__layout.boxBounds;const{fill:a,stroke:n,__drawAfterFill:p}=this.__;if(a&&(t.fillStyle=a,t.fillRect(s,r,o,i)),p&&this.__drawAfterFill(t,e),n){const{strokeAlign:a,__strokeWidth:p}=this.__;if(!p)return;t.setStroke(n,p,this.__);const h=p/2;switch(a){case"center":t.strokeRect(0,0,o,i);break;case"inside":o-=p,i-=p,o<0||i<0?(t.save(),this.__clip(t,e),t.strokeRect(s+h,r+h,o,i),t.restore()):t.strokeRect(s+h,r+h,o,i);break;case"outside":t.strokeRect(s-h,r-h,o+p,i+p)}}}};var j,V;exports.UI=j=class extends t.Leaf{get app(){return this.leafer&&this.leafer.app}get isFrame(){return!1}set scale(e){t.MathHelper.assignScale(this,e)}get scale(){return this.__.scale}get pen(){const{path:e}=this.__;return t.pen.set(this.path=e||[]),e||this.__drawPathByBox(t.pen),t.pen}constructor(t){super(t)}reset(t){}set(t,e){t&&(e?"temp"===e?(this.lockNormalStyle=!0,Object.assign(this,t),this.lockNormalStyle=!1):this.animate(t,e):Object.assign(this,t))}get(t){return"string"==typeof t?this.__.__getInput(t):this.__.__getInputData(t)}createProxyData(){}find(e,s){return t.Plugin.need("find")}findTag(t){return this.find({tag:t})}findOne(e,s){return t.Plugin.need("find")}findId(t){return this.findOne({id:t})}getPath(e,s){this.__layout.update();let r=s?this.__.__pathForRender:this.__.path;return r||(t.pen.set(r=[]),this.__drawPathByBox(t.pen)),e?t.PathConvert.toCanvasData(r,!0):r}getPathString(e,s,r){return t.PathConvert.stringify(this.getPath(e,s),r)}load(){this.__.__computePaint()}__onUpdateSize(){if(this.__.__input){const t=this.__;!t.lazy||this.__inLazyBounds||u.running?t.__computePaint():t.__needComputePaint=!0}}__updateRenderPath(){if(this.__.path){const e=this.__;e.__pathForRender=e.cornerRadius?t.PathCorner.smooth(e.path,e.cornerRadius,e.cornerSmoothing):e.path,e.__useArrow&&p.addArrows(this,!e.cornerRadius)}}__drawRenderPath(t){t.beginPath(),this.__drawPathByData(t,this.__.__pathForRender)}__drawPath(t){t.beginPath(),this.__drawPathByData(t,this.__.path)}__drawPathByData(e,s){s?t.PathDrawer.drawPathByData(e,s):this.__drawPathByBox(e)}__drawPathByBox(t){const{x:e,y:s,width:r,height:o}=this.__layout.boxBounds;if(this.__.cornerRadius){const{cornerRadius:i}=this.__;t.roundRect(e,s,r,o,"number"==typeof i?[i]:i)}else t.rect(e,s,r,o)}drawImagePlaceholder(t,e){h.fill(this.__.placeholderColor,this,t)}animate(e,s,r,o){return t.Plugin.need("animate")}killAnimate(t,e){}export(e,s){return t.Plugin.need("export")}syncExport(e,s){return t.Plugin.need("export")}clone(e){const s=t.DataHelper.clone(this.toJSON());return e&&Object.assign(s,e),j.one(s)}static one(e,s,r,o,i){return t.UICreator.get(e.tag||this.prototype.__tag,e,s,r,o,i)}static registerUI(){t.registerUI()(this)}static registerData(e){t.dataProcessor(e)(this.prototype)}static setEditConfig(t){}static setEditOuter(t){}static setEditInner(t){}destroy(){this.fill=this.stroke=null,this.__animate&&this.killAnimate(),super.destroy()}},e([t.dataProcessor(m)],exports.UI.prototype,"__",void 0),e([o()],exports.UI.prototype,"zoomLayer",void 0),e([t.dataType("")],exports.UI.prototype,"id",void 0),e([t.dataType("")],exports.UI.prototype,"name",void 0),e([t.dataType("")],exports.UI.prototype,"className",void 0),e([t.surfaceType("pass-through")],exports.UI.prototype,"blendMode",void 0),e([t.opacityType(1)],exports.UI.prototype,"opacity",void 0),e([t.visibleType(!0)],exports.UI.prototype,"visible",void 0),e([t.surfaceType(!1)],exports.UI.prototype,"locked",void 0),e([t.surfaceType(!1)],exports.UI.prototype,"dim",void 0),e([t.surfaceType(!1)],exports.UI.prototype,"dimskip",void 0),e([t.sortType(0)],exports.UI.prototype,"zIndex",void 0),e([t.maskType(!1)],exports.UI.prototype,"mask",void 0),e([t.eraserType(!1)],exports.UI.prototype,"eraser",void 0),e([t.positionType(0,!0)],exports.UI.prototype,"x",void 0),e([t.positionType(0,!0)],exports.UI.prototype,"y",void 0),e([t.boundsType(100,!0)],exports.UI.prototype,"width",void 0),e([t.boundsType(100,!0)],exports.UI.prototype,"height",void 0),e([t.scaleType(1,!0)],exports.UI.prototype,"scaleX",void 0),e([t.scaleType(1,!0)],exports.UI.prototype,"scaleY",void 0),e([t.rotationType(0,!0)],exports.UI.prototype,"rotation",void 0),e([t.rotationType(0,!0)],exports.UI.prototype,"skewX",void 0),e([t.rotationType(0,!0)],exports.UI.prototype,"skewY",void 0),e([t.positionType(0,!0)],exports.UI.prototype,"offsetX",void 0),e([t.positionType(0,!0)],exports.UI.prototype,"offsetY",void 0),e([t.positionType(0,!0)],exports.UI.prototype,"scrollX",void 0),e([t.positionType(0,!0)],exports.UI.prototype,"scrollY",void 0),e([t.autoLayoutType()],exports.UI.prototype,"origin",void 0),e([t.autoLayoutType()],exports.UI.prototype,"around",void 0),e([t.dataType(!1)],exports.UI.prototype,"lazy",void 0),e([t.naturalBoundsType(1)],exports.UI.prototype,"pixelRatio",void 0),e([t.pathInputType()],exports.UI.prototype,"path",void 0),e([t.pathType()],exports.UI.prototype,"windingRule",void 0),e([t.pathType(!0)],exports.UI.prototype,"closed",void 0),e([t.boundsType(0)],exports.UI.prototype,"padding",void 0),e([t.boundsType(!1)],exports.UI.prototype,"lockRatio",void 0),e([t.boundsType()],exports.UI.prototype,"widthRange",void 0),e([t.boundsType()],exports.UI.prototype,"heightRange",void 0),e([t.dataType(!1)],exports.UI.prototype,"draggable",void 0),e([t.dataType()],exports.UI.prototype,"dragBounds",void 0),e([t.dataType(!1)],exports.UI.prototype,"editable",void 0),e([t.hitType(!0)],exports.UI.prototype,"hittable",void 0),e([t.hitType("path")],exports.UI.prototype,"hitFill",void 0),e([t.strokeType("path")],exports.UI.prototype,"hitStroke",void 0),e([t.hitType(!1)],exports.UI.prototype,"hitBox",void 0),e([t.hitType(!0)],exports.UI.prototype,"hitChildren",void 0),e([t.hitType(!0)],exports.UI.prototype,"hitSelf",void 0),e([t.hitType()],exports.UI.prototype,"hitRadius",void 0),e([t.cursorType("")],exports.UI.prototype,"cursor",void 0),e([t.surfaceType()],exports.UI.prototype,"fill",void 0),e([t.strokeType()],exports.UI.prototype,"stroke",void 0),e([t.strokeType("inside")],exports.UI.prototype,"strokeAlign",void 0),e([t.strokeType(1)],exports.UI.prototype,"strokeWidth",void 0),e([t.strokeType(!1)],exports.UI.prototype,"strokeWidthFixed",void 0),e([t.strokeType("none")],exports.UI.prototype,"strokeCap",void 0),e([t.strokeType("miter")],exports.UI.prototype,"strokeJoin",void 0),e([t.strokeType()],exports.UI.prototype,"dashPattern",void 0),e([t.strokeType(0)],exports.UI.prototype,"dashOffset",void 0),e([t.strokeType(10)],exports.UI.prototype,"miterLimit",void 0),e([t.pathType(0)],exports.UI.prototype,"cornerRadius",void 0),e([t.pathType()],exports.UI.prototype,"cornerSmoothing",void 0),e([s()],exports.UI.prototype,"shadow",void 0),e([s()],exports.UI.prototype,"innerShadow",void 0),e([s()],exports.UI.prototype,"blur",void 0),e([s()],exports.UI.prototype,"backgroundBlur",void 0),e([s()],exports.UI.prototype,"grayscale",void 0),e([s()],exports.UI.prototype,"filter",void 0),e([t.surfaceType()],exports.UI.prototype,"placeholderColor",void 0),e([t.dataType(100)],exports.UI.prototype,"placeholderDelay",void 0),e([t.dataType({})],exports.UI.prototype,"data",void 0),e([t.rewrite(t.Leaf.prototype.reset)],exports.UI.prototype,"reset",null),exports.UI=j=e([t.useModule(M),t.useModule(O),t.rewriteAble()],exports.UI),exports.Group=class extends exports.UI{get __tag(){return"Group"}get isBranch(){return!0}constructor(t){super(t)}reset(t){this.__setBranch(),super.reset(t)}__setBranch(){this.children||(this.children=[])}set(t,e){if(t)if(t.children){const{children:s}=t;delete t.children,this.children?this.clear():this.__setBranch(),super.set(t,e),s.forEach((t=>this.add(t))),t.children=s}else super.set(t,e)}toJSON(t){const e=super.toJSON(t);return e.children=this.children.map((e=>e.toJSON(t))),e}pick(t,e){}addAt(t,e){this.add(t,e)}addAfter(t,e){this.add(t,this.children.indexOf(e)+1)}addBefore(t,e){this.add(t,this.children.indexOf(e))}add(t,e){}addMany(...t){}remove(t,e){}removeAll(t){}clear(){}},e([t.dataProcessor(R)],exports.Group.prototype,"__",void 0),e([t.boundsType(0)],exports.Group.prototype,"width",void 0),e([t.boundsType(0)],exports.Group.prototype,"height",void 0),exports.Group=e([t.useModule(t.Branch),t.registerUI()],exports.Group);const Y=t.Debug.get("Leafer");exports.Leafer=V=class extends exports.Group{get __tag(){return"Leafer"}get isApp(){return!1}get app(){return this.parent||this}get isLeafer(){return!0}get imageReady(){return this.viewReady&&t.Resource.isComplete}get layoutLocked(){return!this.layouter.running}get FPS(){return this.renderer?this.renderer.FPS:60}get cursorPoint(){return this.interaction&&this.interaction.hoverData||{x:this.width/2,y:this.height/2}}get clientBounds(){return this.canvas&&this.canvas.getClientBounds(!0)||t.getBoundsData()}constructor(t,e){super(e),this.config={start:!0,hittable:!0,smooth:!0,lazySpeard:100},this.leafs=0,this.__eventIds=[],this.__controllers=[],this.__readyWait=[],this.__viewReadyWait=[],this.__viewCompletedWait=[],this.__nextRenderWait=[],this.userConfig=t,t&&(t.view||t.width)&&this.init(t),V.list.add(this)}init(e,s){if(this.canvas)return;let r;const{config:o}=this;this.__setLeafer(this),s&&(this.parentApp=s,this.__bindApp(s),r=s.running),e&&(this.parent=s,this.initType(e.type),this.parent=void 0,t.DataHelper.assign(o,e));const i=this.canvas=t.Creator.canvas(o);this.__controllers.push(this.renderer=t.Creator.renderer(this,i,o),this.watcher=t.Creator.watcher(this,o),this.layouter=t.Creator.layouter(this,o)),this.isApp&&this.__setApp(),this.__checkAutoLayout(o,s),this.view=i.view,s||(this.selector=t.Creator.selector(this),this.interaction=t.Creator.interaction(this,i,this.selector,o),this.interaction&&(this.__controllers.unshift(this.interaction),this.hitCanvasManager=t.Creator.hitCanvasManager()),this.canvasManager=new t.CanvasManager,r=o.start),this.hittable=o.hittable,this.fill=o.fill,this.canvasManager.add(i),this.__listenEvents(),r&&(this.__startTimer=setTimeout(this.start.bind(this))),t.WaitHelper.run(this.__initWait),this.onInit()}onInit(){}initType(t){}set(t,e){this.waitInit((()=>{super.set(t,e)}))}start(){clearTimeout(this.__startTimer),!this.running&&this.canvas&&(this.running=!0,this.ready?this.emitLeafer(t.LeaferEvent.RESTART):this.emitLeafer(t.LeaferEvent.START),this.__controllers.forEach((t=>t.start())),this.isApp||this.renderer.render())}stop(){clearTimeout(this.__startTimer),this.running&&this.canvas&&(this.__controllers.forEach((t=>t.stop())),this.running=!1,this.emitLeafer(t.LeaferEvent.STOP))}unlockLayout(){this.layouter.start(),this.updateLayout()}lockLayout(){this.updateLayout(),this.layouter.stop()}resize(e){const s=t.DataHelper.copyAttrs({},e,t.canvasSizeAttrs);Object.keys(s).forEach((t=>this[t]=s[t]))}forceRender(e,s){const{renderer:r}=this;r&&(r.addBlock(e?new t.Bounds(e):this.canvas.bounds),this.viewReady&&(s?r.render():r.update()))}requestRender(t=!1){this.renderer&&this.renderer.update(t)}updateCursor(t){const e=this.interaction;e&&(t?e.setCursor(t):e.updateCursor())}updateLazyBounds(){this.lazyBounds=this.canvas.bounds.clone().spread(this.config.lazySpeard)}__doResize(e){const{canvas:s}=this;if(!s||s.isSameSize(e))return;const r=t.DataHelper.copyAttrs({},this.canvas,t.canvasSizeAttrs);s.resize(e),this.updateLazyBounds(),this.__onResize(new t.ResizeEvent(e,r))}__onResize(e){this.emitEvent(e),t.DataHelper.copyAttrs(this.__,e,t.canvasSizeAttrs),setTimeout((()=>{this.canvasManager&&this.canvasManager.clearRecycled()}),0)}__setApp(){}__bindApp(t){this.selector=t.selector,this.interaction=t.interaction,this.canvasManager=t.canvasManager,this.hitCanvasManager=t.hitCanvasManager}__setLeafer(t){this.leafer=t,this.__level=1}__checkAutoLayout(e,s){s||(e.width&&e.height||(this.autoLayout=new t.AutoBounds(e)),this.canvas.startAutoLayout(this.autoLayout,this.__onResize.bind(this)))}__setAttr(e,s){return this.canvas&&(t.canvasSizeAttrs.includes(e)?this.__changeCanvasSize(e,s):"fill"===e?this.__changeFill(s):"hittable"===e?this.parent||(this.canvas.hittable=s):"zIndex"===e&&(this.canvas.zIndex=s,setTimeout((()=>this.parent&&this.parent.__updateSortChildren())))),super.__setAttr(e,s)}__getAttr(e){return this.canvas&&t.canvasSizeAttrs.includes(e)?this.canvas[e]:super.__getAttr(e)}__changeCanvasSize(e,s){const r=t.DataHelper.copyAttrs({},this.canvas,t.canvasSizeAttrs);r[e]=this.config[e]=s,s&&this.canvas.stopAutoLayout(),this.__doResize(r)}__changeFill(t){this.config.fill=t,this.canvas.allowBackgroundColor?this.canvas.backgroundColor=t:this.forceRender()}__onCreated(){this.created=!0}__onReady(){this.ready=!0,this.emitLeafer(t.LeaferEvent.BEFORE_READY),this.emitLeafer(t.LeaferEvent.READY),this.emitLeafer(t.LeaferEvent.AFTER_READY),t.WaitHelper.run(this.__readyWait)}__onViewReady(){this.viewReady||(this.viewReady=!0,this.emitLeafer(t.LeaferEvent.VIEW_READY),t.WaitHelper.run(this.__viewReadyWait))}__onLayoutEnd(){const{grow:t,width:e,height:s}=this.config;if(t){let{width:r,height:o,pixelRatio:i}=this;const a="box"===t?this.worldBoxBounds:this.__world;e||(r=Math.max(1,a.x+a.width)),s||(o=Math.max(1,a.y+a.height)),this.__doResize({width:r,height:o,pixelRatio:i})}this.ready||this.__onReady()}__onNextRender(){if(this.viewReady){t.WaitHelper.run(this.__nextRenderWait);const{imageReady:e}=this;e&&!this.viewCompleted&&this.__checkViewCompleted(),e||(this.viewCompleted=!1,this.requestRender())}else this.requestRender()}__checkViewCompleted(e=!0){this.nextRender((()=>{this.imageReady&&(e&&this.emitLeafer(t.LeaferEvent.VIEW_COMPLETED),t.WaitHelper.run(this.__viewCompletedWait),this.viewCompleted=!0)}))}__onWatchData(){this.watcher.childrenChanged&&this.interaction&&this.nextRender((()=>this.interaction.updateCursor()))}waitInit(t,e){e&&(t=t.bind(e)),this.__initWait||(this.__initWait=[]),this.canvas?t():this.__initWait.push(t)}waitReady(t,e){e&&(t=t.bind(e)),this.ready?t():this.__readyWait.push(t)}waitViewReady(t,e){e&&(t=t.bind(e)),this.viewReady?t():this.__viewReadyWait.push(t)}waitViewCompleted(t,e){e&&(t=t.bind(e)),this.__viewCompletedWait.push(t),this.viewCompleted?this.__checkViewCompleted(!1):this.running||this.start()}nextRender(t,e,s){e&&(t=t.bind(e));const r=this.__nextRenderWait;if(s){for(let e=0;e<r.length;e++)if(r[e]===t){r.splice(e,1);break}}else r.push(t);this.requestRender()}zoom(e,s,r,o){return t.Plugin.need("view")}getValidMove(t,e){return{x:t,y:e}}getValidScale(t){return t}getWorldPointByClient(t,e){return this.interaction&&this.interaction.getLocal(t,e)}getPagePointByClient(t,e){return this.getPagePoint(this.getWorldPointByClient(t,e))}getClientPointByWorld(t){const{x:e,y:s}=this.clientBounds;return{x:e+t.x,y:s+t.y}}updateClientBounds(){this.canvas&&this.canvas.updateClientBounds()}receiveEvent(t){}emitLeafer(e){this.emitEvent(new t.LeaferEvent(e,this))}__listenEvents(){const e=t.Run.start("FirstCreate "+this.innerName);this.once([[t.LeaferEvent.START,()=>t.Run.end(e)],[t.LayoutEvent.START,this.updateLazyBounds,this],[t.RenderEvent.START,this.__onCreated,this],[t.RenderEvent.END,this.__onViewReady,this]]),this.__eventIds.push(this.on_([[t.WatchEvent.DATA,this.__onWatchData,this],[t.LayoutEvent.END,this.__onLayoutEnd,this],[t.RenderEvent.NEXT,this.__onNextRender,this]]))}__removeListenEvents(){this.off_(this.__eventIds)}destroy(e){const s=()=>{if(!this.destroyed){V.list.remove(this);try{this.stop(),this.emitEvent(new t.LeaferEvent(t.LeaferEvent.END,this)),this.__removeListenEvents(),this.__controllers.forEach((t=>!(this.parent&&t===this.interaction)&&t.destroy())),this.__controllers.length=0,this.parent||(this.selector&&this.selector.destroy(),this.hitCanvasManager&&this.hitCanvasManager.destroy(),this.canvasManager.destroy()),this.canvas.destroy(),this.config.view=this.view=this.parentApp=null,this.userConfig&&(this.userConfig.view=null),super.destroy(),setTimeout((()=>{t.ImageManager.clearRecycled()}),100)}catch(t){Y.error(t)}}};e?s():setTimeout(s)}},exports.Leafer.list=new t.LeafList,e([t.dataProcessor(P)],exports.Leafer.prototype,"__",void 0),e([t.boundsType()],exports.Leafer.prototype,"pixelRatio",void 0),exports.Leafer=V=e([t.registerUI()],exports.Leafer),exports.Rect=class extends exports.UI{get __tag(){return"Rect"}constructor(t){super(t)}},e([t.dataProcessor(B)],exports.Rect.prototype,"__",void 0),exports.Rect=e([t.useModule(G),t.rewriteAble(),t.registerUI()],exports.Rect);const{copy:X,add:q,includes:J}=t.BoundsHelper,$=exports.Rect.prototype,K=exports.Group.prototype,Q={};exports.Box=class extends exports.Group{get __tag(){return"Box"}get isBranchLeaf(){return!0}constructor(t){super(t),this.__layout.renderChanged||this.__layout.renderChange()}__updateStrokeSpread(){return 0}__updateRectRenderSpread(){return 0}__updateRenderSpread(){return this.__updateRectRenderSpread()||-1}__updateRectBoxBounds(){}__updateBoxBounds(t){const e=this.__;if(this.children.length&&!this.pathInputed)if(e.__autoSide){e.__hasSurface&&this.__extraUpdate(),super.__updateBoxBounds();const{boxBounds:t}=this.__layout;e.__autoSize||(e.__autoWidth?(t.width+=t.x,t.x=0,t.height=e.height,t.y=0):(t.height+=t.y,t.y=0,t.width=e.width,t.x=0)),this.__updateNaturalSize()}else this.__updateRectBoxBounds();else this.__updateRectBoxBounds()}__updateStrokeBounds(){}__updateRenderBounds(){let e;const{renderBounds:s}=this.__layout;this.children.length?(super.__updateRenderBounds(),X(Q,s),this.__updateRectRenderBounds(),e=!J(s,Q),e&&"hide"!==this.__.overflow&&q(s,Q)):this.__updateRectRenderBounds(),t.DataHelper.stintSet(this,"isOverflow",e)}__updateRectRenderBounds(){}__updateRectChange(){}__updateChange(){super.__updateChange(),this.__updateRectChange()}__renderRect(t,e){}__renderGroup(t,e){}__render(t,e){this.__.__drawAfterFill?this.__renderRect(t,e):(this.__renderRect(t,e),this.children.length&&this.__renderGroup(t,e))}__drawContent(t,e){this.__renderGroup(t,e),this.__.__hasStroke&&(t.setWorld(this.__nowWorld),this.__drawRenderPath(t))}},e([t.dataProcessor(S)],exports.Box.prototype,"__",void 0),e([t.boundsType(100)],exports.Box.prototype,"width",void 0),e([t.boundsType(100)],exports.Box.prototype,"height",void 0),e([t.dataType(!1)],exports.Box.prototype,"resizeChildren",void 0),e([t.affectRenderBoundsType("show")],exports.Box.prototype,"overflow",void 0),e([t.rewrite($.__updateStrokeSpread)],exports.Box.prototype,"__updateStrokeSpread",null),e([t.rewrite($.__updateRenderSpread)],exports.Box.prototype,"__updateRectRenderSpread",null),e([t.rewrite($.__updateBoxBounds)],exports.Box.prototype,"__updateRectBoxBounds",null),e([t.rewrite($.__updateStrokeBounds)],exports.Box.prototype,"__updateStrokeBounds",null),e([t.rewrite($.__updateRenderBounds)],exports.Box.prototype,"__updateRectRenderBounds",null),e([t.rewrite($.__updateChange)],exports.Box.prototype,"__updateRectChange",null),e([t.rewrite($.__render)],exports.Box.prototype,"__renderRect",null),e([t.rewrite(K.__render)],exports.Box.prototype,"__renderGroup",null),exports.Box=e([t.rewriteAble(),t.registerUI()],exports.Box),exports.Frame=class extends exports.Box{get __tag(){return"Frame"}get isFrame(){return!0}constructor(t){super(t)}},e([t.dataProcessor(b)],exports.Frame.prototype,"__",void 0),e([t.surfaceType("#FFFFFF")],exports.Frame.prototype,"fill",void 0),e([t.affectRenderBoundsType("hide")],exports.Frame.prototype,"overflow",void 0),exports.Frame=e([t.registerUI()],exports.Frame);const{moveTo:Z,closePath:tt,ellipse:et}=t.PathCommandDataHelper;exports.Ellipse=class extends exports.UI{get __tag(){return"Ellipse"}constructor(t){super(t)}__updatePath(){const{width:e,height:s,innerRadius:r,startAngle:o,endAngle:i}=this.__,a=e/2,n=s/2,p=this.__.path=[];r?(o||i?(r<1&&et(p,a,n,a*r,n*r,0,o,i,!1),et(p,a,n,a,n,0,i,o,!0),r<1&&tt(p)):(r<1&&(et(p,a,n,a*r,n*r),Z(p,e,n)),et(p,a,n,a,n,0,360,0,!0)),t.Platform.ellipseToCurve&&(this.__.path=this.getPath(!0))):o||i?(Z(p,a,n),et(p,a,n,a,n,0,o,i,!1),tt(p)):et(p,a,n,a,n)}},e([t.dataProcessor(C)],exports.Ellipse.prototype,"__",void 0),e([t.pathType(0)],exports.Ellipse.prototype,"innerRadius",void 0),e([t.pathType(0)],exports.Ellipse.prototype,"startAngle",void 0),e([t.pathType(0)],exports.Ellipse.prototype,"endAngle",void 0),exports.Ellipse=e([t.registerUI()],exports.Ellipse);const{moveTo:st,lineTo:rt,drawPoints:ot}=t.PathCommandDataHelper,{rotate:it,getAngle:at,getDistance:nt,defaultPoint:pt}=t.PointHelper,{toBounds:ht}=t.PathBounds;exports.Line=class extends exports.UI{get __tag(){return"Line"}get toPoint(){const{width:e,rotation:s}=this.__,r=t.getPointData();return e&&(r.x=e),s&&it(r,s),r}set toPoint(t){this.width=nt(pt,t),this.rotation=at(pt,t),this.height&&(this.height=0)}constructor(t){super(t)}__updatePath(){const t=this.__,e=t.path=[];t.points?ot(e,t.points,!1,t.closed):(st(e,0,0),rt(e,this.width,0))}__updateRenderPath(){const t=this.__;!this.pathInputed&&t.points&&t.curve?(ot(t.__pathForRender=[],t.points,t.curve,t.closed),t.__useArrow&&p.addArrows(this,!1)):super.__updateRenderPath()}__updateBoxBounds(){this.points?ht(this.__.__pathForRender,this.__layout.boxBounds):super.__updateBoxBounds()}},e([t.dataProcessor(k)],exports.Line.prototype,"__",void 0),e([t.affectStrokeBoundsType("center")],exports.Line.prototype,"strokeAlign",void 0),e([t.boundsType(0)],exports.Line.prototype,"height",void 0),e([t.pathType()],exports.Line.prototype,"points",void 0),e([t.pathType(0)],exports.Line.prototype,"curve",void 0),e([t.pathType(!1)],exports.Line.prototype,"closed",void 0),exports.Line=e([t.registerUI()],exports.Line);const{sin:_t,cos:dt,PI:lt}=Math,{moveTo:ut,lineTo:ct,closePath:xt,drawPoints:yt}=t.PathCommandDataHelper,gt=exports.Line.prototype;exports.Polygon=class extends exports.UI{get __tag(){return"Polygon"}constructor(t){super(t)}__updatePath(){const t=this.__.path=[];if(this.__.points)yt(t,this.__.points,!1,!0);else{const{width:e,height:s,sides:r}=this.__,o=e/2,i=s/2;ut(t,o,0);for(let e=1;e<r;e++)ct(t,o+o*_t(2*e*lt/r),i-i*dt(2*e*lt/r))}xt(t)}__updateRenderPath(){}__updateBoxBounds(){}},e([t.dataProcessor(U)],exports.Polygon.prototype,"__",void 0),e([t.pathType(3)],exports.Polygon.prototype,"sides",void 0),e([t.pathType()],exports.Polygon.prototype,"points",void 0),e([t.pathType(0)],exports.Polygon.prototype,"curve",void 0),e([t.rewrite(gt.__updateRenderPath)],exports.Polygon.prototype,"__updateRenderPath",null),e([t.rewrite(gt.__updateBoxBounds)],exports.Polygon.prototype,"__updateBoxBounds",null),exports.Polygon=e([t.rewriteAble(),t.registerUI()],exports.Polygon);const{sin:vt,cos:ft,PI:wt}=Math,{moveTo:Tt,lineTo:mt,closePath:It}=t.PathCommandDataHelper;exports.Star=class extends exports.UI{get __tag(){return"Star"}constructor(t){super(t)}__updatePath(){const{width:t,height:e,corners:s,innerRadius:r}=this.__,o=t/2,i=e/2,a=this.__.path=[];Tt(a,o,0);for(let t=1;t<2*s;t++)mt(a,o+(t%2==0?o:o*r)*vt(t*wt/s),i-(t%2==0?i:i*r)*ft(t*wt/s));It(a)}},e([t.dataProcessor(A)],exports.Star.prototype,"__",void 0),e([t.pathType(5)],exports.Star.prototype,"corners",void 0),e([t.pathType(.382)],exports.Star.prototype,"innerRadius",void 0),exports.Star=e([t.registerUI()],exports.Star),exports.Image=class extends exports.Rect{get __tag(){return"Image"}get ready(){const{image:t}=this;return t&&t.ready}get image(){const{fill:t}=this.__;return t instanceof Array&&t[0].image}constructor(t){super(t)}},e([t.dataProcessor(W)],exports.Image.prototype,"__",void 0),e([t.boundsType("")],exports.Image.prototype,"url",void 0),exports.Image=e([t.registerUI()],exports.Image);const Rt=exports.Image;exports.Canvas=class extends exports.Rect{get __tag(){return"Canvas"}get context(){return this.canvas.context}get ready(){return!this.url}constructor(e){super(e),this.canvas=t.Creator.canvas(this.__),e&&e.url&&this.drawImage(e.url)}drawImage(e){new t.LeaferImage({url:e}).load((e=>{this.context.drawImage(e.view,0,0),this.url=void 0,this.paint(),this.emitEvent(new t.ImageEvent(t.ImageEvent.LOADED,{image:e}))}))}draw(e,s,r,o){const i=new t.Matrix(e.worldTransform).invert(),a=new t.Matrix;s&&a.translate(s.x,s.y),r&&("number"==typeof r?a.scale(r):a.scale(r.x,r.y)),o&&a.rotate(o),i.multiplyParent(a),e.__render(this.canvas,{matrix:i.withScale()}),this.paint()}paint(){this.forceRender()}__drawContent(t,e){const{width:s,height:r}=this.__,{view:o}=this.canvas;t.drawImage(o,0,0,o.width,o.height,0,0,s,r)}__updateSize(){const{canvas:t}=this;if(t){const{smooth:e,safeResize:s}=this.__;t.resize(this.__,s),t.smooth!==e&&(t.smooth=e)}}destroy(){this.canvas&&(this.canvas.destroy(),this.canvas=null),super.destroy()}},e([t.dataProcessor(z)],exports.Canvas.prototype,"__",void 0),e([r(100)],exports.Canvas.prototype,"width",void 0),e([r(100)],exports.Canvas.prototype,"height",void 0),e([r(1)],exports.Canvas.prototype,"pixelRatio",void 0),e([r(!0)],exports.Canvas.prototype,"smooth",void 0),e([t.dataType(!1)],exports.Canvas.prototype,"safeResize",void 0),e([r()],exports.Canvas.prototype,"contextSettings",void 0),exports.Canvas=e([t.registerUI()],exports.Canvas);const{copyAndSpread:St,includes:Pt,spread:bt,setList:kt}=t.BoundsHelper;exports.Text=class extends exports.UI{get __tag(){return"Text"}get textDrawData(){return this.updateLayout(),this.__.__textDrawData}constructor(t){super(t)}__updateTextDrawData(){const e=this.__,{lineHeight:s,letterSpacing:r,fontFamily:o,fontSize:a,fontWeight:p,italic:h,textCase:_,textOverflow:d,padding:l}=e;e.__lineHeight=n.number(s,a),e.__letterSpacing=n.number(r,a),e.__padding=l?t.MathHelper.fourNumber(l):void 0,e.__baseLine=e.__lineHeight-(e.__lineHeight-.7*a)/2,e.__font=`${h?"italic ":""}${"small-caps"===_?"small-caps ":""}${"normal"!==p?p+" ":""}${a}px ${o}`,e.__clipText="show"!==d&&!e.__autoSize,e.__textDrawData=i.getDrawData((e.__isPlacehold=e.placeholder&&""===e.text)?e.placeholder:e.text,this.__)}__updateBoxBounds(){const e=this.__,s=this.__layout,{fontSize:r,italic:o,padding:i,__autoWidth:a,__autoHeight:n}=e;this.__updateTextDrawData();const{bounds:p}=e.__textDrawData,h=s.boxBounds;if(s.contentBounds=p,e.__lineHeight<r&&bt(p,r/2),a||n){if(h.x=a?p.x:0,h.y=n?p.y:0,h.width=a?p.width:e.width,h.height=n?p.height:e.height,i){const[t,s,r,o]=e.__padding;a&&(h.x-=o,h.width+=s+o),n&&(h.y-=t,h.height+=r+t)}this.__updateNaturalSize()}else super.__updateBoxBounds();o&&(h.width+=.16*r),t.DataHelper.stintSet(this,"isOverflow",!Pt(h,p)),this.isOverflow?(kt(e.__textBoxBounds={},[h,p]),s.renderChanged=!0):e.__textBoxBounds=h}__onUpdateSize(){this.__box&&this.__box.__onUpdateSize(),super.__onUpdateSize()}__updateRenderSpread(){let t=super.__updateRenderSpread();return t||(t=this.isOverflow?1:0),t}__updateRenderBounds(){const{renderBounds:t,renderSpread:e}=this.__layout;St(t,this.__.__textBoxBounds,e),this.__box&&(this.__box.__layout.renderBounds=t)}__drawRenderPath(t){t.font=this.__.__font}__draw(t,e,s){const r=this.__box;r&&(r.__nowWorld=this.__nowWorld,r.__draw(t,e,s)),this.textEditing&&!u.running||super.__draw(t,e,s)}destroy(){this.boxStyle&&(this.boxStyle=null),super.destroy()}},e([t.dataProcessor(F)],exports.Text.prototype,"__",void 0),e([t.boundsType(0)],exports.Text.prototype,"width",void 0),e([t.boundsType(0)],exports.Text.prototype,"height",void 0),e([t.surfaceType()],exports.Text.prototype,"boxStyle",void 0),e([t.dataType(!1)],exports.Text.prototype,"resizeFontSize",void 0),e([t.surfaceType("#000000")],exports.Text.prototype,"fill",void 0),e([t.affectStrokeBoundsType("outside")],exports.Text.prototype,"strokeAlign",void 0),e([t.hitType("all")],exports.Text.prototype,"hitFill",void 0),e([t.boundsType("")],exports.Text.prototype,"text",void 0),e([t.boundsType("")],exports.Text.prototype,"placeholder",void 0),e([t.boundsType("caption")],exports.Text.prototype,"fontFamily",void 0),e([t.boundsType(12)],exports.Text.prototype,"fontSize",void 0),e([t.boundsType("normal")],exports.Text.prototype,"fontWeight",void 0),e([t.boundsType(!1)],exports.Text.prototype,"italic",void 0),e([t.boundsType("none")],exports.Text.prototype,"textCase",void 0),e([t.boundsType("none")],exports.Text.prototype,"textDecoration",void 0),e([t.boundsType(0)],exports.Text.prototype,"letterSpacing",void 0),e([t.boundsType({type:"percent",value:1.5})],exports.Text.prototype,"lineHeight",void 0),e([t.boundsType(0)],exports.Text.prototype,"paraIndent",void 0),e([t.boundsType(0)],exports.Text.prototype,"paraSpacing",void 0),e([t.boundsType("x")],exports.Text.prototype,"writingMode",void 0),e([t.boundsType("left")],exports.Text.prototype,"textAlign",void 0),e([t.boundsType("top")],exports.Text.prototype,"verticalAlign",void 0),e([t.boundsType(!0)],exports.Text.prototype,"autoSizeAlign",void 0),e([t.boundsType("normal")],exports.Text.prototype,"textWrap",void 0),e([t.boundsType("show")],exports.Text.prototype,"textOverflow",void 0),exports.Text=e([t.registerUI()],exports.Text),exports.Path=class extends exports.UI{get __tag(){return"Path"}constructor(t){super(t)}},e([t.dataProcessor(L)],exports.Path.prototype,"__",void 0),e([t.affectStrokeBoundsType("center")],exports.Path.prototype,"strokeAlign",void 0),exports.Path=e([t.registerUI()],exports.Path),exports.Pen=class extends exports.Group{get __tag(){return"Pen"}constructor(t){super(t)}setStyle(t){const e=this.pathElement=new exports.Path(t);return this.pathStyle=t,this.__path=e.path||(e.path=[]),this.add(e),this}beginPath(){return this}moveTo(t,e){return this}lineTo(t,e){return this}bezierCurveTo(t,e,s,r,o,i){return this}quadraticCurveTo(t,e,s,r){return this}closePath(){return this}rect(t,e,s,r){return this}roundRect(t,e,s,r,o){return this}ellipse(t,e,s,r,o,i,a,n){return this}arc(t,e,s,r,o,i){return this}arcTo(t,e,s,r,o){return this}drawEllipse(t,e,s,r,o,i,a,n){return this}drawArc(t,e,s,r,o,i){return this}drawPoints(t,e,s){return this}clearPath(){return this}paint(){this.pathElement.__layout.boxChanged||this.pathElement.forceUpdate("path")}},e([t.dataProcessor(D)],exports.Pen.prototype,"__",void 0),e([(e,s)=>{t.defineKey(e,s,{get(){return this.__path}})}],exports.Pen.prototype,"path",void 0),exports.Pen=e([t.useModule(t.PathCreator,["set","path","paint"]),t.registerUI()],exports.Pen),exports.BoxData=S,exports.CanvasData=z,exports.ColorConvert=a,exports.Effect=d,exports.EllipseData=C,exports.Export=u,exports.Filter=l,exports.FrameData=b,exports.GroupData=R,exports.ImageData=W,exports.LeaferData=P,exports.LineData=k,exports.MyImage=Rt,exports.Paint=h,exports.PaintGradient={},exports.PaintImage=_,exports.PathArrow=p,exports.PathData=L,exports.PenData=D,exports.PolygonData=U,exports.RectData=B,exports.RectRender=G,exports.StarData=A,exports.State=c,exports.TextConvert=i,exports.TextData=F,exports.Transition=x,exports.UIBounds=M,exports.UIData=m,exports.UIRender=O,exports.UnitConvert=n,exports.effectType=s,exports.resizeType=r,exports.zoomLayerType=o,Object.keys(t).forEach((function(e){"default"===e||Object.prototype.hasOwnProperty.call(exports,e)||Object.defineProperty(exports,e,{enumerable:!0,get:function(){return t[e]}})}));
|
|
1
|
+
"use strict";var t=require("@leafer/core");function e(t,e,s,r){var o,i=arguments.length,a=i<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,s):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,s,r);else for(var n=t.length-1;n>=0;n--)(o=t[n])&&(a=(i<3?o(a):i>3?o(e,s,a):o(e,s))||a);return i>3&&a&&Object.defineProperty(e,s,a),a}function s(e){return t.decorateLeafAttr(e,(e=>t.attr({set(t){this.__setAttr(e,t),t&&(this.__.__useEffect=!0),this.__layout.renderChanged||this.__layout.renderChange()}})))}function r(e){return t.decorateLeafAttr(e,(e=>t.attr({set(t){this.__setAttr(e,t),this.__layout.boxChanged||this.__layout.boxChange(),this.__updateSize()}})))}function o(){return(e,s)=>{const r="_"+s;t.defineKey(e,s,{set(t){this.isLeafer&&(this[r]=t)},get(){return this.isApp?this.tree.zoomLayer:this.isLeafer?this[r]||this:this.leafer&&this.leafer.zoomLayer}})}}"function"==typeof SuppressedError&&SuppressedError;const i={},a={hasTransparent:function(t){if(!t||7===t.length||4===t.length)return!1;if("transparent"===t)return!0;const e=t[0];if("#"===e)switch(t.length){case 5:return"f"!==t[4]&&"F"!==t[4];case 9:return"f"!==t[7]&&"F"!==t[7]||"f"!==t[8]&&"F"!==t[8]}else if(("r"===e||"h"===e)&&"a"===t[3]){const e=t.lastIndexOf(",");if(e>-1)return parseFloat(t.slice(e+1))<1}return!1}},n={number:(t,e)=>"object"==typeof t?"percent"===t.type?t.value*e:t.value:t},p={},h={},_={},d={},l={apply(){t.Plugin.need("filter")}},u={},c={setStyleName:()=>t.Plugin.need("state"),set:()=>t.Plugin.need("state")},x={list:{},register(t,e){x.list[t]=e},get:t=>x.list[t]},{parse:y,objectToCanvasData:g}=t.PathConvert,{stintSet:v}=t.DataHelper,{hasTransparent:f}=a,w={},T=t.Debug.get("UIData");class m extends t.LeafData{get scale(){const{scaleX:t,scaleY:e}=this;return t!==e?{x:t,y:e}:t}get __strokeWidth(){const{strokeWidth:t,strokeWidthFixed:e}=this;if(e){const e=this.__leaf;let{scaleX:s}=e.__nowWorld||e.__world;return s<0&&(s=-s),s>1?t/s:t}return t}get __hasStroke(){return this.stroke&&this.strokeWidth}get __hasHalf(){const t=this;return t.stroke&&"center"===t.strokeAlign&&t.strokeWidth%2||void 0}get __hasMultiPaint(){const t=this;return!!(t.__isFills&&t.fill.length>1||t.__isStrokes&&t.stroke.length>1||t.__useEffect)||t.fill&&this.__hasStroke}get __clipAfterFill(){const t=this;return t.cornerRadius||t.innerShadow||t.__pathInputed}get __hasSurface(){return this.fill||this.stroke}get __autoWidth(){return!this._width}get __autoHeight(){return!this._height}get __autoSide(){return!this._width||!this._height}get __autoSize(){return!this._width&&!this._height}setVisible(t){this._visible=t;const{leafer:e}=this.__leaf;e&&(e.watcher.hasVisible=!0)}setWidth(t){t<0?(this._width=-t,this.__leaf.scaleX*=-1,T.warn("width < 0, instead -scaleX ",this)):this._width=t}setHeight(t){t<0?(this._height=-t,this.__leaf.scaleY*=-1,T.warn("height < 0, instead -scaleY",this)):this._height=t}setFill(t){this.__naturalWidth&&this.__removeNaturalSize(),"string"!=typeof t&&t?"object"==typeof t&&this.__setPaint("fill",t):(v(this,"__isTransparentFill",f(t)),this.__isFills&&this.__removePaint("fill",!0),this._fill=t)}setStroke(t){"string"!=typeof t&&t?"object"==typeof t&&this.__setPaint("stroke",t):(v(this,"__isTransparentStroke",f(t)),this.__isStrokes&&this.__removePaint("stroke",!0),this._stroke=t)}setPath(t){const e="string"==typeof t;e||t&&"object"==typeof t[0]?(this.__setInput("path",t),this._path=e?y(t):g(t)):(this.__input&&this.__removeInput("path"),this._path=t)}setShadow(t){I(this,"shadow",t)}setInnerShadow(t){I(this,"innerShadow",t)}setFilter(t){I(this,"filter",t)}__computePaint(){const{fill:t,stroke:e}=this.__input;t&&h.compute("fill",this.__leaf),e&&h.compute("stroke",this.__leaf),this.__needComputePaint=void 0}__setPaint(t,e){this.__setInput(t,e);const s=this.__leaf.__layout;s.boxChanged||s.boxChange(),e instanceof Array&&!e.length?this.__removePaint(t):"fill"===t?(this.__isFills=!0,this._fill||(this._fill=w)):(this.__isStrokes=!0,this._stroke||(this._stroke=w))}__removePaint(t,e){e&&this.__removeInput(t),_.recycleImage(t,this),"fill"===t?(v(this,"__isAlphaPixelFill",void 0),this._fill=this.__isFills=void 0):(v(this,"__isAlphaPixelStroke",void 0),this._stroke=this.__isStrokes=void 0)}}function I(t,e,s){t.__setInput(e,s),s instanceof Array?(s.some((t=>!1===t.visible))&&(s=s.filter((t=>!1!==t.visible))),s.length||(s=void 0)):s=s&&!1!==s.visible?[s]:void 0,t["_"+e]=s}class R extends m{}class S extends R{get __boxStroke(){return!this.__pathInputed}get __drawAfterFill(){const t=this;return"hide"===t.overflow&&(t.__clipAfterFill||t.innerShadow)&&t.__leaf.children.length}get __clipAfterFill(){return this.__leaf.isOverflow||super.__clipAfterFill}}class P extends R{__getInputData(e,s){const r=super.__getInputData(e,s);return t.canvasSizeAttrs.forEach((t=>delete r[t])),r}}class b extends S{}class k extends m{}class B extends m{get __boxStroke(){return!this.__pathInputed}}class C extends m{get __boxStroke(){return!this.__pathInputed}}class U extends m{}class A extends m{}class L extends m{get __pathInputed(){return 2}}class E extends R{}const D={thin:100,"extra-light":200,light:300,normal:400,medium:500,"semi-bold":600,bold:700,"extra-bold":800,black:900};class F extends m{get __useNaturalRatio(){return!1}setFontWeight(t){"string"==typeof t?(this.__setInput("fontWeight",t),t=D[t]||400):this.__input&&this.__removeInput("fontWeight"),this._fontWeight=t}setBoxStyle(e){let s=this.__leaf,r=s.__box;if(e){const{boxStyle:o}=this;if(r)for(let t in o)r[t]=void 0;else r=s.__box=t.UICreator.get("Rect",0);const i=s.__layout,a=r.__layout;o||(r.parent=s,r.__world=s.__world,a.boxBounds=i.boxBounds),r.set(e),a.strokeChanged&&i.strokeChange(),a.renderChanged&&i.renderChange(),r.__updateChange()}else r&&(s.__box=r.parent=null,r.destroy());this._boxStyle=e}}class W extends B{setUrl(t){this.__setImageFill(t),this._url=t}__setImageFill(t){this.fill=t?{type:"image",mode:"stretch",url:t}:void 0}__getData(){const t=super.__getData();return delete t.fill,t}__getInputData(t,e){const s=super.__getInputData(t,e);return delete s.fill,s}}class z extends B{get __isCanvas(){return!0}get __drawAfterFill(){return!0}__getInputData(t,e){const s=super.__getInputData(t,e);return s.url=this.__leaf.canvas.toDataURL("image/png"),s}}const M={__updateStrokeSpread(){let t=0,e=0;const s=this.__,{strokeAlign:r,strokeWidth:o}=s,i=this.__box;if((s.stroke||"all"===s.hitStroke)&&o&&"inside"!==r&&(e=t="center"===r?o/2:o,!s.__boxStroke)){const e=s.__isLinePath?0:10*t,r="none"===s.strokeCap?0:o;t+=Math.max(e,r)}return s.__useArrow&&(t+=5*o),i&&(t=Math.max(i.__layout.strokeSpread=i.__updateStrokeSpread(),t),e=i.__layout.strokeBoxSpread),this.__layout.strokeBoxSpread=e,t},__updateRenderSpread(){let t=0;const{shadow:e,innerShadow:s,blur:r,backgroundBlur:o,filter:i}=this.__;e&&e.forEach((e=>t=Math.max(t,Math.max(Math.abs(e.y),Math.abs(e.x))+(e.spread>0?e.spread:0)+1.5*e.blur))),r&&(t=Math.max(t,r)),i&&(t+=l.getSpread(i));let a=t=Math.ceil(t);return s&&s.forEach((t=>a=Math.max(a,Math.max(Math.abs(t.y),Math.abs(t.x))+(t.spread<0?-t.spread:0)+1.5*t.blur))),o&&(a=Math.max(a,o)),this.__layout.renderShapeSpread=a,t+=this.__layout.strokeSpread||0,this.__box?Math.max(this.__box.__updateRenderSpread(),t):t}},{stintSet:H}=t.DataHelper,O={__updateChange(){const t=this.__;if(t.__useEffect){const{shadow:e,fill:s,stroke:r}=t,o=t.innerShadow||t.blur||t.backgroundBlur||t.filter;H(t,"__isFastShadow",e&&!o&&e.length<2&&!e[0].spread&&!(e[0].box&&t.__isTransparentFill)&&s&&!(s instanceof Array&&s.length>1)&&(this.useFastShadow||!r||r&&"inside"===t.strokeAlign)),t.__useEffect=!(!e&&!o)}H(this.__world,"half",t.__hasHalf),H(t,"__fillAfterStroke",t.stroke&&"outside"===t.strokeAlign&&t.fill&&!t.__isTransparentFill),t.__checkSingle(),H(t,"__complex",t.__isFills||t.__isStrokes||t.cornerRadius||t.__useEffect)},__drawFast(t,e){N(this,t,e)},__draw(t,e,s){const r=this.__;if(r.__complex){r.__needComputePaint&&r.__computePaint();const{fill:o,stroke:i,__drawAfterFill:n,__fillAfterStroke:p,__isFastShadow:_}=r;if(this.__drawRenderPath(t),r.__useEffect&&!_){const a=h.shape(this,t,e);this.__nowWorld=this.__getNowWorld(e);const{shadow:_,innerShadow:u,filter:c}=r;_&&d.shadow(this,t,a),p&&(r.__isStrokes?h.strokes(i,this,t):h.stroke(i,this,t)),o&&(r.__isFills?h.fills(o,this,t):h.fill(o,this,t)),n&&this.__drawAfterFill(t,e),u&&d.innerShadow(this,t,a),i&&!p&&(r.__isStrokes?h.strokes(i,this,t):h.stroke(i,this,t)),c&&l.apply(c,this,this.__nowWorld,t,s,a),a.worldCanvas&&a.worldCanvas.recycle(),a.canvas.recycle()}else{if(p&&(r.__isStrokes?h.strokes(i,this,t):h.stroke(i,this,t)),_){const e=r.shadow[0],{scaleX:s,scaleY:o}=this.__nowWorld;t.save(),t.setWorldShadow(e.x*s,e.y*o,e.blur*s,a.string(e.color))}o&&(r.__isFills?h.fills(o,this,t):h.fill(o,this,t)),_&&t.restore(),n&&this.__drawAfterFill(t,e),i&&!p&&(r.__isStrokes?h.strokes(i,this,t):h.stroke(i,this,t))}}else r.__pathInputed?N(this,t,e):this.__drawFast(t,e)},__renderShape(t,e,s,r){if(this.__worldOpacity){t.setWorld(this.__nowWorld=this.__getNowWorld(e));const{fill:o,stroke:i}=this.__;this.__drawRenderPath(t),o&&!s&&(this.__.__isAlphaPixelFill?h.fills(o,this,t):h.fill("#000000",this,t)),this.__.__isCanvas&&this.__drawAfterFill(t,e),i&&!r&&(this.__.__isAlphaPixelStroke?h.strokes(i,this,t):h.stroke("#000000",this,t))}},__drawAfterFill(t,e){this.__.__clipAfterFill?(t.save(),t.clipUI(),this.__drawContent(t,e),t.restore()):this.__drawContent(t,e)}};function N(t,e,s){const{fill:r,stroke:o,__drawAfterFill:i,__fillAfterStroke:a}=t.__;t.__drawRenderPath(e),a&&h.stroke(o,t,e),r&&h.fill(r,t,e),i&&t.__drawAfterFill(e,s),o&&!a&&h.stroke(o,t,e)}const G={__drawFast(t,e){let{x:s,y:r,width:o,height:i}=this.__layout.boxBounds;const{fill:a,stroke:n,__drawAfterFill:p}=this.__;if(a&&(t.fillStyle=a,t.fillRect(s,r,o,i)),p&&this.__drawAfterFill(t,e),n){const{strokeAlign:a,__strokeWidth:p}=this.__;if(!p)return;t.setStroke(n,p,this.__);const h=p/2;switch(a){case"center":t.strokeRect(0,0,o,i);break;case"inside":o-=p,i-=p,o<0||i<0?(t.save(),this.__clip(t,e),t.strokeRect(s+h,r+h,o,i),t.restore()):t.strokeRect(s+h,r+h,o,i);break;case"outside":t.strokeRect(s-h,r-h,o+p,i+p)}}}};var j,V;exports.UI=j=class extends t.Leaf{get app(){return this.leafer&&this.leafer.app}get isFrame(){return!1}set scale(e){t.MathHelper.assignScale(this,e)}get scale(){return this.__.scale}get pen(){const{path:e}=this.__;return t.pen.set(this.path=e||[]),e||this.__drawPathByBox(t.pen),t.pen}constructor(t){super(t)}reset(t){}set(t,e){t&&(e?"temp"===e?(this.lockNormalStyle=!0,Object.assign(this,t),this.lockNormalStyle=!1):this.animate(t,e):Object.assign(this,t))}get(t){return"string"==typeof t?this.__.__getInput(t):this.__.__getInputData(t)}createProxyData(){}find(e,s){return t.Plugin.need("find")}findTag(t){return this.find({tag:t})}findOne(e,s){return t.Plugin.need("find")}findId(t){return this.findOne({id:t})}getPath(e,s){this.__layout.update();let r=s?this.__.__pathForRender:this.__.path;return r||(t.pen.set(r=[]),this.__drawPathByBox(t.pen)),e?t.PathConvert.toCanvasData(r,!0):r}getPathString(e,s,r){return t.PathConvert.stringify(this.getPath(e,s),r)}load(){this.__.__computePaint()}__onUpdateSize(){if(this.__.__input){const t=this.__;!t.lazy||this.__inLazyBounds||u.running?t.__computePaint():t.__needComputePaint=!0}}__updateRenderPath(){if(this.__.path){const e=this.__;e.__pathForRender=e.cornerRadius?t.PathCorner.smooth(e.path,e.cornerRadius,e.cornerSmoothing):e.path,e.__useArrow&&p.addArrows(this,!e.cornerRadius)}}__drawRenderPath(t){t.beginPath(),this.__drawPathByData(t,this.__.__pathForRender)}__drawPath(t){t.beginPath(),this.__drawPathByData(t,this.__.path)}__drawPathByData(e,s){s?t.PathDrawer.drawPathByData(e,s):this.__drawPathByBox(e)}__drawPathByBox(t){const{x:e,y:s,width:r,height:o}=this.__layout.boxBounds;if(this.__.cornerRadius){const{cornerRadius:i}=this.__;t.roundRect(e,s,r,o,"number"==typeof i?[i]:i)}else t.rect(e,s,r,o)}drawImagePlaceholder(t,e){h.fill(this.__.placeholderColor,this,t)}animate(e,s,r,o){return t.Plugin.need("animate")}killAnimate(t,e){}export(e,s){return t.Plugin.need("export")}syncExport(e,s){return t.Plugin.need("export")}clone(e){const s=t.DataHelper.clone(this.toJSON());return e&&Object.assign(s,e),j.one(s)}static one(e,s,r,o,i){return t.UICreator.get(e.tag||this.prototype.__tag,e,s,r,o,i)}static registerUI(){t.registerUI()(this)}static registerData(e){t.dataProcessor(e)(this.prototype)}static setEditConfig(t){}static setEditOuter(t){}static setEditInner(t){}destroy(){this.fill=this.stroke=null,this.__animate&&this.killAnimate(),super.destroy()}},e([t.dataProcessor(m)],exports.UI.prototype,"__",void 0),e([o()],exports.UI.prototype,"zoomLayer",void 0),e([t.dataType("")],exports.UI.prototype,"id",void 0),e([t.dataType("")],exports.UI.prototype,"name",void 0),e([t.dataType("")],exports.UI.prototype,"className",void 0),e([t.surfaceType("pass-through")],exports.UI.prototype,"blendMode",void 0),e([t.opacityType(1)],exports.UI.prototype,"opacity",void 0),e([t.visibleType(!0)],exports.UI.prototype,"visible",void 0),e([t.surfaceType(!1)],exports.UI.prototype,"locked",void 0),e([t.surfaceType(!1)],exports.UI.prototype,"dim",void 0),e([t.surfaceType(!1)],exports.UI.prototype,"dimskip",void 0),e([t.sortType(0)],exports.UI.prototype,"zIndex",void 0),e([t.maskType(!1)],exports.UI.prototype,"mask",void 0),e([t.eraserType(!1)],exports.UI.prototype,"eraser",void 0),e([t.positionType(0,!0)],exports.UI.prototype,"x",void 0),e([t.positionType(0,!0)],exports.UI.prototype,"y",void 0),e([t.boundsType(100,!0)],exports.UI.prototype,"width",void 0),e([t.boundsType(100,!0)],exports.UI.prototype,"height",void 0),e([t.scaleType(1,!0)],exports.UI.prototype,"scaleX",void 0),e([t.scaleType(1,!0)],exports.UI.prototype,"scaleY",void 0),e([t.rotationType(0,!0)],exports.UI.prototype,"rotation",void 0),e([t.rotationType(0,!0)],exports.UI.prototype,"skewX",void 0),e([t.rotationType(0,!0)],exports.UI.prototype,"skewY",void 0),e([t.positionType(0,!0)],exports.UI.prototype,"offsetX",void 0),e([t.positionType(0,!0)],exports.UI.prototype,"offsetY",void 0),e([t.positionType(0,!0)],exports.UI.prototype,"scrollX",void 0),e([t.positionType(0,!0)],exports.UI.prototype,"scrollY",void 0),e([t.autoLayoutType()],exports.UI.prototype,"origin",void 0),e([t.autoLayoutType()],exports.UI.prototype,"around",void 0),e([t.dataType(!1)],exports.UI.prototype,"lazy",void 0),e([t.naturalBoundsType(1)],exports.UI.prototype,"pixelRatio",void 0),e([t.pathInputType()],exports.UI.prototype,"path",void 0),e([t.pathType()],exports.UI.prototype,"windingRule",void 0),e([t.pathType(!0)],exports.UI.prototype,"closed",void 0),e([t.boundsType(0)],exports.UI.prototype,"padding",void 0),e([t.boundsType(!1)],exports.UI.prototype,"lockRatio",void 0),e([t.boundsType()],exports.UI.prototype,"widthRange",void 0),e([t.boundsType()],exports.UI.prototype,"heightRange",void 0),e([t.dataType(!1)],exports.UI.prototype,"draggable",void 0),e([t.dataType()],exports.UI.prototype,"dragBounds",void 0),e([t.dataType(!1)],exports.UI.prototype,"editable",void 0),e([t.hitType(!0)],exports.UI.prototype,"hittable",void 0),e([t.hitType("path")],exports.UI.prototype,"hitFill",void 0),e([t.strokeType("path")],exports.UI.prototype,"hitStroke",void 0),e([t.hitType(!1)],exports.UI.prototype,"hitBox",void 0),e([t.hitType(!0)],exports.UI.prototype,"hitChildren",void 0),e([t.hitType(!0)],exports.UI.prototype,"hitSelf",void 0),e([t.hitType()],exports.UI.prototype,"hitRadius",void 0),e([t.cursorType("")],exports.UI.prototype,"cursor",void 0),e([t.surfaceType()],exports.UI.prototype,"fill",void 0),e([t.strokeType()],exports.UI.prototype,"stroke",void 0),e([t.strokeType("inside")],exports.UI.prototype,"strokeAlign",void 0),e([t.strokeType(1)],exports.UI.prototype,"strokeWidth",void 0),e([t.strokeType(!1)],exports.UI.prototype,"strokeWidthFixed",void 0),e([t.strokeType("none")],exports.UI.prototype,"strokeCap",void 0),e([t.strokeType("miter")],exports.UI.prototype,"strokeJoin",void 0),e([t.strokeType()],exports.UI.prototype,"dashPattern",void 0),e([t.strokeType(0)],exports.UI.prototype,"dashOffset",void 0),e([t.strokeType(10)],exports.UI.prototype,"miterLimit",void 0),e([t.pathType(0)],exports.UI.prototype,"cornerRadius",void 0),e([t.pathType()],exports.UI.prototype,"cornerSmoothing",void 0),e([s()],exports.UI.prototype,"shadow",void 0),e([s()],exports.UI.prototype,"innerShadow",void 0),e([s()],exports.UI.prototype,"blur",void 0),e([s()],exports.UI.prototype,"backgroundBlur",void 0),e([s()],exports.UI.prototype,"grayscale",void 0),e([s()],exports.UI.prototype,"filter",void 0),e([t.surfaceType()],exports.UI.prototype,"placeholderColor",void 0),e([t.dataType(100)],exports.UI.prototype,"placeholderDelay",void 0),e([t.dataType({})],exports.UI.prototype,"data",void 0),e([t.rewrite(t.Leaf.prototype.reset)],exports.UI.prototype,"reset",null),exports.UI=j=e([t.useModule(M),t.useModule(O),t.rewriteAble()],exports.UI),exports.Group=class extends exports.UI{get __tag(){return"Group"}get isBranch(){return!0}constructor(t){super(t)}reset(t){this.__setBranch(),super.reset(t)}__setBranch(){this.children||(this.children=[])}set(t,e){if(t)if(t.children){const{children:s}=t;delete t.children,this.children?this.clear():this.__setBranch(),super.set(t,e),s.forEach((t=>this.add(t))),t.children=s}else super.set(t,e)}toJSON(t){const e=super.toJSON(t);return e.children=this.children.map((e=>e.toJSON(t))),e}pick(t,e){}addAt(t,e){this.add(t,e)}addAfter(t,e){this.add(t,this.children.indexOf(e)+1)}addBefore(t,e){this.add(t,this.children.indexOf(e))}add(t,e){}addMany(...t){}remove(t,e){}removeAll(t){}clear(){}},e([t.dataProcessor(R)],exports.Group.prototype,"__",void 0),e([t.boundsType(0)],exports.Group.prototype,"width",void 0),e([t.boundsType(0)],exports.Group.prototype,"height",void 0),exports.Group=e([t.useModule(t.Branch),t.registerUI()],exports.Group);const Y=t.Debug.get("Leafer");exports.Leafer=V=class extends exports.Group{get __tag(){return"Leafer"}get isApp(){return!1}get app(){return this.parent||this}get isLeafer(){return!0}get imageReady(){return this.viewReady&&t.Resource.isComplete}get layoutLocked(){return!this.layouter.running}get FPS(){return this.renderer?this.renderer.FPS:60}get cursorPoint(){return this.interaction&&this.interaction.hoverData||{x:this.width/2,y:this.height/2}}get clientBounds(){return this.canvas&&this.canvas.getClientBounds(!0)||t.getBoundsData()}constructor(t,e){super(e),this.config={start:!0,hittable:!0,smooth:!0,lazySpeard:100},this.leafs=0,this.__eventIds=[],this.__controllers=[],this.__readyWait=[],this.__viewReadyWait=[],this.__viewCompletedWait=[],this.__nextRenderWait=[],this.userConfig=t,t&&(t.view||t.width)&&this.init(t),V.list.add(this)}init(e,s){if(this.canvas)return;let r;const{config:o}=this;this.__setLeafer(this),s&&(this.parentApp=s,this.__bindApp(s),r=s.running),e&&(this.parent=s,this.initType(e.type),this.parent=void 0,t.DataHelper.assign(o,e));const i=this.canvas=t.Creator.canvas(o);this.__controllers.push(this.renderer=t.Creator.renderer(this,i,o),this.watcher=t.Creator.watcher(this,o),this.layouter=t.Creator.layouter(this,o)),this.isApp&&this.__setApp(),this.__checkAutoLayout(o,s),this.view=i.view,s||(this.selector=t.Creator.selector(this),this.interaction=t.Creator.interaction(this,i,this.selector,o),this.interaction&&(this.__controllers.unshift(this.interaction),this.hitCanvasManager=t.Creator.hitCanvasManager()),this.canvasManager=new t.CanvasManager,r=o.start),this.hittable=o.hittable,this.fill=o.fill,this.canvasManager.add(i),this.__listenEvents(),r&&(this.__startTimer=setTimeout(this.start.bind(this))),t.WaitHelper.run(this.__initWait),this.onInit()}onInit(){}initType(t){}set(t,e){this.waitInit((()=>{super.set(t,e)}))}start(){clearTimeout(this.__startTimer),!this.running&&this.canvas&&(this.running=!0,this.ready?this.emitLeafer(t.LeaferEvent.RESTART):this.emitLeafer(t.LeaferEvent.START),this.__controllers.forEach((t=>t.start())),this.isApp||this.renderer.render())}stop(){clearTimeout(this.__startTimer),this.running&&this.canvas&&(this.__controllers.forEach((t=>t.stop())),this.running=!1,this.emitLeafer(t.LeaferEvent.STOP))}unlockLayout(){this.layouter.start(),this.updateLayout()}lockLayout(){this.updateLayout(),this.layouter.stop()}resize(e){const s=t.DataHelper.copyAttrs({},e,t.canvasSizeAttrs);Object.keys(s).forEach((t=>this[t]=s[t]))}forceRender(e,s){const{renderer:r}=this;r&&(r.addBlock(e?new t.Bounds(e):this.canvas.bounds),this.viewReady&&(s?r.render():r.update()))}requestRender(t=!1){this.renderer&&this.renderer.update(t)}updateCursor(t){const e=this.interaction;e&&(t?e.setCursor(t):e.updateCursor())}updateLazyBounds(){this.lazyBounds=this.canvas.bounds.clone().spread(this.config.lazySpeard)}__doResize(e){const{canvas:s}=this;if(!s||s.isSameSize(e))return;const r=t.DataHelper.copyAttrs({},this.canvas,t.canvasSizeAttrs);s.resize(e),this.updateLazyBounds(),this.__onResize(new t.ResizeEvent(e,r))}__onResize(e){this.emitEvent(e),t.DataHelper.copyAttrs(this.__,e,t.canvasSizeAttrs),setTimeout((()=>{this.canvasManager&&this.canvasManager.clearRecycled()}),0)}__setApp(){}__bindApp(t){this.selector=t.selector,this.interaction=t.interaction,this.canvasManager=t.canvasManager,this.hitCanvasManager=t.hitCanvasManager}__setLeafer(t){this.leafer=t,this.__level=1}__checkAutoLayout(e,s){s||(e.width&&e.height||(this.autoLayout=new t.AutoBounds(e)),this.canvas.startAutoLayout(this.autoLayout,this.__onResize.bind(this)))}__setAttr(e,s){return this.canvas&&(t.canvasSizeAttrs.includes(e)?this.__changeCanvasSize(e,s):"fill"===e?this.__changeFill(s):"hittable"===e?this.parent||(this.canvas.hittable=s):"zIndex"===e&&(this.canvas.zIndex=s,setTimeout((()=>this.parent&&this.parent.__updateSortChildren())))),super.__setAttr(e,s)}__getAttr(e){return this.canvas&&t.canvasSizeAttrs.includes(e)?this.canvas[e]:super.__getAttr(e)}__changeCanvasSize(e,s){const r=t.DataHelper.copyAttrs({},this.canvas,t.canvasSizeAttrs);r[e]=this.config[e]=s,s&&this.canvas.stopAutoLayout(),this.__doResize(r)}__changeFill(t){this.config.fill=t,this.canvas.allowBackgroundColor?this.canvas.backgroundColor=t:this.forceRender()}__onCreated(){this.created=!0}__onReady(){this.ready=!0,this.emitLeafer(t.LeaferEvent.BEFORE_READY),this.emitLeafer(t.LeaferEvent.READY),this.emitLeafer(t.LeaferEvent.AFTER_READY),t.WaitHelper.run(this.__readyWait)}__onViewReady(){this.viewReady||(this.viewReady=!0,this.emitLeafer(t.LeaferEvent.VIEW_READY),t.WaitHelper.run(this.__viewReadyWait))}__onLayoutEnd(){const{grow:t,width:e,height:s}=this.config;if(t){let{width:r,height:o,pixelRatio:i}=this;const a="box"===t?this.worldBoxBounds:this.__world;e||(r=Math.max(1,a.x+a.width)),s||(o=Math.max(1,a.y+a.height)),this.__doResize({width:r,height:o,pixelRatio:i})}this.ready||this.__onReady()}__onNextRender(){if(this.viewReady){t.WaitHelper.run(this.__nextRenderWait);const{imageReady:e}=this;e&&!this.viewCompleted&&this.__checkViewCompleted(),e||(this.viewCompleted=!1,this.requestRender())}else this.requestRender()}__checkViewCompleted(e=!0){this.nextRender((()=>{this.imageReady&&(e&&this.emitLeafer(t.LeaferEvent.VIEW_COMPLETED),t.WaitHelper.run(this.__viewCompletedWait),this.viewCompleted=!0)}))}__onWatchData(){this.watcher.childrenChanged&&this.interaction&&this.nextRender((()=>this.interaction.updateCursor()))}waitInit(t,e){e&&(t=t.bind(e)),this.__initWait||(this.__initWait=[]),this.canvas?t():this.__initWait.push(t)}waitReady(t,e){e&&(t=t.bind(e)),this.ready?t():this.__readyWait.push(t)}waitViewReady(t,e){e&&(t=t.bind(e)),this.viewReady?t():this.__viewReadyWait.push(t)}waitViewCompleted(t,e){e&&(t=t.bind(e)),this.__viewCompletedWait.push(t),this.viewCompleted?this.__checkViewCompleted(!1):this.running||this.start()}nextRender(t,e,s){e&&(t=t.bind(e));const r=this.__nextRenderWait;if(s){for(let e=0;e<r.length;e++)if(r[e]===t){r.splice(e,1);break}}else r.push(t);this.requestRender()}zoom(e,s,r,o){return t.Plugin.need("view")}getValidMove(t,e){return{x:t,y:e}}getValidScale(t){return t}getWorldPointByClient(t,e){return this.interaction&&this.interaction.getLocal(t,e)}getPagePointByClient(t,e){return this.getPagePoint(this.getWorldPointByClient(t,e))}getClientPointByWorld(t){const{x:e,y:s}=this.clientBounds;return{x:e+t.x,y:s+t.y}}updateClientBounds(){this.canvas&&this.canvas.updateClientBounds()}receiveEvent(t){}emitLeafer(e){this.emitEvent(new t.LeaferEvent(e,this))}__listenEvents(){const e=t.Run.start("FirstCreate "+this.innerName);this.once([[t.LeaferEvent.START,()=>t.Run.end(e)],[t.LayoutEvent.START,this.updateLazyBounds,this],[t.RenderEvent.START,this.__onCreated,this],[t.RenderEvent.END,this.__onViewReady,this]]),this.__eventIds.push(this.on_([[t.WatchEvent.DATA,this.__onWatchData,this],[t.LayoutEvent.END,this.__onLayoutEnd,this],[t.RenderEvent.NEXT,this.__onNextRender,this]]))}__removeListenEvents(){this.off_(this.__eventIds)}destroy(e){const s=()=>{if(!this.destroyed){V.list.remove(this);try{this.stop(),this.emitEvent(new t.LeaferEvent(t.LeaferEvent.END,this)),this.__removeListenEvents(),this.__controllers.forEach((t=>!(this.parent&&t===this.interaction)&&t.destroy())),this.__controllers.length=0,this.parent||(this.selector&&this.selector.destroy(),this.hitCanvasManager&&this.hitCanvasManager.destroy(),this.canvasManager.destroy()),this.canvas.destroy(),this.config.view=this.view=this.parentApp=null,this.userConfig&&(this.userConfig.view=null),super.destroy(),setTimeout((()=>{t.ImageManager.clearRecycled()}),100)}catch(t){Y.error(t)}}};e?s():setTimeout(s)}},exports.Leafer.list=new t.LeafList,e([t.dataProcessor(P)],exports.Leafer.prototype,"__",void 0),e([t.boundsType()],exports.Leafer.prototype,"pixelRatio",void 0),exports.Leafer=V=e([t.registerUI()],exports.Leafer),exports.Rect=class extends exports.UI{get __tag(){return"Rect"}constructor(t){super(t)}},e([t.dataProcessor(B)],exports.Rect.prototype,"__",void 0),exports.Rect=e([t.useModule(G),t.rewriteAble(),t.registerUI()],exports.Rect);const{copy:X,add:q,includes:J}=t.BoundsHelper,$=exports.Rect.prototype,K=exports.Group.prototype,Q={};exports.Box=class extends exports.Group{get __tag(){return"Box"}get isBranchLeaf(){return!0}constructor(t){super(t),this.__layout.renderChanged||this.__layout.renderChange()}__updateStrokeSpread(){return 0}__updateRectRenderSpread(){return 0}__updateRenderSpread(){return this.__updateRectRenderSpread()||-1}__updateRectBoxBounds(){}__updateBoxBounds(t){const e=this.__;if(this.children.length&&!this.pathInputed)if(e.__autoSide){e.__hasSurface&&this.__extraUpdate(),super.__updateBoxBounds();const{boxBounds:t}=this.__layout;e.__autoSize||(e.__autoWidth?(t.width+=t.x,t.x=0,t.height=e.height,t.y=0):(t.height+=t.y,t.y=0,t.width=e.width,t.x=0)),this.__updateNaturalSize()}else this.__updateRectBoxBounds();else this.__updateRectBoxBounds()}__updateStrokeBounds(){}__updateRenderBounds(){let e;const{renderBounds:s}=this.__layout;this.children.length?(super.__updateRenderBounds(),X(Q,s),this.__updateRectRenderBounds(),e=!J(s,Q),e&&"hide"!==this.__.overflow&&q(s,Q)):this.__updateRectRenderBounds(),t.DataHelper.stintSet(this,"isOverflow",e)}__updateRectRenderBounds(){}__updateRectChange(){}__updateChange(){super.__updateChange(),this.__updateRectChange()}__renderRect(t,e){}__renderGroup(t,e){}__render(t,e){this.__.__drawAfterFill?this.__renderRect(t,e):(this.__renderRect(t,e),this.children.length&&this.__renderGroup(t,e))}__drawContent(t,e){this.__renderGroup(t,e),this.__.__hasStroke&&(t.setWorld(this.__nowWorld),this.__drawRenderPath(t))}},e([t.dataProcessor(S)],exports.Box.prototype,"__",void 0),e([t.boundsType(100)],exports.Box.prototype,"width",void 0),e([t.boundsType(100)],exports.Box.prototype,"height",void 0),e([t.dataType(!1)],exports.Box.prototype,"resizeChildren",void 0),e([t.affectRenderBoundsType("show")],exports.Box.prototype,"overflow",void 0),e([t.rewrite($.__updateStrokeSpread)],exports.Box.prototype,"__updateStrokeSpread",null),e([t.rewrite($.__updateRenderSpread)],exports.Box.prototype,"__updateRectRenderSpread",null),e([t.rewrite($.__updateBoxBounds)],exports.Box.prototype,"__updateRectBoxBounds",null),e([t.rewrite($.__updateStrokeBounds)],exports.Box.prototype,"__updateStrokeBounds",null),e([t.rewrite($.__updateRenderBounds)],exports.Box.prototype,"__updateRectRenderBounds",null),e([t.rewrite($.__updateChange)],exports.Box.prototype,"__updateRectChange",null),e([t.rewrite($.__render)],exports.Box.prototype,"__renderRect",null),e([t.rewrite(K.__render)],exports.Box.prototype,"__renderGroup",null),exports.Box=e([t.rewriteAble(),t.registerUI()],exports.Box),exports.Frame=class extends exports.Box{get __tag(){return"Frame"}get isFrame(){return!0}constructor(t){super(t)}},e([t.dataProcessor(b)],exports.Frame.prototype,"__",void 0),e([t.surfaceType("#FFFFFF")],exports.Frame.prototype,"fill",void 0),e([t.affectRenderBoundsType("hide")],exports.Frame.prototype,"overflow",void 0),exports.Frame=e([t.registerUI()],exports.Frame);const{moveTo:Z,closePath:tt,ellipse:et}=t.PathCommandDataHelper;exports.Ellipse=class extends exports.UI{get __tag(){return"Ellipse"}constructor(t){super(t)}__updatePath(){const{width:e,height:s,innerRadius:r,startAngle:o,endAngle:i}=this.__,a=e/2,n=s/2,p=this.__.path=[];r?(o||i?(r<1&&et(p,a,n,a*r,n*r,0,o,i,!1),et(p,a,n,a,n,0,i,o,!0),r<1&&tt(p)):(r<1&&(et(p,a,n,a*r,n*r),Z(p,e,n)),et(p,a,n,a,n,0,360,0,!0)),t.Platform.ellipseToCurve&&(this.__.path=this.getPath(!0))):o||i?(Z(p,a,n),et(p,a,n,a,n,0,o,i,!1),tt(p)):et(p,a,n,a,n)}},e([t.dataProcessor(C)],exports.Ellipse.prototype,"__",void 0),e([t.pathType(0)],exports.Ellipse.prototype,"innerRadius",void 0),e([t.pathType(0)],exports.Ellipse.prototype,"startAngle",void 0),e([t.pathType(0)],exports.Ellipse.prototype,"endAngle",void 0),exports.Ellipse=e([t.registerUI()],exports.Ellipse);const{moveTo:st,lineTo:rt,drawPoints:ot}=t.PathCommandDataHelper,{rotate:it,getAngle:at,getDistance:nt,defaultPoint:pt}=t.PointHelper,{toBounds:ht}=t.PathBounds;exports.Line=class extends exports.UI{get __tag(){return"Line"}get toPoint(){const{width:e,rotation:s}=this.__,r=t.getPointData();return e&&(r.x=e),s&&it(r,s),r}set toPoint(t){this.width=nt(pt,t),this.rotation=at(pt,t),this.height&&(this.height=0)}constructor(t){super(t)}__updatePath(){const t=this.__,e=t.path=[];t.points?ot(e,t.points,!1,t.closed):(st(e,0,0),rt(e,this.width,0))}__updateRenderPath(){const t=this.__;!this.pathInputed&&t.points&&t.curve?(ot(t.__pathForRender=[],t.points,t.curve,t.closed),t.__useArrow&&p.addArrows(this,!1)):super.__updateRenderPath()}__updateBoxBounds(){this.points?ht(this.__.__pathForRender,this.__layout.boxBounds):super.__updateBoxBounds()}},e([t.dataProcessor(k)],exports.Line.prototype,"__",void 0),e([t.affectStrokeBoundsType("center")],exports.Line.prototype,"strokeAlign",void 0),e([t.boundsType(0)],exports.Line.prototype,"height",void 0),e([t.pathType()],exports.Line.prototype,"points",void 0),e([t.pathType(0)],exports.Line.prototype,"curve",void 0),e([t.pathType(!1)],exports.Line.prototype,"closed",void 0),exports.Line=e([t.registerUI()],exports.Line);const{sin:_t,cos:dt,PI:lt}=Math,{moveTo:ut,lineTo:ct,closePath:xt,drawPoints:yt}=t.PathCommandDataHelper,gt=exports.Line.prototype;exports.Polygon=class extends exports.UI{get __tag(){return"Polygon"}constructor(t){super(t)}__updatePath(){const t=this.__.path=[];if(this.__.points)yt(t,this.__.points,!1,!0);else{const{width:e,height:s,sides:r}=this.__,o=e/2,i=s/2;ut(t,o,0);for(let e=1;e<r;e++)ct(t,o+o*_t(2*e*lt/r),i-i*dt(2*e*lt/r))}xt(t)}__updateRenderPath(){}__updateBoxBounds(){}},e([t.dataProcessor(U)],exports.Polygon.prototype,"__",void 0),e([t.pathType(3)],exports.Polygon.prototype,"sides",void 0),e([t.pathType()],exports.Polygon.prototype,"points",void 0),e([t.pathType(0)],exports.Polygon.prototype,"curve",void 0),e([t.rewrite(gt.__updateRenderPath)],exports.Polygon.prototype,"__updateRenderPath",null),e([t.rewrite(gt.__updateBoxBounds)],exports.Polygon.prototype,"__updateBoxBounds",null),exports.Polygon=e([t.rewriteAble(),t.registerUI()],exports.Polygon);const{sin:vt,cos:ft,PI:wt}=Math,{moveTo:Tt,lineTo:mt,closePath:It}=t.PathCommandDataHelper;exports.Star=class extends exports.UI{get __tag(){return"Star"}constructor(t){super(t)}__updatePath(){const{width:t,height:e,corners:s,innerRadius:r}=this.__,o=t/2,i=e/2,a=this.__.path=[];Tt(a,o,0);for(let t=1;t<2*s;t++)mt(a,o+(t%2==0?o:o*r)*vt(t*wt/s),i-(t%2==0?i:i*r)*ft(t*wt/s));It(a)}},e([t.dataProcessor(A)],exports.Star.prototype,"__",void 0),e([t.pathType(5)],exports.Star.prototype,"corners",void 0),e([t.pathType(.382)],exports.Star.prototype,"innerRadius",void 0),exports.Star=e([t.registerUI()],exports.Star),exports.Image=class extends exports.Rect{get __tag(){return"Image"}get ready(){const{image:t}=this;return t&&t.ready}get image(){const{fill:t}=this.__;return t instanceof Array&&t[0].image}constructor(t){super(t)}},e([t.dataProcessor(W)],exports.Image.prototype,"__",void 0),e([t.boundsType("")],exports.Image.prototype,"url",void 0),exports.Image=e([t.registerUI()],exports.Image);const Rt=exports.Image;exports.Canvas=class extends exports.Rect{get __tag(){return"Canvas"}get context(){return this.canvas.context}get ready(){return!this.url}constructor(e){super(e),this.canvas=t.Creator.canvas(this.__),e&&e.url&&this.drawImage(e.url)}drawImage(e){new t.LeaferImage({url:e}).load((e=>{this.context.drawImage(e.view,0,0),this.url=void 0,this.paint(),this.emitEvent(new t.ImageEvent(t.ImageEvent.LOADED,{image:e}))}))}draw(e,s,r,o){const i=new t.Matrix(e.worldTransform).invert(),a=new t.Matrix;s&&a.translate(s.x,s.y),r&&("number"==typeof r?a.scale(r):a.scale(r.x,r.y)),o&&a.rotate(o),i.multiplyParent(a),e.__render(this.canvas,{matrix:i.withScale()}),this.paint()}paint(){this.forceRender()}__drawContent(t,e){const{width:s,height:r}=this.__,{view:o}=this.canvas;t.drawImage(o,0,0,o.width,o.height,0,0,s,r)}__updateSize(){const{canvas:t}=this;if(t){const{smooth:e,safeResize:s}=this.__;t.resize(this.__,s),t.smooth!==e&&(t.smooth=e)}}destroy(){this.canvas&&(this.canvas.destroy(),this.canvas=null),super.destroy()}},e([t.dataProcessor(z)],exports.Canvas.prototype,"__",void 0),e([r(100)],exports.Canvas.prototype,"width",void 0),e([r(100)],exports.Canvas.prototype,"height",void 0),e([r(1)],exports.Canvas.prototype,"pixelRatio",void 0),e([r(!0)],exports.Canvas.prototype,"smooth",void 0),e([t.dataType(!1)],exports.Canvas.prototype,"safeResize",void 0),e([r()],exports.Canvas.prototype,"contextSettings",void 0),exports.Canvas=e([t.registerUI()],exports.Canvas);const{copyAndSpread:St,includes:Pt,spread:bt,setList:kt}=t.BoundsHelper;exports.Text=class extends exports.UI{get __tag(){return"Text"}get textDrawData(){return this.updateLayout(),this.__.__textDrawData}constructor(t){super(t)}__updateTextDrawData(){const e=this.__,{lineHeight:s,letterSpacing:r,fontFamily:o,fontSize:a,fontWeight:p,italic:h,textCase:_,textOverflow:d,padding:l}=e;e.__lineHeight=n.number(s,a),e.__letterSpacing=n.number(r,a),e.__padding=l?t.MathHelper.fourNumber(l):void 0,e.__baseLine=e.__lineHeight-(e.__lineHeight-.7*a)/2,e.__font=`${h?"italic ":""}${"small-caps"===_?"small-caps ":""}${"normal"!==p?p+" ":""}${a}px ${o}`,e.__clipText="show"!==d&&!e.__autoSize,e.__textDrawData=i.getDrawData((e.__isPlacehold=e.placeholder&&""===e.text)?e.placeholder:e.text,this.__)}__updateBoxBounds(){const e=this.__,s=this.__layout,{fontSize:r,italic:o,padding:i,__autoWidth:a,__autoHeight:n}=e;this.__updateTextDrawData();const{bounds:p}=e.__textDrawData,h=s.boxBounds;if(s.contentBounds=p,e.__lineHeight<r&&bt(p,r/2),a||n){if(h.x=a?p.x:0,h.y=n?p.y:0,h.width=a?p.width:e.width,h.height=n?p.height:e.height,i){const[t,s,r,o]=e.__padding;a&&(h.x-=o,h.width+=s+o),n&&(h.y-=t,h.height+=r+t)}this.__updateNaturalSize()}else super.__updateBoxBounds();o&&(h.width+=.16*r),t.DataHelper.stintSet(this,"isOverflow",!Pt(h,p)),this.isOverflow?(kt(e.__textBoxBounds={},[h,p]),s.renderChanged=!0):e.__textBoxBounds=h}__onUpdateSize(){this.__box&&this.__box.__onUpdateSize(),super.__onUpdateSize()}__updateRenderSpread(){let t=super.__updateRenderSpread();return t||(t=this.isOverflow?1:0),t}__updateRenderBounds(){const{renderBounds:t,renderSpread:e}=this.__layout;St(t,this.__.__textBoxBounds,e),this.__box&&(this.__box.__layout.renderBounds=t)}__drawRenderPath(t){t.font=this.__.__font}__draw(t,e,s){const r=this.__box;r&&(r.__nowWorld=this.__nowWorld,r.__draw(t,e,s)),this.textEditing&&!u.running||super.__draw(t,e,s)}destroy(){this.boxStyle&&(this.boxStyle=null),super.destroy()}},e([t.dataProcessor(F)],exports.Text.prototype,"__",void 0),e([t.boundsType(0)],exports.Text.prototype,"width",void 0),e([t.boundsType(0)],exports.Text.prototype,"height",void 0),e([t.surfaceType()],exports.Text.prototype,"boxStyle",void 0),e([t.dataType(!1)],exports.Text.prototype,"resizeFontSize",void 0),e([t.surfaceType("#000000")],exports.Text.prototype,"fill",void 0),e([t.affectStrokeBoundsType("outside")],exports.Text.prototype,"strokeAlign",void 0),e([t.hitType("all")],exports.Text.prototype,"hitFill",void 0),e([t.boundsType("")],exports.Text.prototype,"text",void 0),e([t.boundsType("")],exports.Text.prototype,"placeholder",void 0),e([t.boundsType("caption")],exports.Text.prototype,"fontFamily",void 0),e([t.boundsType(12)],exports.Text.prototype,"fontSize",void 0),e([t.boundsType("normal")],exports.Text.prototype,"fontWeight",void 0),e([t.boundsType(!1)],exports.Text.prototype,"italic",void 0),e([t.boundsType("none")],exports.Text.prototype,"textCase",void 0),e([t.boundsType("none")],exports.Text.prototype,"textDecoration",void 0),e([t.boundsType(0)],exports.Text.prototype,"letterSpacing",void 0),e([t.boundsType({type:"percent",value:1.5})],exports.Text.prototype,"lineHeight",void 0),e([t.boundsType(0)],exports.Text.prototype,"paraIndent",void 0),e([t.boundsType(0)],exports.Text.prototype,"paraSpacing",void 0),e([t.boundsType("x")],exports.Text.prototype,"writingMode",void 0),e([t.boundsType("left")],exports.Text.prototype,"textAlign",void 0),e([t.boundsType("top")],exports.Text.prototype,"verticalAlign",void 0),e([t.boundsType(!0)],exports.Text.prototype,"autoSizeAlign",void 0),e([t.boundsType("normal")],exports.Text.prototype,"textWrap",void 0),e([t.boundsType("show")],exports.Text.prototype,"textOverflow",void 0),e([t.surfaceType(!1)],exports.Text.prototype,"textEditing",void 0),exports.Text=e([t.registerUI()],exports.Text),exports.Path=class extends exports.UI{get __tag(){return"Path"}constructor(t){super(t)}},e([t.dataProcessor(L)],exports.Path.prototype,"__",void 0),e([t.affectStrokeBoundsType("center")],exports.Path.prototype,"strokeAlign",void 0),exports.Path=e([t.registerUI()],exports.Path),exports.Pen=class extends exports.Group{get __tag(){return"Pen"}constructor(t){super(t)}setStyle(t){const e=this.pathElement=new exports.Path(t);return this.pathStyle=t,this.__path=e.path||(e.path=[]),this.add(e),this}beginPath(){return this}moveTo(t,e){return this}lineTo(t,e){return this}bezierCurveTo(t,e,s,r,o,i){return this}quadraticCurveTo(t,e,s,r){return this}closePath(){return this}rect(t,e,s,r){return this}roundRect(t,e,s,r,o){return this}ellipse(t,e,s,r,o,i,a,n){return this}arc(t,e,s,r,o,i){return this}arcTo(t,e,s,r,o){return this}drawEllipse(t,e,s,r,o,i,a,n){return this}drawArc(t,e,s,r,o,i){return this}drawPoints(t,e,s){return this}clearPath(){return this}paint(){this.pathElement.__layout.boxChanged||this.pathElement.forceUpdate("path")}},e([t.dataProcessor(E)],exports.Pen.prototype,"__",void 0),e([(e,s)=>{t.defineKey(e,s,{get(){return this.__path}})}],exports.Pen.prototype,"path",void 0),exports.Pen=e([t.useModule(t.PathCreator,["set","path","paint"]),t.registerUI()],exports.Pen),exports.BoxData=S,exports.CanvasData=z,exports.ColorConvert=a,exports.Effect=d,exports.EllipseData=C,exports.Export=u,exports.Filter=l,exports.FrameData=b,exports.GroupData=R,exports.ImageData=W,exports.LeaferData=P,exports.LineData=k,exports.MyImage=Rt,exports.Paint=h,exports.PaintGradient={},exports.PaintImage=_,exports.PathArrow=p,exports.PathData=L,exports.PenData=E,exports.PolygonData=U,exports.RectData=B,exports.RectRender=G,exports.StarData=A,exports.State=c,exports.TextConvert=i,exports.TextData=F,exports.Transition=x,exports.UIBounds=M,exports.UIData=m,exports.UIRender=O,exports.UnitConvert=n,exports.effectType=s,exports.resizeType=r,exports.zoomLayerType=o,Object.keys(t).forEach((function(e){"default"===e||Object.prototype.hasOwnProperty.call(exports,e)||Object.defineProperty(exports,e,{enumerable:!0,get:function(){return t[e]}})}));
|
|
2
2
|
//# sourceMappingURL=draw.min.cjs.map
|