vislite 1.9.0 → 1.10.0

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.
Files changed (82) hide show
  1. package/CHANGELOG +15 -0
  2. package/README.md +53 -52
  3. package/lib/BarLayout/index.es.js +8 -17
  4. package/lib/BarLayout/index.es.min.js +1 -10
  5. package/lib/Buffer/index.es.js +0 -4
  6. package/lib/Buffer/index.es.min.js +0 -4
  7. package/lib/Canvas/index.es.js +0 -4
  8. package/lib/Canvas/index.es.min.js +0 -4
  9. package/lib/Cardinal/index.es.js +0 -4
  10. package/lib/Cardinal/index.es.min.js +0 -4
  11. package/lib/Eoap/index.es.js +0 -4
  12. package/lib/Eoap/index.es.min.js +0 -4
  13. package/lib/Hermite/index.es.js +0 -4
  14. package/lib/Hermite/index.es.min.js +0 -4
  15. package/lib/MapCoordinate/index.es.js +0 -4
  16. package/lib/MapCoordinate/index.es.min.js +0 -4
  17. package/lib/Matrix4/index.es.js +0 -4
  18. package/lib/Matrix4/index.es.min.js +0 -4
  19. package/lib/Mercator/index.es.js +0 -4
  20. package/lib/Mercator/index.es.min.js +0 -4
  21. package/lib/PieLayout/index.es.js +8 -17
  22. package/lib/PieLayout/index.es.min.js +1 -9
  23. package/lib/RawCanvas/index.es.js +0 -4
  24. package/lib/RawCanvas/index.es.min.js +0 -4
  25. package/lib/SVG/index.es.js +14 -9
  26. package/lib/SVG/index.es.min.js +1 -5
  27. package/lib/Shader/index.es.js +0 -4
  28. package/lib/Shader/index.es.min.js +0 -4
  29. package/lib/Texture/index.es.js +0 -4
  30. package/lib/Texture/index.es.min.js +0 -4
  31. package/lib/TreeLayout/index.es.js +8 -17
  32. package/lib/TreeLayout/index.es.min.js +1 -9
  33. package/lib/animation/index.es.js +8 -17
  34. package/lib/animation/index.es.min.js +1 -9
  35. package/lib/assemble/index.es.js +0 -4
  36. package/lib/assemble/index.es.min.js +0 -4
  37. package/lib/getLoopColors/index.es.js +0 -4
  38. package/lib/getLoopColors/index.es.min.js +0 -4
  39. package/lib/getWebGLContext/index.es.js +0 -4
  40. package/lib/getWebGLContext/index.es.min.js +0 -4
  41. package/lib/index.umd.js +27 -28
  42. package/lib/index.umd.min.js +2 -12
  43. package/lib/initOption/index.es.js +0 -4
  44. package/lib/initOption/index.es.min.js +0 -4
  45. package/lib/mergeOption/index.es.js +0 -4
  46. package/lib/mergeOption/index.es.min.js +0 -4
  47. package/lib/move/index.es.js +0 -4
  48. package/lib/move/index.es.min.js +0 -4
  49. package/lib/rotate/index.es.js +0 -4
  50. package/lib/rotate/index.es.min.js +0 -4
  51. package/lib/ruler/index.es.js +0 -4
  52. package/lib/ruler/index.es.min.js +0 -4
  53. package/lib/scale/index.es.js +0 -4
  54. package/lib/scale/index.es.min.js +0 -4
  55. package/lib/throttle/index.es.js +4 -13
  56. package/lib/throttle/index.es.min.js +1 -9
  57. package/package.json +3 -2
  58. package/src/SVG.ts +19 -5
  59. package/types/Buffer.d.ts +15 -8
  60. package/types/Canvas.d.ts +4 -0
  61. package/types/CanvasConfig.d.ts +20 -47
  62. package/types/Cardinal.d.ts +9 -2
  63. package/types/Gradient.d.ts +10 -4
  64. package/types/Hermite.d.ts +15 -8
  65. package/types/Matrix4.d.ts +47 -15
  66. package/types/SVG.d.ts +4 -0
  67. package/types/SVGConfig.d.ts +18 -35
  68. package/types/Shader.d.ts +10 -4
  69. package/types/Texture.d.ts +12 -6
  70. package/types/TreeConfig.d.ts +32 -16
  71. package/types/TreeLayout.d.ts +25 -13
  72. package/types/animation.d.ts +15 -0
  73. package/types/assemble.d.ts +10 -1
  74. package/types/getLoopColors.d.ts +9 -1
  75. package/types/index.d.ts +52 -27
  76. package/types/move.d.ts +11 -1
  77. package/types/painterConfig.d.ts +10 -0
  78. package/types/rotate.d.ts +11 -1
  79. package/types/ruler.d.ts +15 -1
  80. package/types/scale.d.ts +11 -1
  81. package/types/throttle.d.ts +2 -1
  82. package/uni-app/ui-canvas.vue +2 -2
@@ -1,5 +1 @@
1
- /*!
2
- * RawCanvas of VISLite JavaScript Library v1.9.0
3
- * git+https://github.com/oi-contrib/VISLite.git
4
- */
5
1
  var t=function(i,e){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,i){t.__proto__=i}||function(t,i){for(var e in i)Object.prototype.hasOwnProperty.call(i,e)&&(t[e]=i[e])},t(i,e)};var i=function(){return i=Object.assign||function(t){for(var i,e=1,n=arguments.length;e<n;e++)for(var r in i=arguments[e])Object.prototype.hasOwnProperty.call(i,r)&&(t[r]=i[r]);return t},i.apply(this,arguments)};"function"==typeof SuppressedError&&SuppressedError;var e=function(t,i,e,n,r){var o=Math.cos(e),s=Math.sin(e);return[+((n-t)*o-(r-i)*s+t).toFixed(7),+((n-t)*s+(r-i)*o+i).toFixed(7)]};var n=function(t,i,e,n,r){return t.beginPath(),t.translate(e,n),t.rotate(r),t.font=i.fontStyle+" "+i.fontWeight+" "+i.fontSize+"px "+i.fontFamily,t},r=function(t,i,n,r,o,s,_,a){if(o>s){var h=o;o=s,s=h}return _%=2*Math.PI,a>=1.999999*Math.PI||a<=1.999999*-Math.PI?a=2*Math.PI:a%=2*Math.PI,function(t,i,n,r,o,s,_){i<0&&(t+=i,i*=-1);var a,h=[];a=e(0,0,t,o,0),h[0]=a[0],h[1]=a[1],a=e(0,0,i,a[0],a[1]),h[2]=a[0],h[3]=a[1],a=e(0,0,t,s,0),h[4]=a[0],h[5]=a[1],a=e(0,0,i,a[0],a[1]),h[6]=a[0],h[7]=a[1],_(t,t+i,h[0]+n,h[1]+r,h[4]+n,h[5]+r,h[2]+n,h[3]+r,h[6]+n,h[7]+r,.5*(s-o))}(_,a,n,r,o,s,(function(e,_,a,h,l,p,u,f,c,g,y){y<0&&(y=-y),t.beginPath(),t.moveTo(a,h),t.arc(n,r,o,e,_,!1),"round"==i.arcEndCap?t.arc(.5*(u+c),.5*(f+g),y,_-Math.PI,_,!0):"-round"==i.arcEndCap?t.arc(.5*(u+c),.5*(f+g),y,_-Math.PI,_,!1):t.lineTo(c,g),t.arc(n,r,s,_,e,!0),"round"==i.arcStartCap?t.arc(.5*(a+l),.5*(h+p),y,e,e-Math.PI,!0):"-round"==i.arcStartCap?t.arc(.5*(a+l),.5*(h+p),y,e,e-Math.PI,!1):t.lineTo(a,h)})),"butt"==i.arcStartCap&&t.closePath(),t},o=function(t,i,e,n){return t.beginPath(),t.moveTo(i+n,e),t.arc(i,e,n,0,2*Math.PI),t},s=function(t,i,e,n,r,o){t.beginPath();var s=[];if(Array.isArray(i.rectRadius)&&i.rectRadius.length>0)for(var _=0;_<4;_++)s.push.apply(s,i.rectRadius);return s.length>=4?(t.arc(e+s[0],n+s[0],s[0],Math.PI,1.5*Math.PI),t.arc(e+r-s[1],n+s[1],s[1],1.5*Math.PI,0),t.arc(e+r-s[2],n+o-s[2],s[2],0,.5*Math.PI),t.arc(e+s[3],n+o-s[3],s[3],.5*Math.PI,Math.PI),t.closePath()):t.rect(e,n,r,o),t};function _(t,i,e,n,r){for(var o=0,s="",_=0;_<i.length;_++)t.measureText(s+i[_]).width>e||/\n$/.test(s)?(r(s,((o+=1)-.5)*n),s=i[_]):_==i.length-1?(o+=1,r(s+i[_],(o-.5)*n)):s+=i[_];return o*n}function a(t){var e={fontSize:16,fontFamily:"sans-serif",fontWeight:400,fontStyle:"normal",arcStartCap:"butt",arcEndCap:"butt",rectRadius:[]},n={fillStyle:"black",strokeStyle:"black",lineWidth:1,lineCap:"butt",lineJoin:"miter",lineDash:[],textAlign:"left",textBaseline:"middle",shadowBlur:0,shadowColor:"black"};return"special"==t?e:"init"==t?n:i(i({},e),n)}var h=function(){function t(t,i,e,n,r){void 0===i&&(i={}),void 0===n&&(n=!1),this.__region=null,this.__onlyRegion=!1,this.__onlyView=!1,this.__specialConfig=a("special"),this.__initConfig=a("init"),this.painter=t.getContext("2d",i),this.__region=e,this.__isPainter=n,this.painter.textBaseline="middle",this.painter.textAlign="left",this.painter.shadowColor="black"}return t.prototype.useConfig=function(t,i){if(this.__region&&!this.__onlyView&&["fillStyle","strokeStyle","shadowBlur","shadowColor"].indexOf(t)<0&&this.__region.useConfig(t,i),this.__isPainter&&this.__onlyRegion)return this;if("lineDash"==t)this.painter.setLineDash&&this.painter.setLineDash(i);else if(t in this.__specialConfig)"fontSize"==t&&(i=Math.round(i)),this.__specialConfig[t]=i;else{if(!(t in this.__initConfig))throw new Error("Illegal configuration item of painter : "+t+" !");this.painter[t]=i}return this},t.prototype.fillText=function(t,i,e,r){return void 0===r&&(r=0),this.__region&&!this.__onlyView&&this.__region.fillText(t,i,e,r),this.__isPainter&&this.__onlyRegion||(this.painter.save(),n(this.painter,this.__specialConfig,i,e,r).fillText(t,0,0),this.painter.restore()),this},t.prototype.strokeText=function(t,i,e,r){return void 0===r&&(r=0),this.__region&&!this.__onlyView&&this.__region.strokeText(t,i,e,r),this.__isPainter&&this.__onlyRegion||(this.painter.save(),n(this.painter,this.__specialConfig,i,e,r).strokeText(t,0,0),this.painter.restore()),this},t.prototype.fullText=function(t,i,e,r){return void 0===r&&(r=0),this.__region&&!this.__onlyView&&this.__region.fullText(t,i,e,r),this.__isPainter&&this.__onlyRegion||(this.painter.save(),n(this.painter,this.__specialConfig,i,e,r),this.painter.fillText(t,0,0),this.painter.strokeText(t,0,0),this.painter.restore()),this},t.prototype.fillTexts=function(t,i,e,r,o,s){var a=this;void 0===o&&(o=1.2),void 0===s&&(s=0);var h=0;if(this.__region&&!this.__onlyView&&(h=this.__region.fillTexts(t,i,e,r,o)),this.__isPainter&&this.__onlyRegion)return h;this.painter.save(),n(this.painter,this.__specialConfig,i,e,s);var l=_(this.painter,t,r,this.__specialConfig.fontSize*o,(function(t,i){a.painter.fillText(t,0,i)}));return this.painter.restore(),l},t.prototype.strokeTexts=function(t,i,e,r,o,s){var a=this;void 0===o&&(o=1.2),void 0===s&&(s=0);var h=0;if(this.__region&&!this.__onlyView&&(h=this.__region.fillTexts(t,i,e,r,o)),this.__isPainter&&this.__onlyRegion)return h;this.painter.save(),n(this.painter,this.__specialConfig,i,e,s);var l=_(this.painter,t,r,this.__specialConfig.fontSize*o,(function(t,i){a.painter.strokeText(t,0,i)}));return this.painter.restore(),l},t.prototype.fullTexts=function(t,i,e,r,o,s){var a=this;void 0===o&&(o=1.2),void 0===s&&(s=0);var h=0;if(this.__region&&!this.__onlyView&&(h=this.__region.fillTexts(t,i,e,r,o)),this.__isPainter&&this.__onlyRegion)return h;this.painter.save(),n(this.painter,this.__specialConfig,i,e,s);var l=_(this.painter,t,r,this.__specialConfig.fontSize*o,(function(t,i){a.painter.fillText(t,0,i),a.painter.strokeText(t,0,i)}));return this.painter.restore(),l},t.prototype.beginPath=function(){return this.__region&&!this.__onlyView&&this.__region.beginPath(),this.__isPainter&&this.__onlyRegion||this.painter.beginPath(),this},t.prototype.closePath=function(){return this.__region&&!this.__onlyView&&this.__region.closePath(),this.__isPainter&&this.__onlyRegion||this.painter.closePath(),this},t.prototype.moveTo=function(t,i){return this.__region&&!this.__onlyView&&this.__region.moveTo(t,i),this.__isPainter&&this.__onlyRegion||this.painter.moveTo(Math.round(t)+.5,Math.round(i)+.5),this},t.prototype.lineTo=function(t,i){return this.__region&&!this.__onlyView&&this.__region.lineTo(t,i),this.__isPainter&&this.__onlyRegion||this.painter.lineTo(Math.round(t)+.5,Math.round(i)+.5),this},t.prototype.arc=function(t,i,e,n,r){return this.__region&&!this.__onlyView&&this.__region.arc(t,i,e,n,r),this.__isPainter&&this.__onlyRegion||this.painter.arc(t,i,e,n,n+r,r<0),this},t.prototype.fill=function(){return this.__region&&!this.__onlyView&&this.__region.fill(),this.__isPainter&&this.__onlyRegion||this.painter.fill(),this},t.prototype.stroke=function(){return this.__region&&!this.__onlyView&&this.__region.stroke(),this.__isPainter&&this.__onlyRegion||this.painter.stroke(),this},t.prototype.full=function(){return this.__region&&!this.__onlyView&&this.__region.full(),this.__isPainter&&this.__onlyRegion||(this.painter.fill(),this.painter.stroke()),this},t.prototype.save=function(){return this.__region&&!this.__onlyView&&this.__region.save(),this.__isPainter&&this.__onlyRegion||this.painter.save(),this},t.prototype.restore=function(){return this.__region&&!this.__onlyView&&this.__region.restore(),this.__isPainter&&this.__onlyRegion||this.painter.restore(),this},t.prototype.clip=function(){return this.__region&&!this.__onlyView&&this.__region.clip(),this.__isPainter&&this.__onlyRegion||this.painter.clip(),this},t.prototype.quadraticCurveTo=function(t,i,e,n){return this.__region&&!this.__onlyView&&this.__region.quadraticCurveTo(t,i,e,n),this.__isPainter&&this.__onlyRegion||this.painter.quadraticCurveTo(t,i,e,n),this},t.prototype.bezierCurveTo=function(t,i,e,n,r,o){return this.__region&&!this.__onlyView&&this.__region.bezierCurveTo(t,i,e,n,r,o),this.__isPainter&&this.__onlyRegion||this.painter.bezierCurveTo(t,i,e,n,r,o),this},t.prototype.clearRect=function(t,i,e,n){return this.__region&&!this.__onlyView&&this.__region.clearRect(t,i,e,n),this.__isPainter&&this.__onlyRegion||this.painter.clearRect(t,i,e,n),this},t.prototype.clearCircle=function(t,i,e){return this.__region&&!this.__onlyView&&this.__region.clearCircle(t,i,e),this.__isPainter&&this.__onlyRegion||(this.painter.beginPath(),this.painter.globalCompositeOperation="destination-out",this.painter.arc(t,i,e,0,2*Math.PI),this.painter.fill(),this.painter.globalCompositeOperation="source-over",this.painter.closePath()),this},t.prototype.fillArc=function(t,i,e,n,o,s){return this.__region&&!this.__onlyView&&this.__region.fillArc(t,i,e,n,o,s),this.__isPainter&&this.__onlyRegion||r(this.painter,this.__specialConfig,t,i,e,n,o,s).fill(),this},t.prototype.strokeArc=function(t,i,e,n,o,s){return this.__region&&!this.__onlyView&&this.__region.strokeArc(t,i,e,n,o,s),this.__isPainter&&this.__onlyRegion||r(this.painter,this.__specialConfig,t,i,e,n,o,s).stroke(),this},t.prototype.fullArc=function(t,i,e,n,o,s){return this.__region&&!this.__onlyView&&this.__region.fullArc(t,i,e,n,o,s),this.__isPainter&&this.__onlyRegion||(r(this.painter,this.__specialConfig,t,i,e,n,o,s),this.painter.fill(),this.painter.stroke()),this},t.prototype.fillCircle=function(t,i,e){return this.__region&&!this.__onlyView&&this.__region.fillCircle(t,i,e),this.__isPainter&&this.__onlyRegion||o(this.painter,t,i,e).fill(),this},t.prototype.strokeCircle=function(t,i,e){return this.__region&&!this.__onlyView&&this.__region.strokeCircle(t,i,e),this.__isPainter&&this.__onlyRegion||o(this.painter,t,i,e).stroke(),this},t.prototype.fullCircle=function(t,i,e){return this.__region&&!this.__onlyView&&this.__region.fullCircle(t,i,e),this.__isPainter&&this.__onlyRegion||(o(this.painter,t,i,e),this.painter.fill(),this.painter.stroke()),this},t.prototype.fillRect=function(t,i,e,n){return this.__region&&!this.__onlyView&&this.__region.fillRect(t,i,e,n),this.__isPainter&&this.__onlyRegion||s(this.painter,this.__specialConfig,t,i,e,n).fill(),this},t.prototype.strokeRect=function(t,i,e,n){return this.__region&&!this.__onlyView&&this.__region.strokeRect(t,i,e,n),this.__isPainter&&this.__onlyRegion||s(this.painter,this.__specialConfig,t,i,e,n).stroke(),this},t.prototype.fullRect=function(t,i,e,n){return this.__region&&!this.__onlyView&&this.__region.fullRect(t,i,e,n),this.__isPainter&&this.__onlyRegion||(s(this.painter,this.__specialConfig,t,i,e,n),this.painter.fill(),this.painter.stroke()),this},t.prototype.draw=function(){return Promise.resolve()},t.prototype.drawImage=function(t,i,e,n,r,o){var s=this;return void 0===o&&(o=!1),new Promise((function(_){if(s.__region&&!s.__onlyView&&s.__region.fillRect(i,e,n,r),s.__isPainter&&s.__onlyRegion)_({});else if("string"!=typeof t||o)s.painter.drawImage(t,i,e,n,r),_({});else{var a=new Image;a.onload=function(){s.painter.drawImage(a,i,e,n,r),_({})},a.src=t}}))},t.prototype.translate=function(t,i){return this.painter.translate(t,i),this},t.prototype.rotate=function(t){return this.painter.rotate(t),this},t.prototype.install=function(t){var i=this,e=function(e){if(e in n)throw new Error("VISLite Canvas:Method already exists and cannot be overwritten.");n[e]=function(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];var o=t[e].apply(i,n);return null!=o?o:i}},n=this;for(var r in t)e(r);return this},t}();var l=function(t,i){var e={value:function(){return t},setColor:function(n,r){return t.addColorStop(i?i(n):n,r),e}};return e};var p=function(i){function e(t,e,n,r){void 0===n&&(n={}),void 0===r&&(r=1);var o=i.call(this,t,n,e?new h(e,{willReadFrequently:!0}):void 0,!0,r)||this;return o.name="Canvas",o.__regionList={},o.__regionAssemble=function(t,i,e,n){for(var r=[],o=0;o<n;o++)r[o]=t;return function(){for(var o=0;o<n;o++){if(r[o]+e<i){r[o]=+(r[o]+e).toFixed(7);break}o<n-1&&(r[o]=t)}return r}}(0,255,10,3),o.__scaleSize=r,o.setRegion(""),o}return function(i,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=i}t(i,e),i.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}(e,i),e.prototype.config=function(t){for(var i in t)this.useConfig(i,t[i]);return this},e.prototype.reset=function(t){return void 0===t&&(t={}),this.config(function(t,i){for(var e in t)i[e]=t[e];return i}(t,a())),this},e.prototype.onlyRegion=function(t){return this.__onlyRegion=t,this},e.prototype.onlyView=function(t){return this.__onlyView=t,this},e.prototype.setRegion=function(t){if(this.__region)if(t){if(null==this.__regionList[t]){var i=this.__regionAssemble();this.__regionList[t]="rgb("+i[0]+","+i[1]+","+i[2]+")"}this.__region.useConfig("fillStyle",this.__regionList[t])&&this.__region.useConfig("strokeStyle",this.__regionList[t])}else this.__region.useConfig("fillStyle","#000000")&&this.__region.useConfig("strokeStyle","#000000");return this},e.prototype.getRegion=function(t,i){var e=this;return new Promise((function(n){var r=e.__region?e.__region.painter.getImageData(t-.5,i-.5,1,1):{data:[0,0,0,0]},o=r.data,s=function(){if(e.__region)for(var t in e.__regionList)if("rgb("+o[0]+","+o[1]+","+o[2]+")"==e.__regionList[t]){n(t);break}n("")};o?s():r.then((function(t){o=t,s()}))}))},e.prototype.textWidth=function(t){this.painter.save(),n(this.painter,this.__specialConfig,0,0,0);var i=this.painter.measureText(t+"").width;return this.painter.restore(),i},e.prototype.getContext=function(t){return void 0===t&&(t=!1),t?this.__region?this.__region.painter:null:this.painter},e.prototype.getInfo=function(){return{width:this.painter.canvas.width/this.__scaleSize,height:this.painter.canvas.height/this.__scaleSize}},e.prototype.createLinearGradient=function(t,i,e,n){return function(t,i,e,n,r){var o=t.createLinearGradient(i,e,n,r);return l(o)}(this.painter,t,i,e,n)},e.prototype.createRadialGradient=function(t,i,e){return function(t,i,e,n){var r=t.createRadialGradient(i,e,0,i,e,n);return l(r)}(this.painter,t,i,e)},e.prototype.createConicGradient=function(t,i,e,n){return function(t,i,e,n,r){var o=t.createConicGradient(n,i,e);return l(o,r?function(t){return r/(2*Math.PI)*t}:void 0)}(this.painter,t,i,e,n)},e.prototype.getColor=function(t,i){t*=this.__scaleSize,i*=this.__scaleSize;var e=this.painter.getImageData(t-.5,i-.5,1,1).data;return"rgba("+e[0]+","+e[1]+","+e[2]+","+e[3]+")"},e}(h);export{p as default};
@@ -1,7 +1,3 @@
1
- /*!
2
- * SVG of VISLite JavaScript Library v1.9.0
3
- * git+https://github.com/oi-contrib/VISLite.git
4
- */
5
1
  /******************************************************************************
6
2
  Copyright (c) Microsoft Corporation.
7
3
 
@@ -636,11 +632,20 @@ var SVG = (function (_super) {
636
632
  throw new Error("VISLite SVG:The mount point requires an HTMLElement type but encountered null.");
637
633
  }
638
634
  var width = el.clientWidth, height = el.clientHeight;
639
- var ViewSVG = document.createElementNS("http://www.w3.org/2000/svg", 'svg');
640
- el.appendChild(ViewSVG);
641
- ViewSVG.setAttribute("width", width + "");
642
- ViewSVG.setAttribute("height", height + "");
643
- ViewSVG.setAttribute("viewBox", "0 0 " + width + " " + height);
635
+ var ViewSVG;
636
+ var _el = el;
637
+ if (_el._vislite_svg_) {
638
+ ViewSVG = _el._vislite_svg_[0];
639
+ }
640
+ else {
641
+ ViewSVG = document.createElementNS("http://www.w3.org/2000/svg", 'svg');
642
+ el.appendChild(ViewSVG);
643
+ ViewSVG.setAttribute("width", width + "");
644
+ ViewSVG.setAttribute("height", height + "");
645
+ ViewSVG.setAttribute("viewBox", "0 0 " + width + " " + height);
646
+ _el._vislite_svg_ = [ViewSVG];
647
+ el.setAttribute('vislite', 'SVG');
648
+ }
644
649
  _this = _super.call(this, ViewSVG) || this;
645
650
  _this.__el = el;
646
651
  return _this;
@@ -1,5 +1 @@
1
- /*!
2
- * SVG of VISLite JavaScript Library v1.9.0
3
- * git+https://github.com/oi-contrib/VISLite.git
4
- */
5
- var t=function(r,e){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,r){t.__proto__=r}||function(t,r){for(var e in r)Object.prototype.hasOwnProperty.call(r,e)&&(t[e]=r[e])},t(r,e)};"function"==typeof SuppressedError&&SuppressedError;var r=["href","title","show","type","role","actuate"],e=function(t,r){o(t,"stroke-dasharray",r.lineDash.join(",")),o(t,"stroke-width",r.lineWidth+""),o(t,"stroke-linecap",r.lineCap+""),o(t,"stroke-linejoin",r.lineJoin+"")};function n(t){return document.createElementNS("http://www.w3.org/2000/svg",t)}var i=function(t,e,n){r.indexOf(e)>-1?t.setAttributeNS("http://www.w3.org/1999/xlink","xlink:"+e,n+""):t.setAttribute(e,n+"")},o=i;function s(t,r){e(t,r),i(t,"stroke",r.strokeStyle),i(t,"fill",r.fillStyle)}function a(t,r){i(t,"fill",r.fillStyle)}function h(t,r){e(t,r),i(t,"stroke",r.strokeStyle),i(t,"fill","none")}var _=function(t,r,e,n,i){var o=Math.cos(e),s=Math.sin(e);return[+((n-t)*o-(i-r)*s+t).toFixed(7),+((n-t)*s+(i-r)*o+r).toFixed(7)]};var u=function(t){var r=t.getElementsByTagName("defs");if(r.length<=0){var e=n("defs");return t.appendChild(e),e}return r[0]},f=function(t,r,e,n,i){if("text"!==t.nodeName.toLowerCase())throw new Error("Need a <text> !");o(t,"dy",{top:.5*r.fontSize,middle:0,bottom:.5*-r.fontSize}[r.textBaseline]),function(t,r){for(var e in r)t.style[e]=r[e]}(t,{"text-anchor":{left:"start",right:"end",center:"middle"}[r.textAlign],"dominant-baseline":"central","font-size":r.fontSize+"px","font-family":r.fontFamily}),o(t,"x",e),o(t,"y",n),"number"==typeof i&&o(t,"transform","rotate("+(i%=360)+","+e+","+n+")")},c=function(t,r,e,n){if("circle"!==t.nodeName.toLowerCase())throw new Error("Need a <circle> !");o(t,"cx",r),o(t,"cy",e),o(t,"r",n)},l=function(t,r){if("path"!==t.nodeName.toLowerCase())throw new Error("Need a <path> !");o(t,"d",r)},p=function(t,r,e,n,i,s){if("path"!==t.nodeName.toLowerCase())throw new Error("Need a <path> !");var a=[];if(Array.isArray(r.rectRadius)&&r.rectRadius.length>0)for(var h=0;h<4;h++)a.push.apply(a,r.rectRadius);s<0&&(n-=s*=-1),i<0&&(e-=i*=-1);var _="";a.length>=4?(_="M"+(e+a[0])+" "+n,_+="L"+(e+i-a[1])+" "+n,_+="A"+a[1]+" "+a[1]+" 0 0 1 "+(e+i)+" "+(n+a[1]),_+="L"+(e+i)+" "+(n+s-a[2]),_+="A"+a[2]+" "+a[2]+" 0 0 1 "+(e+i-a[2])+" "+(n+s),_+="L"+(e+a[3])+" "+(n+s),_+="A"+a[3]+" "+a[3]+" 0 0 1 "+e+" "+(n+s-a[3]),_+="L"+e+" "+(n+a[0]),_+="A"+a[0]+" "+a[0]+" 0 0 1 "+(e+a[0])+" "+n):(_="M"+e+" "+n,_+="L"+(e+i)+" "+n,_+="L"+(e+i)+" "+(n+s),_+="L"+e+" "+(n+s),_+="Z"),o(t,"d",_)},d=function(t,r,e,n,i,s,a,h){if("path"!==t.nodeName.toLowerCase())throw new Error("Need a <path> !");if(a=a/180*Math.PI,h=h/180*Math.PI,a%=2*Math.PI,i>s){var u=i;i=s,s=u}h>=1.999999*Math.PI||h<=1.999999*-Math.PI?h=1.999999*Math.PI:h%=2*Math.PI,function(t,r,e,n,i,o,s){r<0&&(t+=r,r*=-1);var a,h=[];a=_(0,0,t,i,0),h[0]=a[0],h[1]=a[1],a=_(0,0,r,a[0],a[1]),h[2]=a[0],h[3]=a[1],a=_(0,0,t,o,0),h[4]=a[0],h[5]=a[1],a=_(0,0,r,a[0],a[1]),h[6]=a[0],h[7]=a[1],s(t,t+r,h[0]+e,h[1]+n,h[4]+e,h[5]+n,h[2]+e,h[3]+n,h[6]+e,h[7]+n,.5*(o-i))}(a,h,e,n,i,s,(function(e,n,a,h,_,u,f,c,l,p,d){var y=n-e>Math.PI?1:0,m="M"+a+" "+h;d<0&&(d=-d),m+="A"+i+" "+i+" 0 "+y+" 1 "+f+" "+c,"round"==r.arcEndCap?m+="A"+d+" "+d+" 0 1 0 "+l+" "+p:"-round"==r.arcEndCap?m+="A"+d+" "+d+" 0 1 1 "+l+" "+p:m+="L"+l+" "+p,m+="A"+s+" "+s+" 0 "+y+" 0 "+_+" "+u,"round"==r.arcStartCap?m+="A"+d+" "+d+" 0 1 0 "+a+" "+h:"-round"==r.arcStartCap?m+="A"+d+" "+d+" 0 1 1 "+a+" "+h:m+="L"+a+" "+h,"butt"==r.arcStartCap&&(m+="Z"),o(t,"d",m)}))};function y(t,r,e,n,i){var o=Math.cos(e),s=Math.sin(e);return[(n-t)*o-(i-r)*s+t,(n-t)*s+(i-r)*o+r]}var m=function(t,r){var e={value:function(){return"url(#"+r+")"},setColor:function(r,i){var s=n("stop");return t.appendChild(s),o(s,"offset",100*r+"%"),o(s,"style","stop-color:"+i+";"),e}};return e};var g=function(){function t(t){this.name="SVG",this.__config={fillStyle:"rgb(0,0,0)",strokeStyle:"rgb(0,0,0)",textAlign:"left",textBaseline:"middle",fontSize:16,fontFamily:"sans-serif",arcStartCap:"butt",arcEndCap:"butt",lineDash:[],lineWidth:1,lineCap:"butt",lineJoin:"miter",rectRadius:[]},this.__path="",this.__currentPosition=[],this.__transform_history=[],this.__transform_current="",this.__svg=t}return t.prototype.config=function(t){if("object"!=typeof t)return this.__config[t];for(var r in t)this.__config[r]=t[r];return this},t.prototype.reset=function(t){return void 0===t&&(t={}),this.config(function(t,r){for(var e in t)r[e]=t[e];return r}(t,{fillStyle:"rgb(0,0,0)",strokeStyle:"rgb(0,0,0)",textAlign:"left",textBaseline:"middle",fontSize:16,fontFamily:"sans-serif",arcStartCap:"butt",arcEndCap:"butt",lineDash:[],lineWidth:1,lineCap:"butt",lineJoin:"miter",rectRadius:[]})),this},t.prototype.useEl=function(t){return this.__useEl=t,this},t.prototype.getEl=function(){return this.__useEl},t.prototype.appendEl=function(t,r){return r=r||this.__svg,"string"==typeof t&&(t=n(t)),r.appendChild(t),this.__useEl=t,this},t.prototype.appendBoard=function(t,r){var e=t;if("string"==typeof t&&(e={text:"text",path:"path",arc:"path",circle:"circle",rect:"path"}[t]||""),""==e)throw new Error("Unsupported drawing method:"+t);return this.appendEl(e,r)},t.prototype.remove=function(){if(!this.__useEl)throw new Error("Currently, no node can be deleted.");return this.__useEl.parentNode.removeChild(this.__useEl),this},t.prototype.attr=function(t){if(!this.__useEl)throw new Error("Currently, no node can be modified or viewed.");if("object"!=typeof t)return function(t,e){return r.indexOf(e)>-1&&(e="xlink:"+e),t.getAttribute(e)}(this.__useEl,t);for(var e in t)o(this.__useEl,e,t[e]);return this},t.prototype.fillText=function(t,r,e,n){return void 0===n&&(n=0),f(this.__useEl,this.__config,r,e,n),this.attr({transform:this.__transform_current}),this.__useEl.textContent=t,a(this.__useEl,this.__config),this},t.prototype.strokeText=function(t,r,e,n){return void 0===n&&(n=0),f(this.__useEl,this.__config,r,e,n),this.attr({transform:this.__transform_current}),this.__useEl.textContent=t,h(this.__useEl,this.__config),this},t.prototype.fullText=function(t,r,e,n){return void 0===n&&(n=0),f(this.__useEl,this.__config,r,e,n),this.attr({transform:this.__transform_current}),this.__useEl.textContent=t,s(this.__useEl,this.__config),this},t.prototype.fillArc=function(t,r,e,n,i,o){return d(this.__useEl,this.__config,t,r,e,n,i,o),this.attr({transform:this.__transform_current}),a(this.__useEl,this.__config),this},t.prototype.strokeArc=function(t,r,e,n,i,o){return d(this.__useEl,this.__config,t,r,e,n,i,o),this.attr({transform:this.__transform_current}),h(this.__useEl,this.__config),this},t.prototype.fullArc=function(t,r,e,n,i,o){return d(this.__useEl,this.__config,t,r,e,n,i,o),this.attr({transform:this.__transform_current}),s(this.__useEl,this.__config),this},t.prototype.fillCircle=function(t,r,e){return c(this.__useEl,t,r,e),this.attr({transform:this.__transform_current}),a(this.__useEl,this.__config),this},t.prototype.strokeCircle=function(t,r,e){return c(this.__useEl,t,r,e),this.attr({transform:this.__transform_current}),h(this.__useEl,this.__config),this},t.prototype.fullCircle=function(t,r,e){return c(this.__useEl,t,r,e),this.attr({transform:this.__transform_current}),s(this.__useEl,this.__config),this},t.prototype.fillRect=function(t,r,e,n){return p(this.__useEl,this.__config,t,r,e,n),this.attr({transform:this.__transform_current}),a(this.__useEl,this.__config),this},t.prototype.strokeRect=function(t,r,e,n){return p(this.__useEl,this.__config,t,r,e,n),this.attr({transform:this.__transform_current}),h(this.__useEl,this.__config),this},t.prototype.fullRect=function(t,r,e,n){return p(this.__useEl,this.__config,t,r,e,n),this.attr({transform:this.__transform_current}),s(this.__useEl,this.__config),this},t.prototype.beginPath=function(){return this.__currentPosition=[],this.__path="",this},t.prototype.closePath=function(){return this.__path+="Z",this},t.prototype.moveTo=function(t,r){return this.__currentPosition=[t,r],this.__path+="M"+t+" "+r,this},t.prototype.lineTo=function(t,r){return this.__currentPosition=[t,r],this.__path+=(""==this.__path?"M":"L")+t+" "+r,this},t.prototype.fill=function(){return l(this.__useEl,this.__path),this.attr({transform:this.__transform_current}),a(this.__useEl,this.__config),this},t.prototype.stroke=function(){return l(this.__useEl,this.__path),this.attr({transform:this.__transform_current}),h(this.__useEl,this.__config),this},t.prototype.full=function(){return l(this.__useEl,this.__path),this.attr({transform:this.__transform_current}),s(this.__useEl,this.__config),this},t.prototype.save=function(){return this.__transform_history.push(this.__transform_current),this},t.prototype.restore=function(){return this.__transform_history.length>0&&(this.__transform_current=this.__transform_history.pop()),this},t.prototype.arc=function(t,r,e,n,i){var o=y(t,r,n/180*Math.PI,t+e,r),s=y(t,r,(n+i)/180*Math.PI,t+e,r);return""==this.__path?this.__path+="M"+o[0]+","+o[1]:o[0]==this.__currentPosition[0]&&o[1]==this.__currentPosition[1]||(this.__path+="L"+o[0]+","+o[1]),this.__path+="A"+e+","+e+" 0 "+(i>180||i<-180?1:0)+","+(i>0?1:0)+" "+s[0]+","+s[1],this},t.prototype.quadraticCurveTo=function(t,r,e,n){return this.__path+="Q"+t+" "+r+","+e+" "+n,this},t.prototype.bezierCurveTo=function(t,r,e,n,i,o){return this.__path+="C"+t+" "+r+","+e+" "+n+","+i+" "+o,this},t.prototype.bind=function(t,r){return this.__useEl.addEventListener(t,(function(t){r.call(this,t,this)}),!1),this},t.prototype.createLinearGradient=function(t,r,e,i){return function(t,r,e,i,s){var a=u(t),h="visliteLg"+(new Date).valueOf()+(1e6*Math.random()).toFixed(0),_=n("linearGradient");return a.appendChild(_),o(_,"id",h),o(_,"x1",r+"%"),o(_,"y1",e+"%"),o(_,"x2",i+"%"),o(_,"y2",s+"%"),m(_,h)}(this.__svg,t,r,e,i)},t.prototype.createRadialGradient=function(t,r,e){return function(t,r,e,i){var s=u(t),a="visliteRg"+(new Date).valueOf()+(1e6*Math.random()).toFixed(0),h=n("radialGradient");return s.appendChild(h),o(h,"id",a),o(h,"cx",r+"%"),o(h,"cy",e+"%"),o(h,"r",i+"%"),m(h,a)}(this.__svg,t,r,e)},t.prototype.translate=function(t,r){return this.__transform_current+=" translate("+t+","+r+")",this},t.prototype.rotate=function(t){return this.__transform_current+=" rotate("+t+")",this},t.prototype.install=function(t){var r=this,e=function(e){if(e in n)throw new Error("VISLite SVG:Method already exists and cannot be overwritten.");n[e]=function(){for(var n=[],i=0;i<arguments.length;i++)n[i]=arguments[i];var o=t[e].apply(r,n);return null!=o?o:r}},n=this;for(var i in t)e(i);return this},t}(),v=function(r){function e(t){var e=this;if(!t)throw new Error("VISLite SVG:The mount point requires an HTMLElement type but encountered null.");var n=t.clientWidth,i=t.clientHeight,o=document.createElementNS("http://www.w3.org/2000/svg","svg");return t.appendChild(o),o.setAttribute("width",n+""),o.setAttribute("height",i+""),o.setAttribute("viewBox","0 0 "+n+" "+i),(e=r.call(this,o)||this).__el=t,e}return function(r,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=r}t(r,e),r.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}(e,r),e.prototype.toDataURL=function(){var t=this;return new Promise((function(r){var e=t.__el.clientWidth,n=t.__el.clientHeight,i=document.createElement("img");i.setAttribute("width",e+""),i.setAttribute("height",n+"");var o="data:image/svg+xml;charset=utf-8,<svg xmlns='http://www.w3.org/2000/svg' width='"+e+"' height='"+n+"'>"+t.__svg.innerHTML.replace(/"/g,"'")+"</svg>";i.setAttribute("src",o),setTimeout((function(){var t=document.createElement("canvas");t.setAttribute("width",e+""),t.setAttribute("height",n+"");var o=t.getContext("2d");o&&o.drawImage(i,0,0,e,n),r(t.toDataURL())}),100)}))},e}(g);export{v as default};
1
+ var t=function(r,e){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,r){t.__proto__=r}||function(t,r){for(var e in r)Object.prototype.hasOwnProperty.call(r,e)&&(t[e]=r[e])},t(r,e)};"function"==typeof SuppressedError&&SuppressedError;var r=["href","title","show","type","role","actuate"],e=function(t,r){o(t,"stroke-dasharray",r.lineDash.join(",")),o(t,"stroke-width",r.lineWidth+""),o(t,"stroke-linecap",r.lineCap+""),o(t,"stroke-linejoin",r.lineJoin+"")};function i(t){return document.createElementNS("http://www.w3.org/2000/svg",t)}var n=function(t,e,i){r.indexOf(e)>-1?t.setAttributeNS("http://www.w3.org/1999/xlink","xlink:"+e,i+""):t.setAttribute(e,i+"")},o=n;function s(t,r){e(t,r),n(t,"stroke",r.strokeStyle),n(t,"fill",r.fillStyle)}function a(t,r){n(t,"fill",r.fillStyle)}function h(t,r){e(t,r),n(t,"stroke",r.strokeStyle),n(t,"fill","none")}var _=function(t,r,e,i,n){var o=Math.cos(e),s=Math.sin(e);return[+((i-t)*o-(n-r)*s+t).toFixed(7),+((i-t)*s+(n-r)*o+r).toFixed(7)]};var u=function(t){var r=t.getElementsByTagName("defs");if(r.length<=0){var e=i("defs");return t.appendChild(e),e}return r[0]},f=function(t,r,e,i,n){if("text"!==t.nodeName.toLowerCase())throw new Error("Need a <text> !");o(t,"dy",{top:.5*r.fontSize,middle:0,bottom:.5*-r.fontSize}[r.textBaseline]),function(t,r){for(var e in r)t.style[e]=r[e]}(t,{"text-anchor":{left:"start",right:"end",center:"middle"}[r.textAlign],"dominant-baseline":"central","font-size":r.fontSize+"px","font-family":r.fontFamily}),o(t,"x",e),o(t,"y",i),"number"==typeof n&&o(t,"transform","rotate("+(n%=360)+","+e+","+i+")")},c=function(t,r,e,i){if("circle"!==t.nodeName.toLowerCase())throw new Error("Need a <circle> !");o(t,"cx",r),o(t,"cy",e),o(t,"r",i)},l=function(t,r){if("path"!==t.nodeName.toLowerCase())throw new Error("Need a <path> !");o(t,"d",r)},p=function(t,r,e,i,n,s){if("path"!==t.nodeName.toLowerCase())throw new Error("Need a <path> !");var a=[];if(Array.isArray(r.rectRadius)&&r.rectRadius.length>0)for(var h=0;h<4;h++)a.push.apply(a,r.rectRadius);s<0&&(i-=s*=-1),n<0&&(e-=n*=-1);var _="";a.length>=4?(_="M"+(e+a[0])+" "+i,_+="L"+(e+n-a[1])+" "+i,_+="A"+a[1]+" "+a[1]+" 0 0 1 "+(e+n)+" "+(i+a[1]),_+="L"+(e+n)+" "+(i+s-a[2]),_+="A"+a[2]+" "+a[2]+" 0 0 1 "+(e+n-a[2])+" "+(i+s),_+="L"+(e+a[3])+" "+(i+s),_+="A"+a[3]+" "+a[3]+" 0 0 1 "+e+" "+(i+s-a[3]),_+="L"+e+" "+(i+a[0]),_+="A"+a[0]+" "+a[0]+" 0 0 1 "+(e+a[0])+" "+i):(_="M"+e+" "+i,_+="L"+(e+n)+" "+i,_+="L"+(e+n)+" "+(i+s),_+="L"+e+" "+(i+s),_+="Z"),o(t,"d",_)},d=function(t,r,e,i,n,s,a,h){if("path"!==t.nodeName.toLowerCase())throw new Error("Need a <path> !");if(a=a/180*Math.PI,h=h/180*Math.PI,a%=2*Math.PI,n>s){var u=n;n=s,s=u}h>=1.999999*Math.PI||h<=1.999999*-Math.PI?h=1.999999*Math.PI:h%=2*Math.PI,function(t,r,e,i,n,o,s){r<0&&(t+=r,r*=-1);var a,h=[];a=_(0,0,t,n,0),h[0]=a[0],h[1]=a[1],a=_(0,0,r,a[0],a[1]),h[2]=a[0],h[3]=a[1],a=_(0,0,t,o,0),h[4]=a[0],h[5]=a[1],a=_(0,0,r,a[0],a[1]),h[6]=a[0],h[7]=a[1],s(t,t+r,h[0]+e,h[1]+i,h[4]+e,h[5]+i,h[2]+e,h[3]+i,h[6]+e,h[7]+i,.5*(o-n))}(a,h,e,i,n,s,(function(e,i,a,h,_,u,f,c,l,p,d){var y=i-e>Math.PI?1:0,m="M"+a+" "+h;d<0&&(d=-d),m+="A"+n+" "+n+" 0 "+y+" 1 "+f+" "+c,"round"==r.arcEndCap?m+="A"+d+" "+d+" 0 1 0 "+l+" "+p:"-round"==r.arcEndCap?m+="A"+d+" "+d+" 0 1 1 "+l+" "+p:m+="L"+l+" "+p,m+="A"+s+" "+s+" 0 "+y+" 0 "+_+" "+u,"round"==r.arcStartCap?m+="A"+d+" "+d+" 0 1 0 "+a+" "+h:"-round"==r.arcStartCap?m+="A"+d+" "+d+" 0 1 1 "+a+" "+h:m+="L"+a+" "+h,"butt"==r.arcStartCap&&(m+="Z"),o(t,"d",m)}))};function y(t,r,e,i,n){var o=Math.cos(e),s=Math.sin(e);return[(i-t)*o-(n-r)*s+t,(i-t)*s+(n-r)*o+r]}var m=function(t,r){var e={value:function(){return"url(#"+r+")"},setColor:function(r,n){var s=i("stop");return t.appendChild(s),o(s,"offset",100*r+"%"),o(s,"style","stop-color:"+n+";"),e}};return e};var g=function(){function t(t){this.name="SVG",this.__config={fillStyle:"rgb(0,0,0)",strokeStyle:"rgb(0,0,0)",textAlign:"left",textBaseline:"middle",fontSize:16,fontFamily:"sans-serif",arcStartCap:"butt",arcEndCap:"butt",lineDash:[],lineWidth:1,lineCap:"butt",lineJoin:"miter",rectRadius:[]},this.__path="",this.__currentPosition=[],this.__transform_history=[],this.__transform_current="",this.__svg=t}return t.prototype.config=function(t){if("object"!=typeof t)return this.__config[t];for(var r in t)this.__config[r]=t[r];return this},t.prototype.reset=function(t){return void 0===t&&(t={}),this.config(function(t,r){for(var e in t)r[e]=t[e];return r}(t,{fillStyle:"rgb(0,0,0)",strokeStyle:"rgb(0,0,0)",textAlign:"left",textBaseline:"middle",fontSize:16,fontFamily:"sans-serif",arcStartCap:"butt",arcEndCap:"butt",lineDash:[],lineWidth:1,lineCap:"butt",lineJoin:"miter",rectRadius:[]})),this},t.prototype.useEl=function(t){return this.__useEl=t,this},t.prototype.getEl=function(){return this.__useEl},t.prototype.appendEl=function(t,r){return r=r||this.__svg,"string"==typeof t&&(t=i(t)),r.appendChild(t),this.__useEl=t,this},t.prototype.appendBoard=function(t,r){var e=t;if("string"==typeof t&&(e={text:"text",path:"path",arc:"path",circle:"circle",rect:"path"}[t]||""),""==e)throw new Error("Unsupported drawing method:"+t);return this.appendEl(e,r)},t.prototype.remove=function(){if(!this.__useEl)throw new Error("Currently, no node can be deleted.");return this.__useEl.parentNode.removeChild(this.__useEl),this},t.prototype.attr=function(t){if(!this.__useEl)throw new Error("Currently, no node can be modified or viewed.");if("object"!=typeof t)return function(t,e){return r.indexOf(e)>-1&&(e="xlink:"+e),t.getAttribute(e)}(this.__useEl,t);for(var e in t)o(this.__useEl,e,t[e]);return this},t.prototype.fillText=function(t,r,e,i){return void 0===i&&(i=0),f(this.__useEl,this.__config,r,e,i),this.attr({transform:this.__transform_current}),this.__useEl.textContent=t,a(this.__useEl,this.__config),this},t.prototype.strokeText=function(t,r,e,i){return void 0===i&&(i=0),f(this.__useEl,this.__config,r,e,i),this.attr({transform:this.__transform_current}),this.__useEl.textContent=t,h(this.__useEl,this.__config),this},t.prototype.fullText=function(t,r,e,i){return void 0===i&&(i=0),f(this.__useEl,this.__config,r,e,i),this.attr({transform:this.__transform_current}),this.__useEl.textContent=t,s(this.__useEl,this.__config),this},t.prototype.fillArc=function(t,r,e,i,n,o){return d(this.__useEl,this.__config,t,r,e,i,n,o),this.attr({transform:this.__transform_current}),a(this.__useEl,this.__config),this},t.prototype.strokeArc=function(t,r,e,i,n,o){return d(this.__useEl,this.__config,t,r,e,i,n,o),this.attr({transform:this.__transform_current}),h(this.__useEl,this.__config),this},t.prototype.fullArc=function(t,r,e,i,n,o){return d(this.__useEl,this.__config,t,r,e,i,n,o),this.attr({transform:this.__transform_current}),s(this.__useEl,this.__config),this},t.prototype.fillCircle=function(t,r,e){return c(this.__useEl,t,r,e),this.attr({transform:this.__transform_current}),a(this.__useEl,this.__config),this},t.prototype.strokeCircle=function(t,r,e){return c(this.__useEl,t,r,e),this.attr({transform:this.__transform_current}),h(this.__useEl,this.__config),this},t.prototype.fullCircle=function(t,r,e){return c(this.__useEl,t,r,e),this.attr({transform:this.__transform_current}),s(this.__useEl,this.__config),this},t.prototype.fillRect=function(t,r,e,i){return p(this.__useEl,this.__config,t,r,e,i),this.attr({transform:this.__transform_current}),a(this.__useEl,this.__config),this},t.prototype.strokeRect=function(t,r,e,i){return p(this.__useEl,this.__config,t,r,e,i),this.attr({transform:this.__transform_current}),h(this.__useEl,this.__config),this},t.prototype.fullRect=function(t,r,e,i){return p(this.__useEl,this.__config,t,r,e,i),this.attr({transform:this.__transform_current}),s(this.__useEl,this.__config),this},t.prototype.beginPath=function(){return this.__currentPosition=[],this.__path="",this},t.prototype.closePath=function(){return this.__path+="Z",this},t.prototype.moveTo=function(t,r){return this.__currentPosition=[t,r],this.__path+="M"+t+" "+r,this},t.prototype.lineTo=function(t,r){return this.__currentPosition=[t,r],this.__path+=(""==this.__path?"M":"L")+t+" "+r,this},t.prototype.fill=function(){return l(this.__useEl,this.__path),this.attr({transform:this.__transform_current}),a(this.__useEl,this.__config),this},t.prototype.stroke=function(){return l(this.__useEl,this.__path),this.attr({transform:this.__transform_current}),h(this.__useEl,this.__config),this},t.prototype.full=function(){return l(this.__useEl,this.__path),this.attr({transform:this.__transform_current}),s(this.__useEl,this.__config),this},t.prototype.save=function(){return this.__transform_history.push(this.__transform_current),this},t.prototype.restore=function(){return this.__transform_history.length>0&&(this.__transform_current=this.__transform_history.pop()),this},t.prototype.arc=function(t,r,e,i,n){var o=y(t,r,i/180*Math.PI,t+e,r),s=y(t,r,(i+n)/180*Math.PI,t+e,r);return""==this.__path?this.__path+="M"+o[0]+","+o[1]:o[0]==this.__currentPosition[0]&&o[1]==this.__currentPosition[1]||(this.__path+="L"+o[0]+","+o[1]),this.__path+="A"+e+","+e+" 0 "+(n>180||n<-180?1:0)+","+(n>0?1:0)+" "+s[0]+","+s[1],this},t.prototype.quadraticCurveTo=function(t,r,e,i){return this.__path+="Q"+t+" "+r+","+e+" "+i,this},t.prototype.bezierCurveTo=function(t,r,e,i,n,o){return this.__path+="C"+t+" "+r+","+e+" "+i+","+n+" "+o,this},t.prototype.bind=function(t,r){return this.__useEl.addEventListener(t,(function(t){r.call(this,t,this)}),!1),this},t.prototype.createLinearGradient=function(t,r,e,n){return function(t,r,e,n,s){var a=u(t),h="visliteLg"+(new Date).valueOf()+(1e6*Math.random()).toFixed(0),_=i("linearGradient");return a.appendChild(_),o(_,"id",h),o(_,"x1",r+"%"),o(_,"y1",e+"%"),o(_,"x2",n+"%"),o(_,"y2",s+"%"),m(_,h)}(this.__svg,t,r,e,n)},t.prototype.createRadialGradient=function(t,r,e){return function(t,r,e,n){var s=u(t),a="visliteRg"+(new Date).valueOf()+(1e6*Math.random()).toFixed(0),h=i("radialGradient");return s.appendChild(h),o(h,"id",a),o(h,"cx",r+"%"),o(h,"cy",e+"%"),o(h,"r",n+"%"),m(h,a)}(this.__svg,t,r,e)},t.prototype.translate=function(t,r){return this.__transform_current+=" translate("+t+","+r+")",this},t.prototype.rotate=function(t){return this.__transform_current+=" rotate("+t+")",this},t.prototype.install=function(t){var r=this,e=function(e){if(e in i)throw new Error("VISLite SVG:Method already exists and cannot be overwritten.");i[e]=function(){for(var i=[],n=0;n<arguments.length;n++)i[n]=arguments[n];var o=t[e].apply(r,i);return null!=o?o:r}},i=this;for(var n in t)e(n);return this},t}(),v=function(r){function e(t){var e=this;if(!t)throw new Error("VISLite SVG:The mount point requires an HTMLElement type but encountered null.");var i,n=t.clientWidth,o=t.clientHeight,s=t;return s._vislite_svg_?i=s._vislite_svg_[0]:(i=document.createElementNS("http://www.w3.org/2000/svg","svg"),t.appendChild(i),i.setAttribute("width",n+""),i.setAttribute("height",o+""),i.setAttribute("viewBox","0 0 "+n+" "+o),s._vislite_svg_=[i],t.setAttribute("vislite","SVG")),(e=r.call(this,i)||this).__el=t,e}return function(r,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function i(){this.constructor=r}t(r,e),r.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}(e,r),e.prototype.toDataURL=function(){var t=this;return new Promise((function(r){var e=t.__el.clientWidth,i=t.__el.clientHeight,n=document.createElement("img");n.setAttribute("width",e+""),n.setAttribute("height",i+"");var o="data:image/svg+xml;charset=utf-8,<svg xmlns='http://www.w3.org/2000/svg' width='"+e+"' height='"+i+"'>"+t.__svg.innerHTML.replace(/"/g,"'")+"</svg>";n.setAttribute("src",o),setTimeout((function(){var t=document.createElement("canvas");t.setAttribute("width",e+""),t.setAttribute("height",i+"");var o=t.getContext("2d");o&&o.drawImage(n,0,0,e,i),r(t.toDataURL())}),100)}))},e}(g);export{v as default};
@@ -1,7 +1,3 @@
1
- /*!
2
- * Shader of VISLite JavaScript Library v1.9.0
3
- * git+https://github.com/oi-contrib/VISLite.git
4
- */
5
1
  var loadShader = function (painter, type, source) {
6
2
  var shader = painter.createShader(type);
7
3
  if (shader == null)
@@ -1,5 +1 @@
1
- /*!
2
- * Shader of VISLite JavaScript Library v1.9.0
3
- * git+https://github.com/oi-contrib/VISLite.git
4
- */
5
1
  var r=function(r,e,t){var a=r.createShader(e);if(null==a)throw new Error("Unable to create shader!");if(r.shaderSource(a,t),r.compileShader(a),!r.getShaderParameter(a,r.COMPILE_STATUS))throw new Error("Failed to compile shader:"+r.getShaderInfoLog(a));return a},e=function(){function e(r){this.__painter=r}return e.prototype.use=function(){return this.__painter.useProgram(this.program),this},e.prototype.compile=function(e,t){return this.program=function(e,t,a){var o=r(e,e.VERTEX_SHADER,t),n=r(e,e.FRAGMENT_SHADER,a),i=e.createProgram();if(e.attachShader(i,o),e.attachShader(i,n),e.linkProgram(i),!e.getProgramParameter(i,e.LINK_STATUS))throw new Error("Failed to link program: "+e.getProgramInfoLog(i));return i}(this.__painter,e,t),this},e}();export{e as default};
@@ -1,7 +1,3 @@
1
- /*!
2
- * Texture of VISLite JavaScript Library v1.9.0
3
- * git+https://github.com/oi-contrib/VISLite.git
4
- */
5
1
  var initTexture = function (painter, type, unit) {
6
2
  var texture = painter.createTexture();
7
3
  painter.activeTexture(painter['TEXTURE' + unit]);
@@ -1,5 +1 @@
1
- /*!
2
- * Texture of VISLite JavaScript Library v1.9.0
3
- * git+https://github.com/oi-contrib/VISLite.git
4
- */
5
1
  var _=function(){function _(_,t,e){void 0===e&&(e=0),this.__painter=_,this.__type={"2d":_.TEXTURE_2D,cube:_.TEXTURE_CUBE_MAP}[t],this.__texture=function(_,t,e){var E=_.createTexture();return _.activeTexture(_["TEXTURE"+e]),_.bindTexture(t,E),E}(_,this.__type,e),_.texParameteri(this.__type,_.TEXTURE_MIN_FILTER,_.NEAREST),_.texParameteri(this.__type,_.TEXTURE_MAG_FILTER,_.NEAREST),_.texParameteri(this.__type,_.TEXTURE_WRAP_S,_.CLAMP_TO_EDGE),_.texParameteri(this.__type,_.TEXTURE_WRAP_T,_.CLAMP_TO_EDGE)}return _.prototype.useImage=function(_){return function(_,t,e,E,T,i){_.texImage2D(t,e,E,E,T,i)}(this.__painter,this.__type,0,this.__painter.RGBA,this.__painter.UNSIGNED_BYTE,_),this},_.prototype.useCube=function(_,t,e){return function(_,t,e,E,T,i,r,n,a){for(var u,p=[_.TEXTURE_CUBE_MAP_POSITIVE_X,_.TEXTURE_CUBE_MAP_NEGATIVE_X,_.TEXTURE_CUBE_MAP_POSITIVE_Y,_.TEXTURE_CUBE_MAP_NEGATIVE_Y,_.TEXTURE_CUBE_MAP_POSITIVE_Z,_.TEXTURE_CUBE_MAP_NEGATIVE_Z],s=0;s<p.length;s++)i[s]&&(u=p[s],_.texImage2D(u,e,E,r,n,0,E,T,null),_.bindTexture(t,a),_.texImage2D(u,e,E,E,T,i[s]));_.generateMipmap(t)}(this.__painter,this.__type,0,this.__painter.RGBA,this.__painter.UNSIGNED_BYTE,_,t,e,this.__texture),this},_}();export{_ as default};
@@ -1,7 +1,3 @@
1
- /*!
2
- * TreeLayout of VISLite JavaScript Library v1.9.0
3
- * git+https://github.com/oi-contrib/VISLite.git
4
- */
5
1
  /******************************************************************************
6
2
  Copyright (c) Microsoft Corporation.
7
3
 
@@ -187,17 +183,12 @@ var Tree = (function () {
187
183
  return Tree;
188
184
  }());
189
185
 
190
- /*!
191
- * animation of OIPage v1.8.0
192
- * git+https://github.com/oi-contrib/OIPage.git
193
- */
194
-
195
186
  //当前正在运动的动画的tick函数堆栈
196
- var $timers = [];
187
+ let $timers = [];
197
188
  //唯一定时器的定时间隔
198
- var $interval = 13;
189
+ let $interval = 13;
199
190
  //定时器ID
200
- var $timerId;
191
+ let $timerId;
201
192
 
202
193
  /**
203
194
  * 动画轮播
@@ -211,13 +202,13 @@ function animation(doback, duration, callback) {
211
202
  if (arguments.length < 2) duration = 400;
212
203
  if (arguments.length < 3) callback = function () { };
213
204
 
214
- var clock = {
205
+ let clock = {
215
206
  //把tick函数推入堆栈
216
207
  "timer": function (tick, duration, callback) {
217
208
  if (!tick) {
218
209
  throw new Error('Tick is required!');
219
210
  }
220
- var id = new Date().valueOf() + "_" + (Math.random() * 1000).toFixed(0);
211
+ let id = new Date().valueOf() + "_" + (Math.random() * 1000).toFixed(0);
221
212
  $timers.push({
222
213
  "id": id,
223
214
  "createTime": new Date(),
@@ -249,7 +240,7 @@ function animation(doback, duration, callback) {
249
240
 
250
241
  //被定时器调用,遍历timers堆栈
251
242
  "tick": function () {
252
- var createTime, flag, tick, callback, timer, duration, passTime, timers = $timers;
243
+ let createTime, flag, tick, callback, timer, duration, passTime, timers = $timers;
253
244
 
254
245
  $timers = [];
255
246
  $timers.length = 0;
@@ -292,7 +283,7 @@ function animation(doback, duration, callback) {
292
283
  }
293
284
  };
294
285
 
295
- var id = clock.timer(function (deep) {
286
+ let id = clock.timer(function (deep) {
296
287
  //其中deep为0-1,表示改变的程度
297
288
  doback(deep);
298
289
  }, duration, callback);
@@ -301,7 +292,7 @@ function animation(doback, duration, callback) {
301
292
  // 一个函数
302
293
  // 用于在动画结束前结束动画
303
294
  stop: function () {
304
- var i;
295
+ let i;
305
296
  for (i in $timers) {
306
297
  if ($timers[i].id == id) {
307
298
  $timers[i].id = void 0;
@@ -1,9 +1 @@
1
- /*!
2
- * TreeLayout of VISLite JavaScript Library v1.9.0
3
- * git+https://github.com/oi-contrib/VISLite.git
4
- */
5
- var t=function(e,o){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o])},t(e,o)};"function"==typeof SuppressedError&&SuppressedError;function e(t,e){for(var o in t)e[o]=t[o];return e}var o,n=function(){function t(t){void 0===t&&(t={}),this.name="Tree",this.__config=e(t,{root:function(t){return t},children:function(t){return t.children},id:function(t){return t.name}})}return t.prototype.use=function(t,e){return void 0===e&&(e={}),function(t,e,o){void 0===o&&(o={});var n=function(t,e){var o,n,i={},r=e.root(t);o=n=e.id(r),i[o]={data:r,pid:null,id:o,isOpen:!0,show:!0,deg:0,children:[]};var p=1;return function n(r,s){var h=e.children(r,t);p+=h?h.length:0;for(var d=0;h&&d<h.length;d++)o=e.id(h[d]),i[s].children.push(o),i[o]={data:h[d],pid:s,id:o,isOpen:!0,show:!0,deg:0,children:[]},n(h[d],o)}(r,o),{rid:n,value:i,num:p}}(t,e),i=n.value,r=n.rid;if(1==n.num)return i[r].left=.5,i[r].top=.5,i[r].show=!0,{deep:1,node:i,root:r,size:1};var p=[],s=0,h=0;for(var d in o[r]?(i[r].left=.5,i[r].top=.5,i[r].show=!0,s=1):function t(e,n){n>h&&(h=n);var r=0;if(!o[e.id])for(r=0;r<e.children.length;r++)t(i[e.children[r]],n+1);if(i[e.id].left=n+.5,0==r?(null==p[n]&&(p[n]=-.5),null==p[n-1]&&(p[n-1]=-.5),i[e.id].top=p[n]+1,p[n]+1+.5*(i[e.pid].children.length-1)-1<p[n-1]&&(i[e.id].top=p[n-1]+1-.5*(i[e.pid].children.length-1))):i[e.id].top=.5*(i[e.children[0]].top+i[e.children[r-1]].top),i[e.id].top<=p[n])var d=p[n]+1-i[e.id].top((function t(e,o){i[e].top+=d,p[o]<i[e].top&&(p[o]=i[e].top);for(var n=0;n<i[e].children.length;n++)t(i[e].children[n],o+1)}))(e.id,n);p[n]=i[e.id].top,i[e.id].top+.5>s&&(s=i[e.id].top+.5)}(i[r],0),o)o[d]&&(i[d].isOpen=!1,function t(e,o,n){for(var r=0;r<i[e].children.length;r++)i[i[e].children[r]].left=o,i[i[e].children[r]].top=n,i[i[e].children[r]].show=!1,t(i[e].children[r],o,n)}(d,i[d].left,i[d].top));return{node:i,root:r,size:s,deep:h+1}}(t,this.__config,e)},t}(),i=[];
6
- /*!
7
- * animation of OIPage v1.8.0
8
- * git+https://github.com/oi-contrib/OIPage.git
9
- */function r(t,e,o,n,i){var r=Math.cos(o),p=Math.sin(o);return[(n-t)*r-(i-e)*p+t,(n-t)*p+(i-e)*r+e]}var p=function(n){function p(){var t=null!==n&&n.apply(this,arguments)||this;return t.name="TreeLayout",t.__option={offsetX:0,offsetY:0,duration:500,type:"plain",direction:"LR",x:100,y:100,width:100,height:100,radius:100},t.__noOpens={},t}return function(e,o){if("function"!=typeof o&&null!==o)throw new TypeError("Class extends value "+String(o)+" is not a constructor or null");function n(){this.constructor=e}t(e,o),e.prototype=null===o?Object.create(o):(n.prototype=o.prototype,new n)}(p,n),p.prototype.setOption=function(t){return e(t,this.__option),this},p.prototype.use=function(t,e){void 0===e&&(e={});var o=n.prototype.use.call(this,t,e);if(0!=this.__option.offsetX||0!=this.__option.offsetY)for(var i in o.node)if(!o.node[i].show){var p=0,s=i;do{s=o.node[s].pid,p++}while(!o.node[s].show);o.node[i].left+=this.__option.offsetX*p,o.node[i].top+=this.__option.offsetY*p}if("rect"==this.__option.type){if("LR"==this.__option.direction||"RL"==this.__option.direction){var h=this.__option.height/o.size,d=this.__option.width/(o.deep-1),_=this.__option.y-.5*this.__option.height,l="LR"==this.__option.direction?1:-1;for(var i in o.node)1==o.deep?(o.node[i].left=this.__option.x+.5*this.__option.width*l,o.node[i].top=this.__option.y):(o.node[i].left=this.__option.x+(o.node[i].left-.5)*d*l,o.node[i].top=o.node[i].top*h+_)}else if("TB"==this.__option.direction||"BT"==this.__option.direction){h=this.__option.width/o.size,d=this.__option.height/(o.deep-1),_=this.__option.x-.5*this.__option.width,l="TB"==this.__option.direction?1:-1;for(var i in o.node)if(o.node[i].deg="TB"==this.__option.direction?.5*Math.PI:-.5*Math.PI,1==o.deep)o.node[i].left=this.__option.x,o.node[i].top=this.__option.y+.5*this.__option.height*l;else{var a=o.node[i].left;o.node[i].left=o.node[i].top*h+_,o.node[i].top=this.__option.y+(a-.5)*d*l}}}else if("circle"==this.__option.type){var f=this.__option.x,c=this.__option.y,u=2*Math.PI/o.size,v=this.__option.radius/(o.deep-1);for(var i in o.node)if(.5==o.node[i].left)o.node[i].left=f,o.node[i].top=c;else{var T=r(f,c,u*o.node[i].top,f+(o.node[i].left-.5)*v,c);o.node[i].deg=u*o.node[i].top,o.node[i].left=T[0],o.node[i].top=T[1]}}return o},p.prototype.bind=function(t,e,o){return void 0===o&&(o={}),this.__rback=e,this.__oralTree=t,this.__noOpens=o,this.__preTree=this.use(this.__oralTree,this.__noOpens),this.__rback(this.__preTree),this},p.prototype.unbind=function(){return this.__rback=function(){return null},this.__oralTree=null,this.__preTree=null,this.__noOpens={},this},p.prototype.doUpdate=function(){var t=this,e=this.use(this.__oralTree,this.__noOpens),n=JSON.parse(JSON.stringify(e));return function(t,e,n){arguments.length<2&&(e=400),arguments.length<3&&(n=function(){});var r={timer:function(t,e,o){if(!t)throw new Error("Tick is required!");var n=(new Date).valueOf()+"_"+(1e3*Math.random()).toFixed(0);return i.push({id:n,createTime:new Date,tick:t,duration:e,callback:o}),r.start(),n},start:function(){if(!o)try{o=globalThis&&globalThis.requestAnimationFrame?globalThis.requestAnimationFrame((function t(){r.tick(),o&&(o=globalThis.requestAnimationFrame(t))})):setInterval(r.tick,13)}catch(t){o=setInterval(r.tick,13)}},tick:function(){var t,e,o,n,p,s,h,d=i;for((i=[]).length=0,e=0;e<d.length;e++)t=(p=d[e]).createTime,o=p.tick,s=p.duration,n=p.callback,o(h=(h=(+(new Date).valueOf()-t.valueOf())/s)>1?1:h),h<1&&p.id?i.push(p):n(h);i.length<=0&&r.stop()},stop:function(){if(o){try{globalThis&&globalThis.requestAnimationFrame?globalThis.cancelAnimationFrame(o):clearInterval(o)}catch(t){clearInterval(o)}o=null}}},p=r.timer((function(e){t(e)}),e,n)}((function(o){if(t.__preTree)for(var i in n.node)(e.node[i].show||t.__preTree.node[i].show)&&(n.node[i].show=!0,n.node[i].left=t.__preTree.node[i].left+(e.node[i].left-t.__preTree.node[i].left)*o,n.node[i].top=t.__preTree.node[i].top+(e.node[i].top-t.__preTree.node[i].top)*o);t.__rback(n)}),this.__option.duration,(function(){t.__preTree=e,t.__rback(t.__preTree)})),this},p.prototype.closeNode=function(t){return this.__preTree?(this.__noOpens[t]=!0,this.doUpdate(),this):this},p.prototype.openNode=function(t){return this.__preTree?(this.__noOpens[t]=!1,this.doUpdate(),this):this},p.prototype.toggleNode=function(t){return this.__preTree?(this.__noOpens[t]=!this.__noOpens[t],this.doUpdate(),this):this},p}(n);export{p as default};
1
+ var t=function(e,o){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o])},t(e,o)};"function"==typeof SuppressedError&&SuppressedError;function e(t,e){for(var o in t)e[o]=t[o];return e}var o=function(){function t(t){void 0===t&&(t={}),this.name="Tree",this.__config=e(t,{root:function(t){return t},children:function(t){return t.children},id:function(t){return t.name}})}return t.prototype.use=function(t,e){return void 0===e&&(e={}),function(t,e,o){void 0===o&&(o={});var n=function(t,e){var o,n,i={},r=e.root(t);o=n=e.id(r),i[o]={data:r,pid:null,id:o,isOpen:!0,show:!0,deg:0,children:[]};var p=1;return function n(r,s){var h=e.children(r,t);p+=h?h.length:0;for(var d=0;h&&d<h.length;d++)o=e.id(h[d]),i[s].children.push(o),i[o]={data:h[d],pid:s,id:o,isOpen:!0,show:!0,deg:0,children:[]},n(h[d],o)}(r,o),{rid:n,value:i,num:p}}(t,e),i=n.value,r=n.rid;if(1==n.num)return i[r].left=.5,i[r].top=.5,i[r].show=!0,{deep:1,node:i,root:r,size:1};var p=[],s=0,h=0;for(var d in o[r]?(i[r].left=.5,i[r].top=.5,i[r].show=!0,s=1):function t(e,n){n>h&&(h=n);var r=0;if(!o[e.id])for(r=0;r<e.children.length;r++)t(i[e.children[r]],n+1);if(i[e.id].left=n+.5,0==r?(null==p[n]&&(p[n]=-.5),null==p[n-1]&&(p[n-1]=-.5),i[e.id].top=p[n]+1,p[n]+1+.5*(i[e.pid].children.length-1)-1<p[n-1]&&(i[e.id].top=p[n-1]+1-.5*(i[e.pid].children.length-1))):i[e.id].top=.5*(i[e.children[0]].top+i[e.children[r-1]].top),i[e.id].top<=p[n])var d=p[n]+1-i[e.id].top((function t(e,o){i[e].top+=d,p[o]<i[e].top&&(p[o]=i[e].top);for(var n=0;n<i[e].children.length;n++)t(i[e].children[n],o+1)}))(e.id,n);p[n]=i[e.id].top,i[e.id].top+.5>s&&(s=i[e.id].top+.5)}(i[r],0),o)o[d]&&(i[d].isOpen=!1,function t(e,o,n){for(var r=0;r<i[e].children.length;r++)i[i[e].children[r]].left=o,i[i[e].children[r]].top=n,i[i[e].children[r]].show=!1,t(i[e].children[r],o,n)}(d,i[d].left,i[d].top));return{node:i,root:r,size:s,deep:h+1}}(t,this.__config,e)},t}();let n,i=[];function r(t,e,o,n,i){var r=Math.cos(o),p=Math.sin(o);return[(n-t)*r-(i-e)*p+t,(n-t)*p+(i-e)*r+e]}var p=function(o){function p(){var t=null!==o&&o.apply(this,arguments)||this;return t.name="TreeLayout",t.__option={offsetX:0,offsetY:0,duration:500,type:"plain",direction:"LR",x:100,y:100,width:100,height:100,radius:100},t.__noOpens={},t}return function(e,o){if("function"!=typeof o&&null!==o)throw new TypeError("Class extends value "+String(o)+" is not a constructor or null");function n(){this.constructor=e}t(e,o),e.prototype=null===o?Object.create(o):(n.prototype=o.prototype,new n)}(p,o),p.prototype.setOption=function(t){return e(t,this.__option),this},p.prototype.use=function(t,e){void 0===e&&(e={});var n=o.prototype.use.call(this,t,e);if(0!=this.__option.offsetX||0!=this.__option.offsetY)for(var i in n.node)if(!n.node[i].show){var p=0,s=i;do{s=n.node[s].pid,p++}while(!n.node[s].show);n.node[i].left+=this.__option.offsetX*p,n.node[i].top+=this.__option.offsetY*p}if("rect"==this.__option.type){if("LR"==this.__option.direction||"RL"==this.__option.direction){var h=this.__option.height/n.size,d=this.__option.width/(n.deep-1),_=this.__option.y-.5*this.__option.height,l="LR"==this.__option.direction?1:-1;for(var i in n.node)1==n.deep?(n.node[i].left=this.__option.x+.5*this.__option.width*l,n.node[i].top=this.__option.y):(n.node[i].left=this.__option.x+(n.node[i].left-.5)*d*l,n.node[i].top=n.node[i].top*h+_)}else if("TB"==this.__option.direction||"BT"==this.__option.direction){h=this.__option.width/n.size,d=this.__option.height/(n.deep-1),_=this.__option.x-.5*this.__option.width,l="TB"==this.__option.direction?1:-1;for(var i in n.node)if(n.node[i].deg="TB"==this.__option.direction?.5*Math.PI:-.5*Math.PI,1==n.deep)n.node[i].left=this.__option.x,n.node[i].top=this.__option.y+.5*this.__option.height*l;else{var a=n.node[i].left;n.node[i].left=n.node[i].top*h+_,n.node[i].top=this.__option.y+(a-.5)*d*l}}}else if("circle"==this.__option.type){var f=this.__option.x,c=this.__option.y,u=2*Math.PI/n.size,v=this.__option.radius/(n.deep-1);for(var i in n.node)if(.5==n.node[i].left)n.node[i].left=f,n.node[i].top=c;else{var T=r(f,c,u*n.node[i].top,f+(n.node[i].left-.5)*v,c);n.node[i].deg=u*n.node[i].top,n.node[i].left=T[0],n.node[i].top=T[1]}}return n},p.prototype.bind=function(t,e,o){return void 0===o&&(o={}),this.__rback=e,this.__oralTree=t,this.__noOpens=o,this.__preTree=this.use(this.__oralTree,this.__noOpens),this.__rback(this.__preTree),this},p.prototype.unbind=function(){return this.__rback=function(){return null},this.__oralTree=null,this.__preTree=null,this.__noOpens={},this},p.prototype.doUpdate=function(){var t=this,e=this.use(this.__oralTree,this.__noOpens),o=JSON.parse(JSON.stringify(e));return function(t,e,o){arguments.length<2&&(e=400),arguments.length<3&&(o=function(){});let r={timer:function(t,e,o){if(!t)throw new Error("Tick is required!");let n=(new Date).valueOf()+"_"+(1e3*Math.random()).toFixed(0);return i.push({id:n,createTime:new Date,tick:t,duration:e,callback:o}),r.start(),n},start:function(){if(!n)try{n=globalThis&&globalThis.requestAnimationFrame?globalThis.requestAnimationFrame((function t(){r.tick(),n&&(n=globalThis.requestAnimationFrame(t))})):setInterval(r.tick,13)}catch(t){n=setInterval(r.tick,13)}},tick:function(){let t,e,o,n,p,s,h,d=i;for(i=[],i.length=0,e=0;e<d.length;e++)p=d[e],t=p.createTime,o=p.tick,s=p.duration,n=p.callback,h=(+(new Date).valueOf()-t.valueOf())/s,h=h>1?1:h,o(h),h<1&&p.id?i.push(p):n(h);i.length<=0&&r.stop()},stop:function(){if(n){try{globalThis&&globalThis.requestAnimationFrame?globalThis.cancelAnimationFrame(n):clearInterval(n)}catch(t){clearInterval(n)}n=null}}},p=r.timer((function(e){t(e)}),e,o)}((function(n){if(t.__preTree)for(var i in o.node)(e.node[i].show||t.__preTree.node[i].show)&&(o.node[i].show=!0,o.node[i].left=t.__preTree.node[i].left+(e.node[i].left-t.__preTree.node[i].left)*n,o.node[i].top=t.__preTree.node[i].top+(e.node[i].top-t.__preTree.node[i].top)*n);t.__rback(o)}),this.__option.duration,(function(){t.__preTree=e,t.__rback(t.__preTree)})),this},p.prototype.closeNode=function(t){return this.__preTree?(this.__noOpens[t]=!0,this.doUpdate(),this):this},p.prototype.openNode=function(t){return this.__preTree?(this.__noOpens[t]=!1,this.doUpdate(),this):this},p.prototype.toggleNode=function(t){return this.__preTree?(this.__noOpens[t]=!this.__noOpens[t],this.doUpdate(),this):this},p}(o);export{p as default};
@@ -1,18 +1,9 @@
1
- /*!
2
- * animation of VISLite JavaScript Library v1.9.0
3
- * git+https://github.com/oi-contrib/VISLite.git
4
- */
5
- /*!
6
- * animation of OIPage v1.8.0
7
- * git+https://github.com/oi-contrib/OIPage.git
8
- */
9
-
10
1
  //当前正在运动的动画的tick函数堆栈
11
- var $timers = [];
2
+ let $timers = [];
12
3
  //唯一定时器的定时间隔
13
- var $interval = 13;
4
+ let $interval = 13;
14
5
  //定时器ID
15
- var $timerId;
6
+ let $timerId;
16
7
 
17
8
  /**
18
9
  * 动画轮播
@@ -26,13 +17,13 @@ function animation(doback, duration, callback) {
26
17
  if (arguments.length < 2) duration = 400;
27
18
  if (arguments.length < 3) callback = function () { };
28
19
 
29
- var clock = {
20
+ let clock = {
30
21
  //把tick函数推入堆栈
31
22
  "timer": function (tick, duration, callback) {
32
23
  if (!tick) {
33
24
  throw new Error('Tick is required!');
34
25
  }
35
- var id = new Date().valueOf() + "_" + (Math.random() * 1000).toFixed(0);
26
+ let id = new Date().valueOf() + "_" + (Math.random() * 1000).toFixed(0);
36
27
  $timers.push({
37
28
  "id": id,
38
29
  "createTime": new Date(),
@@ -64,7 +55,7 @@ function animation(doback, duration, callback) {
64
55
 
65
56
  //被定时器调用,遍历timers堆栈
66
57
  "tick": function () {
67
- var createTime, flag, tick, callback, timer, duration, passTime, timers = $timers;
58
+ let createTime, flag, tick, callback, timer, duration, passTime, timers = $timers;
68
59
 
69
60
  $timers = [];
70
61
  $timers.length = 0;
@@ -107,7 +98,7 @@ function animation(doback, duration, callback) {
107
98
  }
108
99
  };
109
100
 
110
- var id = clock.timer(function (deep) {
101
+ let id = clock.timer(function (deep) {
111
102
  //其中deep为0-1,表示改变的程度
112
103
  doback(deep);
113
104
  }, duration, callback);
@@ -116,7 +107,7 @@ function animation(doback, duration, callback) {
116
107
  // 一个函数
117
108
  // 用于在动画结束前结束动画
118
109
  stop: function () {
119
- var i;
110
+ let i;
120
111
  for (i in $timers) {
121
112
  if ($timers[i].id == id) {
122
113
  $timers[i].id = void 0;
@@ -1,9 +1 @@
1
- /*!
2
- * animation of VISLite JavaScript Library v1.9.0
3
- * git+https://github.com/oi-contrib/VISLite.git
4
- */
5
- /*!
6
- * animation of OIPage v1.8.0
7
- * git+https://github.com/oi-contrib/OIPage.git
8
- */
9
- var t,e=[],i=13;function n(n,a,r){return function(n,a,r){arguments.length<2&&(a=400),arguments.length<3&&(r=function(){});var o={timer:function(t,i,n){if(!t)throw new Error("Tick is required!");var a=(new Date).valueOf()+"_"+(1e3*Math.random()).toFixed(0);return e.push({id:a,createTime:new Date,tick:t,duration:i,callback:n}),o.start(),a},start:function(){if(!t)try{t=globalThis&&globalThis.requestAnimationFrame?globalThis.requestAnimationFrame((function e(){o.tick(),t&&(t=globalThis.requestAnimationFrame(e))})):setInterval(o.tick,i)}catch(e){t=setInterval(o.tick,i)}},tick:function(){var t,i,n,a,r,l,c,u=e;for((e=[]).length=0,i=0;i<u.length;i++)t=(r=u[i]).createTime,n=r.tick,l=r.duration,a=r.callback,n(c=(c=(+(new Date).valueOf()-t.valueOf())/l)>1?1:c),c<1&&r.id?e.push(r):a(c);e.length<=0&&o.stop()},stop:function(){if(t){try{globalThis&&globalThis.requestAnimationFrame?globalThis.cancelAnimationFrame(t):clearInterval(t)}catch(e){clearInterval(t)}t=null}}},l=o.timer((function(t){n(t)}),a,r);return{stop:function(){var t;for(t in e)if(e[t].id==l)return void(e[t].id=void 0)}}}(n,a||400,r||function(){}).stop}export{n as default};
1
+ let t,e=[],i=13;function n(n,a,r){return function(n,a,r){arguments.length<2&&(a=400),arguments.length<3&&(r=function(){});let l={timer:function(t,i,n){if(!t)throw new Error("Tick is required!");let a=(new Date).valueOf()+"_"+(1e3*Math.random()).toFixed(0);return e.push({id:a,createTime:new Date,tick:t,duration:i,callback:n}),l.start(),a},start:function(){if(!t)try{t=globalThis&&globalThis.requestAnimationFrame?globalThis.requestAnimationFrame((function e(){l.tick(),t&&(t=globalThis.requestAnimationFrame(e))})):setInterval(l.tick,i)}catch(e){t=setInterval(l.tick,i)}},tick:function(){let t,i,n,a,r,o,c,u=e;for(e=[],e.length=0,i=0;i<u.length;i++)r=u[i],t=r.createTime,n=r.tick,o=r.duration,a=r.callback,c=(+(new Date).valueOf()-t.valueOf())/o,c=c>1?1:c,n(c),c<1&&r.id?e.push(r):a(c);e.length<=0&&l.stop()},stop:function(){if(t){try{globalThis&&globalThis.requestAnimationFrame?globalThis.cancelAnimationFrame(t):clearInterval(t)}catch(e){clearInterval(t)}t=null}}},o=l.timer((function(t){n(t)}),a,r);return{stop:function(){let t;for(t in e)if(e[t].id==o)return void(e[t].id=void 0)}}}(n,a||400,r||function(){}).stop}export{n as default};
@@ -1,7 +1,3 @@
1
- /*!
2
- * assemble of VISLite JavaScript Library v1.9.0
3
- * git+https://github.com/oi-contrib/VISLite.git
4
- */
5
1
  function assemble (begin, end, step, count) {
6
2
  var val = [];
7
3
  for (var index = 0; index < count; index++)
@@ -1,5 +1 @@
1
- /*!
2
- * assemble of VISLite JavaScript Library v1.9.0
3
- * git+https://github.com/oi-contrib/VISLite.git
4
- */
5
1
  function r(r,t,e,f){for(var n=[],o=0;o<f;o++)n[o]=r;return function(){for(var o=0;o<f;o++){if(n[o]+e<t){n[o]=+(n[o]+e).toFixed(7);break}o<f-1&&(n[o]=r)}return n}}export{r as default};
@@ -1,7 +1,3 @@
1
- /*!
2
- * getLoopColors of VISLite JavaScript Library v1.9.0
3
- * git+https://github.com/oi-contrib/VISLite.git
4
- */
5
1
  function getLoopColors (num, alpha, colorsFactory) {
6
2
  if (alpha === void 0) { alpha = 1; }
7
3
  var colorList = colorsFactory ? colorsFactory(alpha) : [
@@ -1,5 +1 @@
1
- /*!
2
- * getLoopColors of VISLite JavaScript Library v1.9.0
3
- * git+https://github.com/oi-contrib/VISLite.git
4
- */
5
1
  function r(r,a,g){void 0===a&&(a=1);var t=g?g(a):["rgba(84,112,198,"+a+")","rgba(145,204,117,"+a+")","rgba(250,200,88,"+a+")","rgba(238,102,102,"+a+")","rgba(115,192,222,"+a+")","rgba(59,162,114,"+a+")","rgba(252,132,82,"+a+")","rgba(154,96,180,"+a+")","rgba(234,124,204,"+a+")"],e=[];if(r<=t.length)return t;if(r%t.length==0)for(var n=0;n<r/t.length;n++)e=e.concat(t);else{for(var o=1;o<r/t.length;o++)e=e.concat(t);if(r%t.length==1)e=e.concat(t[4]);else for(var b=0;b<r%t.length;b++)e=e.concat(t[b])}return e}export{r as default};
@@ -1,7 +1,3 @@
1
- /*!
2
- * getWebGLContext of VISLite JavaScript Library v1.9.0
3
- * git+https://github.com/oi-contrib/VISLite.git
4
- */
5
1
  function getWebGLContext (canvas, scale, opts, mode) {
6
2
  if (opts === void 0) { opts = {}; }
7
3
  if (mode === void 0) { mode = "scaleToFill"; }
@@ -1,5 +1 @@
1
- /*!
2
- * getWebGLContext of VISLite JavaScript Library v1.9.0
3
- * git+https://github.com/oi-contrib/VISLite.git
4
- */
5
1
  var e=function(e,t,i){if(void 0===t&&(t=1),!e)throw new Error("VISLite getWebGLContext:The mount point requires an HTMLElement type but encountered null.");var n,r=e.clientWidth,a=e.clientHeight,o=e;return o._vislite_canvas_?n=o._vislite_canvas_:(n=document.createElement("canvas"),e.appendChild(n),o._vislite_canvas_=n,e.setAttribute("vislite","WebGL")),n.style.width=r+"px",n.setAttribute("width",r+""),n.style.height=a+"px",n.setAttribute("height",a+""),function(e,t,i,n){void 0===i&&(i={}),void 0===n&&(n="scaleToFill");for(var r=["experimental-webgl","webkit-3d","moz-webgl"],a=e.getContext("webgl",i),o=0;o<r.length;o++){try{a=e.getContext(r[o],i)}catch(e){}if(a)break}if(!a)throw new Error("Non canvas or browser does not support webgl.");var l=a.canvas.width,s=a.canvas.height,c=t,v=t;"aspectFit"==n?l>s?c*=s/l:s>l&&(v*=l/s):"aspectFill"==n&&(l>s?v*=l/s:s>l&&(c*=s/l));var h=l*c,u=s*v;return a.viewport(.5*(l-h),.5*(s-u),h,u),a.depthFunc(a.LEQUAL),a.enable(a.DEPTH_TEST),a}(n,t,{},i)};export{e as default};
package/lib/index.umd.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * VISLite JavaScript Library v1.9.0
2
+ * VISLite JavaScript Library v1.10.0
3
3
  * git+https://github.com/oi-contrib/VISLite.git
4
4
  */
5
5
  (function (global, factory) {
@@ -293,17 +293,12 @@
293
293
  return colors;
294
294
  }
295
295
 
296
- /*!
297
- * animation of OIPage v1.8.0
298
- * git+https://github.com/oi-contrib/OIPage.git
299
- */
300
-
301
296
  //当前正在运动的动画的tick函数堆栈
302
- var $timers = [];
297
+ let $timers = [];
303
298
  //唯一定时器的定时间隔
304
- var $interval = 13;
299
+ let $interval = 13;
305
300
  //定时器ID
306
- var $timerId;
301
+ let $timerId;
307
302
 
308
303
  /**
309
304
  * 动画轮播
@@ -317,13 +312,13 @@
317
312
  if (arguments.length < 2) duration = 400;
318
313
  if (arguments.length < 3) callback = function () { };
319
314
 
320
- var clock = {
315
+ let clock = {
321
316
  //把tick函数推入堆栈
322
317
  "timer": function (tick, duration, callback) {
323
318
  if (!tick) {
324
319
  throw new Error('Tick is required!');
325
320
  }
326
- var id = new Date().valueOf() + "_" + (Math.random() * 1000).toFixed(0);
321
+ let id = new Date().valueOf() + "_" + (Math.random() * 1000).toFixed(0);
327
322
  $timers.push({
328
323
  "id": id,
329
324
  "createTime": new Date(),
@@ -355,7 +350,7 @@
355
350
 
356
351
  //被定时器调用,遍历timers堆栈
357
352
  "tick": function () {
358
- var createTime, flag, tick, callback, timer, duration, passTime, timers = $timers;
353
+ let createTime, flag, tick, callback, timer, duration, passTime, timers = $timers;
359
354
 
360
355
  $timers = [];
361
356
  $timers.length = 0;
@@ -398,7 +393,7 @@
398
393
  }
399
394
  };
400
395
 
401
- var id = clock.timer(function (deep) {
396
+ let id = clock.timer(function (deep) {
402
397
  //其中deep为0-1,表示改变的程度
403
398
  doback(deep);
404
399
  }, duration, callback);
@@ -407,7 +402,7 @@
407
402
  // 一个函数
408
403
  // 用于在动画结束前结束动画
409
404
  stop: function () {
410
- var i;
405
+ let i;
411
406
  for (i in $timers) {
412
407
  if ($timers[i].id == id) {
413
408
  $timers[i].id = void 0;
@@ -1234,11 +1229,20 @@
1234
1229
  throw new Error("VISLite SVG:The mount point requires an HTMLElement type but encountered null.");
1235
1230
  }
1236
1231
  var width = el.clientWidth, height = el.clientHeight;
1237
- var ViewSVG = document.createElementNS("http://www.w3.org/2000/svg", 'svg');
1238
- el.appendChild(ViewSVG);
1239
- ViewSVG.setAttribute("width", width + "");
1240
- ViewSVG.setAttribute("height", height + "");
1241
- ViewSVG.setAttribute("viewBox", "0 0 " + width + " " + height);
1232
+ var ViewSVG;
1233
+ var _el = el;
1234
+ if (_el._vislite_svg_) {
1235
+ ViewSVG = _el._vislite_svg_[0];
1236
+ }
1237
+ else {
1238
+ ViewSVG = document.createElementNS("http://www.w3.org/2000/svg", 'svg');
1239
+ el.appendChild(ViewSVG);
1240
+ ViewSVG.setAttribute("width", width + "");
1241
+ ViewSVG.setAttribute("height", height + "");
1242
+ ViewSVG.setAttribute("viewBox", "0 0 " + width + " " + height);
1243
+ _el._vislite_svg_ = [ViewSVG];
1244
+ el.setAttribute('vislite', 'SVG');
1245
+ }
1242
1246
  _this = _super.call(this, ViewSVG) || this;
1243
1247
  _this.__el = el;
1244
1248
  return _this;
@@ -2281,15 +2285,10 @@
2281
2285
  return Mercator;
2282
2286
  }());
2283
2287
 
2284
- /*!
2285
- * throttle of OIPage v1.8.0
2286
- * git+https://github.com/oi-contrib/OIPage.git
2287
- */
2288
-
2289
2288
  function throttle(callback, _option) {
2290
2289
 
2291
2290
  // 缺省值
2292
- var option = {
2291
+ let option = {
2293
2292
  time: 200,
2294
2293
  keep: false,
2295
2294
  opportunity: "end"
@@ -2297,12 +2296,12 @@
2297
2296
 
2298
2297
  // 校对
2299
2298
  if (_option) {
2300
- for (var key in _option) {
2299
+ for (let key in _option) {
2301
2300
  option[key] = _option[key];
2302
2301
  }
2303
2302
  }
2304
2303
 
2305
- var hadInterval = false, hadClick = false, oneClick = false, arg;
2304
+ let hadInterval = false, hadClick = false, oneClick = false, arg;
2306
2305
  return function () {
2307
2306
  const _this = this;
2308
2307
  arg = arguments;
@@ -2314,7 +2313,7 @@
2314
2313
  }
2315
2314
  hadInterval = true;
2316
2315
 
2317
- var interval = setInterval(() => {
2316
+ let interval = setInterval(() => {
2318
2317
  if (hadClick) {
2319
2318
  if (!option.keep) {
2320
2319
  callback.apply(_this, arg);