@plotdb/chart 2.1.20 → 2.1.22
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/CHANGELOG.md +10 -0
- package/index.js +2 -1
- package/index.min.js +1 -1
- package/package.json +1 -1
- package/utils/tint.js +7 -3
- package/utils/tint.min.js +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# Change Logs
|
|
2
2
|
|
|
3
|
+
## v2.1.22
|
|
4
|
+
|
|
5
|
+
- reset option of `tint.set` now depends on the given palette's signature if omitted.
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
## v2.1.21
|
|
9
|
+
|
|
10
|
+
- fix bug: number parsing fails with non-string input
|
|
11
|
+
|
|
12
|
+
|
|
3
13
|
## v2.1.20
|
|
4
14
|
|
|
5
15
|
- correctly parse numbers based on locale (default `en-US` and currently not customizable)
|
package/index.js
CHANGED
|
@@ -27,7 +27,8 @@
|
|
|
27
27
|
};
|
|
28
28
|
_np = new _np("en-US");
|
|
29
29
|
_nparse = function(str){
|
|
30
|
-
str
|
|
30
|
+
str == null && (str = "");
|
|
31
|
+
str = (str + "").trim().replace(_np._group, "").replace(_np._decimal, '.').replace(_np._numeral, _np._index);
|
|
31
32
|
if (str) {
|
|
32
33
|
return +str;
|
|
33
34
|
} else {
|
package/index.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(){var e,c,n,i,o,s,u,a,t;function l(t,e,d){function f(t,e){return n.call(t,e)}var p={}.toString,n={}.hasOwnProperty,m=!0;return function t(e,n,r){var i,o,s,u,a,l,h,c;if(null==e||null==n)return e===n;if(e.__placeholder__||n.__placeholder__)return!0;if(e===n)return 0!==e||1/e==1/n;i=p.call(e);if(p.call(n)!=i)return!1;switch(i){case"[object String]":return e==String(n);case"[object Number]":return e!=+e?n!=+n:0==e?1/e==1/n:e==+n;case"[object Date]":case"[object Boolean]":return+e==+n;case"[object RegExp]":return e.source==n.source&&e.global==n.global&&e.multiline==n.multiline&&e.ignoreCase==n.ignoreCase}if("object"!=typeof e||"object"!=typeof n)return!1;o=r.length;for(;o--;)if(r[o]==e)return!0;r.push(e);s=0;u=!0;if("[object Array]"==i){if(a=e.length,l=n.length,m){switch(d){case"===":u=a===l;break;case"<==":u=a<=l;break;case"<<=":u=a<l}s=a,m=!1}else u=a===l,s=a;if(u)for(;s--&&(u=s in e==s in n&&t(e[s],n[s],r)););}else{if("constructor"in e!="constructor"in n||e.constructor!=n.constructor)return!1;for(h in e)if(f(e,h)&&(s++,!(u=f(n,h)&&t(e[h],n[h],r))))break;if(u){for(h in c=0,n)f(n,h)&&++c;u=m?"<<="===d?s<c:"<=="===d?s<=c:s===c:(m=!1,s===c)}}r.pop();return u}(t,e,[])}function h(t,e){var n,r={}.hasOwnProperty;for(n in e)r.call(e,n)&&(t[n]=e[n]);return t}e=new function(t){var n=new Intl.NumberFormat(t),e=n.formatToParts(12345.6),t=Array.from({length:10}).map(function(t,e){return n.format(e)}),r=new Map(t.map(function(t,e){return[t,e]}));return this._group=new RegExp("["+e.find(function(t){return l(t.type,"group","===")}).value+"]","g"),this._decimal=new RegExp("["+e.find(function(t){return l(t.type,"decimal","===")}).value+"]"),this._numeral=new RegExp("["+t.join("")+"]","g"),this._index=function(t){return r.get(t)},this}("en-US"),c=function(t){return(t=t.trim().replace(e._group,"").replace(e._decimal,".").replace(e._numeral,e._index))?+t:NaN},n=function(t,e,n){for(var r=t;t&&t!==n;)t=t.parentNode;if(t!==n)return null;if(!e)return t;for(t=r;t&&t!==n&&(!t.matches||t.matches&&!t.matches(e));)t=t.parentNode;return t!==n||n.matches&&n.matches(e)?t:null},(i=function(){return this.running=!1,this.time={now:0,last:0},this.fps(60),this.evtHandler={},this}).prototype=h(Object.create(Object.prototype),{on:function(t,n){var r=this;return(Array.isArray(t)?t:[t]).map(function(t){var e;return((e=r.evtHandler)[t]||(e[t]=[])).push(n)})},fire:function(t){for(var e,n,r,i,o=[],s=[],u=1,a=arguments.length;u<a;++u)s.push(arguments[u]);for(e=s,u=0,r=(n=this.evtHandler[t]||[]).length;u<r;++u)i=n[u],o.push(i.apply(this,e));return o},reset:function(){return this.time={now:0}},setTime:function(t){return this.time.now=t},getTime:function(){return this.time.now},isRunning:function(){return this.running},toggle:function(t){return null!=t&&(this.running=!t),this.running?this.pause():this.run()},pause:function(){return this.running=!1},render:function(){return this.fire("tick",this.time.now)},run:function(t){var e=this;if(null!=t&&this.fps(t),!this.running)return this.running=!0,requestAnimationFrame(function(t){return e.handler(e.time.last=t,!0)})},throttle:function(t){return this.isThrottled=t=null==t?!0:t},fps:function(t){return null==t?this._fps_val:(this._fps_val=.01<t?t:.01,this._fps_delay=1e3/this._fps_val)},handler:function(t,e){var n,r=this;if(null==e&&(e=!1),this.running)return this.time.now=t,n=this.isThrottled?1e3<(n=this._fps_delay)?n:1e3:this._fps_delay,(e||this.time.now-this.time.last>=n)&&(this.time.last=t,this.render()),requestAnimationFrame(function(t){return r.handler(t,!1)})}}),o={list:[],init:function(){var t,n,r=this;return this.inited=!0,t=null==document.hidden&&null==document.msHidden&&null!=document.webkiHidden?["webkitHidden","webkitvisibilitychange"]:["hidden","visibilitychange"],n=t[0],document.addEventListener(t[1],debounce(150,function(){var e=!!document[n];return r.list.map(function(t){return t.throttle(e)})},!1))},add:function(t){return this.inited||this.init(),this.list.push(t)}},s={wm:new WeakMap,ro:new ResizeObserver(function(t){return t.map(function(t){return s.wm.get(t.target)._resize()})}),add:function(t,e){return this.wm.set(t,e),this.ro.observe(t)},delete:function(t){return this.ro.unobserve(t),this.wm.delete(t)}},u=function(t,e,n){return null==e&&(e={}),null==n&&(n={}),function(t,e,n){var r,i;for(r in e)i=e[r],null==t[r]?t[r]=i:"object"!=typeof t[r]||"object"!=typeof i||n[r]&&n[r].type||u(t[r],e[r],n[r]);return t}(t=null==t?{}:t,e=JSON.parse(JSON.stringify(e)),n)},a=function(t){var o=function(t,e){var n,r,i;for(r in null==e&&(e={}),n=t.child,t)(i=t[r]).type?i.default&&(e[r]=i.default):o(i,e[r]||(e[r]={}));return e};return o(t)},(t=function(t){var e=this;return this.root="string"==typeof(t=null==t?{}:t).root?document.querySelector(t.root):t.root,this.useSample=null==t.useSample||t.useSample,this.autoSelect=null==t.autoSelect||t.autoSelect,this.forceInit=t.forceInit||!1,this.prepareSvg=null==t.prepareSvg||t.prepareSvg,this.layoutOpt=null==t.layout||t.layout,this.delayRender=t.delayRender||!1,this.dataAccessor=null!=t.dataAccessor?t.dataAccessor:function(t){return t?t.data._raw:null},this.data=[],this.raw=t.raw||null,this.mod=t.mod||{},this.cfg=t.config||{},this.seed=t.seed||Math.random(),this.binding=t.binding||{},this._normalizeBinding(),this.evtHandler={},this.init=proxise.once(function(){return e._init()}),this._resize=null,this.autoSelect&&(this.root.addEventListener("click",this._select=function(t){if(t=n(t.target,".data",e.root))return e.fire("select",[{data:e.dataAccessor(t),node:t}])}),this.root.addEventListener("mouseover",this._hover=function(t){if(t=ld$.parent(t.target,".data",e.root))return e.fire("hover",[{data:e.dataAccessor(t),node:t}])})),this}).prototype=h(Object.create(Object.prototype),{_init:function(){var n,t,e,r=this;return"static"===window.getComputedStyle(this.root).position&&(this.root.style.position="relative"),n=this.layoutOpt?"object"!=typeof this.layoutOpt?this.root.querySelector(".pdl-layout"):"string"==typeof this.layoutOpt.root?this.root.querySelector(this.layoutOpt.root):this.layoutOpt.root||null:null,this.prepareSvg&&!(this.svg=this.root.querySelector("svg"))&&(this.svg=document.createElementNS("http://www.w3.org/2000/svg","svg"),(t=this.svg.style).width="100%",t.height="100%",this.layoutOpt&&(n||console.error("[@plotdb/chart] layout enabled yet layout root isn't configured properly. "),(e=n.querySelector("[data-type=render]"))||console.warn("[@plotdb/chart] prepareSvg and layout is configured at the same time,\nyet render container for layout is not found. svg is thus appended in the root.")),(e||this.root).appendChild(this.svg)),this._aniloop=new i,o.add(this._aniloop),this._aniloop.on("tick",function(){return r.tick()}),Promise.resolve().then(function(){var t;if(r._defcfg=t=a(r.mod.config||{}),u(r.cfg,t),(!r.raw||!Array.isArray(r.raw))&&r.useSample&&r.mod.sample)return(t=r.mod.sample.apply(r)).then?t.then():Promise.resolve(t)}).then(function(t){return r.raw=(t=t||{}).raw,r.binding=t.binding,r}).then(function(){var t,e;if(r.raw||(r.raw=[]),r.layoutOpt&&("undefined"==typeof layout||null===layout?console.warn("[@plotdb/chart] layout-opt is set yet @plotdb/layout is not found."):(n||(console.error("[@plotdb/chart] cannot determine root node for @plotdb/layout."),console.error("[@plotdb/chart] config layout properly or disable layout by setting layout to false")),r.layout=new layout("object"==typeof r.layoutOpt?((t=h({},r.layoutOpt)).watchResize=!1,t):{root:n,watchResize:!1}))),e=proxise(function(){return s.add(r.root,r),null}),!r.forceInit&&r.root.offsetParent&&"none"!==window.getComputedStyle(r.root).display)return r._resize=function(){return e.resolve()},e()}).then(function(){return r._resize=function(){}}).then(function(){var t,e=function(){if(r.mod.init)return r.mod.init.apply(r)};return r.layout?(t=proxise(function(){return Promise.resolve(r.layout.init(e)),null}),r._layout=function(){return t.resolve()},r.layout.on("render",function(){return r._layout()}),t()):e()}).then(function(){r._layout=function(){},Promise.resolve().then(function(){if(r.delayRender)return r.renderLock=proxise(function(){}),r.renderLock()}).then(function(){return r._resize=function(){return r.resize(),r.render()},r._layout=function(){return r.parse(),r.bind(),r.resize(),r.render()},r.parse(),r.bind(),r.resize(),r.render()})})},parse:function(){var t,l=(t=this.mod).dimension||(t.dimension={}),h=this.binding;if(this.data=this.raw.map(function(e,t){var n,r,i,o,s={};for(n in r=l)i=r[n],(o=h[n])?(s[n]=i.multiple?(o.map?o:[o]).map(u):e[o.key],/[RIT]/.exec(i.type)&&!/[CN]/.exec(i.type)&&(s[n]=Array.isArray(s[n])?s[n].map(a):c(s[n]))):i.multiple&&(s[n]=[]);return s._raw=e,s._idx=t,s;function u(t){return e[t.key]}function a(t){return c(t)}}),this.mod.parse)return this.mod.parse.apply(this)},bind:function(){if(this.mod.bind)return this.mod.bind.apply(this)},start:function(){if(this._aniloop.run(),this.mod.start)return this.mod.start.apply(this)},stop:function(){if(this._aniloop.pause(),this.mod.stop)return this.mod.stop.apply(this)},resize:function(){if(this.layout&&this.layout.update(!1),this.box=this.root.getBoundingClientRect(),this.mod.resize)return this.mod.resize.apply(this)},tick:function(){if(this.mod.tick)return this.mod.tick.apply(this)},render:function(){if(this.mod.render)return this.mod.render.apply(this)},destroy:function(){var t=this;return Promise.resolve().then(function(){if(t._select&&t.root.removeEventListener("click",t._select),t._hover&&t.root.removeEventListener("mouseover",t._hover),s.delete(t.root),t.layout&&t.layout.destroy(),t.stop(),t.mod.destroy)return t.mod.destroy.apply(t)})},config:function(){var t,e,n;if(!arguments.length)return this.cfg;for(t={},e=0,n=arguments.length;e<n;++e)u(t,arguments[e],this.mod.config);return u(t,this.cfg,this.mod.config),u(t,this._defcfg,this.mod.config),h(this.cfg,t)},_normalizeBinding:function(t){var e,n,r,i,o,s,u,a=[];if(null==t){for(t in e=[],this.mod.dimension||{})e.push(t);t=e}for(n=0,r=(t=!Array.isArray(t)?[t]:t).length;n<r;++n)i=t[n],o=(this.mod.dimension||{})[i]||{},s=this.binding[i],u=Array.isArray(s),!o.multiple!=!u&&(o.multiple||u)&&a.push(this.binding[i]=u?s[0]:s?[s]:[]);return a},setBind:function(t,e){return this.binding[t]=e,this._normalizeBinding([t]),this.parse(),this.bind(),this.resize(),this.render()},setRaw:function(t,e,n){var r;return null==n&&(n=!1),Array.isArray(t)||(t=(r=t).raw,e=r.binding,n=r.reinit),null!=t&&(this.raw=t),null!=e&&(this.binding=e,this._normalizeBinding()),this.renderLock?(this.renderLock.resolve(),this.renderLock=null):(n&&this.mod.init&&this.mod.init.apply(this),this.parse(),this.bind(),this.resize(),this.render())},on:function(t,n){var r=this;return(Array.isArray(t)?t:[t]).map(function(t){var e;return((e=r.evtHandler)[t]||(e[t]=[])).push(n)})},fire:function(t){for(var e,n,r,i,o=[],s=[],u=1,a=arguments.length;u<a;++u)s.push(arguments[u]);for(e=s,u=0,r=(n=this.evtHandler[t]||[]).length;u<r;++u)i=n[u],o.push(i.apply(this,e));return o},filter:function(t,e){var n,r,i,o,s;for(r in null==t&&(t={}),null==e&&(e=!1),n=[],i=this.binding)o=i[r],s=(s=Array.isArray(o)?o:[o]).map(u),n=n.concat(s);for(r in t)o=t[r],n.filter(a).map(l);return e&&this.fire("filter",t),this.mod.filter&&this.mod.filter.apply(this,[t,e]),this.parse(),this.bind(),this.resize(),this.render();function u(t){return{k:r,v:t}}function a(t){return t.k===r}function l(t){return t.v.filter=o}},sample:function(){return this.mod.sample?this.mod.sample.apply(this):{raw:[],binding:{}}}}),"undefined"!=typeof module&&null!==module?module.exports=t:"undefined"!=typeof window&&null!==window&&(window.chart=t)}.call(this);
|
|
1
|
+
!function(){var e,c,n,i,o,s,u,a,t;function l(t,e,d){function f(t,e){return n.call(t,e)}var p={}.toString,n={}.hasOwnProperty,m=!0;return function t(e,n,r){var i,o,s,u,a,l,h,c;if(null==e||null==n)return e===n;if(e.__placeholder__||n.__placeholder__)return!0;if(e===n)return 0!==e||1/e==1/n;i=p.call(e);if(p.call(n)!=i)return!1;switch(i){case"[object String]":return e==String(n);case"[object Number]":return e!=+e?n!=+n:0==e?1/e==1/n:e==+n;case"[object Date]":case"[object Boolean]":return+e==+n;case"[object RegExp]":return e.source==n.source&&e.global==n.global&&e.multiline==n.multiline&&e.ignoreCase==n.ignoreCase}if("object"!=typeof e||"object"!=typeof n)return!1;o=r.length;for(;o--;)if(r[o]==e)return!0;r.push(e);s=0;u=!0;if("[object Array]"==i){if(a=e.length,l=n.length,m){switch(d){case"===":u=a===l;break;case"<==":u=a<=l;break;case"<<=":u=a<l}s=a,m=!1}else u=a===l,s=a;if(u)for(;s--&&(u=s in e==s in n&&t(e[s],n[s],r)););}else{if("constructor"in e!="constructor"in n||e.constructor!=n.constructor)return!1;for(h in e)if(f(e,h)&&(s++,!(u=f(n,h)&&t(e[h],n[h],r))))break;if(u){for(h in c=0,n)f(n,h)&&++c;u=m?"<<="===d?s<c:"<=="===d?s<=c:s===c:(m=!1,s===c)}}r.pop();return u}(t,e,[])}function h(t,e){var n,r={}.hasOwnProperty;for(n in e)r.call(e,n)&&(t[n]=e[n]);return t}e=new function(t){var n=new Intl.NumberFormat(t),e=n.formatToParts(12345.6),t=Array.from({length:10}).map(function(t,e){return n.format(e)}),r=new Map(t.map(function(t,e){return[t,e]}));return this._group=new RegExp("["+e.find(function(t){return l(t.type,"group","===")}).value+"]","g"),this._decimal=new RegExp("["+e.find(function(t){return l(t.type,"decimal","===")}).value+"]"),this._numeral=new RegExp("["+t.join("")+"]","g"),this._index=function(t){return r.get(t)},this}("en-US"),c=function(t){return(t=((t=null==t?"":t)+"").trim().replace(e._group,"").replace(e._decimal,".").replace(e._numeral,e._index))?+t:NaN},n=function(t,e,n){for(var r=t;t&&t!==n;)t=t.parentNode;if(t!==n)return null;if(!e)return t;for(t=r;t&&t!==n&&(!t.matches||t.matches&&!t.matches(e));)t=t.parentNode;return t!==n||n.matches&&n.matches(e)?t:null},(i=function(){return this.running=!1,this.time={now:0,last:0},this.fps(60),this.evtHandler={},this}).prototype=h(Object.create(Object.prototype),{on:function(t,n){var r=this;return(Array.isArray(t)?t:[t]).map(function(t){var e;return((e=r.evtHandler)[t]||(e[t]=[])).push(n)})},fire:function(t){for(var e,n,r,i,o=[],s=[],u=1,a=arguments.length;u<a;++u)s.push(arguments[u]);for(e=s,u=0,r=(n=this.evtHandler[t]||[]).length;u<r;++u)i=n[u],o.push(i.apply(this,e));return o},reset:function(){return this.time={now:0}},setTime:function(t){return this.time.now=t},getTime:function(){return this.time.now},isRunning:function(){return this.running},toggle:function(t){return null!=t&&(this.running=!t),this.running?this.pause():this.run()},pause:function(){return this.running=!1},render:function(){return this.fire("tick",this.time.now)},run:function(t){var e=this;if(null!=t&&this.fps(t),!this.running)return this.running=!0,requestAnimationFrame(function(t){return e.handler(e.time.last=t,!0)})},throttle:function(t){return this.isThrottled=t=null==t?!0:t},fps:function(t){return null==t?this._fps_val:(this._fps_val=.01<t?t:.01,this._fps_delay=1e3/this._fps_val)},handler:function(t,e){var n,r=this;if(null==e&&(e=!1),this.running)return this.time.now=t,n=this.isThrottled?1e3<(n=this._fps_delay)?n:1e3:this._fps_delay,(e||this.time.now-this.time.last>=n)&&(this.time.last=t,this.render()),requestAnimationFrame(function(t){return r.handler(t,!1)})}}),o={list:[],init:function(){var t,n,r=this;return this.inited=!0,t=null==document.hidden&&null==document.msHidden&&null!=document.webkiHidden?["webkitHidden","webkitvisibilitychange"]:["hidden","visibilitychange"],n=t[0],document.addEventListener(t[1],debounce(150,function(){var e=!!document[n];return r.list.map(function(t){return t.throttle(e)})},!1))},add:function(t){return this.inited||this.init(),this.list.push(t)}},s={wm:new WeakMap,ro:new ResizeObserver(function(t){return t.map(function(t){return s.wm.get(t.target)._resize()})}),add:function(t,e){return this.wm.set(t,e),this.ro.observe(t)},delete:function(t){return this.ro.unobserve(t),this.wm.delete(t)}},u=function(t,e,n){return null==e&&(e={}),null==n&&(n={}),function(t,e,n){var r,i;for(r in e)i=e[r],null==t[r]?t[r]=i:"object"!=typeof t[r]||"object"!=typeof i||n[r]&&n[r].type||u(t[r],e[r],n[r]);return t}(t=null==t?{}:t,e=JSON.parse(JSON.stringify(e)),n)},a=function(t){var o=function(t,e){var n,r,i;for(r in null==e&&(e={}),n=t.child,t)(i=t[r]).type?i.default&&(e[r]=i.default):o(i,e[r]||(e[r]={}));return e};return o(t)},(t=function(t){var e=this;return this.root="string"==typeof(t=null==t?{}:t).root?document.querySelector(t.root):t.root,this.useSample=null==t.useSample||t.useSample,this.autoSelect=null==t.autoSelect||t.autoSelect,this.forceInit=t.forceInit||!1,this.prepareSvg=null==t.prepareSvg||t.prepareSvg,this.layoutOpt=null==t.layout||t.layout,this.delayRender=t.delayRender||!1,this.dataAccessor=null!=t.dataAccessor?t.dataAccessor:function(t){return t?t.data._raw:null},this.data=[],this.raw=t.raw||null,this.mod=t.mod||{},this.cfg=t.config||{},this.seed=t.seed||Math.random(),this.binding=t.binding||{},this._normalizeBinding(),this.evtHandler={},this.init=proxise.once(function(){return e._init()}),this._resize=null,this.autoSelect&&(this.root.addEventListener("click",this._select=function(t){if(t=n(t.target,".data",e.root))return e.fire("select",[{data:e.dataAccessor(t),node:t}])}),this.root.addEventListener("mouseover",this._hover=function(t){if(t=ld$.parent(t.target,".data",e.root))return e.fire("hover",[{data:e.dataAccessor(t),node:t}])})),this}).prototype=h(Object.create(Object.prototype),{_init:function(){var n,t,e,r=this;return"static"===window.getComputedStyle(this.root).position&&(this.root.style.position="relative"),n=this.layoutOpt?"object"!=typeof this.layoutOpt?this.root.querySelector(".pdl-layout"):"string"==typeof this.layoutOpt.root?this.root.querySelector(this.layoutOpt.root):this.layoutOpt.root||null:null,this.prepareSvg&&!(this.svg=this.root.querySelector("svg"))&&(this.svg=document.createElementNS("http://www.w3.org/2000/svg","svg"),(t=this.svg.style).width="100%",t.height="100%",this.layoutOpt&&(n||console.error("[@plotdb/chart] layout enabled yet layout root isn't configured properly. "),(e=n.querySelector("[data-type=render]"))||console.warn("[@plotdb/chart] prepareSvg and layout is configured at the same time,\nyet render container for layout is not found. svg is thus appended in the root.")),(e||this.root).appendChild(this.svg)),this._aniloop=new i,o.add(this._aniloop),this._aniloop.on("tick",function(){return r.tick()}),Promise.resolve().then(function(){var t;if(r._defcfg=t=a(r.mod.config||{}),u(r.cfg,t),(!r.raw||!Array.isArray(r.raw))&&r.useSample&&r.mod.sample)return(t=r.mod.sample.apply(r)).then?t.then():Promise.resolve(t)}).then(function(t){return r.raw=(t=t||{}).raw,r.binding=t.binding,r}).then(function(){var t,e;if(r.raw||(r.raw=[]),r.layoutOpt&&("undefined"==typeof layout||null===layout?console.warn("[@plotdb/chart] layout-opt is set yet @plotdb/layout is not found."):(n||(console.error("[@plotdb/chart] cannot determine root node for @plotdb/layout."),console.error("[@plotdb/chart] config layout properly or disable layout by setting layout to false")),r.layout=new layout("object"==typeof r.layoutOpt?((t=h({},r.layoutOpt)).watchResize=!1,t):{root:n,watchResize:!1}))),e=proxise(function(){return s.add(r.root,r),null}),!r.forceInit&&r.root.offsetParent&&"none"!==window.getComputedStyle(r.root).display)return r._resize=function(){return e.resolve()},e()}).then(function(){return r._resize=function(){}}).then(function(){var t,e=function(){if(r.mod.init)return r.mod.init.apply(r)};return r.layout?(t=proxise(function(){return Promise.resolve(r.layout.init(e)),null}),r._layout=function(){return t.resolve()},r.layout.on("render",function(){return r._layout()}),t()):e()}).then(function(){r._layout=function(){},Promise.resolve().then(function(){if(r.delayRender)return r.renderLock=proxise(function(){}),r.renderLock()}).then(function(){return r._resize=function(){return r.resize(),r.render()},r._layout=function(){return r.parse(),r.bind(),r.resize(),r.render()},r.parse(),r.bind(),r.resize(),r.render()})})},parse:function(){var t,l=(t=this.mod).dimension||(t.dimension={}),h=this.binding;if(this.data=this.raw.map(function(e,t){var n,r,i,o,s={};for(n in r=l)i=r[n],(o=h[n])?(s[n]=i.multiple?(o.map?o:[o]).map(u):e[o.key],/[RIT]/.exec(i.type)&&!/[CN]/.exec(i.type)&&(s[n]=Array.isArray(s[n])?s[n].map(a):c(s[n]))):i.multiple&&(s[n]=[]);return s._raw=e,s._idx=t,s;function u(t){return e[t.key]}function a(t){return c(t)}}),this.mod.parse)return this.mod.parse.apply(this)},bind:function(){if(this.mod.bind)return this.mod.bind.apply(this)},start:function(){if(this._aniloop.run(),this.mod.start)return this.mod.start.apply(this)},stop:function(){if(this._aniloop.pause(),this.mod.stop)return this.mod.stop.apply(this)},resize:function(){if(this.layout&&this.layout.update(!1),this.box=this.root.getBoundingClientRect(),this.mod.resize)return this.mod.resize.apply(this)},tick:function(){if(this.mod.tick)return this.mod.tick.apply(this)},render:function(){if(this.mod.render)return this.mod.render.apply(this)},destroy:function(){var t=this;return Promise.resolve().then(function(){if(t._select&&t.root.removeEventListener("click",t._select),t._hover&&t.root.removeEventListener("mouseover",t._hover),s.delete(t.root),t.layout&&t.layout.destroy(),t.stop(),t.mod.destroy)return t.mod.destroy.apply(t)})},config:function(){var t,e,n;if(!arguments.length)return this.cfg;for(t={},e=0,n=arguments.length;e<n;++e)u(t,arguments[e],this.mod.config);return u(t,this.cfg,this.mod.config),u(t,this._defcfg,this.mod.config),h(this.cfg,t)},_normalizeBinding:function(t){var e,n,r,i,o,s,u,a=[];if(null==t){for(t in e=[],this.mod.dimension||{})e.push(t);t=e}for(n=0,r=(t=!Array.isArray(t)?[t]:t).length;n<r;++n)i=t[n],o=(this.mod.dimension||{})[i]||{},s=this.binding[i],u=Array.isArray(s),!o.multiple!=!u&&(o.multiple||u)&&a.push(this.binding[i]=u?s[0]:s?[s]:[]);return a},setBind:function(t,e){return this.binding[t]=e,this._normalizeBinding([t]),this.parse(),this.bind(),this.resize(),this.render()},setRaw:function(t,e,n){var r;return null==n&&(n=!1),Array.isArray(t)||(t=(r=t).raw,e=r.binding,n=r.reinit),null!=t&&(this.raw=t),null!=e&&(this.binding=e,this._normalizeBinding()),this.renderLock?(this.renderLock.resolve(),this.renderLock=null):(n&&this.mod.init&&this.mod.init.apply(this),this.parse(),this.bind(),this.resize(),this.render())},on:function(t,n){var r=this;return(Array.isArray(t)?t:[t]).map(function(t){var e;return((e=r.evtHandler)[t]||(e[t]=[])).push(n)})},fire:function(t){for(var e,n,r,i,o=[],s=[],u=1,a=arguments.length;u<a;++u)s.push(arguments[u]);for(e=s,u=0,r=(n=this.evtHandler[t]||[]).length;u<r;++u)i=n[u],o.push(i.apply(this,e));return o},filter:function(t,e){var n,r,i,o,s;for(r in null==t&&(t={}),null==e&&(e=!1),n=[],i=this.binding)o=i[r],s=(s=Array.isArray(o)?o:[o]).map(u),n=n.concat(s);for(r in t)o=t[r],n.filter(a).map(l);return e&&this.fire("filter",t),this.mod.filter&&this.mod.filter.apply(this,[t,e]),this.parse(),this.bind(),this.resize(),this.render();function u(t){return{k:r,v:t}}function a(t){return t.k===r}function l(t){return t.v.filter=o}},sample:function(){return this.mod.sample?this.mod.sample.apply(this):{raw:[],binding:{}}}}),"undefined"!=typeof module&&null!==module?module.exports=t:"undefined"!=typeof window&&null!==window&&(window.chart=t)}.call(this);
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"author":"zbryikt","name":"@plotdb/chart","license":"MIT","description":"plotdb charts","style":"index.min.css","browser":"index.min.js","main":"index.min.js","version":"2.1.
|
|
1
|
+
{"author":"zbryikt","name":"@plotdb/chart","license":"MIT","description":"plotdb charts","style":"index.min.css","browser":"index.min.js","main":"index.min.js","version":"2.1.22","homepage":"https://github.com/plotdb/chart","repository":{"type":"git","url":"https://github.com/plotdb/chart"},"engines":{"node":">=10.14.1","npm":">=6.4.1"},"scripts":{"start":"npx server -r web -o true"},"devDependencies":{"@loadingio/bootstrap.ext":"^0.0.9","@loadingio/ldquery":"^3.0.4","@loadingio/loading.css":"^3.1.0","@loadingio/vscroll":"^0.0.8","@plotdb/layout":"^0.0.12","@plotdb/pdmap-world":"^0.0.5","@plotdb/semver":"^0.0.3","@plotdb/sheet":"^0.2.0","@xlfont/choose":"^0.0.13","@xlfont/load":"^2.1.0","@zbryikt/template":"^2.3.38","bootstrap":"^4.6.1","bootstrap.native":"^3.0.15","fedep":"^1.1.7","ldbutton":"^2.0.1","ldfile":"^2.0.0","ldiconfont":"^0.2.3","ldloader":"^3.0.1","ldview":"^1.2.1","livescript":"^1.6.0","pdmaptw":"2.1.0","uglify-js":"^3.13.1","uglifycss":"^0.0.29","zmgr":"^2.2.3"},"frontendDependencies":{"root":"web/static/assets/lib","modules":["bootstrap","bootstrap.native","@loadingio/bootstrap.ext","@loadingio/ldquery","@loadingio/loading.css","@loadingio/ldcolorpicker","@loadingio/debounce.js","@loadingio/vscroll","@plotdb/pdmap-world","@plotdb/block","@plotdb/csscope","@plotdb/rescope","@plotdb/layout","@plotdb/sheet","@plotdb/konfig","@plotdb/semver","@xlfont/choose","@xlfont/load","@zbryikt/voronoijs","d3","d3-array","d3-axis","d3-brush","d3-color","d3-dispatch","d3-drag","d3-ease","d3-force","d3-force-boundary","d3-format","d3-hierarchy","d3-interpolate","d3-path","d3-quadtree","d3-random","d3-scale-chromatic","d3-selection","d3-shape","d3-timer","d3-transition","choosefont.js","pdmaptw","proxise","ldiconfont","ldloader","ldbutton","ldcover","ldcolor","ldfile","ldslider","wrap-svg-text","ldpalettepicker","zmgr","ldview"]},"dependencies":{"@loadingio/debounce.js":"^1.0.1","@loadingio/ldcolorpicker":"^3.0.0","@plotdb/block":"^4.7.1","@plotdb/csscope":"^4.0.6","@plotdb/konfig":"^4.7.2","@plotdb/rescope":"^4.1.6","@zbryikt/voronoijs":"^1.0.0","choosefont.js":"^0.0.1","d3":"^4.13.0","d3-array":"^3.1.1","d3-axis":"^3.0.0","d3-brush":"^3.0.0","d3-color":"^3.1.0","d3-dispatch":"^3.0.1","d3-drag":"^3.0.0","d3-ease":"^3.0.1","d3-force":"^3.0.0","d3-force-boundary":"^0.0.2","d3-format":"^3.1.0","d3-hierarchy":"^3.1.1","d3-interpolate":"^3.0.1","d3-path":"^3.0.1","d3-quadtree":"^3.0.1","d3-random":"^3.0.1","d3-scale-chromatic":"^3.0.0","d3-selection":"^3.0.0","d3-shape":"^3.1.0","d3-timer":"^3.0.1","d3-transition":"^3.0.1","ldcolor":"^1.0.0","ldcover":"^3.2.1","ldpalettepicker":"^4.0.1","ldslider":"^3.1.1","proxise":"^1.0.1","wrap-svg-text":"^0.0.7"}}
|
package/utils/tint.js
CHANGED
|
@@ -14,10 +14,14 @@
|
|
|
14
14
|
};
|
|
15
15
|
tint['default'] = ['#e15c64', '#f7b26a', '#f3ed9d', '#a4bd81', '#a0d7d2', '#8db1da', '#daaedb'];
|
|
16
16
|
tint.prototype = import$(Object.create(Object.prototype), {
|
|
17
|
-
set: function(pal
|
|
18
|
-
var ref$, this$ = this;
|
|
17
|
+
set: function(pal){
|
|
18
|
+
var key, reset, ref$, this$ = this;
|
|
19
19
|
pal == null && (pal = []);
|
|
20
|
-
|
|
20
|
+
key = pal.key || pal.name;
|
|
21
|
+
if (!(typeof reset != 'undefined' && reset !== null)) {
|
|
22
|
+
reset = key != null && this.key !== key ? true : false;
|
|
23
|
+
}
|
|
24
|
+
this.key = key;
|
|
21
25
|
this.colors = Array.isArray(pal) && pal.length
|
|
22
26
|
? pal
|
|
23
27
|
: pal.colors && Array.isArray(pal.colors)
|
package/utils/tint.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(){var r;(r=function(t){return this.isUnique=null==(t=null==t?{}:t).unique||t.unique,this.map={},this.nmap=[],this.wm=new WeakMap,this.count=0,this._ext=t.extent||[0,1],this.set(t.palette)||t.colors,this.mode(t.mode),this}).default=["#e15c64","#f7b26a","#f3ed9d","#a4bd81","#a0d7d2","#8db1da","#daaedb"],r.prototype=function(t,n){var s,
|
|
1
|
+
!function(){var r;(r=function(t){return this.isUnique=null==(t=null==t?{}:t).unique||t.unique,this.map={},this.nmap=[],this.wm=new WeakMap,this.count=0,this._ext=t.extent||[0,1],this.set(t.palette)||t.colors,this.mode(t.mode),this}).default=["#e15c64","#f7b26a","#f3ed9d","#a4bd81","#a0d7d2","#8db1da","#daaedb"],r.prototype=function(t,n){var s,i={}.hasOwnProperty;for(s in n)i.call(n,s)&&(t[s]=n[s]);return t}(Object.create(Object.prototype),{set:function(t){var n,s=this,i=(t=null==t?[]:t).key||t.name;return null==n&&(n=null!=i&&this.key!==i),this.key=i,this.colors=Array.isArray(t)&&t.length?t:t.colors&&Array.isArray(t.colors)?t.colors:r.default,this.nmap=t.maps||[],this.tags=this.colors.map(function(t){return t.tag||[]}),this.colors=this.colors.map(function(t){return t.value||t}),1===this.colors.length&&this.colors.push(ldcolor.complement(this.colors[0])),this.colors=this.colors.map(function(t){return ldcolor.hsl(t)}),this.len=2<(t=this.colors.length)?t:2,n?this.reset():this.nmap.map(function(t,n){return(Array.isArray(t)?t:[t]).map(function(t){return s.get(t,0,n)})}),this.tags.map(function(t,n){return t.map(function(t){return s.get(t,0,n)})})},unique:function(t){return null!=t?this.isUnique=!!t:this.isUnique},reset:function(){var s=this;return this.map={},this.wm=new WeakMap,this.count=0,(this.nmap||[]).map(function(t,n){return(Array.isArray(t)?t:[t]).map(function(t){return s.get(t,0,n)})})},mode:function(t){return 0===arguments.length?this._m:this._m=t},extent:function(t){return 0===arguments.length?this._ext:(this._ext=t.map(function(t){return null!=t?t:0}),this._ext.sort(function(t,n){return t-n}))},get:function(t,n,s){switch(null==n&&(n=0),this._m){case 1:return this._vd(t,n);case 2:return this._vc(t,n);case 3:return this._vs(t,n);default:return this._d(t,n,s)}},_v:function(t,n){return 0<n?t=ldcolor.lighter(t,n):n<0&&(t=ldcolor.darker(t,-n)),ldcolor.web(t)},_d:function(t,n,s){var i,r,e,o,h,l,u,c;if(null==n&&(n=0),null!=s?(this.count<s&&(this.count=s+1),i=s%this.len,"object"==typeof t?this.wm.set(t,i):this.map[t]=i):("object"==typeof t?null==(i=this.wm.get(t))&&this.wm.set(t,i=this.count++):null==(i=this.map[t])&&(this.map[t]=i=this.count++),this.isUnique||(i%=this.len)),i>=this.len){for(c=i%(this.len-1),r=Math.floor(i/(this.len-1)),o=(e=[0,1])[0],h=e[1];0<r;)o=(e=[2*o,2*h])[0],h=e[1],r%2&&(o+=1),r>>=1;r=o/h,e=[this.colors[c],this.colors[1+c]],l=e[0],u=e[1],c={h:(e=["h","s","l"].map(function(t){return r*(u[t]-l[t])+l[t]}))[0],s:e[1],l:e[2]}}else c=this.colors[i];return this._v(c,n)},_vs:function(t,n){for(var s,i,r,e=this._ext||[0,1],o=-1,h=0,l=e.length-1;h<l;++h)if(!(t>=e[(s=h)+1])){o=s;break}return-1===o&&(o=e.length),this._v(this.colors[(i=0<o?o:0)<(r=this.colors.length-1)?i:r],n)},_vd:function(t,n){var s,i=this._ext||[0,1],i=(t=0<(s=(t-i[0])/(i[1]-i[0]||1))?s:0)<1?t:1;return this._v(this.colors[Math.floor((t=i*(this.len||1))<(s=this.len-1)?t:s)],n)},_vc:function(t,n){var s,i,r,e=this._ext||[0,1],t=((o=0<(h=(t-e[0])/(e[1]-e[0]||1))?h:0)<1?o:1)*(0<(o=this.len-1)?o:0),o=t==this.len-1?[0<(o=this.len-2)?o:0,0<(o=this.len-1)?o:0]:[Math.floor(t),Math.floor(t)+1],e=o[0],h=o[1];return o=[this.colors[e],this.colors[h]],s=o[0],i=o[1],r=t-e,t=(o=["h","s","l"].map(function(t){return r*(i[t]-s[t])+s[t]}))[0],e=o[1],o=o[2],this._v({h:t,s:e,l:o},n)},text:function(t,n){return null==n&&(n={}),t=ldcolor.hcl(this.get(t)),ldcolor.web(50<t.l?n.textDark||"#000":n.textLight||"#fff")}}),r.mode={ordinal:0,discrete:1,continuous:2,ranges:3},"undefined"!=typeof chart&&null!==chart&&((chart.utils||(chart.utils={})).tint=r)}.call(this);
|