@d3plus/dom 3.0.9 → 3.0.10
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/es/src/date.js +2 -0
- package/package.json +1 -1
- package/umd/d3plus-dom.full.js +3 -1
- package/umd/d3plus-dom.full.js.map +1 -1
- package/umd/d3plus-dom.full.min.js +48 -48
- package/umd/d3plus-dom.js +3 -1
- package/umd/d3plus-dom.js.map +1 -1
- package/umd/d3plus-dom.min.js +2 -2
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/*
|
|
2
|
-
@d3plus/dom v3.0.
|
|
2
|
+
@d3plus/dom v3.0.10
|
|
3
3
|
JavaScript functions for manipulating and analyzing DOM elements.
|
|
4
4
|
Copyright (c) 2025 D3plus - https://d3plus.org
|
|
5
5
|
@license MIT
|
|
6
6
|
*/
|
|
7
|
-
(t=>{"function"==typeof define&&define.amd?define(t):t()})(function(){if("undefined"!=typeof window){try{if("undefined"==typeof SVGElement||Boolean(SVGElement.prototype.innerHTML))return}catch(t){return}function r(t){switch(t.nodeType){case 1:var
|
|
7
|
+
(t=>{"function"==typeof define&&define.amd?define(t):t()})(function(){if("undefined"!=typeof window){try{if("undefined"==typeof SVGElement||Boolean(SVGElement.prototype.innerHTML))return}catch(t){return}function r(t){switch(t.nodeType){case 1:var e=t,n="";return n+="<"+e.tagName,e.hasAttributes()&&[].forEach.call(e.attributes,function(t){n+=" "+t.name+'="'+t.value+'"'}),n+=">",e.hasChildNodes()&&[].forEach.call(e.childNodes,function(t){n+=r(t)}),n+="</"+e.tagName+">";case 3:return t.textContent.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">");case 8:return"\x3c!--"+t.nodeValue+"--\x3e"}}Object.defineProperty(SVGElement.prototype,"innerHTML",{get:function(){var e="";return[].forEach.call(this.childNodes,function(t){e+=r(t)}),e},set:function(t){for(;this.firstChild;)this.removeChild(this.firstChild);try{var e=new DOMParser,n=(e.async=!1,"<svg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink'>"+t+"</svg>"),r=e.parseFromString(n,"text/xml").documentElement;[].forEach.call(r.childNodes,function(t){this.appendChild(this.ownerDocument.importNode(t,!0))}.bind(this))}catch(t){throw new Error("Error parsing markup string")}}}),Object.defineProperty(SVGElement.prototype,"innerSVG",{get:function(){return this.innerHTML},set:function(t){this.innerHTML=t}})}}),((t,e)=>{"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define("@d3plus/dom",["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).d3plus={})})(this,function(t){
|
|
8
8
|
/**
|
|
9
9
|
@function isObject
|
|
10
10
|
@desc Detects if a variable is a javascript Object.
|
|
@@ -21,37 +21,37 @@
|
|
|
21
21
|
@desc Applies each key/value in an object as an attr.
|
|
22
22
|
@param {D3selection} elem The D3 element to apply the styles to.
|
|
23
23
|
@param {Object} attrs An object of key/value attr pairs.
|
|
24
|
-
*/function u(t,
|
|
24
|
+
*/function u(t,e={}){for(var n in e)!{}.hasOwnProperty.call(e,n)||t.attr(n,e[n])}
|
|
25
25
|
/**
|
|
26
26
|
@function date
|
|
27
27
|
@summary Parses numbers and strings to valid Javascript Date objects.
|
|
28
28
|
@description Returns a javascript Date object for a given a Number (representing either a 4-digit year or milliseconds since epoch), a String representing a Quarter (ie. "Q2 1987", mapping to the last day in that quarter), or a String that is in [valid dateString format](http://dygraphs.com/date-formats.html). Besides the 4-digit year parsing, this function is useful when needing to parse negative (BC) years, which the vanilla Date object cannot parse.
|
|
29
29
|
@param {Number|String} *date*
|
|
30
|
-
*/var j="http://www.w3.org/1999/xhtml",z={svg:"http://www.w3.org/2000/svg",xhtml:j,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function i(t){var
|
|
31
|
-
}function F(t){t=i(t);return(t.local?function(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}:function(
|
|
30
|
+
*/var j="http://www.w3.org/1999/xhtml",z={svg:"http://www.w3.org/2000/svg",xhtml:j,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function i(t){var e=t+="",n=e.indexOf(":");return 0<=n&&"xmlns"!==(e=t.slice(0,n))&&(t=t.slice(n+1)),z.hasOwnProperty(e)?{space:z[e],local:t}:t;// eslint-disable-line no-prototype-builtins
|
|
31
|
+
}function F(t){t=i(t);return(t.local?function(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}:function(n){return function(){var t=this.ownerDocument,e=this.namespaceURI;return e===j&&t.documentElement.namespaceURI===j?t.createElement(n):t.createElementNS(e,n)}})(t)}function R(){}function H(t){return null==t?R:function(){return this.querySelector(t)}}function L(){return[]}function X(t){return null==t?L:function(){return this.querySelectorAll(t)}}function Y(e){return function(){return null==(t=e.apply(this,arguments))?[]:Array.isArray(t)?t:Array.from(t);
|
|
32
32
|
// Given something array like (or null), returns something that is strictly an
|
|
33
33
|
// array. This is used to ensure that array-like objects passed to d3.selectAll
|
|
34
34
|
// or selection.selectAll are converted into proper arrays when creating a
|
|
35
35
|
// selection; we don’t ever want to create a selection backed by a live
|
|
36
36
|
// HTMLCollection or NodeList. However, note that selection.selectAll will use a
|
|
37
37
|
// static NodeList as a group, since it safely derived from querySelectorAll.
|
|
38
|
-
var t}}function V(t){return function(){return this.matches(t)}}function I(
|
|
38
|
+
var t}}function V(t){return function(){return this.matches(t)}}function I(e){return function(t){return t.matches(e)}}var B=Array.prototype.find;function G(){return this.firstElementChild}var U=Array.prototype.filter;function Q(){return Array.from(this.children)}function W(t){return new Array(t.length)}function d(t,e){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=e}function K(t,e,n,r,i,o){
|
|
39
39
|
// Put any non-null nodes that fit into update.
|
|
40
40
|
// Put any null nodes into enter.
|
|
41
41
|
// Put any remaining data into enter.
|
|
42
|
-
for(var a,u=0,s=
|
|
42
|
+
for(var a,u=0,s=e.length,l=o.length;u<l;++u)(a=e[u])?(a.__data__=o[u],r[u]=a):n[u]=new d(t,o[u]);
|
|
43
43
|
// Put any non-null nodes that don’t fit into exit.
|
|
44
|
-
for(;u<s;++u)(a=
|
|
44
|
+
for(;u<s;++u)(a=e[u])&&(i[u]=a)}function Z(t,e,n,r,i,o,a){
|
|
45
45
|
// Compute the key for each node.
|
|
46
46
|
// If multiple nodes have the same key, the duplicates are added to exit.
|
|
47
|
-
for(var u,s,l=new Map,c=
|
|
47
|
+
for(var u,s,l=new Map,c=e.length,h=o.length,f=new Array(c),p=0;p<c;++p)(u=e[p])&&(f[p]=s=a.call(u,u.__data__,p,e)+"",l.has(s)?i[p]=u:l.set(s,u));
|
|
48
48
|
// Compute the key for each datum.
|
|
49
49
|
// If there a node associated with this key, join and add it to update.
|
|
50
50
|
// If there is not (or the key is a duplicate), add it to enter.
|
|
51
|
-
for(p=0;p<h;++p)s=a.call(t,o[p],p,o)+"",(u=l.get(s))?((r[p]=u).__data__=o[p],l.delete(s)):
|
|
51
|
+
for(p=0;p<h;++p)s=a.call(t,o[p],p,o)+"",(u=l.get(s))?((r[p]=u).__data__=o[p],l.delete(s)):n[p]=new d(t,o[p]);
|
|
52
52
|
// Add any remaining nodes that were not bound to data to exit.
|
|
53
|
-
for(p=0;p<c;++p)(u=
|
|
54
|
-
}function
|
|
53
|
+
for(p=0;p<c;++p)(u=e[p])&&l.get(f[p])===u&&(i[p]=u)}function J(t){return t.__data__}function tt(t,e){return t<e?-1:e<t?1:e<=t?0:NaN}function et(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView;// node is a Document
|
|
54
|
+
}function M(t,e){return t.style.getPropertyValue(e)||et(t).getComputedStyle(t,null).getPropertyValue(e)}function nt(t){return t.trim().split(/^|\s+/)}function rt(t){return t.classList||new it(t)}function it(t){this._node=t,this._names=nt(t.getAttribute("class")||"")}function ot(t,e){for(var n=rt(t),r=-1,i=e.length;++r<i;)n.add(e[r])}function at(t,e){for(var n=rt(t),r=-1,i=e.length;++r<i;)n.remove(e[r])}function ut(){this.textContent=""}function st(){this.innerHTML=""}function lt(){this.nextSibling&&this.parentNode.appendChild(this)}function ct(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function ht(){return null}function ft(){var t=this.parentNode;t&&t.removeChild(this)}function pt(){var t=this.cloneNode(!1),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function dt(){var t=this.cloneNode(!0),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function yt(o){return function(){var t=this.__on;if(t){for(var e,n=0,r=-1,i=t.length;n<i;++n)e=t[n],o.type&&e.type!==o.type||e.name!==o.name?t[++r]=e:this.removeEventListener(e.type,e.listener,e.options);++r?t.length=r:delete this.__on}}}function gt(a,u,s){return function(){function t(t){n.call(this,t,this.__data__)}var e,n,r=this.__on;n=u;if(r)for(var i=0,o=r.length;i<o;++i)if((e=r[i]).type===a.type&&e.name===a.name)return this.removeEventListener(e.type,e.listener,e.options),this.addEventListener(e.type,e.listener=t,e.options=s),void(e.value=u);this.addEventListener(a.type,t,s),e={type:a.type,name:a.name,value:u,listener:t,options:s},r?r.push(e):this.__on=[e]}}function mt(t,e,n){var r=et(t),i=r.CustomEvent;"function"==typeof i?i=new i(e,n):(i=r.document.createEvent("Event"),n?(i.initEvent(e,n.bubbles,n.cancelable),i.detail=n.detail):i.initEvent(e,!1,!1)),t.dispatchEvent(i)}d.prototype={constructor:d,appendChild:function(t){return this._parent.insertBefore(t,this._next)},insertBefore:function(t,e){return this._parent.insertBefore(t,e)},querySelector:function(t){return this._parent.querySelector(t)},querySelectorAll:function(t){return this._parent.querySelectorAll(t)}},it.prototype={add:function(t){this._names.indexOf(t)<0&&(this._names.push(t),this._node.setAttribute("class",this._names.join(" ")))},remove:function(t){t=this._names.indexOf(t);0<=t&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return 0<=this._names.indexOf(t)}};var wt=[null];function x(t,e){this._groups=t,this._parents=e}function e(){return new x([[document.documentElement]],wt)}function s(t){return"string"==typeof t?new x([[document.querySelector(t)]],[document.documentElement]):new x([[t]],wt)}x.prototype=e.prototype={constructor:x,select:function(t){"function"!=typeof t&&(t=H(t));for(var e=this._groups,n=e.length,r=new Array(n),i=0;i<n;++i)for(var o,a,u=e[i],s=u.length,l=r[i]=new Array(s),c=0;c<s;++c)(o=u[c])&&(a=t.call(o,o.__data__,c,u))&&("__data__"in o&&(a.__data__=o.__data__),l[c]=a);return new x(r,this._parents)},selectAll:function(t){t=("function"==typeof t?Y:X)(t);for(var e=this._groups,n=e.length,r=[],i=[],o=0;o<n;++o)for(var a,u=e[o],s=u.length,l=0;l<s;++l)(a=u[l])&&(r.push(t.call(a,a.__data__,l,u)),i.push(a));return new x(r,i)},selectChild:function(t){return this.select(null==t?G:(e="function"==typeof t?t:I(t),function(){return B.call(this.children,e)}));var e},selectChildren:function(t){return this.selectAll(null==t?Q:(e="function"==typeof t?t:I(t),function(){return U.call(this.children,e)}));var e},filter:function(t){"function"!=typeof t&&(t=V(t));for(var e=this._groups,n=e.length,r=new Array(n),i=0;i<n;++i)for(var o,a=e[i],u=a.length,s=r[i]=[],l=0;l<u;++l)(o=a[l])&&t.call(o,o.__data__,l,a)&&s.push(o);return new x(r,this._parents)},data:function(t,e){if(!arguments.length)return Array.from(this,J);var n,r=e?Z:K,i=this._parents,o=this._groups;"function"!=typeof t&&(n=t,t=function(){return n});for(var a=o.length,u=new Array(a),s=new Array(a),l=new Array(a),c=0;c<a;++c){var h=i[c],f=o[c],p=f.length,d="object"==typeof(d=t.call(h,h&&h.__data__,c,i))&&"length"in d?d:Array.from(d),y=d.length,g=s[c]=new Array(y),m=u[c]=new Array(y);r(h,f,g,m,l[c]=new Array(p),d,e);
|
|
55
55
|
// Now connect the enter nodes to their following update node, such that
|
|
56
56
|
// appendChild can insert the materialized enter node before this node,
|
|
57
57
|
// rather than at the end of the parent node.
|
|
@@ -62,25 +62,25 @@ for(var w,v,_=0,b=0;_<y;++_)if(w=g[_]){for(b<=_&&(b=_+1);!(v=m[b])&&++b<y;);w._n
|
|
|
62
62
|
// array will only be used briefly while data is being bound. (It is possible to
|
|
63
63
|
// cause the data to change while iterating by using a key function, but please
|
|
64
64
|
// don’t; we’d rather avoid a gratuitous copy.)
|
|
65
|
-
,enter:function(){return new x(this._enter||this._groups.map(W),this._parents)},exit:function(){return new x(this._exit||this._groups.map(W),this._parents)},join:function(t,n
|
|
66
|
-
return t},empty:function(){return!this.node()},each:function(t){for(var
|
|
65
|
+
,enter:function(){return new x(this._enter||this._groups.map(W),this._parents)},exit:function(){return new x(this._exit||this._groups.map(W),this._parents)},join:function(t,e,n){var r=this.enter(),i=this,o=this.exit(),r="function"==typeof t?(r=t(r))&&r.selection():r.append(t+"");return null!=e&&(i=(i=e(i))&&i.selection()),null==n?o.remove():n(o),r&&i?r.merge(i).order():i},merge:function(t){for(var t=t.selection?t.selection():t,e=this._groups,n=t._groups,r=e.length,t=n.length,i=Math.min(r,t),o=new Array(r),a=0;a<i;++a)for(var u,s=e[a],l=n[a],c=s.length,h=o[a]=new Array(c),f=0;f<c;++f)(u=s[f]||l[f])&&(h[f]=u);for(;a<r;++a)o[a]=e[a];return new x(o,this._parents)},selection:function(){return this},order:function(){for(var t=this._groups,e=-1,n=t.length;++e<n;)for(var r,i=t[e],o=i.length-1,a=i[o];0<=--o;)(r=i[o])&&(a&&4^r.compareDocumentPosition(a)&&a.parentNode.insertBefore(r,a),a=r);return this},sort:function(n){function t(t,e){return t&&e?n(t.__data__,e.__data__):!t-!e}n=n||tt;for(var e=this._groups,r=e.length,i=new Array(r),o=0;o<r;++o){for(var a,u=e[o],s=u.length,l=i[o]=new Array(s),c=0;c<s;++c)(a=u[c])&&(l[c]=a);l.sort(t)}return new x(i,this._parents).order()},call:function(){var t=arguments[0];return arguments[0]=this,t.apply(null,arguments),this},nodes:function(){return Array.from(this)},node:function(){for(var t=this._groups,e=0,n=t.length;e<n;++e)for(var r=t[e],i=0,o=r.length;i<o;++i){var a=r[i];if(a)return a}return null},size:function(){let t=0;for(var e of this)++t;// eslint-disable-line no-unused-vars
|
|
66
|
+
return t},empty:function(){return!this.node()},each:function(t){for(var e=this._groups,n=0,r=e.length;n<r;++n)for(var i,o=e[n],a=0,u=o.length;a<u;++a)(i=o[a])&&t.call(i,i.__data__,a,o);return this},attr:function(t,e){var n,t=i(t);return arguments.length<2?(n=this.node(),t.local?n.getAttributeNS(t.space,t.local):n.getAttribute(t)):this.each((null==e?t.local?function(t){return function(){this.removeAttributeNS(t.space,t.local)}}:function(t){return function(){this.removeAttribute(t)}}:"function"==typeof e?t.local?function(e,n){return function(){var t=n.apply(this,arguments);null==t?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,t)}}:function(e,n){return function(){var t=n.apply(this,arguments);null==t?this.removeAttribute(e):this.setAttribute(e,t)}}:t.local?function(t,e){return function(){this.setAttributeNS(t.space,t.local,e)}}:function(t,e){return function(){this.setAttribute(t,e)}})(t,e))},style:function(t,e,n){return 1<arguments.length?this.each((null==e?function(t){return function(){this.style.removeProperty(t)}}:"function"==typeof e?function(e,n,r){return function(){var t=n.apply(this,arguments);null==t?this.style.removeProperty(e):this.style.setProperty(e,t,r)}}:function(t,e,n){return function(){this.style.setProperty(t,e,n)}})(t,e,null==n?"":n)):M(this.node(),t)},property:function(t,e){return 1<arguments.length?this.each((null==e?function(t){return function(){delete this[t]}}:"function"==typeof e?function(e,n){return function(){var t=n.apply(this,arguments);null==t?delete this[e]:this[e]=t}}:function(t,e){return function(){this[t]=e}})(t,e)):this.node()[t]},classed:function(t,e){var n=nt(t+"");if(arguments.length<2){for(var r=rt(this.node()),i=-1,o=n.length;++i<o;)if(!r.contains(n[i]))return!1;return!0}return this.each(("function"==typeof e?function(t,e){return function(){(e.apply(this,arguments)?ot:at)(this,t)}}:e?function(t){return function(){ot(this,t)}}:function(t){return function(){at(this,t)}})(n,e))},text:function(t){return arguments.length?this.each(null==t?ut:("function"==typeof t?function(e){return function(){var t=e.apply(this,arguments);this.textContent=null==t?"":t}}:function(t){return function(){this.textContent=t}})(t)):this.node().textContent},html:function(t){return arguments.length?this.each(null==t?st:("function"==typeof t?function(e){return function(){var t=e.apply(this,arguments);this.innerHTML=null==t?"":t}}:function(t){return function(){this.innerHTML=t}})(t)):this.node().innerHTML},raise:function(){return this.each(lt)},lower:function(){return this.each(ct)},append:function(t){var e="function"==typeof t?t:F(t);return this.select(function(){return this.appendChild(e.apply(this,arguments))})},insert:function(t,e){var n="function"==typeof t?t:F(t),r=null==e?ht:"function"==typeof e?e:H(e);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})},remove:function(){return this.each(ft)},clone:function(t){return this.select(t?dt:pt)},datum:function(t){return arguments.length?this.property("__data__",t):this.node().__data__},on:function(t,e,n){var r,i,o=(t+"").trim().split(/^|\s+/).map(function(t){var e="",n=t.indexOf(".");return 0<=n&&(e=t.slice(n+1),t=t.slice(0,n)),{type:t,name:e}}),a=o.length;if(!(arguments.length<2)){for(u=e?gt:yt,r=0;r<a;++r)this.each(u(o[r],e,n));return this}var u=this.node().__on;if(u)for(var s,l=0,c=u.length;l<c;++l)for(r=0,s=u[l];r<a;++r)if((i=o[r]).type===s.type&&i.name===s.name)return s.value},dispatch:function(t,e){return this.each(("function"==typeof e?function(t,e){return function(){return mt(this,t,e.apply(this,arguments))}}:function(t,e){return function(){return mt(this,t,e)}})(t,e))},[Symbol.iterator]:function*(){for(var t=this._groups,e=0,n=t.length;e<n;++e)for(var r,i=t[e],o=0,a=i.length;o<a;++o)(r=i[o])&&(yield r)}};var vt={value:()=>{}};function _t(){for(var t,e=0,n=arguments.length,r={};e<n;++e){if(!(t=arguments[e]+"")||t in r||/[\s.]/.test(t))throw new Error("illegal type: "+t);r[t]=[]}return new o(r)}function o(t){this._=t}function bt(t,e,n){for(var r=0,i=t.length;r<i;++r)if(t[r].name===e){t[r]=vt,t=t.slice(0,r).concat(t.slice(r+1));break}return null!=n&&t.push({name:e,value:n}),t}o.prototype=_t.prototype={constructor:o,on:function(t,e){var n,r,i=this._,o=(r=i,(t+"").trim().split(/^|\s+/).map(function(t){var e="",n=t.indexOf(".");if(0<=n&&(e=t.slice(n+1),t=t.slice(0,n)),t&&!r.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:e}})),a=-1,u=o.length;
|
|
67
67
|
// If no callback was specified, return the callback of the given type and name.
|
|
68
68
|
if(!(arguments.length<2)){
|
|
69
69
|
// If a type was specified, set the callback for the given type and name.
|
|
70
70
|
// Otherwise, if a null callback was specified, remove callbacks of the given name.
|
|
71
|
-
if(null!=
|
|
71
|
+
if(null!=e&&"function"!=typeof e)throw new Error("invalid callback: "+e);for(;++a<u;)if(n=(t=o[a]).type)i[n]=bt(i[n],t.name,e);else if(null==e)for(n in i)i[n]=bt(i[n],t.name,null);return this}for(;++a<u;)if(n=(n=(t=o[a]).type)&&((t,e)=>{for(var n,r=0,i=t.length;r<i;++r)if((n=t[r]).name===e)return n.value})(i[n],t.name))return n},copy:function(){var t,e={},n=this._;for(t in n)e[t]=n[t].slice();return new o(e)},call:function(t,e){if(0<(n=arguments.length-2))for(var n,r,i=new Array(n),o=0;o<n;++o)i[o]=arguments[o+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(o=0,n=(r=this._[t]).length;o<n;++o)r[o].value.apply(e,i)},apply:function(t,e,n){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var r=this._[t],i=0,o=r.length;i<o;++i)r[i].value.apply(e,n)}};var l,c,h=0,f=0,n=0,xt=1e3,p=0,y=0,g=0,m="object"==typeof performance&&performance.now?performance:Date,At="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function Et(){return y||(At(Nt),y=m.now()+g)}function Nt(){y=0}function w(){this._call=this._time=this._next=null}function kt(t,e,n){var r=new w;return r.restart(t,e,n),r}function St(){y=(p=m.now())+g,h=f=0;try{Et(),// Get the current time, if not already set.
|
|
72
72
|
++h;for(// Pretend we’ve set an alarm, if we haven’t already.
|
|
73
|
-
var t,
|
|
73
|
+
var t,e=l;e;)0<=(t=y-e._time)&&e._call.call(void 0,t),e=e._next;--h}finally{for(var n,r,i=l,o=1/(h=0);i;)i=i._call?(o>i._time&&(o=i._time),(n=i)._next):(r=i._next,i._next=null,n?n._next=r:l=r);c=n,Mt(o),y=0}}function $t(){var t=m.now(),e=t-p;xt<e&&(g-=e,p=t)}function Mt(t){h||(// Soonest alarm already set, or will be.
|
|
74
74
|
f=f&&clearTimeout(f),// Strictly less than if we recomputed clockNow.
|
|
75
|
-
24<t-y?(t<1/0&&(f=setTimeout(St,t-m.now()-g)),
|
|
75
|
+
24<t-y?(t<1/0&&(f=setTimeout(St,t-m.now()-g)),n=n&&clearInterval(n)):(n||(p=m.now(),n=setInterval($t,xt)),h=1,At(St)))}function Ot(e,n,t){var r=new w;return n=null==n?0:+n,r.restart(t=>{r.stop(),e(t+n)},n,t),r}w.prototype=kt.prototype={constructor:w,restart:function(t,e,n){if("function"!=typeof t)throw new TypeError("callback is not a function");n=(null==n?Et():+n)+(null==e?0:+e),this._next||c===this||(c?c._next=this:l=this,c=this),this._call=t,this._time=n,Mt()},stop:function(){this._call&&(this._call=null,this._time=1/0,Mt())}};var Ct=_t("start","end","cancel","interrupt"),Tt=[],Dt=0,qt=1,Pt=2,jt=3,zt=4,Ft=5,Rt=6;function Ht(t,e,n,r,i,o){var a,u,s,l,c,h=t.__transition;if(h){if(n in h)return}else t.__transition={};function f(t){var e,n,r,i;
|
|
76
76
|
// If the state is not SCHEDULED, then we previously errored on start.
|
|
77
|
-
if(s.state!==
|
|
77
|
+
if(s.state!==qt)return d();for(e in c)if((i=c[e]).name===s.name){
|
|
78
78
|
// While this element already has a starting transition during this frame,
|
|
79
79
|
// defer starting an interrupting transition until that transition has a
|
|
80
80
|
// chance to tick (and possibly end); see d3/d3-transition#54!
|
|
81
81
|
if(i.state===jt)return Ot(f);
|
|
82
82
|
// Interrupt the active transition, if any.
|
|
83
|
-
i.state===zt?(i.state=Rt,i.timer.stop(),i.on.call("interrupt",a,a.__data__,i.index,i.group),delete c[
|
|
83
|
+
i.state===zt?(i.state=Rt,i.timer.stop(),i.on.call("interrupt",a,a.__data__,i.index,i.group),delete c[e]):+e<u&&(i.state=Rt,i.timer.stop(),i.on.call("cancel",a,a.__data__,i.index,i.group),delete c[e])}
|
|
84
84
|
// Defer the first tick to end of the current frame; see d3/d3#1576.
|
|
85
85
|
// Note the transition may be canceled after start and before the first tick!
|
|
86
86
|
// Note this must be scheduled before the start event; see d3/d3-transition#16!
|
|
@@ -91,68 +91,68 @@ if(Ot(function(){s.state===jt&&(s.state=zt,s.timer.restart(p,s.delay,s.time),p(t
|
|
|
91
91
|
s.state=Pt,s.on.call("start",a,a.__data__,s.index,s.group),s.state===Pt){for(// interrupted
|
|
92
92
|
s.state=jt,
|
|
93
93
|
// Initialize the tween, deleting null tween.
|
|
94
|
-
l=new Array(r=s.tween.length),
|
|
94
|
+
l=new Array(r=s.tween.length),e=0,n=-1;e<r;++e)(i=s.tween[e].value.call(a,a.__data__,s.index,s.group))&&(l[++n]=i);l.length=n+1}}function p(t){for(var e=t<s.duration?s.ease.call(null,t/s.duration):(s.timer.restart(d),s.state=Ft,1),n=-1,r=l.length;++n<r;)l[n].call(a,e);
|
|
95
95
|
// Dispatch the end event.
|
|
96
96
|
s.state===Ft&&(s.on.call("end",a,a.__data__,s.index,s.group),d())}function d(){for(var t in s.state=Rt,s.timer.stop(),delete c[u],c)return;// eslint-disable-line no-unused-vars
|
|
97
|
-
delete a.__transition}a=t,u=
|
|
97
|
+
delete a.__transition}a=t,u=n,s={name:e,index:r,group:i,on:Ct,tween:Tt,time:o.time,delay:o.delay,duration:o.duration,ease:o.ease,timer:null,state:Dt},(
|
|
98
98
|
// Initialize the self timer when the transition is created.
|
|
99
99
|
// Note the actual delay is not known until the first callback!
|
|
100
|
-
(c=a.__transition)[u]=s).timer=kt(function(t){s.state=
|
|
100
|
+
(c=a.__transition)[u]=s).timer=kt(function(t){s.state=qt,s.timer.restart(f,s.delay,s.time),
|
|
101
101
|
// If the elapsed delay is less than our first sleep, start immediately.
|
|
102
|
-
s.delay<=t&&f(t-s.delay)},0,s.time)}function Lt(t,
|
|
103
|
-
/* From FvD 13.37, CSS Color Module Level 3 */function
|
|
102
|
+
s.delay<=t&&f(t-s.delay)},0,s.time)}function Lt(t,e){t=v(t,e);if(t.state>Dt)throw new Error("too late; already scheduled");return t}function O(t,e){t=v(t,e);if(t.state>jt)throw new Error("too late; already running");return t}function v(t,e){t=t.__transition;if(t=t&&t[e])return t;throw new Error("transition not found")}function Xt(t,e,n){(t.prototype=e.prototype=n).constructor=t}function Yt(t,e){var n,r=Object.create(t.prototype);for(n in e)r[n]=e[n];return r}function _(){}var r="\\s*([+-]?\\d+)\\s*",b="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",A="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Vt=/^#([0-9a-f]{3,8})$/,It=new RegExp(`^rgb\\(${r},${r},${r}\\)$`),Bt=new RegExp(`^rgb\\(${A},${A},${A}\\)$`),Gt=new RegExp(`^rgba\\(${r},${r},${r},${b}\\)$`),Ut=new RegExp(`^rgba\\(${A},${A},${A},${b}\\)$`),Qt=new RegExp(`^hsl\\(${b},${A},${A}\\)$`),Wt=new RegExp(`^hsla\\(${b},${A},${A},${b}\\)$`),Kt={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};function Zt(){return this.rgb().formatHex()}function Jt(){return this.rgb().formatRgb()}function E(t){var e,n;return t=(t+"").trim().toLowerCase(),(e=Vt.exec(t))?(n=e[1].length,e=parseInt(e[1],16),6===n?te(e):3===n?new N(e>>8&15|e>>4&240,e>>4&15|240&e,(15&e)<<4|15&e,1):8===n?ee(e>>24&255,e>>16&255,e>>8&255,(255&e)/255):4===n?ee(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|240&e,((15&e)<<4|15&e)/255):null):(e=It.exec(t))?new N(e[1],e[2],e[3],1):(e=Bt.exec(t))?new N(255*e[1]/100,255*e[2]/100,255*e[3]/100,1):(e=Gt.exec(t))?ee(e[1],e[2],e[3],e[4]):(e=Ut.exec(t))?ee(255*e[1]/100,255*e[2]/100,255*e[3]/100,e[4]):(e=Qt.exec(t))?ae(e[1],e[2]/100,e[3]/100,1):(e=Wt.exec(t))?ae(e[1],e[2]/100,e[3]/100,e[4]):Kt.hasOwnProperty(t)?te(Kt[t]):"transparent"===t?new N(NaN,NaN,NaN,0):null}function te(t){return new N(t>>16&255,t>>8&255,255&t,1)}function ee(t,e,n,r){return new N(t=r<=0?e=n=NaN:t,e,n,r)}function ne(t,e,n,r){return 1===arguments.length?(i=(i=t)instanceof _?i:E(i))?new N((i=i.rgb()).r,i.g,i.b,i.opacity):new N:new N(t,e,n,null==r?1:r);var i}function N(t,e,n,r){this.r=+t,this.g=+e,this.b=+n,this.opacity=+r}function re(){return"#"+S(this.r)+S(this.g)+S(this.b)}function ie(){var t=oe(this.opacity);return(1===t?"rgb(":"rgba(")+k(this.r)+`, ${k(this.g)}, `+k(this.b)+(1===t?")":`, ${t})`)}function oe(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function k(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function S(t){return((t=k(t))<16?"0":"")+t.toString(16)}function ae(t,e,n,r){return r<=0?t=e=n=NaN:n<=0||1<=n?t=e=NaN:e<=0&&(t=NaN),new $(t,e,n,r)}function ue(t){var e,n,r,i,o,a,u,s;return t instanceof $?new $(t.h,t.s,t.l,t.opacity):(t=t instanceof _?t:E(t))?t instanceof $?t:(e=(t=t.rgb()).r/255,n=t.g/255,r=t.b/255,i=Math.min(e,n,r),a=NaN,s=((o=Math.max(e,n,r))+i)/2,(u=o-i)?(a=e===o?(n-r)/u+6*(n<r):n===o?(r-e)/u+2:(e-n)/u+4,u/=s<.5?o+i:2-o-i,a*=60):u=0<s&&s<1?0:a,new $(a,u,s,t.opacity)):new $}function $(t,e,n,r){this.h=+t,this.s=+e,this.l=+n,this.opacity=+r}function se(t){return(t=(t||0)%360)<0?t+360:t}function le(t){return Math.max(0,Math.min(1,t||0))}
|
|
103
|
+
/* From FvD 13.37, CSS Color Module Level 3 */function ce(t,e,n){return 255*(t<60?e+(n-e)*t/60:t<180?n:t<240?e+(n-e)*(240-t)/60:e)}Xt(_,E,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:Zt,formatHex:Zt,formatHex8:function(){return this.rgb().formatHex8()},formatHsl:function(){return ue(this).formatHsl()},formatRgb:Jt,toString:Jt}),Xt(N,ne,Yt(_,{brighter(t){return t=null==t?1/.7:Math.pow(1/.7,t),new N(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=null==t?.7:Math.pow(.7,t),new N(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new N(k(this.r),k(this.g),k(this.b),oe(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:re,formatHex:re,formatHex8:function(){return"#"+S(this.r)+S(this.g)+S(this.b)+S(255*(isNaN(this.opacity)?1:this.opacity))},formatRgb:ie,toString:ie})),Xt($,function(t,e,n,r){return 1===arguments.length?ue(t):new $(t,e,n,null==r?1:r)},Yt(_,{brighter(t){return t=null==t?1/.7:Math.pow(1/.7,t),new $(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=null==t?.7:Math.pow(.7,t),new $(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=this.h%360+360*(this.h<0),e=isNaN(t)||isNaN(this.s)?0:this.s,n=this.l,e=n+(n<.5?n:1-n)*e,n=2*n-e;return new N(ce(240<=t?t-240:120+t,n,e),ce(t,n,e),ce(t<120?240+t:t-120,n,e),this.opacity)},clamp(){return new $(se(this.h),le(this.s),le(this.l),oe(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){var t=oe(this.opacity);return(1===t?"hsl(":"hsla(")+se(this.h)+`, ${100*le(this.s)}%, ${100*le(this.l)}%`+(1===t?")":`, ${t})`)}}));var he=t=>()=>t;function fe(o){return 1==(o=+o)?pe:function(t,e){return e-t?(n=t,r=e,i=o,n=Math.pow(n,i),r=Math.pow(r,i)-n,i=1/i,function(t){return Math.pow(n+t*r,i)}):he(isNaN(t)?e:t);var n,r,i}}function pe(t,e){var n,r,i=e-t;return i?(n=t,r=i,function(t){return n+t*r}):he(isNaN(t)?e:t)}var de=function t(e){var a=fe(e);function n(e,t){var n=a((e=ne(e)).r,(t=ne(t)).r),r=a(e.g,t.g),i=a(e.b,t.b),o=pe(e.opacity,t.opacity);return function(t){return e.r=n(t),e.g=r(t),e.b=i(t),e.opacity=o(t),e+""}}return n.gamma=t,n}(1);function C(e,n){return e=+e,n=+n,function(t){return e*(1-t)+n*t}}var ye=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,ge=new RegExp(ye.source,"g");var me,we=180/Math.PI,ve={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function _e(t,e,n,r,i,o){var a,u,s;return(a=Math.sqrt(t*t+e*e))&&(t/=a,e/=a),(s=t*n+e*r)&&(n-=t*s,r-=e*s),(u=Math.sqrt(n*n+r*r))&&(n/=u,r/=u,s/=u),t*r<e*n&&(t=-t,e=-e,s=-s,a=-a),{translateX:i,translateY:o,rotate:Math.atan2(e,t)*we,skewX:Math.atan(s)*we,scaleX:a,scaleY:u}}function be(f,p,d,y){function g(t){return t.length?t.pop()+" ":""}return function(t,e){var n,r,i,o,a,u,s,l,c=[],h=[];// number interpolators
|
|
104
104
|
// gc
|
|
105
|
-
return t=f(t),
|
|
106
|
-
|
|
107
|
-
/* eslint-disable no-undef */function(t){return(t=new("function"==typeof DOMMatrix?DOMMatrix:WebKitCSSMatrix)(t+"")).isIdentity?
|
|
105
|
+
return t=f(t),e=f(e),r=t.translateX,i=t.translateY,s=e.translateX,a=e.translateY,u=c,o=h,r!==s||i!==a?(n=u.push("translate(",null,p,null,d),o.push({i:n-4,x:C(r,s)},{i:n-2,x:C(i,a)})):(s||a)&&u.push("translate("+s+p+a+d),o=t.rotate,r=c,n=h,o!==(i=e.rotate)?(180<o-i?i+=360:180<i-o&&(o+=360),// shortest path
|
|
106
|
+
n.push({i:r.push(g(r)+"rotate(",null,y)-2,x:C(o,i)})):i&&r.push(g(r)+"rotate("+i+y),u=t.skewX,s=c,a=h,u!==(o=e.skewX)?a.push({i:s.push(g(s)+"skewX(",null,y)-2,x:C(u,o)}):o&&s.push(g(s)+"skewX("+o+y),r=t.scaleX,i=t.scaleY,a=e.scaleY,u=c,s=h,r!==(o=e.scaleX)||i!==a?(l=u.push(g(u)+"scale(",null,",",null,")"),s.push({i:l-4,x:C(r,o)},{i:l-2,x:C(i,a)})):1===o&&1===a||u.push(g(u)+"scale("+o+","+a+")"),t=e=null,function(t){for(var e,n=-1,r=h.length;++n<r;)c[(e=h[n]).i]=e.x(t);return c.join("")}}}var xe=be(
|
|
107
|
+
/* eslint-disable no-undef */function(t){return(t=new("function"==typeof DOMMatrix?DOMMatrix:WebKitCSSMatrix)(t+"")).isIdentity?ve:_e(t.a,t.b,t.c,t.d,t.e,t.f)},"px, ","px)","deg)"),Ae=be(function(t){return null!=t&&((me=me||document.createElementNS("http://www.w3.org/2000/svg","g")).setAttribute("transform",t),t=me.transform.baseVal.consolidate())?_e((t=t.matrix).a,t.b,t.c,t.d,t.e,t.f):ve},", ",")",")");function Ee(t,e,n){var r=t._id;return t.each(function(){var t=O(this,r);(t.value||(t.value={}))[e]=n.apply(this,arguments)}),function(t){return v(t,r).value[e]}}function Ne(t,e){var n;return("number"==typeof e?C:e instanceof E?de:(n=E(e))?(e=n,de):function(t,r){var e,n,i,o,a,u=ye.lastIndex=ge.lastIndex=0,s=-1,l=[],c=[];// number interpolators
|
|
108
108
|
// Coerce inputs to strings.
|
|
109
109
|
// Interpolate pairs of numbers in a & b.
|
|
110
|
-
for(t+="",r+="";(
|
|
110
|
+
for(t+="",r+="";(e=ye.exec(t))&&(n=ge.exec(r));)(i=n.index)>u&&(i=r.slice(u,i),l[s]?l[s]+=i:l[++s]=i),(e=e[0])===(n=n[0])?l[s]?l[s]+=n:l[++s]=n:(l[++s]=null,c.push({i:s,x:C(e,n)})),u=ge.lastIndex;
|
|
111
111
|
// Add remains of b.
|
|
112
112
|
// Special optimization for only a single match.
|
|
113
113
|
// Otherwise, interpolate each of the numbers and rejoin the string.
|
|
114
|
-
return u<r.length&&(i=r.slice(u),l[s]?l[s]+=i:l[++s]=i),l.length<2?c[0]?(a=c[0].x,function(t){return a(t)+""}):(o=r,function(){return o}):(r=c.length,function(t){for(var n
|
|
114
|
+
return u<r.length&&(i=r.slice(u),l[s]?l[s]+=i:l[++s]=i),l.length<2?c[0]?(a=c[0].x,function(t){return a(t)+""}):(o=r,function(){return o}):(r=c.length,function(t){for(var e,n=0;n<r;++n)l[(e=c[n]).i]=e.x(t);return l.join("")})})(t,e)}function ke(r,i){var o,a;function t(){var e,n,t=i.apply(this,arguments);return o=t!==a?(a=t)&&(e=r,n=t,function(t){this.setAttributeNS(e.space,e.local,n.call(this,t))}):o}return t._value=i,t}function Se(r,i){var o,a;function t(){var e,n,t=i.apply(this,arguments);return o=t!==a?(a=t)&&(e=r,n=t,function(t){this.setAttribute(e,n.call(this,t))}):o}return t._value=i,t}var $e=e.prototype.constructor;function Me(t){return function(){this.style.removeProperty(t)}}function Oe(i,o,a){var u,s;function t(){var e,n,r,t=o.apply(this,arguments);return u=t!==s?(s=t)&&(e=i,n=t,r=a,function(t){this.style.setProperty(e,n.call(this,t),r)}):u}return t._value=o,t}function Ce(n){var r,i;function t(){var e,t=n.apply(this,arguments);return r=t!==i?(i=t)&&(e=t,function(t){this.textContent=e.call(this,t)}):r}return t._value=n,t}var Te=0;function T(t,e,n,r){this._groups=t,this._parents=e,this._name=n,this._id=r}function De(t){return e().transition(t)}r=e.prototype;T.prototype=De.prototype={constructor:T,select:function(t){var e=this._name,n=this._id;"function"!=typeof t&&(t=H(t));for(var r=this._groups,i=r.length,o=new Array(i),a=0;a<i;++a)for(var u,s,l=r[a],c=l.length,h=o[a]=new Array(c),f=0;f<c;++f)(u=l[f])&&(s=t.call(u,u.__data__,f,l))&&("__data__"in u&&(s.__data__=u.__data__),h[f]=s,Ht(h[f],e,n,f,h,v(u,n)));return new T(o,this._parents,e,n)},selectAll:function(t){var e=this._name,n=this._id;"function"!=typeof t&&(t=X(t));for(var r=this._groups,i=r.length,o=[],a=[],u=0;u<i;++u)for(var s,l=r[u],c=l.length,h=0;h<c;++h)if(s=l[h]){for(var f,p=t.call(s,s.__data__,h,l),d=v(s,n),y=0,g=p.length;y<g;++y)(f=p[y])&&Ht(f,e,n,y,p,d);o.push(p),a.push(s)}return new T(o,a,e,n)},selectChild:r.selectChild,selectChildren:r.selectChildren,filter:function(t){"function"!=typeof t&&(t=V(t));for(var e=this._groups,n=e.length,r=new Array(n),i=0;i<n;++i)for(var o,a=e[i],u=a.length,s=r[i]=[],l=0;l<u;++l)(o=a[l])&&t.call(o,o.__data__,l,a)&&s.push(o);return new T(r,this._parents,this._name,this._id)},merge:function(t){if(t._id!==this._id)throw new Error;for(var e=this._groups,n=t._groups,r=e.length,t=n.length,i=Math.min(r,t),o=new Array(r),a=0;a<i;++a)for(var u,s=e[a],l=n[a],c=s.length,h=o[a]=new Array(c),f=0;f<c;++f)(u=s[f]||l[f])&&(h[f]=u);for(;a<r;++a)o[a]=e[a];return new T(o,this._parents,this._name,this._id)},selection:function(){return new $e(this._groups,this._parents)},transition:function(){for(var t=this._name,e=this._id,n=++Te,r=this._groups,i=r.length,o=0;o<i;++o)for(var a,u=r[o],s=u.length,l=0;l<s;++l)(a=u[l])&&Ht(a,t,n,l,u,{time:(a=v(a,e)).time+a.delay+a.duration,delay:0,duration:a.duration,ease:a.ease});return new T(r,this._parents,t,n)},call:r.call,nodes:r.nodes,node:r.node,size:r.size,empty:r.empty,each:r.each,on:function(t,e){var n,r,i,o,a,u,s=this._id;return arguments.length<2?v(this.node(),s).on.on(t):this.each((n=s,i=e,u=((r=t)+"").trim().split(/^|\s+/).every(function(t){var e=t.indexOf(".");return!(t=0<=e?t.slice(0,e):t)||"start"===t})?Lt:O,function(){var t=u(this,n),e=t.on;
|
|
115
115
|
// If this node shared a dispatch with the previous node,
|
|
116
116
|
// just assign the updated shared dispatch and we’re done!
|
|
117
117
|
// Otherwise, copy-on-write.
|
|
118
|
-
|
|
118
|
+
e!==o&&(a=(o=e).copy()).on(r,i),t.on=a}))},attr:function(t,e){var n=i(t),r="transform"===n?Ae:Ne;return this.attrTween(t,"function"==typeof e?(n.local?function(r,i,o){var a,u,s;return function(){var t,e,n=o(this);if(null!=n)return(t=this.getAttributeNS(r.space,r.local))===(e=n+"")?null:t===a&&e===u?s:(u=e,s=i(a=t,n));this.removeAttributeNS(r.space,r.local)}}:function(r,i,o){var a,u,s;return function(){var t,e,n=o(this);if(null!=n)return(t=this.getAttribute(r))===(e=n+"")?null:t===a&&e===u?s:(u=e,s=i(a=t,n));this.removeAttribute(r)}})(n,r,Ee(this,"attr."+t,e)):null==e?(n.local?function(t){return function(){this.removeAttributeNS(t.space,t.local)}}:function(t){return function(){this.removeAttribute(t)}})(n):(n.local?function(e,n,r){var i,o,a=r+"";return function(){var t=this.getAttributeNS(e.space,e.local);return t===a?null:t===i?o:o=n(i=t,r)}}:function(e,n,r){var i,o,a=r+"";return function(){var t=this.getAttribute(e);return t===a?null:t===i?o:o=n(i=t,r)}})(n,r,e))},attrTween:function(t,e){var n="attr."+t;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(null==e)return this.tween(n,null);if("function"!=typeof e)throw new Error;return t=i(t),this.tween(n,(t.local?ke:Se)(t,e))},style:function(t,e,n){var r,i,o,a,u,s,l,c,h,f,p,d,y,g,m,w,v,_,b,x,A,E,N,k,S,$="transform"==(t+="")?xe:Ne;return null==e?this.styleTween(t,(A=t,E=$,function(){var t=M(this,A),e=(this.style.removeProperty(A),M(this,A));return t===e?null:t===N&&e===k?S:S=E(N=t,k=e)})).on("end.style."+t,Me(t)):"function"==typeof e?this.styleTween(t,(w=$,v=Ee(this,"style."+(m=t),e),function(){var t=M(this,m),e=v(this),n=e+"";return null==e&&(this.style.removeProperty(m),n=e=M(this,m)),t===n?null:t===_&&n===b?x:(b=n,x=w(_=t,e))})).each((l=this._id,g="end."+(y="style."+(c=t)),function(){var t=O(this,l),e=t.on,n=null==t.value[y]?d=d||Me(c):void 0;
|
|
119
119
|
// If this node shared a dispatch with the previous node,
|
|
120
120
|
// just assign the updated shared dispatch and we’re done!
|
|
121
121
|
// Otherwise, copy-on-write.
|
|
122
|
-
|
|
122
|
+
e===h&&p===n||(f=(h=e).copy()).on(g,p=n),t.on=f})):this.styleTween(t,(r=t,i=$,s=(o=e)+"",function(){var t=M(this,r);return t===s?null:t===a?u:u=i(a=t,o)}),n).on("end.style."+t,null)},styleTween:function(t,e,n){var r="style."+(t+="");if(arguments.length<2)return(r=this.tween(r))&&r._value;if(null==e)return this.tween(r,null);if("function"!=typeof e)throw new Error;return this.tween(r,Oe(t,e,null==n?"":n))},text:function(t){return this.tween("text","function"==typeof t?(n=Ee(this,"text",t),function(){var t=n(this);this.textContent=null==t?"":t}):(e=null==t?"":t+"",function(){this.textContent=e}));var e,n},textTween:function(t){var e="text";if(arguments.length<1)return(e=this.tween(e))&&e._value;if(null==t)return this.tween(e,null);if("function"!=typeof t)throw new Error;return this.tween(e,Ce(t))},remove:function(){return this.on("end.remove",(n=this._id,function(){var t,e=this.parentNode;for(t in this.__transition)if(+t!==n)return;e&&e.removeChild(this)}));var n},tween:function(t,e){var n=this._id;if(t+="",arguments.length<2){for(var r,i=v(this.node(),n).tween,o=0,a=i.length;o<a;++o)if((r=i[o]).name===t)return r.value;return null}return this.each((null==e?function(i,o){var a,u;return function(){var t=O(this,i),e=t.tween;
|
|
123
123
|
// If this node shared tween with the previous node,
|
|
124
124
|
// just assign the updated shared tween and we’re done!
|
|
125
125
|
// Otherwise, copy-on-write.
|
|
126
|
-
if(
|
|
126
|
+
if(e!==a)for(var n=0,r=(u=a=e).length;n<r;++n)if(u[n].name===o){(u=u.slice()).splice(n,1);break}t.tween=u}}:function(o,a,u){var s,l;if("function"!=typeof u)throw new Error;return function(){var t=O(this,o),e=t.tween;
|
|
127
127
|
// If this node shared tween with the previous node,
|
|
128
128
|
// just assign the updated shared tween and we’re done!
|
|
129
129
|
// Otherwise, copy-on-write.
|
|
130
|
-
if(
|
|
130
|
+
if(e!==s){l=(s=e).slice();for(var n={name:a,value:u},r=0,i=l.length;r<i;++r)if(l[r].name===a){l[r]=n;break}r===i&&l.push(n)}t.tween=l}})(n,t,e))},delay:function(t){var e=this._id;return arguments.length?this.each(("function"==typeof t?function(t,e){return function(){Lt(this,t).delay=+e.apply(this,arguments)}}:function(t,e){return e=+e,function(){Lt(this,t).delay=e}})(e,t)):v(this.node(),e).delay},duration:function(t){var e=this._id;return arguments.length?this.each(("function"==typeof t?function(t,e){return function(){O(this,t).duration=+e.apply(this,arguments)}}:function(t,e){return e=+e,function(){O(this,t).duration=e}})(e,t)):v(this.node(),e).duration},ease:function(t){var e=this._id;return arguments.length?this.each(((t,e)=>{if("function"!=typeof e)throw new Error;return function(){O(this,t).ease=e}})(e,t)):v(this.node(),e).ease},easeVarying:function(t){if("function"!=typeof t)throw new Error;return this.each((e=this._id,n=t,function(){var t=n.apply(this,arguments);if("function"!=typeof t)throw new Error;O(this,e).ease=t}));var e,n},end:function(){var i,o,a=this,u=a._id,s=a.size();return new Promise(function(t,e){var n={value:e},r={value:function(){0==--s&&t()}};a.each(function(){var t=O(this,u),e=t.on;
|
|
131
131
|
// If this node shared a dispatch with the previous node,
|
|
132
132
|
// just assign the updated shared dispatch and we’re done!
|
|
133
133
|
// Otherwise, copy-on-write.
|
|
134
|
-
|
|
134
|
+
e!==i&&((o=(i=e).copy())._.cancel.push(n),o._.interrupt.push(n),o._.end.push(r)),t.on=o}),
|
|
135
135
|
// The selection was empty, resolve end immediately
|
|
136
|
-
0===s&&t()})},[Symbol.iterator]:r[Symbol.iterator]};var
|
|
136
|
+
0===s&&t()})},[Symbol.iterator]:r[Symbol.iterator]};var qe={time:null,delay:0,duration:250,ease:function(t){return((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2}};
|
|
137
137
|
/**
|
|
138
138
|
* Strips HTML and "un-escapes" escape characters.
|
|
139
139
|
* @param {String} input
|
|
140
|
-
*/function
|
|
140
|
+
*/function Pe(t){var e;return""!==t.replace(/\s+/g,"")&&(e=(new DOMParser).parseFromString(t.replace(/<[^>]+>/g,""),"text/html")).documentElement?e.documentElement.textContent:t}
|
|
141
141
|
/**
|
|
142
142
|
@function textWidth
|
|
143
143
|
@desc Given a text string, returns the predicted pixel width of the string when placed into DOM.
|
|
144
144
|
@param {String|Array} text Can be either a single string or an array of strings to analyze.
|
|
145
145
|
@param {Object} [style] An object of CSS font styles to apply. Accepts any of the valid [CSS font property](http://www.w3schools.com/cssref/pr_font_font.asp) values.
|
|
146
|
-
*/function
|
|
146
|
+
*/function D(t,e){e=Object.assign({"font-size":10,"font-family":"sans-serif","font-style":"normal","font-weight":400,"font-variant":"normal"},e);let n=document.createElement("canvas").getContext("2d");var r=[];return r.push(e["font-style"]),r.push(e["font-variant"]),r.push(e["font-weight"]),r.push("string"==typeof e["font-size"]?e["font-size"]:e["font-size"]+"px"),r.push(e["font-family"]),n.font=r.join(" "),t instanceof Array?t.map(t=>n.measureText(Pe(t)).width):n.measureText(Pe(t)).width}
|
|
147
147
|
/**
|
|
148
148
|
@function trim
|
|
149
149
|
@desc Cross-browser implementation of [trim](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/Trim).
|
|
150
150
|
@param {String} str
|
|
151
|
-
*/
|
|
151
|
+
*/e.prototype.interrupt=function(u){return this.each(function(){var t,e,n,r=this,i=u,o=r.__transition,a=!0;if(o){for(n in i=null==i?null:i+"",o)(t=o[n]).name!==i?a=!1:(e=Pt<t.state&&t.state<Ft,t.state=Rt,t.timer.stop(),t.on.call(e?"interrupt":"cancel",r,r.__data__,t.index,t.group),delete o[n]);a&&delete r.__transition}})},e.prototype.transition=function(t){var e,n;t=t instanceof T?(e=t._id,t._name):(e=++Te,(n=qe).time=Et(),null==t?null:t+"");for(var r=this._groups,i=r.length,o=0;o<i;++o)for(var a,u=r[o],s=u.length,l=0;l<s;++l)(a=u[l])&&Ht(a,t,e,l,u,n||((t,e)=>{for(var n;!(n=t.__transition)||!(n=n[e]);)if(!(t=t.parentNode))throw new Error(`transition ${e} not found`);return n})(a,e));return new T(r,this._parents,t,e)};let q="abcdefghiABCDEFGHI_!@#$%^&*()_+1234567890",P={},je,ze,Fe,Re;
|
|
152
152
|
/**
|
|
153
153
|
@desc Given an HTMLElement and a "width" or "height" string, this function returns the current calculated size for the DOM element.
|
|
154
154
|
@private
|
|
155
|
-
*/function
|
|
155
|
+
*/function He(e,n){if(e){if(void 0===e.tagName||0<=["BODY","HTML"].indexOf(e.tagName)){let t=window["inner"+(n.charAt(0).toUpperCase()+n.slice(1))];var r=s(e);return t="width"===n?(t=(t=(t-=parseFloat(r.style("margin-left"),10))-parseFloat(r.style("margin-right"),10))-parseFloat(r.style("padding-left"),10))-parseFloat(r.style("padding-right"),10):(t=(t=(t-=parseFloat(r.style("margin-top"),10))-parseFloat(r.style("margin-bottom"),10))-parseFloat(r.style("padding-top"),10))-parseFloat(r.style("padding-bottom"),10)}{let t=parseFloat(s(e).style(n),10);return"number"==typeof t&&0<t?t="height"===n?(t-=parseFloat(s(e).style("padding-top"),10))-parseFloat(s(e).style("padding-bottom"),10):t:He(e.parentNode,n)}}}
|
|
156
156
|
/**
|
|
157
157
|
@function getSize
|
|
158
158
|
@desc Finds the available width and height for a specified HTMLElement, traversing it's parents until it finds something with constrained dimensions. Falls back to the inner dimensions of the browser window if none is found.
|
|
@@ -167,13 +167,13 @@ n!==i&&((o=(i=n).copy())._.cancel.push(e),o._.interrupt.push(e),o._.end.push(r))
|
|
|
167
167
|
assign({id: "foo", deep: {group: "A"}}, {id: "bar", deep: {value: 20}}));
|
|
168
168
|
@example <caption>returns this</caption>
|
|
169
169
|
{id: "bar", deep: {group: "A", value: 20}}
|
|
170
|
-
*/function i(...
|
|
170
|
+
*/function i(...e){let o=e[0];for(let t=1;t<e.length;t++){let r=e[t];a(r)&&Object.keys(r).forEach(t=>{var e,n=r[t];a(n)&&(e=n,"undefined"==typeof window||e!==window&&e!==document)?Object.prototype.hasOwnProperty.call(o,t)&&a(o[t])?o[t]=i({},o[t],n):o[t]=i({},n):Array.isArray(n)?o[t]=n.slice():o[t]=n})}return o},t.attrize=u,t.date=function(t){
|
|
171
171
|
// returns if falsey or already Date object
|
|
172
|
-
if([!1,void 0,NaN].includes(t)||t.constructor===Date)return t;if(t.constructor===Number&&5<(""+t).length&&t%1==0)return new Date(t);let
|
|
172
|
+
if([!1,void 0,NaN].includes(t)||t.constructor===Date)return t;if(t.constructor===Number&&5<(""+t).length&&t%1==0)return new Date(t);let e=""+t;
|
|
173
173
|
// tests for MM/DD/YYYY and MM-DD-YYYY format
|
|
174
|
-
var
|
|
174
|
+
var n,r,i=new RegExp(/^\d{1,2}[./-]\d{1,2}[./-](-*\d{1,4})$/g).exec(e);return i?(0===(i=i[1]).indexOf("-")&&(e=e.replace(i,i.substring(1))),(r=new Date(e)).setFullYear(i),r):(i=new RegExp(/^[A-z]{1,3} [A-z]{1,3} \d{1,2} (-*\d{1,4}) \d{1,2}:\d{1,2}:\d{1,2} [A-z]{1,3}-*\d{1,4} \([A-z]{1,3}\)/g).exec(e))?(0===(r=i[1]).indexOf("-")&&(e=e.replace(r,r.substring(1))),(i=new Date(e)).setFullYear(r),i):(r=new RegExp(/^([qQ]{1}[1-4]{1}|[1-4]{1}[qQ]{1})[\s|-]{0,1}(-*\d{1,4})$/g).exec(e),i=new RegExp(/^(-*\d{1,4})[\s|-]{0,1}([qQ]{1}[1-4]{1}|[1-4]{1}[qQ]{1})$/g).exec(e),r||i?(n=+(r?r[1]:i[2]).toLowerCase().replace("q",""),r=+(r?r[2]:i[1]),(i=new Date(r,3*n-3,1)).setFullYear(r),i):(n=new RegExp(/^([-*\d]{1,2})\-(-*\d{1,4})$/g).exec(e),r=new RegExp(/^(-*\d{1,4})\-([-*\d]{1,2})$/g).exec(e),n||r?(i=+(n?n[1]:r[2]),n=+(n?n[2]:r[1]),(r=new Date(n,i-1,1)).setFullYear(n),r):
|
|
175
175
|
// detects if only passing a year value
|
|
176
|
-
|
|
176
|
+
e.includes("/")||e.includes(" ")||e.includes("-")&&e.indexOf("-")?new RegExp(/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?(?:Z|[+-]\d{2}:\d{2})?$/g).exec(e)?new Date(e):new Date(e.replace(/-/g,"/")):((i=new Date(+e,0,1)).setFullYear(t),i)));
|
|
177
177
|
// tests for full Date object string format
|
|
178
178
|
},t.elem=
|
|
179
179
|
/**
|
|
@@ -187,21 +187,21 @@ n.includes("/")||n.includes(" ")||n.includes("-")&&n.indexOf("-")?new Date(n.rep
|
|
|
187
187
|
@param {D3Selection} [params.parent = d3.select("body")] The parent element for this new element to be appended to.
|
|
188
188
|
@param {Number} [params.duration = 0] The duration for the d3 transition.
|
|
189
189
|
@param {Object} [params.update = {}] A collection of key/value pairs that map to attributes to be given on update.
|
|
190
|
-
*/function(t,
|
|
190
|
+
*/function(t,e){
|
|
191
191
|
// overrides default params
|
|
192
|
-
|
|
192
|
+
e=Object.assign({},{condition:!0,enter:{},exit:{},duration:0,parent:s("body"),update:{}},e);var n=/\.([^#]+)/g.exec(t),r=/#([^.]+)/g.exec(t),i=De().duration(e.duration),o=/^([^.^#]+)/g.exec(t)[1],o=(t=e.parent.selectAll(t.includes(":")?t.split(":")[1]:t).data(e.condition?[null]:[])).enter().append(o).call(u,e.enter),r=(r&&o.attr("id",r[1]),n&&o.attr("class",n[1]),(e.duration?t.exit().transition(i):t.exit()).call(u,e.exit).remove(),o.merge(t));return(e.duration?r.transition(i):r).call(u,e.update),r},t.fontExists=e=>{je||(je=D(q,{"font-family":"DejaVuSans","font-size":32}),ze=D(q,{"font-family":"-apple-system","font-size":32}),Fe=D(q,{"font-family":"monospace","font-size":32}),Re=D(q,{"font-family":"sans-serif","font-size":32})),e=(e=e instanceof Array?e:e.split(",")).map(t=>t.toString().replace(/^\s+|\s+$/g,""));for(let t=0;t<e.length;t++){var n=e[t];if(P[n]||["-apple-system","monospace","sans-serif","DejaVuSans"].includes(n))return n;if(!1!==P[n]){var r=D(q,{"font-family":n,"font-size":32});if(P[n]=r!==Fe,P[n]&&(P[n]=r!==Re),ze&&P[n]&&(P[n]=r!==ze),je&&P[n]&&(P[n]=r!==je),P[n])return n}}return!1},t.getSize=function(t){return[He(t,"width"),He(t,"height")]}
|
|
193
193
|
/**
|
|
194
194
|
@module inViewport
|
|
195
195
|
@desc Returns a *Boolean* denoting whether or not a given DOM element is visible in the current window.
|
|
196
196
|
@param {DOMElement} elem The DOM element to analyze.
|
|
197
197
|
@param {Number} [buffer = 0] A pixel offset from the edge of the top and bottom of the screen. If a positive value, the element will be deemed visible when it is that many pixels away from entering the viewport. If negative, the element will have to enter the viewport by that many pixels before being deemed visible.
|
|
198
198
|
@private
|
|
199
|
-
*/,t.inViewport=function(t,
|
|
199
|
+
*/,t.inViewport=function(t,e=0){var n=void 0!==window.pageXOffset?window.pageXOffset:(document.documentElement||document.body.parentNode||document.body).scrollLeft,r=void 0!==window.pageYOffset?window.pageYOffset:(document.documentElement||document.body.parentNode||document.body).scrollTop,i=(t=t.getBoundingClientRect()).height,o=t.left+n,a=t.top+r;return r+window.innerHeight>a+e&&r+e<a+i&&n+window.innerWidth>o+e&&n+e<o+t.width}
|
|
200
200
|
/**
|
|
201
201
|
@function parseSides
|
|
202
202
|
@desc Converts a string of directional CSS shorthand values into an object with the values expanded.
|
|
203
203
|
@param {String|Number} sides The CSS shorthand string to expand.
|
|
204
|
-
*/,t.isObject=a,t.parseSides=function(t){let r;return 1===(r="number"==typeof t?[t]:t.split(/\s+/)).length?r=[r[0],r[0],r[0],r[0]]:2===r.length?r=r.concat(r):3===r.length&&r.push(r[1]),["top","right","bottom","left"].reduce((t,n
|
|
204
|
+
*/,t.isObject=a,t.parseSides=function(t){let r;return 1===(r="number"==typeof t?[t]:t.split(/\s+/)).length?r=[r[0],r[0],r[0],r[0]]:2===r.length?r=r.concat(r):3===r.length&&r.push(r[1]),["top","right","bottom","left"].reduce((t,e,n)=>{n=parseFloat(r[n]);return t[e]=n||0,t},{})}
|
|
205
205
|
/**
|
|
206
206
|
@function prefix
|
|
207
207
|
@desc Returns the appropriate CSS vendor prefix, given the current browser.
|
|
@@ -215,5 +215,5 @@ n=Object.assign({},{condition:!0,enter:{},exit:{},duration:0,parent:s("body"),up
|
|
|
215
215
|
@desc Applies each key/value in an object as a style.
|
|
216
216
|
@param {D3selection} elem The D3 element to apply the styles to.
|
|
217
217
|
@param {Object} styles An object of key/value style pairs.
|
|
218
|
-
*/function(t,
|
|
218
|
+
*/function(t,e={}){for(var n in e)!{}.hasOwnProperty.call(e,n)||t.style(n,e[n])},t.textWidth=D});
|
|
219
219
|
//# sourceMappingURL=d3plus-dom.full.js.map
|
package/umd/d3plus-dom.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
@d3plus/dom v3.0.
|
|
2
|
+
@d3plus/dom v3.0.10
|
|
3
3
|
JavaScript functions for manipulating and analyzing DOM elements.
|
|
4
4
|
Copyright (c) 2025 D3plus - https://d3plus.org
|
|
5
5
|
@license MIT
|
|
@@ -223,6 +223,8 @@
|
|
|
223
223
|
date.setFullYear(d);
|
|
224
224
|
return date;
|
|
225
225
|
}
|
|
226
|
+
const iso8601 = new RegExp(/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?(?:Z|[+-]\d{2}:\d{2})?$/g).exec(s);
|
|
227
|
+
if (iso8601) return new Date(s);
|
|
226
228
|
// falls back to Date object, replacing hyphens with slashes
|
|
227
229
|
return new Date(s.replace(/-/g, "/"));
|
|
228
230
|
}
|