@d3plus/core 3.1.5 → 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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@d3plus/core",
3
- "version": "3.1.5",
3
+ "version": "3.1.6",
4
4
  "description": "Data visualization made easy. A javascript library that extends the popular D3.js to enable fast and beautiful visualizations.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -58,13 +58,16 @@
58
58
  "open-color": "^1.9.1",
59
59
  "textures": "^1.2.3",
60
60
  "topojson-client": "^3.1.0",
61
- "@d3plus/data": "3.1.5",
62
- "@d3plus/format": "3.1.5",
63
- "@d3plus/dom": "3.1.5",
64
- "@d3plus/text": "3.1.5",
65
- "@d3plus/locales": "3.1.5",
66
- "@d3plus/math": "3.1.5",
67
- "@d3plus/color": "3.1.5"
61
+ "@d3plus/locales": "3.1.6",
62
+ "@d3plus/text": "3.1.6",
63
+ "@d3plus/math": "3.1.6",
64
+ "@d3plus/format": "3.1.6",
65
+ "@d3plus/data": "3.1.6",
66
+ "@d3plus/dom": "3.1.6",
67
+ "@d3plus/color": "3.1.6"
68
+ },
69
+ "devDependencies": {
70
+ "playwright": "1.59.1"
68
71
  },
69
72
  "scripts": {
70
73
  "build:esm": "node ../../scripts/build-esm.js",
@@ -1,5 +1,5 @@
1
1
  /*
2
- @d3plus/core v3.1.4
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
@@ -31906,7 +31906,11 @@
31906
31906
  "line-height": lineHeight
31907
31907
  };
31908
31908
  var line = 1, textProg = "", truncated = false, widthProg = 0;
31909
- var lineData = [], sizes = textWidth(words, style);
31909
+ var lineData = [], // of the per-word widths the break logic actually compared against
31910
+ // `width`, which can differ from re-measuring the finished line as a
31911
+ // single string (e.g. a soft hyphen counts toward the break decision but
31912
+ // is stripped from the rendered line, and trailing spaces measure as 0).
31913
+ lineWidths = [], sizes = textWidth(words, style);
31910
31914
  for(var i = 0; i < words.length; i++){
31911
31915
  var word = words[i];
31912
31916
  var wordWidth = sizes[words.indexOf(word)];
@@ -31939,16 +31943,23 @@
31939
31943
  }
31940
31944
  textProg += word;
31941
31945
  widthProg += wordWidth;
31946
+ lineWidths[line - 1] = widthProg;
31942
31947
  }
31943
31948
  // Clean remaining soft hyphens from all lines
31944
31949
  var lines = lineData.map(function(l) {
31945
31950
  return l.replaceAll(softHyphen, "");
31946
31951
  });
31952
+ // Report each line's width as at least the width the break logic consumed,
31953
+ // so that re-wrapping the same text at the reported width is stable (a
31954
+ // consumer that sizes a box to `max(widths)` won't trigger another break).
31955
+ var lineWidthsVisible = textWidth(lines, style);
31947
31956
  return {
31948
31957
  lines: lines,
31949
31958
  sentence: sentence,
31950
31959
  truncated: truncated,
31951
- widths: textWidth(lines, style),
31960
+ widths: lineWidthsVisible.map(function(w, i) {
31961
+ return Math.max(w, lineWidths[i] || 0);
31962
+ }),
31952
31963
  words: words
31953
31964
  };
31954
31965
  }
@@ -35075,6 +35086,9 @@
35075
35086
  zeroLength(initialDomain[0]),
35076
35087
  zeroLength(initialDomain[1])
35077
35088
  ].filter(Boolean).sort();
35089
+ // Nothing meaningful to round to (e.g. a zero-extent domain like
35090
+ // [0, 0]); leave the scale's domain as-is to avoid a NaN factor.
35091
+ if (!zeroArray.length) return;
35078
35092
  const diverging = initialDomain.some((d)=>isNegative(d)) && initialDomain.some((d)=>d > 0);
35079
35093
  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 : max$5(zeroArray);
35080
35094
  let factor = zeros < 1 ? fixFloat(zeros) : +`1${Array(Math.floor(fixFloat(zeros)) - 1).fill(0).join("")}`;
@@ -35335,7 +35349,7 @@
35335
35349
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
35336
35350
  textData.forEach((datum)=>{
35337
35351
  const { fP, i, position } = datum;
35338
- const sizeName = horizontal ? "width" : "height";
35352
+ const sizeName = datum.rotate && horizontal || !datum.rotate && !horizontal ? "height" : "width";
35339
35353
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
35340
35354
  let prev = i ? reverseTextData.find((t)=>t.i < i && !t.truncated) : false;
35341
35355
  if (i === textData.length - 1) {
@@ -35443,7 +35457,7 @@
35443
35457
  id: d,
35444
35458
  labelBounds: rotated && data ? {
35445
35459
  x: -data.width / 2 + data.fS / 4,
35446
- y: this._orient === "bottom" ? size + (data.width - lineHeight * lines) / 2 + fP : size * 2 - (data.width + lineHeight * lines) / 2 + fP,
35460
+ y: this._orient === "bottom" ? size + (data.width - lineHeight * lines) / 2 + fP : size - (data.width + lineHeight * lines) / 2 - 2 * fP,
35447
35461
  width: data.width,
35448
35462
  height: data.height
35449
35463
  } : {
@@ -35711,7 +35725,7 @@
35711
35725
  const rtl$1 = rtl();
35712
35726
  return this._orient === "left" ? rtl$1 ? "start" : "end" : this._orient === "right" ? rtl$1 ? "end" : "start" : this._labelRotation ? this._orient === "bottom" ? "end" : "start" : "middle";
35713
35727
  },
35714
- verticalAlign: ()=>this._orient === "bottom" ? "top" : this._orient === "top" ? "bottom" : "middle"
35728
+ verticalAlign: ()=>this._orient === "bottom" ? "top" : this._orient === "top" ? this._labelRotation ? "top" : "bottom" : "middle"
35715
35729
  },
35716
35730
  r: (d)=>d.tick ? 4 : 0,
35717
35731
  stroke: ()=>{
@@ -57601,7 +57615,7 @@
57601
57615
  defaultMouseMoveShape(d, i, x, event);
57602
57616
  const row = getProp.bind(this)("row", d, i);
57603
57617
  const column = getProp.bind(this)("column", d, i);
57604
- this.hover((h, ii)=>getProp.bind(this)("row", h, ii) === row || getProp.bind(this)("column", h, ii) === column);
57618
+ this.hover((h, ii)=>(getProp.bind(this)("row", h, ii) === row || getProp.bind(this)("column", h, ii) === column) && typeof this._colorScale(h, ii) === "number");
57605
57619
  };
57606
57620
  this._row = accessor("row");
57607
57621
  this._rowAxis = new Axis();