vislite 0.4.1-alpha.2 → 0.4.1-beta.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 (113) hide show
  1. package/.editorconfig +19 -0
  2. package/CHANGELOG +17 -8
  3. package/README.md +16 -1
  4. package/lib/Buffer/index.umd.js +2 -2
  5. package/lib/Buffer/index.umd.min.js +2 -2
  6. package/lib/Canvas/index.umd.js +89 -10
  7. package/lib/Canvas/index.umd.min.js +3 -3
  8. package/lib/Cardinal/index.umd.js +2 -2
  9. package/lib/Cardinal/index.umd.min.js +2 -2
  10. package/lib/Eoap/index.umd.js +2 -2
  11. package/lib/Eoap/index.umd.min.js +2 -2
  12. package/lib/Hermite/index.umd.js +2 -2
  13. package/lib/Hermite/index.umd.min.js +2 -2
  14. package/lib/Matrix4/index.umd.js +2 -2
  15. package/lib/Matrix4/index.umd.min.js +2 -2
  16. package/lib/Mercator/index.umd.js +2 -2
  17. package/lib/Mercator/index.umd.min.js +2 -2
  18. package/lib/OralCanvas/index.es.js +79 -8
  19. package/lib/OralCanvas/index.es.min.js +3 -3
  20. package/lib/OralWebGL/index.es.js +35 -10
  21. package/lib/OralWebGL/index.es.min.js +3 -3
  22. package/lib/SVG/index.umd.js +2 -2
  23. package/lib/SVG/index.umd.min.js +2 -2
  24. package/lib/Shader/index.umd.js +82 -3
  25. package/lib/Shader/index.umd.min.js +3 -3
  26. package/lib/Texture/index.umd.js +3 -5
  27. package/lib/Texture/index.umd.min.js +3 -3
  28. package/lib/TreeLayout/index.umd.js +427 -0
  29. package/lib/TreeLayout/index.umd.min.js +11 -0
  30. package/lib/WebGL/index.umd.js +45 -12
  31. package/lib/WebGL/index.umd.min.js +3 -3
  32. package/lib/animation/index.umd.js +3 -3
  33. package/lib/animation/index.umd.min.js +2 -2
  34. package/lib/formatColor/index.umd.js +59 -0
  35. package/lib/formatColor/index.umd.min.js +11 -0
  36. package/lib/getLoopColors/index.umd.js +2 -2
  37. package/lib/getLoopColors/index.umd.min.js +2 -2
  38. package/lib/getWebGLContext/index.umd.js +2 -2
  39. package/lib/getWebGLContext/index.umd.min.js +2 -2
  40. package/lib/index.umd.js +555 -23
  41. package/lib/index.umd.min.js +3 -3
  42. package/lib/resizeObserver/index.umd.js +48 -0
  43. package/lib/resizeObserver/index.umd.min.js +11 -0
  44. package/lib/rotate/index.umd.js +2 -2
  45. package/lib/rotate/index.umd.min.js +2 -2
  46. package/lib/ruler/index.umd.js +2 -2
  47. package/lib/ruler/index.umd.min.js +2 -2
  48. package/lib/throttle/index.umd.js +68 -0
  49. package/lib/throttle/index.umd.min.js +11 -0
  50. package/lib/viewHandler/index.umd.js +2 -2
  51. package/lib/viewHandler/index.umd.min.js +2 -2
  52. package/package/Buffer/index.ts +1 -0
  53. package/package/Canvas/index.ts +1 -0
  54. package/package/OralCanvas/index.ts +1 -0
  55. package/package/OralWebGL/index.ts +1 -0
  56. package/package/Shader/index.ts +39 -1
  57. package/package/Texture/index.ts +1 -0
  58. package/package/TreeLayout/index.ts +3 -0
  59. package/package/WebGL/index.ts +1 -0
  60. package/package/formatColor/index.ts +3 -0
  61. package/package/index.ts +12 -1
  62. package/package/resizeObserver/index.ts +3 -0
  63. package/package/throttle/index.ts +3 -0
  64. package/package.json +1 -1
  65. package/src/Canvas.ts +7 -3
  66. package/src/Eoap.ts +1 -1
  67. package/src/Matrix4/index.ts +1 -1
  68. package/src/Mercator.ts +1 -1
  69. package/src/SVG.ts +2 -1
  70. package/src/TreeLayout/index.ts +186 -0
  71. package/src/WebGL.ts +7 -3
  72. package/src/animation.ts +2 -3
  73. package/src/common/canvas/config.ts +2 -1
  74. package/src/common/canvas/index.ts +10 -3
  75. package/src/common/canvas/painter.ts +74 -5
  76. package/src/common/mergeOption.ts +7 -0
  77. package/src/common/svg/config.ts +2 -1
  78. package/src/common/svg/index.ts +2 -1
  79. package/src/common/svg/tool.ts +2 -1
  80. package/src/common/tree/index.ts +26 -0
  81. package/src/common/tree/toInnerTree.ts +57 -0
  82. package/src/common/tree/toPlainTree.ts +132 -0
  83. package/src/common/webgl/doDraw.ts +2 -0
  84. package/src/common/webgl/getShader.ts +25 -52
  85. package/src/common/webgl/index.ts +4 -3
  86. package/src/common/webgl/texture.ts +2 -5
  87. package/src/formatColor.ts +45 -0
  88. package/src/interpolation/Cardinal.ts +2 -1
  89. package/src/interpolation/Hermite.ts +1 -1
  90. package/src/resizeObserver.ts +37 -0
  91. package/src/ruler.ts +1 -1
  92. package/src/shader/fsColor.c +8 -0
  93. package/src/shader/fsColors.c +8 -0
  94. package/src/shader/fsCube.c +9 -0
  95. package/src/shader/fsImage.c +9 -0
  96. package/src/shader/vsColor.c +18 -0
  97. package/src/shader/vsColors.c +14 -0
  98. package/src/shader/vsCube.c +14 -0
  99. package/src/shader/vsImage.c +14 -0
  100. package/src/throttle.ts +50 -0
  101. package/src/viewHandler.ts +1 -1
  102. package/types/Canvas.d.ts +12 -0
  103. package/types/CanvasOption.d.ts +2 -2
  104. package/types/Shader.d.ts +6 -0
  105. package/types/Tree.d.ts +38 -0
  106. package/types/TreeConfig.d.ts +25 -0
  107. package/types/TreeLayout.d.ts +49 -0
  108. package/types/TreeOption.d.ts +46 -0
  109. package/types/formatColor.d.ts +3 -0
  110. package/types/index.d.ts +24 -1
  111. package/types/resizeObserver.d.ts +3 -0
  112. package/types/throttle.d.ts +5 -0
  113. package/types/throttleOption.d.ts +20 -0
@@ -1,12 +1,12 @@
1
1
  /*!
2
- * VISLite JavaScript Library v0.4.1-alpha.2
2
+ * VISLite JavaScript Library v0.4.1-beta.0
3
3
  * git+https://github.com/oi-contrib/VISLite.git
4
4
  *
5
5
  * Copyright zxl20070701
6
6
  * Released under the MIT license
7
7
  * https://zxl20070701.github.io/notebook/home.html
8
8
  *
9
- * Publish Date: Sat Aug 12 2023 23:34:54 GMT+0800 (中国标准时间)
9
+ * Publish Date: Wed Aug 23 2023 22:06:27 GMT+0800 (中国标准时间)
10
10
  */
11
11
  (function (global, factory) {
12
12
  typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
@@ -79,7 +79,7 @@
79
79
  var i;
80
80
  for (i in $timers) {
81
81
  if ($timers[i].id == id) {
82
- $timers[i].id = undefined;
82
+ $timers[i].id = void 0;
83
83
  return;
84
84
  }
85
85
  }
@@ -1,11 +1,11 @@
1
1
  /*!
2
- * VISLite JavaScript Library v0.4.1-alpha.2
2
+ * VISLite JavaScript Library v0.4.1-beta.0
3
3
  * git+https://github.com/oi-contrib/VISLite.git
4
4
  *
5
5
  * Copyright zxl20070701
6
6
  * Released under the MIT license
7
7
  * https://zxl20070701.github.io/notebook/home.html
8
8
  *
9
- * Publish Date: Sat Aug 12 2023 23:34:54 GMT+0800 (中国标准时间)
9
+ * Publish Date: Wed Aug 23 2023 22:06:27 GMT+0800 (中国标准时间)
10
10
  */
11
11
  var e,t;e=this,t=function(){"use strict";var e,t=[];return function(i,n,r){void 0===n&&(n=400),void 0===r&&(r=function(){});var o={timer:function(e,i,n){if(!e)throw new Error("Tick is required!");var r=(new Date).valueOf()+"_"+(1e3*Math.random()).toFixed(0);return t.push({id:r,createTime:new Date,tick:e,duration:i,callback:n}),o.start(),r},start:function(){e||(e=setInterval(o.tick,13))},tick:function(){var e,i,n,r,a,u,f,c=t;for((t=[]).length=0,i=0;i<c.length;i++)e=(a=c[i]).createTime,n=a.tick,u=a.duration,r=a.callback,n(f=(f=(+(new Date).valueOf()-e.valueOf())/u)>1?1:f),f<1&&a.id?t.push(a):r(f);t.length<=0&&o.stop()},stop:function(){e&&(clearInterval(e),e=null)}},a=o.timer((function(e){i(e)}),n,r);return function(){var e;for(e in t)if(t[e].id==a)return void(t[e].id=void 0)}}},"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).VISLite_animation=t();
@@ -0,0 +1,59 @@
1
+ /*!
2
+ * VISLite JavaScript Library v0.4.1-beta.0
3
+ * git+https://github.com/oi-contrib/VISLite.git
4
+ *
5
+ * Copyright zxl20070701
6
+ * Released under the MIT license
7
+ * https://zxl20070701.github.io/notebook/home.html
8
+ *
9
+ * Publish Date: Wed Aug 23 2023 22:06:27 GMT+0800 (中国标准时间)
10
+ */
11
+ (function (global, factory) {
12
+ typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
13
+ typeof define === 'function' && define.amd ? define(factory) :
14
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.VISLite_formatColor = factory());
15
+ })(this, (function () { 'use strict';
16
+
17
+ var toHex = function (value) {
18
+ var hex = value.toString(16);
19
+ return hex.length == 1 ? ("0" + hex) : hex;
20
+ };
21
+ function formatColor (color, format) {
22
+ var colorNode = document.getElementsByTagName('head')[0];
23
+ colorNode.style['color'] = color;
24
+ var allStyle = document.defaultView && document.defaultView.getComputedStyle ?
25
+ document.defaultView.getComputedStyle(colorNode, null) :
26
+ colorNode.currentStyle;
27
+ var oralFormat = allStyle.getPropertyValue('color').replace(/rgba?\(/, '').replace(")", "").split(',');
28
+ for (var index = 0; index < oralFormat.length; index++) {
29
+ oralFormat[index] = +oralFormat[index];
30
+ }
31
+ oralFormat.push(1);
32
+ switch (format) {
33
+ case "3d": {
34
+ return [
35
+ oralFormat[0] / 255,
36
+ oralFormat[1] / 255,
37
+ oralFormat[2] / 255,
38
+ oralFormat[3]
39
+ ];
40
+ }
41
+ case "rgba": {
42
+ return "rgba(".concat(oralFormat[0], ", ").concat(oralFormat[1], ", ").concat(oralFormat[2], ", ").concat(oralFormat[3], ")");
43
+ }
44
+ case "rgb": {
45
+ return "rgb(".concat(oralFormat[0], ", ").concat(oralFormat[1], ", ").concat(oralFormat[2], ")");
46
+ }
47
+ case "hexAlpha": {
48
+ return "#".concat(toHex(oralFormat[0])).concat(toHex(oralFormat[1])).concat(toHex(oralFormat[2])).concat(toHex(+(oralFormat[3] * 255).toFixed(0)));
49
+ }
50
+ case "hex": {
51
+ return "#".concat(toHex(oralFormat[0])).concat(toHex(oralFormat[1])).concat(toHex(oralFormat[2]));
52
+ }
53
+ }
54
+ throw new Error("Unsupported color format: " + format);
55
+ }
56
+
57
+ return formatColor;
58
+
59
+ }));
@@ -0,0 +1,11 @@
1
+ /*!
2
+ * VISLite JavaScript Library v0.4.1-beta.0
3
+ * git+https://github.com/oi-contrib/VISLite.git
4
+ *
5
+ * Copyright zxl20070701
6
+ * Released under the MIT license
7
+ * https://zxl20070701.github.io/notebook/home.html
8
+ *
9
+ * Publish Date: Wed Aug 23 2023 22:06:27 GMT+0800 (中国标准时间)
10
+ */
11
+ var e,t;e=this,t=function(){"use strict";var e=function(e){var t=e.toString(16);return 1==t.length?"0"+t:t};return function(t,o){var c=document.getElementsByTagName("head")[0];c.style.color=t;for(var n=(document.defaultView&&document.defaultView.getComputedStyle?document.defaultView.getComputedStyle(c,null):c.currentStyle).getPropertyValue("color").replace(/rgba?\(/,"").replace(")","").split(","),r=0;r<n.length;r++)n[r]=+n[r];switch(n.push(1),o){case"3d":return[n[0]/255,n[1]/255,n[2]/255,n[3]];case"rgba":return"rgba(".concat(n[0],", ").concat(n[1],", ").concat(n[2],", ").concat(n[3],")");case"rgb":return"rgb(".concat(n[0],", ").concat(n[1],", ").concat(n[2],")");case"hexAlpha":return"#".concat(e(n[0])).concat(e(n[1])).concat(e(n[2])).concat(e(+(255*n[3]).toFixed(0)));case"hex":return"#".concat(e(n[0])).concat(e(n[1])).concat(e(n[2]))}throw new Error("Unsupported color format: "+o)}},"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).VISLite_formatColor=t();
@@ -1,12 +1,12 @@
1
1
  /*!
2
- * VISLite JavaScript Library v0.4.1-alpha.2
2
+ * VISLite JavaScript Library v0.4.1-beta.0
3
3
  * git+https://github.com/oi-contrib/VISLite.git
4
4
  *
5
5
  * Copyright zxl20070701
6
6
  * Released under the MIT license
7
7
  * https://zxl20070701.github.io/notebook/home.html
8
8
  *
9
- * Publish Date: Sat Aug 12 2023 23:34:54 GMT+0800 (中国标准时间)
9
+ * Publish Date: Wed Aug 23 2023 22:06:27 GMT+0800 (中国标准时间)
10
10
  */
11
11
  (function (global, factory) {
12
12
  typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
@@ -1,11 +1,11 @@
1
1
  /*!
2
- * VISLite JavaScript Library v0.4.1-alpha.2
2
+ * VISLite JavaScript Library v0.4.1-beta.0
3
3
  * git+https://github.com/oi-contrib/VISLite.git
4
4
  *
5
5
  * Copyright zxl20070701
6
6
  * Released under the MIT license
7
7
  * https://zxl20070701.github.io/notebook/home.html
8
8
  *
9
- * Publish Date: Sat Aug 12 2023 23:34:54 GMT+0800 (中国标准时间)
9
+ * Publish Date: Wed Aug 23 2023 22:06:27 GMT+0800 (中国标准时间)
10
10
  */
11
11
  var e,t;e=this,t=function(){"use strict";return function(e,t){void 0===t&&(t=1);var r=["rgba(84,112,198,"+t+")","rgba(145,204,117,"+t+")","rgba(250,200,88,"+t+")","rgba(238,102,102,"+t+")","rgba(115,192,222,"+t+")","rgba(59,162,114,"+t+")","rgba(252,132,82,"+t+")","rgba(154,96,180,"+t+")","rgba(234,124,204,"+t+")"],n=[];if(e<=r.length)return r;if(e%r.length==0)for(var o=0;o<e/r.length;o++)n=n.concat(r);else{for(var a=1;a<e/r.length;a++)n=n.concat(r);if(e%r.length==1)n=n.concat(r[4]);else for(var f=0;f<e%r.length;f++)n=n.concat(r[f])}return n}},"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).VISLite_getLoopColors=t();
@@ -1,12 +1,12 @@
1
1
  /*!
2
- * VISLite JavaScript Library v0.4.1-alpha.2
2
+ * VISLite JavaScript Library v0.4.1-beta.0
3
3
  * git+https://github.com/oi-contrib/VISLite.git
4
4
  *
5
5
  * Copyright zxl20070701
6
6
  * Released under the MIT license
7
7
  * https://zxl20070701.github.io/notebook/home.html
8
8
  *
9
- * Publish Date: Sat Aug 12 2023 23:34:54 GMT+0800 (中国标准时间)
9
+ * Publish Date: Wed Aug 23 2023 22:06:27 GMT+0800 (中国标准时间)
10
10
  */
11
11
  (function (global, factory) {
12
12
  typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
@@ -1,11 +1,11 @@
1
1
  /*!
2
- * VISLite JavaScript Library v0.4.1-alpha.2
2
+ * VISLite JavaScript Library v0.4.1-beta.0
3
3
  * git+https://github.com/oi-contrib/VISLite.git
4
4
  *
5
5
  * Copyright zxl20070701
6
6
  * Released under the MIT license
7
7
  * https://zxl20070701.github.io/notebook/home.html
8
8
  *
9
- * Publish Date: Sat Aug 12 2023 23:34:54 GMT+0800 (中国标准时间)
9
+ * Publish Date: Wed Aug 23 2023 22:06:27 GMT+0800 (中国标准时间)
10
10
  */
11
11
  var e,t;e=this,t=function(){"use strict";return function(e,t){if(void 0===t&&(t=1),!e)throw new Error("VISLite getWebGLContext:The mount point requires an HTMLElement type but encountered null.");var n,i=e.clientWidth,o=e.clientHeight,r=e;return r._vislite_canvas_?n=r._vislite_canvas_:(n=document.createElement("canvas"),e.appendChild(n),r._vislite_canvas_=n,e.setAttribute("vislite","WebGL")),n.style.width=i+"px",n.setAttribute("width",i+""),n.style.height=o+"px",n.setAttribute("height",o+""),function(e,t,n){void 0===n&&(n={});for(var i=["webgl","experimental-webgl","webkit-3d","moz-webgl"],o=null,r=0;r<i.length;r++){try{o=e.getContext(i[r],n)}catch(e){}if(o)break}if(!o)throw new Error("Non canvas or browser does not support webgl.");var l=o.canvas.width,a=o.canvas.height,s=l*t,u=a*t;return o.viewport(.5*(l-s),.5*(a-u),s,u),o.depthFunc(o.LEQUAL),o.enable(o.DEPTH_TEST),o}(n,t)}},"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).VISLite_getWebGLContext=t();