@d3plus/core 3.1.4 → 3.1.6
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/README.md +5093 -5092
- package/es/src/charts/Matrix.js +1 -1
- package/es/src/charts/Matrix.js.map +1 -1
- package/es/src/components/Axis.js +6 -3
- package/es/src/components/Axis.js.map +1 -1
- package/es/src/utils/D3plusConfig.js.map +1 -1
- package/package.json +11 -8
- package/types/src/utils/D3plusConfig.d.ts +4 -2
- package/umd/d3plus-core.full.js +21 -7
- package/umd/d3plus-core.full.js.map +1 -1
- package/umd/d3plus-core.full.min.js +22 -11
- package/umd/d3plus-core.js +8 -5
- package/umd/d3plus-core.js.map +1 -1
- package/umd/d3plus-core.min.js +9 -6
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
@d3plus/core v3.1.
|
|
2
|
+
@d3plus/core v3.1.5
|
|
3
3
|
Data visualization made easy. A javascript library that extends the popular D3.js to enable fast and beautiful visualizations.
|
|
4
4
|
Copyright (c) 2026 D3plus - https://d3plus.org
|
|
5
5
|
@license MIT
|
|
@@ -980,15 +980,23 @@ function Ug(t){return void 0===t?"undefined":"string"==typeof t||function(t,n){r
|
|
|
980
980
|
/**
|
|
981
981
|
The inner return object and wraps the text and returns the line data array.
|
|
982
982
|
@private
|
|
983
|
-
*/function u(u){var h=Ug(u);void 0===t&&(t=Math.ceil(1.4*e));for(var c=s(h),g={"font-family":n,"font-size":e,"font-weight":i,"line-height":t},d=1,f="",p=!1,_=0,m=[]
|
|
983
|
+
*/function u(u){var h=Ug(u);void 0===t&&(t=Math.ceil(1.4*e));for(var c=s(h),g={"font-family":n,"font-size":e,"font-weight":i,"line-height":t},d=1,f="",p=!1,_=0,m=[],// of the per-word widths the break logic actually compared against
|
|
984
|
+
// `width`, which can differ from re-measuring the finished line as a
|
|
985
|
+
// single string (e.g. a soft hyphen counts toward the break decision but
|
|
986
|
+
// is stripped from the rendered line, and trailing spaces measure as 0).
|
|
987
|
+
y=[],v=ra(c,g),b=0;b<c.length;b++){var x=c[b],w=v[c.indexOf(x)];
|
|
984
988
|
// newline if breaking character or not enough width
|
|
985
|
-
if("\n"===f.slice(-1)||_+
|
|
989
|
+
if("\n"===f.slice(-1)||_+w>l){if(!b&&!o){p=!0;break}if(m.length>=d){var S=m[d-1].trimEnd();
|
|
986
990
|
// Convert trailing soft hyphen to visible hyphen at line breaks
|
|
987
|
-
|
|
991
|
+
S.endsWith("")&&(S=S.slice(0,-1)+"-"),m[d-1]=S}if(d++,t*d>a||w>l&&!o||r&&d>r){p=!0;break}_=0,m.push(x)}else b?(
|
|
988
992
|
// Strip soft hyphen when syllables stay on the same line
|
|
989
|
-
m[d-1].endsWith("")&&(m[d-1]=m[d-1].slice(0,-1)),m[d-1]+=
|
|
993
|
+
m[d-1].endsWith("")&&(m[d-1]=m[d-1].slice(0,-1)),m[d-1]+=x):m[0]=x;f+=x,_+=w,y[d-1]=_}
|
|
990
994
|
// Clean remaining soft hyphens from all lines
|
|
991
|
-
var
|
|
995
|
+
var k=m.map(function(t){return t.replaceAll("","")});
|
|
996
|
+
// Report each line's width as at least the width the break logic consumed,
|
|
997
|
+
// so that re-wrapping the same text at the reported width is stable (a
|
|
998
|
+
// consumer that sizes a box to `max(widths)` won't trigger another break).
|
|
999
|
+
return{lines:k,sentence:h,truncated:p,widths:ra(k,g).map(function(t,n){return Math.max(t,y[n]||0)}),words:c}}
|
|
992
1000
|
/**
|
|
993
1001
|
The font family used for text measurement.
|
|
994
1002
|
*/return u.fontFamily=function(t){return arguments.length?(n=t,u):n},
|
|
@@ -1650,7 +1658,10 @@ v=t?t.slice():[void 0,void 0];let[n,e]=d;this._range&&(void 0!==this._range[0]&&
|
|
|
1650
1658
|
* previously defined range variable.
|
|
1651
1659
|
*/const a=`scale${this._scale.charAt(0).toUpperCase()}${this._scale.slice(1)}`,r=this._domain.slice();if(
|
|
1652
1660
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1653
|
-
this._d3Scale=Pl[a]().domain("time"===this._scale?r.map(o):r).range(v),"none"!==this._rounding){const t=()=>{const t=t=>{if(n){if(!t)return 0;const n=`${t}`.match(/0\.(0*)/);if(n)return+`0.${Array(n[1].length+1).fill(0).join("")}1`}return`${Math.round(Math.abs(t))}`.length},n=r.every(t=>Math.abs(t)<1),e=[t(r[0]),t(r[1])].filter(Boolean).sort()
|
|
1661
|
+
this._d3Scale=Pl[a]().domain("time"===this._scale?r.map(o):r).range(v),"none"!==this._rounding){const t=()=>{const t=t=>{if(n){if(!t)return 0;const n=`${t}`.match(/0\.(0*)/);if(n)return+`0.${Array(n[1].length+1).fill(0).join("")}1`}return`${Math.round(Math.abs(t))}`.length},n=r.every(t=>Math.abs(t)<1),e=[t(r[0]),t(r[1])].filter(Boolean).sort();
|
|
1662
|
+
// Nothing meaningful to round to (e.g. a zero-extent domain like
|
|
1663
|
+
// [0, 0]); leave the scale's domain as-is to avoid a NaN factor.
|
|
1664
|
+
if(!e.length)return;const i=r.some(t=>zd(t))&&r.some(t=>t>0),a=1===e.length?e[0]:e[0]>1&&e[0]===e[1]?e[0]-1:"outside"!==this._rounding&&i?rr(e):e[0]+(e[1]-e[0])/2;let o=a<1?Ld(a):+`1${Array(Math.floor(Ld(a))-1).fill(0).join("")}`;o>=Math.abs(r[1]-r[0])&&(o/=2);const s=r[1]<r[0],l=[Math["outside"===this._rounding?s?"ceil":"floor":s?"floor":"ceil"](r[0]/o)*o,Math["outside"===this._rounding?s?"floor":"ceil":s?"ceil":"floor"](r[1]/o)*o];"log"===this._scale&&(0===l[0]&&(l[0]=r[0]),0===l[1]&&(l[1]=r[1])),this._d3Scale.domain(l.map(Ld))};if("linear"===this._scale)t.bind(this)();else if("log"===this._scale){const n=[],e=r[1]<r[0];n[0]=("outside"===this._rounding?zd(r[0])?e?Td:Bd:e?Bd:Td:zd(r[0])?e?Bd:Td:e?Td:Bd)(r[0]),n[1]=("inside"===this._rounding?zd(r[1])?e?Td:Bd:e?Bd:Td:zd(r[1])?e?Bd:Td:e?Td:Bd)(r[1]);const i=n[1]<n[0];n[0]!==n[1]&&n.some(t=>Math.abs(t)>10)&&i===e?this._d3Scale.domain(n):t.bind(this)()}}if(this._d3Scale.padding&&this._d3Scale.padding(this._scalePadding),this._d3Scale.paddingInner&&this._d3Scale.paddingInner(this._paddingInner),this._d3Scale.paddingOuter&&this._d3Scale.paddingOuter(this._paddingOuter)
|
|
1654
1665
|
/**
|
|
1655
1666
|
* Constructs a separate "negative only" scale for logarithmic
|
|
1656
1667
|
* domains, as they cannot pass zero.
|
|
@@ -1699,7 +1710,7 @@ C=y.map((t,a)=>{const r="function"==typeof e?e(t,a):e,o="function"==typeof i?i(t
|
|
|
1699
1710
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1700
1711
|
C=C.map(t=>{t.space=a-2*t.fP;const n=M(t);return Object.assign(n,t)});const r=C.slice().reverse();
|
|
1701
1712
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1702
|
-
C.forEach(t=>{const{fP:n,i:e,position:i}=t,a=s?"
|
|
1713
|
+
C.forEach(t=>{const{fP:n,i:e,position:i}=t,a=t.rotate&&s||!t.rotate&&!s?"height":"width";
|
|
1703
1714
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1704
1715
|
let o=!!e&&r.find(t=>t.i<e&&!t.truncated);if(e===C.length-1)for(;o&&i-t[a]/2-n<o.position+o[a]/2;)o.truncated=!0,
|
|
1705
1716
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -1722,7 +1733,7 @@ t=>t.id);$.exit().transition(f).attr("opacity",0).call(this._gridPosition.bind(t
|
|
|
1722
1733
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1723
1734
|
let j=b.concat(R).map(t=>{
|
|
1724
1735
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1725
|
-
const n=C.find(n=>n.d===t),e=this._getPosition(t),o=n?n.space:0,u=n?n.lines.length:1,g=n?n.lineHeight:1,d=n?n.fP:0,f=n&&this._labelOffset?n.offset:0,p=s?o:O.width-m[this._position.opposite]-S-m[this._orient]+c,_=m[l],v=(S+f)*(h?-1:1),w=h?O[r]+O[i]-_:O[r]+_,k={id:t,labelBounds:I&&n?{x:-n.width/2+n.fS/4,y:"bottom"===this._orient?v+(n.width-g*u)/2+d:
|
|
1736
|
+
const n=C.find(n=>n.d===t),e=this._getPosition(t),o=n?n.space:0,u=n?n.lines.length:1,g=n?n.lineHeight:1,d=n?n.fP:0,f=n&&this._labelOffset?n.offset:0,p=s?o:O.width-m[this._position.opposite]-S-m[this._orient]+c,_=m[l],v=(S+f)*(h?-1:1),w=h?O[r]+O[i]-_:O[r]+_,k={id:t,labelBounds:I&&n?{x:-n.width/2+n.fS/4,y:"bottom"===this._orient?v+(n.width-g*u)/2+d:v-(n.width+g*u)/2-2*d,width:n.width,height:n.height}:{x:s?-o/2:"left"===this._orient?-p-c+v:v+c,y:s?"bottom"===this._orient?v+d:v-B-d:-o/2,width:s?o:p,height:s?B:o},rotate:!!n&&n.rotate,size:y.includes(t)||"log"===this._scale&&Math.log10(Math.abs(t))%1==0?v:b.includes(t)?Math.ceil(v/2):this._data.find(n=>+n===t)?Math.ceil(v/4):0,text:// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1726
1737
|
!((n||{}).truncated||!y.includes(t))&&x(t),tick:b.includes(t),[a]:e+("band"===this._scale?this._d3Scale.bandwidth()/2:0),[r]:w};return k});"Line"===this._shape&&(j=j.concat(// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1727
1738
|
j.map(t=>{const n=Object.assign({},t);return n[r]+=t.size,n}))),
|
|
1728
1739
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -1745,7 +1756,7 @@ tickFormat(t){return arguments.length?(this._tickFormat=t,this):this._tickFormat
|
|
|
1745
1756
|
/**
|
|
1746
1757
|
Invoked when creating a new class instance, and sets any default parameters.
|
|
1747
1758
|
@private
|
|
1748
|
-
*/constructor(){super(),this._align="middle",this._barConfig={stroke:()=>oc(this._select?a(this._select.node()):"rgb(255, 255, 255)"),"stroke-width":1},this._data=[],this._domain=[0,10],this._duration=600,this._gridConfig={stroke:()=>oc(this._select?a(this._select.node()):"rgb(255, 255, 255)")===ac.dark?Fd.colors.gray[200]:Fd.colors.gray[600],"stroke-width":1},this._gridLog=!1,this._height=400,this._labelOffset=!1,this._labelRotation=!1,this.orient("bottom"),this._outerBounds={width:0,height:0,x:0,y:0},this._padding=5,this._paddingInner=.1,this._paddingOuter=.1,this._rounding="none",this._roundingInsideMinPrefix="< ",this._roundingInsideMinSuffix="",this._roundingInsideMaxPrefix="",this._roundingInsideMaxSuffix="+",this._scale="linear",this._scalePadding=.5,this._shape="Line",this._shapeConfig={fill:()=>oc(this._select?a(this._select.node()):"rgb(255, 255, 255)"),height:t=>t.tick?8:0,label:t=>t.text,labelBounds:t=>t.labelBounds,labelConfig:{fontColor:()=>oc(this._select?a(this._select.node()):"rgb(255, 255, 255)"),fontResize:!1,fontSize:Ta(12),padding:5,textAnchor:()=>{const t=_a();return"left"===this._orient?t?"start":"end":"right"===this._orient?t?"end":"start":this._labelRotation?"bottom"===this._orient?"end":"start":"middle"},verticalAlign:()=>"bottom"===this._orient?"top":"top"===this._orient?"bottom":"middle"},r:t=>t.tick?4:0,stroke:()=>oc(this._select?a(this._select.node()):"rgb(255, 255, 255)"),strokeWidth:1,width:t=>t.tick?8:0},this._tickSize=8,this._tickSuffix="normal",this._tickUnit=0,this._timeLocale=void 0,this._titleClass=new Ud,this._titleConfig={fontColor:()=>oc(this._select?a(this._select.node()):"rgb(255, 255, 255)"),fontSize:12,textAnchor:"middle"},this._width=400,this._margin={top:0,right:0,bottom:0,left:0},this._availableTicks=[],this._visibleTicks=[]}}class Rd extends $d{
|
|
1759
|
+
*/constructor(){super(),this._align="middle",this._barConfig={stroke:()=>oc(this._select?a(this._select.node()):"rgb(255, 255, 255)"),"stroke-width":1},this._data=[],this._domain=[0,10],this._duration=600,this._gridConfig={stroke:()=>oc(this._select?a(this._select.node()):"rgb(255, 255, 255)")===ac.dark?Fd.colors.gray[200]:Fd.colors.gray[600],"stroke-width":1},this._gridLog=!1,this._height=400,this._labelOffset=!1,this._labelRotation=!1,this.orient("bottom"),this._outerBounds={width:0,height:0,x:0,y:0},this._padding=5,this._paddingInner=.1,this._paddingOuter=.1,this._rounding="none",this._roundingInsideMinPrefix="< ",this._roundingInsideMinSuffix="",this._roundingInsideMaxPrefix="",this._roundingInsideMaxSuffix="+",this._scale="linear",this._scalePadding=.5,this._shape="Line",this._shapeConfig={fill:()=>oc(this._select?a(this._select.node()):"rgb(255, 255, 255)"),height:t=>t.tick?8:0,label:t=>t.text,labelBounds:t=>t.labelBounds,labelConfig:{fontColor:()=>oc(this._select?a(this._select.node()):"rgb(255, 255, 255)"),fontResize:!1,fontSize:Ta(12),padding:5,textAnchor:()=>{const t=_a();return"left"===this._orient?t?"start":"end":"right"===this._orient?t?"end":"start":this._labelRotation?"bottom"===this._orient?"end":"start":"middle"},verticalAlign:()=>"bottom"===this._orient?"top":"top"===this._orient?this._labelRotation?"top":"bottom":"middle"},r:t=>t.tick?4:0,stroke:()=>oc(this._select?a(this._select.node()):"rgb(255, 255, 255)"),strokeWidth:1,width:t=>t.tick?8:0},this._tickSize=8,this._tickSuffix="normal",this._tickUnit=0,this._timeLocale=void 0,this._titleClass=new Ud,this._titleConfig={fontColor:()=>oc(this._select?a(this._select.node()):"rgb(255, 255, 255)"),fontSize:12,textAnchor:"middle"},this._width=400,this._margin={top:0,right:0,bottom:0,left:0},this._availableTicks=[],this._visibleTicks=[]}}class Rd extends $d{
|
|
1749
1760
|
/**
|
|
1750
1761
|
Invoked when creating a new class instance, and overrides any default parameters inherited from Axis.
|
|
1751
1762
|
@private
|
|
@@ -4470,7 +4481,7 @@ _draw(t){const{rowValues:n,columnValues:e,shapeData:i}=nC.bind(this)(this._filte
|
|
|
4470
4481
|
/**
|
|
4471
4482
|
Invoked when creating a new class instance, and sets any default parameters.
|
|
4472
4483
|
@private
|
|
4473
|
-
*/constructor(){super(),this._cellPadding=2,this._column=n("column"),this._columnAxis=new $d,this._columnConfig=i({orient:"top"},eC),this._columnSort=(t,n)=>`${t}`.localeCompare(`${n}`),this._label=(t,n)=>`${Ba.bind(this)("row",t,n)} / ${Ba.bind(this)("column",t,n)}`;const t=this._on["mousemove.shape"];this._on["mousemove.shape"]=(n,e,i,a)=>{t(n,e,i,a);const r=Ba.bind(this)("row",n,e),o=Ba.bind(this)("column",n,e);this.hover((t,n)=>Ba.bind(this)("row",t,n)===r||Ba.bind(this)("column",t,n)===o)},this._row=n("row"),this._rowAxis=new $d,this._rowConfig=i({orient:"left"},eC),this._rowSort=(t,n)=>`${t}`.localeCompare(`${n}`)}},t.Message=Kd,t.Network=class extends D_{
|
|
4484
|
+
*/constructor(){super(),this._cellPadding=2,this._column=n("column"),this._columnAxis=new $d,this._columnConfig=i({orient:"top"},eC),this._columnSort=(t,n)=>`${t}`.localeCompare(`${n}`),this._label=(t,n)=>`${Ba.bind(this)("row",t,n)} / ${Ba.bind(this)("column",t,n)}`;const t=this._on["mousemove.shape"];this._on["mousemove.shape"]=(n,e,i,a)=>{t(n,e,i,a);const r=Ba.bind(this)("row",n,e),o=Ba.bind(this)("column",n,e);this.hover((t,n)=>(Ba.bind(this)("row",t,n)===r||Ba.bind(this)("column",t,n)===o)&&"number"==typeof this._colorScale(t,n))},this._row=n("row"),this._rowAxis=new $d,this._rowConfig=i({orient:"left"},eC),this._rowSort=(t,n)=>`${t}`.localeCompare(`${n}`)}},t.Message=Kd,t.Network=class extends D_{
|
|
4474
4485
|
/**
|
|
4475
4486
|
Extends the draw behavior of the abstract Viz class.
|
|
4476
4487
|
@private
|
package/umd/d3plus-core.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
@d3plus/core v3.1.
|
|
2
|
+
@d3plus/core v3.1.5
|
|
3
3
|
Data visualization made easy. A javascript library that extends the popular D3.js to enable fast and beautiful visualizations.
|
|
4
4
|
Copyright (c) 2026 D3plus - https://d3plus.org
|
|
5
5
|
@license MIT
|
|
@@ -2262,6 +2262,9 @@
|
|
|
2262
2262
|
zeroLength(initialDomain[0]),
|
|
2263
2263
|
zeroLength(initialDomain[1])
|
|
2264
2264
|
].filter(Boolean).sort();
|
|
2265
|
+
// Nothing meaningful to round to (e.g. a zero-extent domain like
|
|
2266
|
+
// [0, 0]); leave the scale's domain as-is to avoid a NaN factor.
|
|
2267
|
+
if (!zeroArray.length) return;
|
|
2265
2268
|
const diverging = initialDomain.some((d)=>isNegative(d)) && initialDomain.some((d)=>d > 0);
|
|
2266
2269
|
const zeros = zeroArray.length === 1 ? zeroArray[0] : zeroArray[0] > 1 && zeroArray[0] === zeroArray[1] ? zeroArray[0] - 1 : this._rounding === "outside" || !diverging ? zeroArray[0] + (zeroArray[1] - zeroArray[0]) / 2 : d3Array.max(zeroArray);
|
|
2267
2270
|
let factor = zeros < 1 ? fixFloat(zeros) : +`1${Array(Math.floor(fixFloat(zeros)) - 1).fill(0).join("")}`;
|
|
@@ -2522,7 +2525,7 @@
|
|
|
2522
2525
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2523
2526
|
textData.forEach((datum)=>{
|
|
2524
2527
|
const { fP, i, position } = datum;
|
|
2525
|
-
const sizeName = horizontal ? "
|
|
2528
|
+
const sizeName = datum.rotate && horizontal || !datum.rotate && !horizontal ? "height" : "width";
|
|
2526
2529
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2527
2530
|
let prev = i ? reverseTextData.find((t)=>t.i < i && !t.truncated) : false;
|
|
2528
2531
|
if (i === textData.length - 1) {
|
|
@@ -2630,7 +2633,7 @@
|
|
|
2630
2633
|
id: d,
|
|
2631
2634
|
labelBounds: rotated && data ? {
|
|
2632
2635
|
x: -data.width / 2 + data.fS / 4,
|
|
2633
|
-
y: this._orient === "bottom" ? size + (data.width - lineHeight * lines) / 2 + fP : size
|
|
2636
|
+
y: this._orient === "bottom" ? size + (data.width - lineHeight * lines) / 2 + fP : size - (data.width + lineHeight * lines) / 2 - 2 * fP,
|
|
2634
2637
|
width: data.width,
|
|
2635
2638
|
height: data.height
|
|
2636
2639
|
} : {
|
|
@@ -2898,7 +2901,7 @@
|
|
|
2898
2901
|
const rtl = dom.rtl();
|
|
2899
2902
|
return this._orient === "left" ? rtl ? "start" : "end" : this._orient === "right" ? rtl ? "end" : "start" : this._labelRotation ? this._orient === "bottom" ? "end" : "start" : "middle";
|
|
2900
2903
|
},
|
|
2901
|
-
verticalAlign: ()=>this._orient === "bottom" ? "top" : this._orient === "top" ? "bottom" : "middle"
|
|
2904
|
+
verticalAlign: ()=>this._orient === "bottom" ? "top" : this._orient === "top" ? this._labelRotation ? "top" : "bottom" : "middle"
|
|
2902
2905
|
},
|
|
2903
2906
|
r: (d)=>d.tick ? 4 : 0,
|
|
2904
2907
|
stroke: ()=>{
|
|
@@ -9874,7 +9877,7 @@
|
|
|
9874
9877
|
defaultMouseMoveShape(d, i, x, event);
|
|
9875
9878
|
const row = getProp.bind(this)("row", d, i);
|
|
9876
9879
|
const column = getProp.bind(this)("column", d, i);
|
|
9877
|
-
this.hover((h, ii)=>getProp.bind(this)("row", h, ii) === row || getProp.bind(this)("column", h, ii) === column);
|
|
9880
|
+
this.hover((h, ii)=>(getProp.bind(this)("row", h, ii) === row || getProp.bind(this)("column", h, ii) === column) && typeof this._colorScale(h, ii) === "number");
|
|
9878
9881
|
};
|
|
9879
9882
|
this._row = accessor("row");
|
|
9880
9883
|
this._rowAxis = new Axis();
|