@d3plus/core 3.0.16 → 3.1.0

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.
Files changed (167) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +88482 -2998
  3. package/es/index.js +1 -1
  4. package/es/src/charts/AreaPlot.js +1 -3
  5. package/es/src/charts/BarChart.js +1 -3
  6. package/es/src/charts/BoxWhisker.js +2 -4
  7. package/es/src/charts/BumpChart.js +4 -5
  8. package/es/src/charts/Donut.js +1 -3
  9. package/es/src/charts/Geomap.js +47 -88
  10. package/es/src/charts/LinePlot.js +1 -3
  11. package/es/src/charts/Matrix.js +27 -46
  12. package/es/src/charts/Network.js +87 -81
  13. package/es/src/charts/Pack.js +21 -34
  14. package/es/src/charts/Pie.js +12 -24
  15. package/es/src/charts/Plot.js +226 -321
  16. package/es/src/charts/Priestley.js +18 -36
  17. package/es/src/charts/Radar.js +100 -47
  18. package/es/src/charts/RadialMatrix.js +35 -47
  19. package/es/src/charts/Rings.js +99 -90
  20. package/es/src/charts/Sankey.js +85 -75
  21. package/es/src/charts/StackedArea.js +1 -3
  22. package/es/src/charts/Tree.js +27 -28
  23. package/es/src/charts/Treemap.js +117 -71
  24. package/es/src/charts/Viz.js +296 -492
  25. package/es/src/charts/drawSteps/drawAttribution.js +1 -1
  26. package/es/src/charts/drawSteps/drawBack.js +1 -2
  27. package/es/src/charts/drawSteps/drawColorScale.js +1 -2
  28. package/es/src/charts/drawSteps/drawLegend.js +8 -10
  29. package/es/src/charts/drawSteps/drawSubtitle.js +1 -3
  30. package/es/src/charts/drawSteps/drawTimeline.js +12 -9
  31. package/es/src/charts/drawSteps/drawTitle.js +1 -3
  32. package/es/src/charts/drawSteps/drawTotal.js +1 -3
  33. package/es/src/charts/drawSteps/zoomControls.js +19 -21
  34. package/es/src/charts/events/click.legend.js +2 -3
  35. package/es/src/charts/events/click.shape.js +2 -4
  36. package/es/src/charts/events/mouseenter.js +7 -8
  37. package/es/src/charts/events/mouseleave.js +1 -3
  38. package/es/src/charts/events/mousemove.legend.js +3 -4
  39. package/es/src/charts/events/mousemove.shape.js +2 -4
  40. package/es/src/charts/events/touchstart.body.js +1 -1
  41. package/es/src/charts/helpers/matrixData.js +11 -4
  42. package/es/src/charts/helpers/tileAttributions.js +2 -1
  43. package/es/src/charts/plotBuffers/Bar.js +55 -12
  44. package/es/src/charts/plotBuffers/Box.js +55 -12
  45. package/es/src/charts/plotBuffers/Circle.js +9 -11
  46. package/es/src/charts/plotBuffers/Line.js +4 -6
  47. package/es/src/charts/plotBuffers/Rect.js +10 -12
  48. package/es/src/charts/plotBuffers/discreteBuffer.js +4 -2
  49. package/es/src/charts/plotBuffers/numericBuffer.js +7 -6
  50. package/es/src/components/Axis.js +298 -426
  51. package/es/src/components/AxisBottom.js +1 -3
  52. package/es/src/components/AxisLeft.js +1 -3
  53. package/es/src/components/AxisRight.js +1 -3
  54. package/es/src/components/AxisTop.js +1 -3
  55. package/es/src/components/ColorScale.js +80 -197
  56. package/es/src/components/Legend.js +82 -135
  57. package/es/src/components/Message.js +27 -19
  58. package/es/src/components/TextBox.js +106 -262
  59. package/es/src/components/Timeline.js +88 -155
  60. package/es/src/components/Tooltip.js +301 -330
  61. package/es/src/shapes/Area.js +95 -74
  62. package/es/src/shapes/Bar.js +46 -86
  63. package/es/src/shapes/Box.js +104 -118
  64. package/es/src/shapes/Circle.js +29 -30
  65. package/es/src/shapes/Image.js +44 -102
  66. package/es/src/shapes/Line.js +74 -40
  67. package/es/src/shapes/Path.js +23 -25
  68. package/es/src/shapes/Rect.js +29 -41
  69. package/es/src/shapes/Shape.js +146 -363
  70. package/es/src/shapes/Whisker.js +89 -90
  71. package/es/src/utils/AccessorFn.js +4 -0
  72. package/es/src/utils/BaseClass.js +53 -82
  73. package/es/src/utils/D3plusConfig.js +1 -0
  74. package/es/src/utils/RESET.js +2 -4
  75. package/es/src/utils/accessor.js +4 -5
  76. package/es/src/utils/configPrep.js +13 -12
  77. package/es/src/utils/constant.js +2 -3
  78. package/es/src/utils/getProp.js +4 -4
  79. package/es/src/utils/index.js +0 -1
  80. package/package.json +29 -22
  81. package/types/index.d.ts +5 -0
  82. package/types/src/charts/AreaPlot.d.ts +16 -0
  83. package/types/src/charts/BarChart.d.ts +16 -0
  84. package/types/src/charts/BoxWhisker.d.ts +11 -0
  85. package/types/src/charts/BumpChart.d.ts +36 -0
  86. package/types/src/charts/Donut.d.ts +11 -0
  87. package/types/src/charts/Geomap.d.ts +120 -0
  88. package/types/src/charts/LinePlot.d.ts +15 -0
  89. package/types/src/charts/Matrix.d.ts +74 -0
  90. package/types/src/charts/Network.d.ts +78 -0
  91. package/types/src/charts/Pack.d.ts +47 -0
  92. package/types/src/charts/Pie.d.ts +44 -0
  93. package/types/src/charts/Plot.d.ts +199 -0
  94. package/types/src/charts/Priestley.d.ts +37 -0
  95. package/types/src/charts/Radar.d.ts +38 -0
  96. package/types/src/charts/RadialMatrix.d.ts +78 -0
  97. package/types/src/charts/Rings.d.ts +74 -0
  98. package/types/src/charts/Sankey.d.ts +81 -0
  99. package/types/src/charts/StackedArea.d.ts +14 -0
  100. package/types/src/charts/Tree.d.ts +33 -0
  101. package/types/src/charts/Treemap.d.ts +51 -0
  102. package/types/src/charts/Viz.d.ts +402 -0
  103. package/types/src/charts/drawSteps/drawAttribution.d.ts +7 -0
  104. package/types/src/charts/drawSteps/drawBack.d.ts +6 -0
  105. package/types/src/charts/drawSteps/drawColorScale.d.ts +6 -0
  106. package/types/src/charts/drawSteps/drawLegend.d.ts +12 -0
  107. package/types/src/charts/drawSteps/drawSubtitle.d.ts +7 -0
  108. package/types/src/charts/drawSteps/drawTimeline.d.ts +7 -0
  109. package/types/src/charts/drawSteps/drawTitle.d.ts +7 -0
  110. package/types/src/charts/drawSteps/drawTotal.d.ts +7 -0
  111. package/types/src/charts/drawSteps/zoomControls.d.ts +7 -0
  112. package/types/src/charts/events/click.legend.d.ts +8 -0
  113. package/types/src/charts/events/click.shape.d.ts +8 -0
  114. package/types/src/charts/events/mouseenter.d.ts +8 -0
  115. package/types/src/charts/events/mouseleave.d.ts +8 -0
  116. package/types/src/charts/events/mousemove.legend.d.ts +9 -0
  117. package/types/src/charts/events/mousemove.shape.d.ts +9 -0
  118. package/types/src/charts/events/touchstart.body.d.ts +7 -0
  119. package/types/src/charts/helpers/matrixData.d.ts +11 -0
  120. package/types/src/charts/helpers/tileAttributions.d.ts +6 -0
  121. package/types/src/charts/index.d.ts +21 -0
  122. package/types/src/charts/plotBuffers/Bar.d.ts +16 -0
  123. package/types/src/charts/plotBuffers/Box.d.ts +16 -0
  124. package/types/src/charts/plotBuffers/Circle.d.ts +20 -0
  125. package/types/src/charts/plotBuffers/Line.d.ts +16 -0
  126. package/types/src/charts/plotBuffers/Rect.d.ts +19 -0
  127. package/types/src/charts/plotBuffers/discreteBuffer.d.ts +7 -0
  128. package/types/src/charts/plotBuffers/numericBuffer.d.ts +5 -0
  129. package/types/src/components/Axis.d.ts +309 -0
  130. package/types/src/components/AxisBottom.d.ts +11 -0
  131. package/types/src/components/AxisLeft.d.ts +11 -0
  132. package/types/src/components/AxisRight.d.ts +11 -0
  133. package/types/src/components/AxisTop.d.ts +11 -0
  134. package/types/src/components/ColorScale.d.ts +208 -0
  135. package/types/src/components/Legend.d.ts +157 -0
  136. package/types/src/components/Message.d.ts +40 -0
  137. package/types/src/components/TextBox.d.ts +278 -0
  138. package/types/src/components/Timeline.d.ts +157 -0
  139. package/types/src/components/Tooltip.d.ts +297 -0
  140. package/types/src/components/index.d.ts +11 -0
  141. package/types/src/shapes/Area.d.ts +81 -0
  142. package/types/src/shapes/Bar.d.ts +104 -0
  143. package/types/src/shapes/Box.d.ts +121 -0
  144. package/types/src/shapes/Circle.d.ts +44 -0
  145. package/types/src/shapes/Image.d.ts +124 -0
  146. package/types/src/shapes/Line.d.ts +48 -0
  147. package/types/src/shapes/Path.d.ts +38 -0
  148. package/types/src/shapes/Rect.d.ts +54 -0
  149. package/types/src/shapes/Shape.d.ts +378 -0
  150. package/types/src/shapes/Whisker.d.ts +96 -0
  151. package/types/src/shapes/index.d.ts +10 -0
  152. package/types/src/utils/AccessorFn.d.ts +6 -0
  153. package/types/src/utils/BaseClass.d.ts +76 -0
  154. package/types/src/utils/D3plusConfig.d.ts +164 -0
  155. package/types/src/utils/RESET.d.ts +3 -0
  156. package/types/src/utils/accessor.d.ts +13 -0
  157. package/types/src/utils/configPrep.d.ts +28 -0
  158. package/types/src/utils/constant.d.ts +11 -0
  159. package/types/src/utils/getProp.d.ts +9 -0
  160. package/types/src/utils/index.d.ts +8 -0
  161. package/umd/d3plus-core.full.js +20126 -18700
  162. package/umd/d3plus-core.full.js.map +1 -1
  163. package/umd/d3plus-core.full.min.js +2919 -5393
  164. package/umd/d3plus-core.js +1919 -4073
  165. package/umd/d3plus-core.js.map +1 -1
  166. package/umd/d3plus-core.min.js +1604 -3936
  167. package/es/src/utils/uuid.js +0 -13
@@ -1,3 +1,11 @@
1
+ function _array_like_to_array(arr, len) {
2
+ if (len == null || len > arr.length) len = arr.length;
3
+ for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
4
+ return arr2;
5
+ }
6
+ function _array_with_holes(arr) {
7
+ if (Array.isArray(arr)) return arr;
8
+ }
1
9
  function _assert_this_initialized(self) {
2
10
  if (self === void 0) {
3
11
  throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
@@ -63,12 +71,40 @@ function _inherits(subClass, superClass) {
63
71
  if (superClass) _set_prototype_of(subClass, superClass);
64
72
  }
65
73
  function _instanceof(left, right) {
74
+ "@swc/helpers - instanceof";
66
75
  if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
67
76
  return !!right[Symbol.hasInstance](left);
68
77
  } else {
69
78
  return left instanceof right;
70
79
  }
71
80
  }
81
+ function _iterable_to_array_limit(arr, i) {
82
+ var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
83
+ if (_i == null) return;
84
+ var _arr = [];
85
+ var _n = true;
86
+ var _d = false;
87
+ var _s, _e;
88
+ try {
89
+ for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
90
+ _arr.push(_s.value);
91
+ if (i && _arr.length === i) break;
92
+ }
93
+ } catch (err) {
94
+ _d = true;
95
+ _e = err;
96
+ } finally{
97
+ try {
98
+ if (!_n && _i["return"] != null) _i["return"]();
99
+ } finally{
100
+ if (_d) throw _e;
101
+ }
102
+ }
103
+ return _arr;
104
+ }
105
+ function _non_iterable_rest() {
106
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
107
+ }
72
108
  function _possible_constructor_return(self, call) {
73
109
  if (call && (_type_of(call) === "object" || typeof call === "function")) {
74
110
  return call;
@@ -82,6 +118,9 @@ function _set_prototype_of(o, p) {
82
118
  };
83
119
  return _set_prototype_of(o, p);
84
120
  }
121
+ function _sliced_to_array(arr, i) {
122
+ return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
123
+ }
85
124
  function _super_prop_base(object, property) {
86
125
  while(!Object.prototype.hasOwnProperty.call(object, property)){
87
126
  object = _get_prototype_of(object);
@@ -93,6 +132,14 @@ function _type_of(obj) {
93
132
  "@swc/helpers - typeof";
94
133
  return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
95
134
  }
135
+ function _unsupported_iterable_to_array(o, minLen) {
136
+ if (!o) return;
137
+ if (typeof o === "string") return _array_like_to_array(o, minLen);
138
+ var n = Object.prototype.toString.call(o).slice(8, -1);
139
+ if (n === "Object" && o.constructor) n = o.constructor.name;
140
+ if (n === "Map" || n === "Set") return Array.from(n);
141
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
142
+ }
96
143
  function _is_native_reflect_construct() {
97
144
  try {
98
145
  var result = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
@@ -101,8 +148,7 @@ function _is_native_reflect_construct() {
101
148
  return !!result;
102
149
  })();
103
150
  }
104
- import { extent, max, mean, min, merge } from "d3-array";
105
- import { nest } from "d3-collection";
151
+ import { extent, groups, max, mean, min, merge } from "d3-array";
106
152
  import { forceLink, forceManyBody, forceSimulation } from "d3-force";
107
153
  import { polygonHull } from "d3-polygon";
108
154
  import * as scales from "d3-scale";
@@ -116,7 +162,7 @@ import Viz from "./Viz.js";
116
162
  /**
117
163
  * Fetches the unique ID for a data point, whether it's defined by data or nodes.
118
164
  * @private
119
- */ function getNodeId(d, i) {
165
+ */ function getNodeId(d, i) {
120
166
  return "".concat(this._id(d, i) || this._nodeGroupBy[min([
121
167
  this._drawDepth,
122
168
  this._nodeGroupBy.length - 1
@@ -287,7 +333,7 @@ var Network = /*#__PURE__*/ function(Viz) {
287
333
  _this._sizeScale = "sqrt";
288
334
  _this._shape = constant("Circle");
289
335
  _this._shapeConfig = assign(_this._shapeConfig, {
290
- ariaLabel: function(d, i) {
336
+ ariaLabel: function ariaLabel(d, i) {
291
337
  var validSize = _this._size ? ", ".concat(_this._size(d, i)) : "";
292
338
  return "".concat(_this._drawLabel(d, i)).concat(validSize, ".");
293
339
  },
@@ -315,7 +361,7 @@ var Network = /*#__PURE__*/ function(Viz) {
315
361
  /**
316
362
  Extends the draw behavior of the abstract Viz class.
317
363
  @private
318
- */ key: "_draw",
364
+ */ key: "_draw",
319
365
  value: function _draw(callback) {
320
366
  var _this = this;
321
367
  _get(_get_prototype_of(Network.prototype), "_draw", this).call(this, callback);
@@ -343,7 +389,7 @@ var Network = /*#__PURE__*/ function(Viz) {
343
389
  shape: d !== undefined && _this._shape(d) !== undefined ? _this._shape(d) : _this._shape(n)
344
390
  };
345
391
  }).filter(function(n) {
346
- return n;
392
+ return !!n;
347
393
  });
348
394
  var nodeLookup = this._nodeLookup = nodes.reduce(function(obj, d) {
349
395
  obj[d.id] = d;
@@ -401,7 +447,7 @@ var Network = /*#__PURE__*/ function(Viz) {
401
447
  if (nodePositions.length === 2) {
402
448
  angle = 100;
403
449
  } else if (nodePositions.length > 2) {
404
- var hull = polygonHull(nodePositions);
450
+ var hull = polygonHull(nodePositions) || [];
405
451
  var rect = largestRect(hull, {
406
452
  verbose: true
407
453
  });
@@ -559,7 +605,7 @@ var Network = /*#__PURE__*/ function(Viz) {
559
605
  }
560
606
  }).node()).render());
561
607
  var shapeConfig = {
562
- label: function(d) {
608
+ label: function label(d) {
563
609
  return nodes.length <= _this._dataCutoff || _this._hover && _this._hover(d) || _this._active && _this._active(d) ? _this._drawLabel(d.data || d.node, d.i) : false;
564
610
  },
565
611
  select: elem("g.d3plus-network-nodes", {
@@ -573,21 +619,19 @@ var Network = /*#__PURE__*/ function(Viz) {
573
619
  }
574
620
  }).node()
575
621
  };
576
- nest().key(function(d) {
622
+ groups(nodes, function(d) {
577
623
  return d.shape;
578
- }).entries(nodes).forEach(function(d) {
579
- _this._shapes.push(new shapes[d.key]().config(configPrep.bind(_this)(_this._shapeConfig, "shape", d.key)).config(shapeConfig).config(shapeConfig[d.key] || {}).data(d.values).render());
624
+ }).forEach(function(param) {
625
+ var _param = _sliced_to_array(param, 2), key = _param[0], values = _param[1];
626
+ _this._shapes.push(new shapes[key]().config(configPrep.bind(_this)(_this._shapeConfig, "shape", key)).config(shapeConfig).config(shapeConfig[key] || {}).data(values).render());
580
627
  });
581
628
  return this;
582
629
  }
583
630
  },
584
631
  {
585
632
  /**
586
- @memberof Network
587
- @desc If *value* is specified, sets the hover method to the specified function and returns the current class instance.
588
- @param {Function} [*value*]
589
- @chainable
590
- */ key: "hover",
633
+ The hover callback function for highlighting shapes on mouseover.
634
+ */ key: "hover",
591
635
  value: function hover(_) {
592
636
  this._hover = _;
593
637
  if (this._nodes.length < this._dataCutoff) {
@@ -601,17 +645,14 @@ var Network = /*#__PURE__*/ function(Viz) {
601
645
  },
602
646
  {
603
647
  /**
604
- @memberof Network
605
- @desc A predefined *Array* of edges that connect each object passed to the [node](#Network.node) method. The `source` and `target` keys in each link need to map to the nodes in one of three ways:
648
+ A predefined *Array* of edges that connect each object passed to the [node](#Network.node) method. The `source` and `target` keys in each link need to map to the nodes in one of three ways:
606
649
  1. The index of the node in the nodes array (as in [this](http://d3plus.org/examples/d3plus-network/getting-started/) example).
607
650
  2. The actual node *Object* itself.
608
651
  3. A *String* value matching the `id` of the node.
609
652
 
610
653
  The value passed should either be an *Array* of data or a *String* representing a filepath or URL to be loaded. An optional formatting function can be passed as a second argument to this method. This custom function will be passed the data that has been loaded, as long as there are no errors. This function should return the final links *Array*.
611
- @param {Array|String} *links* = []
612
- @param {Function} [*formatter*]
613
- @chainable
614
- */ key: "links",
654
+ @param f Array of link objects or a URL to load links from.
655
+ */ key: "links",
615
656
  value: function links(_, f) {
616
657
  if (arguments.length) {
617
658
  addToQueue.bind(this)(_, f, "links");
@@ -622,44 +663,32 @@ The value passed should either be an *Array* of data or a *String* representing
622
663
  },
623
664
  {
624
665
  /**
625
- @memberof Network
626
- @desc Defines the thickness of the links connecting each node. The value provided can be either a pixel Number to be used for all links, or an accessor function that returns a specific data value to be used in an automatically calculated linear scale.
627
- @param {Function|Name} [*value* = 1]
628
- @chainable
629
- */ key: "linkSize",
666
+ Defines the thickness of the links connecting each node. The value provided can be either a pixel Number to be used for all links, or an accessor function that returns a specific data value to be used in an automatically calculated linear scale.
667
+ */ key: "linkSize",
630
668
  value: function linkSize(_) {
631
669
  return arguments.length ? (this._linkSize = typeof _ === "function" ? _ : constant(_), this) : this._linkSize;
632
670
  }
633
671
  },
634
672
  {
635
673
  /**
636
- @memberof Network
637
- @desc Defines the minimum pixel stroke width used in link sizing.
638
- @param {Number} [*value* = 2]
639
- @chainable
640
- */ key: "linkSizeMin",
674
+ Defines the minimum pixel stroke width used in link sizing.
675
+ */ key: "linkSizeMin",
641
676
  value: function linkSizeMin(_) {
642
677
  return arguments.length ? (this._linkSizeMin = _, this) : this._linkSizeMin;
643
678
  }
644
679
  },
645
680
  {
646
681
  /**
647
- @memberof Network
648
- @desc Sets the specific type of [continuous d3-scale](https://github.com/d3/d3-scale#continuous-scales) used when calculating the pixel size of links in the network.
649
- @param {String} [*value* = "sqrt"]
650
- @chainable
651
- */ key: "linkSizeScale",
682
+ The type of [continuous d3-scale](https://github.com/d3/d3-scale#continuous-scales) used when calculating the pixel size of links in the network.
683
+ */ key: "linkSizeScale",
652
684
  value: function linkSizeScale(_) {
653
685
  return arguments.length ? (this._linkSizeScale = _, this) : this._linkSizeScale;
654
686
  }
655
687
  },
656
688
  {
657
689
  /**
658
- @memberof Network
659
- @desc If *value* is specified, sets the node group accessor(s) to the specified string, function, or array of values and returns the current class instance. This method overrides the default .groupBy() function from being used with the data passed to .nodes(). If *value* is not specified, returns the current node group accessor.
660
- @param {String|Function|Array} [*value* = "id"]
661
- @chainable
662
- */ key: "nodeGroupBy",
690
+ The node group accessor(s). This method overrides the default .groupBy() function from being used with the data passed to .nodes().
691
+ */ key: "nodeGroupBy",
663
692
  value: function nodeGroupBy(_) {
664
693
  var _this = this;
665
694
  if (!arguments.length) return this._nodeGroupBy;
@@ -682,14 +711,11 @@ The value passed should either be an *Array* of data or a *String* representing
682
711
  },
683
712
  {
684
713
  /**
685
- @memberof Network
686
- @desc The list of nodes to be used for drawing the network. The value passed should either be an *Array* of data or a *String* representing a filepath or URL to be loaded.
714
+ The list of nodes to be used for drawing the network. The value passed should either be an *Array* of data or a *String* representing a filepath or URL to be loaded.
687
715
 
688
716
  Additionally, a custom formatting function can be passed as a second argument to this method. This custom function will be passed the data that has been loaded, as long as there are no errors. This function should return the final node *Array*.
689
- @param {Array|String} *nodes* = []
690
- @param {Function} [*formatter*]
691
- @chainable
692
- */ key: "nodes",
717
+ @param f Array of node objects or a URL to load nodes from.
718
+ */ key: "nodes",
693
719
  value: function nodes(_, f) {
694
720
  if (arguments.length) {
695
721
  addToQueue.bind(this)(_, f, "nodes");
@@ -700,55 +726,40 @@ Additionally, a custom formatting function can be passed as a second argument to
700
726
  },
701
727
  {
702
728
  /**
703
- @memberof Network
704
- @desc If *value* is specified, sets the size accessor to the specified function or data key and returns the current class instance. If *value* is not specified, returns the current size accessor.
705
- @param {Function|String} [*value*]
706
- @chainable
707
- */ key: "size",
729
+ The size accessor for each node in the network.
730
+ */ key: "size",
708
731
  value: function size(_) {
709
732
  return arguments.length ? (this._size = typeof _ === "function" || !_ ? _ : accessor(_), this) : this._size;
710
733
  }
711
734
  },
712
735
  {
713
736
  /**
714
- @memberof Network
715
- @desc Defines the maximum pixel radius used in size scaling. By default, the maximum size is determined by half the distance of the two closest nodes.
716
- @param {Number} [*value*]
717
- @chainable
718
- */ key: "sizeMax",
737
+ Defines the maximum pixel radius used in size scaling. By default, the maximum size is determined by half the distance of the two closest nodes.
738
+ */ key: "sizeMax",
719
739
  value: function sizeMax(_) {
720
740
  return arguments.length ? (this._sizeMax = _, this) : this._sizeMax;
721
741
  }
722
742
  },
723
743
  {
724
744
  /**
725
- @memberof Network
726
- @desc Defines the minimum pixel radius used in size scaling.
727
- @param {Number} [*value* = 5]
728
- @chainable
729
- */ key: "sizeMin",
745
+ Defines the minimum pixel radius used in size scaling.
746
+ */ key: "sizeMin",
730
747
  value: function sizeMin(_) {
731
748
  return arguments.length ? (this._sizeMin = _, this) : this._sizeMin;
732
749
  }
733
750
  },
734
751
  {
735
752
  /**
736
- @memberof Network
737
- @desc Sets the specific type of [continuous d3-scale](https://github.com/d3/d3-scale#continuous-scales) used when calculating the pixel size of nodes in the network.
738
- @param {String} [*value* = "sqrt"]
739
- @chainable
740
- */ key: "sizeScale",
753
+ The type of [continuous d3-scale](https://github.com/d3/d3-scale#continuous-scales) used when calculating the pixel size of nodes in the network.
754
+ */ key: "sizeScale",
741
755
  value: function sizeScale(_) {
742
756
  return arguments.length ? (this._sizeScale = _, this) : this._sizeScale;
743
757
  }
744
758
  },
745
759
  {
746
760
  /**
747
- @memberof Network
748
- @desc If *value* is specified, sets the x accessor to the specified function or string matching a key in the data and returns the current class instance. The data passed to .data() takes priority over the .nodes() data array. If *value* is not specified, returns the current x accessor. By default, the x and y positions are determined dynamically based on default force layout properties.
749
- @param {Function|String} [*value*]
750
- @chainable
751
- */ key: "x",
761
+ The x position accessor for each node. The data passed to .data() takes priority over the .nodes() data array. By default, the x and y positions are determined dynamically based on default force layout properties.
762
+ */ key: "x",
752
763
  value: function x(_) {
753
764
  if (arguments.length) {
754
765
  if (typeof _ === "function") this._x = _;
@@ -762,11 +773,8 @@ Additionally, a custom formatting function can be passed as a second argument to
762
773
  },
763
774
  {
764
775
  /**
765
- @memberof Network
766
- @desc If *value* is specified, sets the y accessor to the specified function or string matching a key in the data and returns the current class instance. The data passed to .data() takes priority over the .nodes() data array. If *value* is not specified, returns the current y accessor. By default, the x and y positions are determined dynamically based on default force layout properties.
767
- @param {Function|String} [*value*]
768
- @chainable
769
- */ key: "y",
776
+ The y position accessor for each node. The data passed to .data() takes priority over the .nodes() data array. By default, the x and y positions are determined dynamically based on default force layout properties.
777
+ */ key: "y",
770
778
  value: function y(_) {
771
779
  if (arguments.length) {
772
780
  if (typeof _ === "function") this._y = _;
@@ -782,7 +790,5 @@ Additionally, a custom formatting function can be passed as a second argument to
782
790
  return Network;
783
791
  }(Viz);
784
792
  /**
785
- @class Network
786
- @extends Viz
787
- @desc Creates a network visualization based on a defined set of nodes and edges. [Click here](http://d3plus.org/examples/d3plus-network/getting-started/) for help getting started using the Network class.
793
+ Creates a network visualization based on a defined set of nodes and edges. [Click here](http://d3plus.org/examples/d3plus-network/getting-started/) for help getting started using the Network class.
788
794
  */ export { Network as default };
@@ -119,13 +119,13 @@ function _is_native_reflect_construct() {
119
119
  return !!result;
120
120
  })();
121
121
  }
122
- import { nest } from "d3-collection";
123
122
  import { hierarchy, pack } from "d3-hierarchy";
124
123
  import { assign, elem } from "@d3plus/dom";
124
+ import { nestGroups } from "@d3plus/data";
125
125
  import { accessor, configPrep, constant } from "../utils/index.js";
126
126
  import { Circle } from "../shapes/index.js";
127
127
  import Viz from "./Viz.js";
128
- var recursionCircles = function(d) {
128
+ var recursionCircles = function recursionCircles1(d) {
129
129
  var arr = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : [];
130
130
  if (d.values) {
131
131
  d.values.forEach(function(h) {
@@ -185,13 +185,13 @@ var Pack = /*#__PURE__*/ function(Viz) {
185
185
  _this._shape = constant("Circle");
186
186
  _this._shapeConfig = assign(_this._shapeConfig, {
187
187
  Circle: {
188
- label: function(d) {
188
+ label: function label(d) {
189
189
  return d.parent && !d.children ? d.id : false;
190
190
  },
191
191
  labelConfig: {
192
192
  fontResize: true
193
193
  },
194
- opacity: function(d) {
194
+ opacity: function opacity(d) {
195
195
  return d.__d3plusOpacity__;
196
196
  }
197
197
  }
@@ -207,16 +207,14 @@ var Pack = /*#__PURE__*/ function(Viz) {
207
207
  /**
208
208
  Extends the draw behavior of the abstract Viz class.
209
209
  @private
210
- */ key: "_draw",
210
+ */ key: "_draw",
211
211
  value: function _draw(callback) {
212
212
  var _this = this;
213
213
  _get(_get_prototype_of(Pack.prototype), "_draw", this).call(this, callback);
214
214
  var height = this._height - this._margin.top - this._margin.bottom, width = this._width - this._margin.left - this._margin.right;
215
215
  var diameter = Math.min(height, width);
216
216
  var transform = "translate(".concat((width - diameter) / 2, ", ").concat((height - diameter) / 2, ")");
217
- var nestedData = nest();
218
- for(var i = 0; i <= this._drawDepth; i++)nestedData.key(this._groupBy[i]);
219
- nestedData = nestedData.entries(this._filteredData);
217
+ var nestedData = nestGroups(this._filteredData, this._groupBy.slice(0, this._drawDepth + 1));
220
218
  var packData = this._pack.padding(this._layoutPadding).size([
221
219
  diameter,
222
220
  diameter
@@ -247,11 +245,8 @@ var Pack = /*#__PURE__*/ function(Viz) {
247
245
  },
248
246
  {
249
247
  /**
250
- @memberof Pack
251
- @desc If *value* is specified, sets the hover method to the specified function and returns the current class instance.
252
- @param {Function} [*value*]
253
- @chainable
254
- */ key: "hover",
248
+ The hover callback function for highlighting shapes on mouseover.
249
+ */ key: "hover",
255
250
  value: function hover(_) {
256
251
  this._hover = _;
257
252
  this._shapes.forEach(function(s) {
@@ -263,48 +258,42 @@ var Pack = /*#__PURE__*/ function(Viz) {
263
258
  },
264
259
  {
265
260
  /**
266
- @memberof Pack
267
- @desc If *value* is specified, sets the opacity accessor to the specified function or number and returns the current class instance. If *value* is not specified, returns the current pack opacity accessor.
268
- @param {Function|Number} [*value*]
269
- */ key: "layoutPadding",
261
+ The inner and outer padding for the pack layout.
262
+ */ key: "layoutPadding",
270
263
  value: function layoutPadding(_) {
271
264
  return arguments.length ? (this._layoutPadding = _, this) : this._layoutPadding;
272
265
  }
273
266
  },
274
267
  {
275
268
  /**
276
- @memberof Pack
277
- @desc If *value* is specified, sets the padding accessor to the specified function or number and returns the current class instance. If *value* is not specified, returns the current pack opacity accessor.
278
- @param {Function|Number} [*value*]
279
- */ key: "packOpacity",
269
+ The opacity of nested circles within the pack layout.
270
+ */ key: "packOpacity",
280
271
  value: function packOpacity(_) {
281
272
  return arguments.length ? (this._packOpacity = typeof _ === "function" ? _ : constant(_), this) : this._packOpacity;
282
273
  }
283
274
  },
284
275
  {
285
276
  /**
286
- @memberof Pack
287
- @desc If *comparator* is specified, sets the sort order for the pack using the specified comparator function. If *comparator* is not specified, returns the current group sort order, which defaults to descending order by the associated input data's numeric value attribute.
288
- @param {Array} [*comparator*]
289
- @example
277
+ Sort comparator function for the pack layout. Defaults to descending order by the associated input data's numeric value attribute.
278
+
279
+ @example
290
280
  function comparator(a, b) {
291
281
  return b.value - a.value;
292
282
  }
293
- */ key: "sort",
283
+ */ key: "sort",
294
284
  value: function sort(_) {
295
285
  return arguments.length ? (this._sort = _, this) : this._sort;
296
286
  }
297
287
  },
298
288
  {
299
289
  /**
300
- @memberof Pack
301
- @desc If *value* is specified, sets the sum accessor to the specified function or number and returns the current class instance. If *value* is not specified, returns the current sum accessor.
302
- @param {Function|Number} [*value*]
303
- @example
290
+ The sum accessor used for sizing each circle in the pack layout.
291
+
292
+ @example
304
293
  function sum(d) {
305
294
  return d.sum;
306
295
  }
307
- */ key: "sum",
296
+ */ key: "sum",
308
297
  value: function sum(_) {
309
298
  return arguments.length ? (this._sum = typeof _ === "function" ? _ : accessor(_), this) : this._sum;
310
299
  }
@@ -313,7 +302,5 @@ function sum(d) {
313
302
  return Pack;
314
303
  }(Viz);
315
304
  /**
316
- @class Pack
317
- @extends Viz
318
- @desc Uses the [d3 pack layout](https://github.com/d3/d3-hierarchy#pack) to creates Circle Packing chart based on an array of data.
305
+ Uses the [d3 pack layout](https://github.com/d3/d3-hierarchy#pack) to creates Circle Packing chart based on an array of data.
319
306
  */ export { Pack as default };
@@ -116,7 +116,7 @@ var Pie = /*#__PURE__*/ function(Viz) {
116
116
  return _this._value(b) - _this._value(a);
117
117
  };
118
118
  _this._shapeConfig = assign(_this._shapeConfig, {
119
- ariaLabel: function(d, i) {
119
+ ariaLabel: function ariaLabel(d, i) {
120
120
  return _this._pieData ? "".concat(++_this._pieData[i].index, ". ").concat(_this._drawLabel(d, i), ", ").concat(_this._value(d, i), ".") : "";
121
121
  },
122
122
  Path: {
@@ -167,7 +167,7 @@ var Pie = /*#__PURE__*/ function(Viz) {
167
167
  transform: transform
168
168
  }
169
169
  }).node()).config({
170
- id: function(d) {
170
+ id: function id(d) {
171
171
  return _this._ids(d).join("-");
172
172
  },
173
173
  x: 0,
@@ -178,55 +178,45 @@ var Pie = /*#__PURE__*/ function(Viz) {
178
178
  },
179
179
  {
180
180
  /**
181
- @memberof Pie
182
- @desc The pixel value, or function that returns a pixel value, that is used as the inner radius of the Pie (creating a Donut).
183
- @param {Function|Number} [*value* = 0]
184
- */ key: "innerRadius",
181
+ The pixel value, or function that returns a pixel value, that is used as the inner radius of the Pie (creating a Donut).
182
+ */ key: "innerRadius",
185
183
  value: function innerRadius(_) {
186
184
  return arguments.length ? (this._innerRadius = _, this) : this._innerRadius;
187
185
  }
188
186
  },
189
187
  {
190
188
  /**
191
- @memberof Pie
192
- @desc The padding between each arc, set as a radian value between \`0\` and \`1\`.
189
+ The padding between each arc, set as a radian value between \`0\` and \`1\`.
193
190
 
194
191
  If set, this will override any previously set padPixel value.
195
- @param {Number} [*value*]
196
- */ key: "padAngle",
192
+ */ key: "padAngle",
197
193
  value: function padAngle(_) {
198
194
  return arguments.length ? (this._padAngle = _, this) : this._padAngle;
199
195
  }
200
196
  },
201
197
  {
202
198
  /**
203
- @memberof Pie
204
- @desc The padding between each arc, set as a pixel number value.
199
+ The padding between each arc, set as a pixel number value.
205
200
 
206
201
  By default the value is \`0\`, which shows no padding between each arc.
207
202
 
208
203
  If \`padAngle\` is defined, the \`padPixel\` value will not be considered.
209
- @param {Number} [*value* = 0]
210
- */ key: "padPixel",
204
+ */ key: "padPixel",
211
205
  value: function padPixel(_) {
212
206
  return arguments.length ? (this._padPixel = _, this) : this._padPixel;
213
207
  }
214
208
  },
215
209
  {
216
210
  /**
217
- @memberof Pie
218
- @desc A comparator function that sorts the Pie slices.
219
- @param {Function} [*comparator* = (a, b) => b.value - a.value]
220
- */ key: "sort",
211
+ A comparator function that sorts the Pie slices.
212
+ */ key: "sort",
221
213
  value: function sort(_) {
222
214
  return arguments.length ? (this._sort = _, this) : this._sort;
223
215
  }
224
216
  },
225
217
  {
226
218
  /**
227
- @memberof Pie
228
- @desc The accessor key for each data point used to calculate the size of each Pie section.
229
- @param {Function|String} *value* = d => d.value
219
+ The accessor key for each data point used to calculate the size of each Pie section.
230
220
  */ key: "value",
231
221
  value: function value(_) {
232
222
  return arguments.length ? (this._value = typeof _ === "function" ? _ : accessor(_), this) : this._value;
@@ -236,7 +226,5 @@ If \`padAngle\` is defined, the \`padPixel\` value will not be considered.
236
226
  return Pie;
237
227
  }(Viz);
238
228
  /**
239
- @class Pie
240
- @extends Viz
241
- @desc Uses the [d3 pie layout](https://github.com/d3/d3-shape#pies) to creates SVG arcs based on an array of data.
229
+ Uses the [d3 pie layout](https://github.com/d3/d3-shape#pies) to creates SVG arcs based on an array of data.
242
230
  */ export { Pie as default };