@d3plus/core 3.0.15 → 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 +297 -493
  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 +152 -369
  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 +20134 -18708
  162. package/umd/d3plus-core.full.js.map +1 -1
  163. package/umd/d3plus-core.full.min.js +2922 -5396
  164. package/umd/d3plus-core.js +1927 -4081
  165. package/umd/d3plus-core.js.map +1 -1
  166. package/umd/d3plus-core.min.js +1607 -3939
  167. package/es/src/utils/uuid.js +0 -13
@@ -2,7 +2,7 @@ import { select } from "d3-selection";
2
2
  import { stylize } from "@d3plus/dom";
3
3
  /**
4
4
  @name _drawAttribution
5
- @desc Draws absolute positioned attribution text.
5
+ Draws absolute positioned attribution text.
6
6
  @private
7
7
  */ export default function() {
8
8
  var attr = select(this._select.node().parentNode).selectAll("div.d3plus-attribution").data(this._attribution ? [
@@ -1,7 +1,6 @@
1
1
  import { elem } from "@d3plus/dom";
2
2
  /**
3
- @function _drawBack
4
- @desc Draws a back button if there are states in this._history.
3
+ Draws a back button if there are states in this._history.
5
4
  @private
6
5
  */ export default function() {
7
6
  var visible = this._history.length;
@@ -2,8 +2,7 @@ import { min, rollup } from "d3-array";
2
2
  import { merge } from "@d3plus/data";
3
3
  import { elem } from "@d3plus/dom";
4
4
  /**
5
- @function _drawColorScale
6
- @desc Renders the color scale if this._colorScale is not falsey.
5
+ Renders the color scale if this._colorScale is not falsey.
7
6
  @private
8
7
  */ export default function() {
9
8
  var _this = this;
@@ -1,4 +1,5 @@
1
1
  function _instanceof(left, right) {
2
+ "@swc/helpers - instanceof";
2
3
  if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
3
4
  return !!right[Symbol.hasInstance](left);
4
5
  } else {
@@ -15,16 +16,13 @@ var legendAttrs = [
15
16
  "texture"
16
17
  ];
17
18
  /**
18
- @function legendLabel
19
- @desc Default label function for the legend.
19
+ Default label function for the legend.
20
20
  @private
21
21
  */ export function legendLabel(d, i) {
22
22
  return this._drawLabel(d, i, this._legendDepth);
23
23
  }
24
24
  /**
25
- @function _drawLegend
26
- @desc Renders the legend if this._legend is not falsy.
27
- @param {Array} data The filtered data array to be displayed.
25
+ Renders the legend if this._legend is not falsy.
28
26
  @private
29
27
  */ export default function() {
30
28
  var _this, _loop = function(x) {
@@ -41,13 +39,13 @@ var legendAttrs = [
41
39
  var _this1 = this;
42
40
  var data = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [];
43
41
  var legendData = [];
44
- var getAttr = function(d, i, attr) {
42
+ var getAttr = function getAttr(d, i, attr) {
45
43
  var shape = _this1._shape(d, i);
46
44
  if (attr === "fill" && shape === "Line") attr = "stroke";
47
45
  var value = _this1._shapeConfig[shape] && _this1._shapeConfig[shape][attr] ? _this1._shapeConfig[shape][attr] : _this1._shapeConfig[attr];
48
46
  return typeof value === "function" ? value.bind(_this1)(d, i) : value;
49
47
  };
50
- var fill = function(d, i) {
48
+ var fill = function fill(d, i) {
51
49
  return legendAttrs.map(function(a) {
52
50
  return getAttr(d, i, a);
53
51
  }).join("_");
@@ -67,7 +65,7 @@ var legendAttrs = [
67
65
  var _ret = (_this = this, _loop(x));
68
66
  if (_ret === "break") break;
69
67
  }
70
- var hidden = function(d, i) {
68
+ var hidden = function hidden(d, i) {
71
69
  var id = _this1._id(d, i);
72
70
  if (_instanceof(id, Array)) id = id[0];
73
71
  return _this1._hidden.includes(id) || _this1._solo.length && !_this1._solo.includes(id);
@@ -106,11 +104,11 @@ var legendAttrs = [
106
104
  this._legendClass.id(fill).align(wide ? "center" : position).direction(wide ? "row" : "column").duration(this._duration).data(visible ? legendData : []).height(wide ? this._height - (this._margin.bottom + this._margin.top) : this._height - (this._margin.bottom + this._margin.top + padding.bottom + padding.top)).locale(this._locale).parent(this).select(legendGroup).shape(function(d, i) {
107
105
  return _this1._shape(d, i) === "Circle" ? "Circle" : "Rect";
108
106
  }).verticalAlign(!wide ? "middle" : position).width(wide ? this._width - (this._margin.left + this._margin.right + padding.left + padding.right) : this._width - (this._margin.left + this._margin.right)).shapeConfig(configPrep.bind(this)(this._shapeConfig, "legend")).shapeConfig({
109
- fill: function(d, i) {
107
+ fill: function fill(d, i) {
110
108
  return hidden(d, i) ? _this1._hiddenColor(d, i) : getAttr(d, i, "fill");
111
109
  },
112
110
  labelConfig: {
113
- fontOpacity: function(d, i) {
111
+ fontOpacity: function fontOpacity(d, i) {
114
112
  return hidden(d, i) ? _this1._hiddenOpacity(d, i) : 1;
115
113
  }
116
114
  }
@@ -1,8 +1,6 @@
1
1
  import { elem } from "@d3plus/dom";
2
2
  /**
3
- @function _drawSubtitle
4
- @desc Draws a subtitle if this._subtitle is defined.
5
- @param {Array} [*data*] The currently filtered dataset.
3
+ Draws a subtitle if this._subtitle is defined.
6
4
  @private
7
5
  */ export default function() {
8
6
  var data = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [];
@@ -1,4 +1,5 @@
1
1
  function _instanceof(left, right) {
2
+ "@swc/helpers - instanceof";
2
3
  if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
3
4
  return !!right[Symbol.hasInstance](left);
4
5
  } else {
@@ -9,9 +10,8 @@ import { extent } from "d3-array";
9
10
  import { unique } from "@d3plus/data";
10
11
  import { date, elem } from "@d3plus/dom";
11
12
  /**
12
- @function setTimeFilter
13
- @desc Determines whether or not to update the timeFilter method of the Viz.
14
- @param {Array|Date} The timeline selection given from the d3 brush.
13
+ Determines whether or not to update the timeFilter method of the Viz.
14
+ @param The timeline selection given from the d3 brush.
15
15
  @private
16
16
  */ function setTimeFilter(s) {
17
17
  var _this = this;
@@ -22,22 +22,23 @@ import { date, elem } from "@d3plus/dom";
22
22
  if (JSON.stringify(s) !== JSON.stringify(this._timelineSelection)) {
23
23
  this._timelineSelection = s;
24
24
  s = s.map(Number);
25
+ var sNums = s;
25
26
  this.timeFilter(function(d) {
26
27
  var ms = date(_this._time(d)).getTime();
27
- return ms >= s[0] && ms <= s[1];
28
+ return ms >= sNums[0] && ms <= sNums[1];
28
29
  }).render();
29
30
  }
30
31
  }
31
32
  /**
32
- @function _drawTimeline
33
- @desc Renders the timeline if this._time and this._timeline are not falsy and there are more than 1 tick available.
34
- @param {Array} data The filtered data array to be displayed.
33
+ Renders the timeline if this._time and this._timeline are not falsy and there are more than 1 tick available.
35
34
  @private
36
35
  */ export default function() {
37
36
  var _this = this;
38
37
  var data = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [];
39
38
  var timelinePossible = this._time && this._timeline;
40
- var ticks = timelinePossible ? unique(this._data.map(this._time)).map(date) : [];
39
+ var ticks = timelinePossible ? unique(this._data.map(this._time)).map(function(d) {
40
+ return date(d);
41
+ }) : [];
41
42
  timelinePossible = timelinePossible && ticks.length > 1;
42
43
  var padding = this._timelinePadding() ? this._padding : {
43
44
  top: 0,
@@ -59,7 +60,9 @@ import { date, elem } from "@d3plus/dom";
59
60
  var timeline = this._timelineClass.domain(extent(ticks)).duration(this._duration).height(this._height - this._margin.bottom).locale(this._locale).select(timelineGroup).ticks(ticks.sort(function(a, b) {
60
61
  return +a - +b;
61
62
  })).width(this._width - (this._margin.left + this._margin.right + padding.left + padding.right));
62
- var dataExtent = extent(data.map(this._time).map(date));
63
+ var dataExtent = extent(data.map(this._time).map(function(d) {
64
+ return date(d);
65
+ }));
63
66
  if (!this._timelineSelection) {
64
67
  this._timelineSelection = this._timelineDefault || dataExtent;
65
68
  } else {
@@ -1,8 +1,6 @@
1
1
  import { elem } from "@d3plus/dom";
2
2
  /**
3
- @function _drawTitle
4
- @desc Draws a title if this._title is defined.
5
- @param {Array} [*data*] The currently filtered dataset.
3
+ Draws a title if this._title is defined.
6
4
  @private
7
5
  */ export default function() {
8
6
  var data = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [];
@@ -1,9 +1,7 @@
1
1
  import { sum } from "d3-array";
2
2
  import { elem } from "@d3plus/dom";
3
3
  /**
4
- @function _drawTotal
5
- @desc Draws a total title if this._total is defined.
6
- @param {Array} [*data*] The currently filtered dataset.
4
+ Draws a total title if this._total is defined.
7
5
  @private
8
6
  */ export default function() {
9
7
  var data = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [];
@@ -50,7 +50,7 @@ import { attrize, stylize } from "@d3plus/dom";
50
50
  var brushing = false;
51
51
  /**
52
52
  @name zoomControls
53
- @desc Sets up initial zoom events and controls.
53
+ Sets up initial zoom events and controls.
54
54
  @private
55
55
  */ export default function() {
56
56
  var _this = this;
@@ -94,14 +94,15 @@ var brushing = false;
94
94
  controlEnter.append("div").attr("class", "zoom-control zoom-reset");
95
95
  control.select(".zoom-reset").on("click", zoomMath.bind(this, 0)).html("&#8634");
96
96
  controlEnter.append("div").attr("class", "zoom-control zoom-brush");
97
- control.select(".zoom-brush").on("click", function() {
98
- select(this).classed("active", !brushing).call(stylize, brushing ? that._zoomControlStyle || {} : that._zoomControlStyleActive || {});
97
+ control.select(".zoom-brush").on("click", function(_event) {
98
+ select(_event.currentTarget).classed("active", !brushing).call(stylize, brushing ? that._zoomControlStyle || {} : that._zoomControlStyleActive || {});
99
99
  zoomEvents.bind(that)(!brushing);
100
100
  }).html("&#164");
101
- control.selectAll(".zoom-control").call(stylize, that._zoomControlStyle).on("mouseenter", function() {
102
- select(this).call(stylize, that._zoomControlStyleHover || {});
103
- }).on("mouseleave", function() {
104
- select(this).call(stylize, select(this).classed("active") ? that._zoomControlStyleActive || {} : that._zoomControlStyle || {});
101
+ control.selectAll(".zoom-control").call(stylize, that._zoomControlStyle).on("mouseenter", function(_event) {
102
+ select(_event.currentTarget).call(stylize, that._zoomControlStyleHover || {});
103
+ }).on("mouseleave", function(_event) {
104
+ var el = select(_event.currentTarget);
105
+ el.call(stylize, el.classed("active") ? that._zoomControlStyleActive || {} : that._zoomControlStyle || {});
105
106
  });
106
107
  this._zoomBrush.extent([
107
108
  [
@@ -124,7 +125,7 @@ var brushing = false;
124
125
  }
125
126
  /**
126
127
  @name zoomEvents
127
- @desc Handles adding/removing zoom event listeners.
128
+ Handles adding/removing zoom event listeners.
128
129
  @private
129
130
  */ function zoomEvents() {
130
131
  var brush = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : false;
@@ -145,9 +146,8 @@ var brushing = false;
145
146
  }
146
147
  /**
147
148
  @name zoomed
148
- @desc Handles events dispatched from this._zoomBehavior
149
- @param {Object} [*transform* = event.transform]
150
- @param {Number} [*duration* = 0]
149
+ Handles events dispatched from this._zoomBehavior
150
+ @param transform
151
151
  @private
152
152
  */ function zoomed() {
153
153
  var transform = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : false, duration = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0;
@@ -159,9 +159,8 @@ var brushing = false;
159
159
  }
160
160
  /**
161
161
  @name zoomMath
162
- @desc Zooms in or out based on the provided multiplier.
163
- @param {Number} [*factor* = 0]
164
- @private
162
+ Zooms in or out based on the provided multiplier.
163
+ @param factor @private
165
164
  */ function zoomMath() {
166
165
  var factor = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 0;
167
166
  if (!this._container) return;
@@ -191,9 +190,8 @@ var brushing = false;
191
190
  }
192
191
  /**
193
192
  @name zoomToBounds
194
- @desc Zooms to given bounds.
195
- @param {Array} *bounds*
196
- @param {Number} [*duration* = 0]
193
+ Zooms to given bounds.
194
+ @param bounds
197
195
  @private
198
196
  */ function zoomToBounds(bounds) {
199
197
  var duration = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : this._duration;
@@ -226,13 +224,13 @@ var brushing = false;
226
224
  zoomed.bind(this)(t, duration);
227
225
  }
228
226
  /**
229
- @desc Triggered on brush "brush".
227
+ Triggered on brush "brush".
230
228
  @private
231
229
  */ function brushBrush() {
232
230
  brushStyle.bind(this)();
233
231
  }
234
232
  /**
235
- @desc Triggered on brush "end".
233
+ Triggered on brush "end".
236
234
  @private
237
235
  */ function brushEnd(event) {
238
236
  if (!event.selection) return; // Only transition after input.
@@ -240,13 +238,13 @@ var brushing = false;
240
238
  zoomToBounds.bind(this)(event.selection);
241
239
  }
242
240
  /**
243
- @desc Triggered on brush "start".
241
+ Triggered on brush "start".
244
242
  @private
245
243
  */ function brushStart() {
246
244
  brushStyle.bind(this)();
247
245
  }
248
246
  /**
249
- @desc Overrides the default brush styles.
247
+ Overrides the default brush styles.
250
248
  @private
251
249
  */ function brushStyle() {
252
250
  this._brushGroup.selectAll(".selection").call(attrize, this._zoomBrushSelectionStyle || {});
@@ -1,4 +1,5 @@
1
1
  function _instanceof(left, right) {
2
+ "@swc/helpers - instanceof";
2
3
  if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
3
4
  return !!right[Symbol.hasInstance](left);
4
5
  } else {
@@ -8,9 +9,7 @@ function _instanceof(left, right) {
8
9
  import { merge } from "d3-array";
9
10
  /**
10
11
  @module clickLegend
11
- @desc On click event for all legend shapes in a Viz.
12
- @param {Object} *d* The data object being interacted with.
13
- @param {Number} *i* The index of the data object being interacted with.
12
+ On click event for all legend shapes in a Viz.
14
13
  @private
15
14
  */ export default function(d, i, x, event) {
16
15
  var _this = this;
@@ -1,8 +1,6 @@
1
1
  /**
2
2
  @module clickShape
3
- @desc On click event for all shapes in a Viz.
4
- @param {Object} *d* The data object being interacted with.
5
- @param {Number} *i* The index of the data object being interacted with.
3
+ On click event for all shapes in a Viz.
6
4
  @private
7
5
  */ export default function(d, i, x, event) {
8
6
  event.stopPropagation();
@@ -18,7 +16,7 @@
18
16
  });
19
17
  this.config({
20
18
  depth: this._drawDepth + 1,
21
- filter: function(f, x) {
19
+ filter: function filter(f, x) {
22
20
  return (!oldFilter || oldFilter(f, x)) && filterGroup(f, x) === filterId;
23
21
  }
24
22
  }).render();
@@ -1,17 +1,16 @@
1
- /**
2
- @module mouseEnter
3
- @desc On mouseenter event for all shapes in a Viz.
4
- @param {Object} *d* The data object being interacted with.
5
- @param {Number} *i* The index of the data object being interacted with.
6
- @private
7
- */ function _instanceof(left, right) {
1
+ function _instanceof(left, right) {
2
+ "@swc/helpers - instanceof";
8
3
  if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
9
4
  return !!right[Symbol.hasInstance](left);
10
5
  } else {
11
6
  return left instanceof right;
12
7
  }
13
8
  }
14
- export default function(d, i) {
9
+ /**
10
+ @module mouseEnter
11
+ On mouseenter event for all shapes in a Viz.
12
+ @private
13
+ */ export default function(d, i) {
15
14
  var _this = this;
16
15
  if (this._shapeConfig.hoverOpacity !== 1) {
17
16
  var filterIds = this._id(d, i);
@@ -1,8 +1,6 @@
1
1
  /**
2
2
  @module mouseLeave
3
- @desc On mouseleave event for all shapes in a Viz.
4
- @param {Object} *d* The data object being interacted with.
5
- @param {Number} *i* The index of the data object being interacted with.
3
+ On mouseleave event for all shapes in a Viz.
6
4
  @private
7
5
  */ export default function(d, i) {
8
6
  var _this = this;
@@ -1,4 +1,5 @@
1
1
  function _instanceof(left, right) {
2
+ "@swc/helpers - instanceof";
2
3
  if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
3
4
  return !!right[Symbol.hasInstance](left);
4
5
  } else {
@@ -11,10 +12,8 @@ import { legendLabel } from "../drawSteps/drawLegend.js";
11
12
  import { configPrep } from "../../utils/index.js";
12
13
  /**
13
14
  @module mouseMoveLegend
14
- @desc Tooltip logic for a specified data point.
15
- @param {Object} *d* The data object being interacted with.
16
- @param {Number} *i* The index of the data object being interacted with.
17
- @param {Object} [*config*] Optional configuration methods for the Tooltip class.
15
+ Tooltip logic for a specified data point.
16
+ @param config Optional configuration methods for the Tooltip class.
18
17
  @private
19
18
  */ export default function(d, i, x, event) {
20
19
  var _this = this;
@@ -2,10 +2,8 @@ import { configPrep } from "../../utils/index.js";
2
2
  import clickShape from "./click.shape.js";
3
3
  /**
4
4
  @module mouseMoveShape
5
- @desc Tooltip logic for a specified data point.
6
- @param {Object} *d* The data object being interacted with.
7
- @param {Number} *i* The index of the data object being interacted with.
8
- @param {Object} [*config*] Optional configuration methods for the Tooltip class.
5
+ Tooltip logic for a specified data point.
6
+ @param config Optional configuration methods for the Tooltip class.
9
7
  @private
10
8
  */ export default function(d, i, x, event) {
11
9
  var _this = this;
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  @module touchStartBody
3
- @desc On touchstart event for the Body element.
3
+ On touchstart event for the Body element.
4
4
  @private
5
5
  */ export default function() {
6
6
  this._tooltipClass.data([]).render();
@@ -58,22 +58,29 @@ function _unsupported_iterable_to_array(o, minLen) {
58
58
  }
59
59
  var _instance;
60
60
  import { unique } from "@d3plus/data";
61
- var cartesian = function(a, b) {
61
+ var cartesian = function cartesian(a, b) {
62
62
  return (_instance = []).concat.apply(_instance, _to_consumable_array(a.map(function(d) {
63
63
  return b.map(function(e) {
64
- return [].concat(d, e);
64
+ return [
65
+ d,
66
+ e
67
+ ];
65
68
  });
66
69
  })));
67
70
  };
68
71
  /**
69
72
  @module matrixData
70
73
  @private
71
- */ export default function() {
74
+ */ export default function(_data) {
72
75
  var _this = this;
73
76
  var data = this._filteredData;
74
77
  var rowValues = (this._rowList || unique(data.map(this._row))).sort(this._rowSort);
75
78
  var columnValues = (this._columnList || unique(data.map(this._column))).sort(this._columnSort);
76
- if (!rowValues.length || !columnValues.length) return this;
79
+ if (!rowValues.length || !columnValues.length) return {
80
+ rowValues: [],
81
+ columnValues: [],
82
+ shapeData: []
83
+ };
77
84
  var shapeData = cartesian(rowValues, columnValues).map(function(param) {
78
85
  var _param = _sliced_to_array(param, 2), rowValue = _param[0], columnValue = _param[1];
79
86
  var dataObj = {
@@ -1,4 +1,4 @@
1
- export default [
1
+ var tileAttributions = [
2
2
  {
3
3
  matches: [
4
4
  "cartodb",
@@ -32,3 +32,4 @@ export default [
32
32
  text: "Map tiles by <a href='http://stamen.com' target='_blank'>Stamen Design</a>, under <a href='http://creativecommons.org/licenses/by/3.0' target='_blank'>CC BY 3.0</a>. Data by <a href='http://openstreetmap.org' target='_blank'>OpenStreetMap</a>, under <a href='http://creativecommons.org/licenses/by-sa/3.0' target='_blank'>CC BY SA</a>."
33
33
  }
34
34
  ];
35
+ export default tileAttributions;
@@ -1,14 +1,56 @@
1
- import { max, min, sum } from "d3-array";
2
- import { nest } from "d3-collection";
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
+ }
9
+ function _iterable_to_array_limit(arr, i) {
10
+ var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
11
+ if (_i == null) return;
12
+ var _arr = [];
13
+ var _n = true;
14
+ var _d = false;
15
+ var _s, _e;
16
+ try {
17
+ for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
18
+ _arr.push(_s.value);
19
+ if (i && _arr.length === i) break;
20
+ }
21
+ } catch (err) {
22
+ _d = true;
23
+ _e = err;
24
+ } finally{
25
+ try {
26
+ if (!_n && _i["return"] != null) _i["return"]();
27
+ } finally{
28
+ if (_d) throw _e;
29
+ }
30
+ }
31
+ return _arr;
32
+ }
33
+ function _non_iterable_rest() {
34
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
35
+ }
36
+ function _sliced_to_array(arr, i) {
37
+ return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
38
+ }
39
+ function _unsupported_iterable_to_array(o, minLen) {
40
+ if (!o) return;
41
+ if (typeof o === "string") return _array_like_to_array(o, minLen);
42
+ var n = Object.prototype.toString.call(o).slice(8, -1);
43
+ if (n === "Object" && o.constructor) n = o.constructor.name;
44
+ if (n === "Map" || n === "Set") return Array.from(n);
45
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
46
+ }
47
+ import { groups, max, min, sum } from "d3-array";
3
48
  /**
4
49
  @module barBuffer
5
- @desc Adds a buffer to either side of the non-discrete axis.
6
- @param {Array} data
7
- @param {D3Scale} x
8
- @param {D3Scale} y
9
- @param {Object} [config]
10
- @param {Number} [buffer = 10]
11
- @private
50
+ Adds a buffer to either side of the non-discrete axis.
51
+
52
+
53
+ @param buffer @private
12
54
  */ export default function(param) {
13
55
  var _this = this;
14
56
  var data = param.data, x = param.x, y = param.y, x2 = param.x2, y2 = param.y2, _param_buffer = param.buffer, buffer = _param_buffer === void 0 ? 10 : _param_buffer;
@@ -20,10 +62,11 @@ import { nest } from "d3-collection";
20
62
  if (isDiscreteX) oppDomain.reverse();
21
63
  var negVals, posVals;
22
64
  if (this._stacked) {
23
- var groupedData = nest().key(function(d) {
65
+ var groupedData = groups(data, function(d) {
24
66
  return "".concat(d[_this._discrete], "_").concat(d.group);
25
- }).entries(data).map(function(d) {
26
- return d.values.map(function(x) {
67
+ }).map(function(param) {
68
+ var _param = _sliced_to_array(param, 2), values = _param[1];
69
+ return values.map(function(x) {
27
70
  return x[isDiscreteX ? yKey : xKey];
28
71
  });
29
72
  });
@@ -1,14 +1,56 @@
1
- import { max, min, sum } from "d3-array";
2
- import { nest } from "d3-collection";
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
+ }
9
+ function _iterable_to_array_limit(arr, i) {
10
+ var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
11
+ if (_i == null) return;
12
+ var _arr = [];
13
+ var _n = true;
14
+ var _d = false;
15
+ var _s, _e;
16
+ try {
17
+ for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
18
+ _arr.push(_s.value);
19
+ if (i && _arr.length === i) break;
20
+ }
21
+ } catch (err) {
22
+ _d = true;
23
+ _e = err;
24
+ } finally{
25
+ try {
26
+ if (!_n && _i["return"] != null) _i["return"]();
27
+ } finally{
28
+ if (_d) throw _e;
29
+ }
30
+ }
31
+ return _arr;
32
+ }
33
+ function _non_iterable_rest() {
34
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
35
+ }
36
+ function _sliced_to_array(arr, i) {
37
+ return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
38
+ }
39
+ function _unsupported_iterable_to_array(o, minLen) {
40
+ if (!o) return;
41
+ if (typeof o === "string") return _array_like_to_array(o, minLen);
42
+ var n = Object.prototype.toString.call(o).slice(8, -1);
43
+ if (n === "Object" && o.constructor) n = o.constructor.name;
44
+ if (n === "Map" || n === "Set") return Array.from(n);
45
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
46
+ }
47
+ import { groups, max, min, sum } from "d3-array";
3
48
  /**
4
49
  @module boxBuffer
5
- @desc Adds a buffer to either side of the non-discrete axis.
6
- @param {Array} data
7
- @param {D3Scale} x
8
- @param {D3Scale} y
9
- @param {Object} [config]
10
- @param {Number} [buffer = 10]
11
- @private
50
+ Adds a buffer to either side of the non-discrete axis.
51
+
52
+
53
+ @param buffer @private
12
54
  */ export default function(param) {
13
55
  var _this = this;
14
56
  var data = param.data, x = param.x, y = param.y, x2 = param.x2, y2 = param.y2, _param_buffer = param.buffer, buffer = _param_buffer === void 0 ? 10 : _param_buffer;
@@ -20,10 +62,11 @@ import { nest } from "d3-collection";
20
62
  if (isDiscreteX) oppDomain.reverse();
21
63
  var negVals, posVals;
22
64
  if (this._stacked) {
23
- var groupedData = nest().key(function(d) {
65
+ var groupedData = groups(data, function(d) {
24
66
  return d[_this._discrete];
25
- }).entries(data).map(function(d) {
26
- return d.values.map(function(x) {
67
+ }).map(function(param) {
68
+ var _param = _sliced_to_array(param, 2), values = _param[1];
69
+ return values.map(function(x) {
27
70
  return x[isDiscreteX ? yKey : xKey];
28
71
  });
29
72
  });
@@ -2,12 +2,10 @@ import discreteBuffer from "./discreteBuffer.js";
2
2
  import numericBuffer from "./numericBuffer.js";
3
3
  /**
4
4
  @module circleBuffer
5
- @desc Adds a buffer to either side of the non-discrete axis.
6
- @param {Array} data
7
- @param {D3Scale} x
8
- @param {D3Scale} y
9
- @param {Object} [config]
10
- @param {Number} [buffer] Defaults to the radius of the largest Circle.
5
+ Adds a buffer to either side of the non-discrete axis.
6
+
7
+
8
+ @param buffer Defaults to the radius of the largest Circle.
11
9
  @private
12
10
  */ export default function(param) {
13
11
  var data = param.data, x = param.x, y = param.y, x2 = param.x2, y2 = param.y2, yScale = param.yScale, xScale = param.xScale, config = param.config, buffer = param.buffer;
@@ -21,14 +19,14 @@ import numericBuffer from "./numericBuffer.js";
21
19
  if (!y.invert && y.padding) discreteBuffer(y, data, this._discrete);
22
20
  if (x.invert || y.invert) {
23
21
  data.forEach(function(d) {
24
- var s = buffer ? buffer : config.r(d.data, d.i) * 2;
22
+ var s = buffer ? buffer : (config === null || config === void 0 ? void 0 : config.r)(d.data, d.i) * 2;
25
23
  if (x.invert) {
26
- xD = numericBuffer(x, xScale, d[xKey], s, xR, xD, 0, false);
27
- xD = numericBuffer(x, xScale, d[xKey], s, xR, xD, 1, false);
24
+ xD = numericBuffer(x, xScale !== null && xScale !== void 0 ? xScale : "linear", d[xKey], s, xR, xD, 0, false);
25
+ xD = numericBuffer(x, xScale !== null && xScale !== void 0 ? xScale : "linear", d[xKey], s, xR, xD, 1, false);
28
26
  }
29
27
  if (y.invert) {
30
- yD = numericBuffer(y, yScale, d[yKey], s, yR, yD, 0, true);
31
- yD = numericBuffer(y, yScale, d[yKey], s, yR, yD, 1, true);
28
+ yD = numericBuffer(y, yScale !== null && yScale !== void 0 ? yScale : "linear", d[yKey], s, yR, yD, 0, true);
29
+ yD = numericBuffer(y, yScale !== null && yScale !== void 0 ? yScale : "linear", d[yKey], s, yR, yD, 1, true);
32
30
  }
33
31
  });
34
32
  }