@d3plus/core 3.0.14 → 3.0.16

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.0.14",
3
+ "version": "3.0.16",
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",
@@ -34,13 +34,13 @@
34
34
  "test": "eslint index.js src/**/*.js && eslint --global=it test && mocha 'test/**/*-test.js'"
35
35
  },
36
36
  "dependencies": {
37
- "@d3plus/color": "3.0.14",
38
- "@d3plus/data": "3.0.14",
39
- "@d3plus/dom": "3.0.14",
40
- "@d3plus/format": "3.0.14",
41
- "@d3plus/locales": "3.0.14",
42
- "@d3plus/math": "3.0.14",
43
- "@d3plus/text": "3.0.14",
37
+ "@d3plus/color": "3.0.16",
38
+ "@d3plus/data": "3.0.16",
39
+ "@d3plus/dom": "3.0.16",
40
+ "@d3plus/format": "3.0.16",
41
+ "@d3plus/locales": "3.0.16",
42
+ "@d3plus/math": "3.0.16",
43
+ "@d3plus/text": "3.0.16",
44
44
  "@popperjs/core": "^2.11.8",
45
45
  "d3-array": "^3.2.4",
46
46
  "d3-brush": "^3.0.0",
@@ -1,7 +1,7 @@
1
1
  /*
2
- @d3plus/core v3.0.14
2
+ @d3plus/core v3.0.16
3
3
  Data visualization made easy. A javascript library that extends the popular D3.js to enable fast and beautiful visualizations.
4
- Copyright (c) 2025 D3plus - https://d3plus.org
4
+ Copyright (c) 2026 D3plus - https://d3plus.org
5
5
  @license MIT
6
6
  */
7
7
 
@@ -23490,7 +23490,7 @@
23490
23490
  }
23491
23491
  }
23492
23492
  }
23493
- return 0; // Return -1 if no element is found with the class
23493
+ return -1; // Return -1 if no element is found with the class
23494
23494
  }
23495
23495
  class Shape extends BaseClass {
23496
23496
  /**
@@ -23687,8 +23687,6 @@
23687
23687
  this._group.selectAll(`g.d3plus-${this._name}-shape, g.d3plus-${this._name}-image, g.d3plus-${this._name}-text, g.d3plus-${this._name}-hover`).selectAll(".d3plus-Shape, .d3plus-Image, .d3plus-textBox").each(function(d, i) {
23688
23688
  if (!d) d = {};
23689
23689
  if (!d.parentNode) d.parentNode = this.parentNode;
23690
- if (!d.dataIndex) d.dataIndex = i;
23691
- const dataIndex = d.dataIndex;
23692
23690
  const parent = d.parentNode;
23693
23691
  const d3plusType = select(this).classed("d3plus-textBox") ? "textBox" : select(this).classed("d3plus-Image") ? "Image" : "Shape";
23694
23692
  if (d3plusType === "textBox") d = d.data;
@@ -23701,13 +23699,15 @@
23701
23699
  const notHovering = !that._hover || typeof that._hover !== "function" || !that._hover(d, i);
23702
23700
  const group = notHovering ? parent : that._hoverGroup.node();
23703
23701
  if (group !== this.parentNode) {
23704
- const offset = d3plusType === "textBox" ? findLastIndexWithClass(group.childNodes, [
23702
+ const afterIndex = d3plusType === "textBox" ? findLastIndexWithClass(group.childNodes, [
23705
23703
  "d3plus-Image",
23706
23704
  "d3plus-Shape"
23707
23705
  ]) : d3plusType === "Image" ? findLastIndexWithClass(group.childNodes, [
23708
23706
  "d3plus-Shape"
23709
- ]) : 0;
23710
- group.insertBefore(this, group.childNodes[offset + dataIndex]);
23707
+ ]) : -1;
23708
+ if (notHovering) group.appendChild(this);
23709
+ else if (afterIndex === -1) group.prepend(this);
23710
+ else group.childNodes[afterIndex].after(this);
23711
23711
  }
23712
23712
  if (this.className.baseVal.includes("d3plus-Shape")) {
23713
23713
  if (parent === group) select(this).call(that._applyStyle.bind(that));
@@ -34663,7 +34663,7 @@
34663
34663
  @chainable
34664
34664
  */ hover(_) {
34665
34665
  let hoverFunction = this._hover = _;
34666
- if (this._shapeConfig.hoverOpacity !== 1) {
34666
+ if (this._shapeConfig.hoverOpacity !== 1 && _ !== undefined) {
34667
34667
  if (typeof _ === "function") {
34668
34668
  let shapeData = merge$1(this._shapes.map((s)=>s.data()));
34669
34669
  shapeData = shapeData.concat(this._legendClass.data());
@@ -56305,7 +56305,7 @@
56305
56305
  return obj;
56306
56306
  }, {});
56307
56307
  const transform = `translate(${this._margin.left}, ${this._margin.top})`;
56308
- this._sankey.nodeAlign(this._nodeAlign).nodePadding(this._nodePadding).nodeWidth(this._nodeWidth).nodes(nodes).links(links).size([
56308
+ this._sankey.nodeAlign(this._nodeAlign).nodePadding(this._nodePadding).nodeWidth(this._nodeWidth).nodes(nodes).nodeSort(this._nodeSort).links(links).linkSort(this._linkSort).iterations(this._iterations).size([
56309
56309
  width,
56310
56310
  height
56311
56311
  ])();
@@ -56342,6 +56342,14 @@
56342
56342
  if (this._legend) this._legendClass.hover(_);
56343
56343
  return this;
56344
56344
  }
56345
+ /**
56346
+ @memberof Sankey
56347
+ @desc A pass-through for the d3-sankey [iterations](https://github.com/d3/d3-sankey?tab=readme-ov-file#sankey_iterations) function.
56348
+ @param {Number} [*value* = 6]
56349
+ @chainable
56350
+ */ iterations(_) {
56351
+ return arguments.length ? (this._iterations = _, this) : this._iterations;
56352
+ }
56345
56353
  /**
56346
56354
  @memberof Sankey
56347
56355
  @desc A predefined *Array* of edges that connect each object passed to the [node](#Sankey.node) method. The `source` and `target` keys in each link need to map to the nodes in one of one way:
@@ -56357,6 +56365,14 @@
56357
56365
  }
56358
56366
  return this._links;
56359
56367
  }
56368
+ /**
56369
+ @memberof Sankey
56370
+ @desc A pass-through for the d3-sankey [linkSort](https://github.com/d3/d3-sankey?tab=readme-ov-file#sankey_linkSort) function.
56371
+ @param {Function|undefined} [*value* = undefined]
56372
+ @chainable
56373
+ */ linkSort(_) {
56374
+ return arguments.length ? (this._linkSort = _, this) : this._linkSort;
56375
+ }
56360
56376
  /**
56361
56377
  @memberof Sankey
56362
56378
  @desc The key inside of each link Object that references the source node.
@@ -56411,6 +56427,14 @@
56411
56427
  */ nodePadding(_) {
56412
56428
  return arguments.length ? (this._nodePadding = _, this) : this._nodePadding;
56413
56429
  }
56430
+ /**
56431
+ @memberof Sankey
56432
+ @desc A pass-through for the d3-sankey [nodeSort](https://github.com/d3/d3-sankey?tab=readme-ov-file#sankey_nodeSort) function.
56433
+ @param {Function|undefined} [*value* = undefined]
56434
+ @chainable
56435
+ */ nodeSort(_) {
56436
+ return arguments.length ? (this._nodeSort = _, this) : this._nodeSort;
56437
+ }
56414
56438
  /**
56415
56439
  @memberof Sankey
56416
56440
  @desc If *value* is specified, sets the width of the node and returns the current class instance. If *value* is not specified, returns the current nodeWidth. By default, the nodeWidth size is 30.
@@ -56436,8 +56460,11 @@
56436
56460
  @private
56437
56461
  */ constructor(){
56438
56462
  super();
56463
+ this._iterations = 6;
56439
56464
  this._nodeId = accessor("id");
56465
+ this._nodeSort = undefined;
56440
56466
  this._links = accessor("links");
56467
+ this._linkSort = undefined;
56441
56468
  this._linksSource = "source";
56442
56469
  this._linksTarget = "target";
56443
56470
  this._noDataMessage = false;