@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
@@ -27,6 +27,19 @@ function _create_class(Constructor, protoProps, staticProps) {
27
27
  if (staticProps) _defineProperties(Constructor, staticProps);
28
28
  return Constructor;
29
29
  }
30
+ function _define_property(obj, key, value) {
31
+ if (key in obj) {
32
+ Object.defineProperty(obj, key, {
33
+ value: value,
34
+ enumerable: true,
35
+ configurable: true,
36
+ writable: true
37
+ });
38
+ } else {
39
+ obj[key] = value;
40
+ }
41
+ return obj;
42
+ }
30
43
  function _get_prototype_of(o) {
31
44
  _get_prototype_of = Object.setPrototypeOf ? Object.getPrototypeOf : function getPrototypeOf(o) {
32
45
  return o.__proto__ || Object.getPrototypeOf(o);
@@ -47,6 +60,7 @@ function _inherits(subClass, superClass) {
47
60
  if (superClass) _set_prototype_of(subClass, superClass);
48
61
  }
49
62
  function _instanceof(left, right) {
63
+ "@swc/helpers - instanceof";
50
64
  if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
51
65
  return !!right[Symbol.hasInstance](left);
52
66
  } else {
@@ -92,19 +106,21 @@ import { strip } from "@d3plus/text";
92
106
  import { TextBox } from "../components/index.js";
93
107
  import { accessor, BaseClass, configPrep, constant } from "../utils/index.js";
94
108
  /**
95
- * @param {*} nodeList
96
- * @param {*} classNames
109
+ * @param {*} nodeList
110
+ * @param {*} classNames
97
111
  * @private
98
- */ function findLastIndexWithClass(nodeList, classNames) {
112
+ */ function findLastIndexWithClass(nodeList, classNames) {
99
113
  for(var x = 0; x < classNames.length; x++){
100
114
  var className = classNames[x];
101
115
  for(var i = nodeList.length - 1; i >= 0; i--){
116
+ // Iterate backwards
102
117
  if (nodeList[i].classList.contains(className)) {
118
+ // Check for the class
103
119
  return i; // Return the index if found
104
120
  }
105
121
  }
106
122
  }
107
- return 0; // Return -1 if no element is found with the class
123
+ return -1; // Return -1 if no element is found with the class
108
124
  }
109
125
  import Image from "./Image.js";
110
126
  var Shape = /*#__PURE__*/ function(BaseClass) {
@@ -114,10 +130,10 @@ var Shape = /*#__PURE__*/ function(BaseClass) {
114
130
  var tagName = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "g";
115
131
  _class_call_check(this, Shape);
116
132
  var _this;
117
- _this = _call_super(this, Shape);
133
+ _this = _call_super(this, Shape), _define_property(_this, "_activeOpacity", void 0), _define_property(_this, "_activeStyle", void 0), _define_property(_this, "_ariaLabel", void 0), _define_property(_this, "_backgroundImage", void 0), _define_property(_this, "_backgroundImageClass", void 0), _define_property(_this, "_data", void 0), _define_property(_this, "_duration", void 0), _define_property(_this, "_fill", void 0), _define_property(_this, "_fillOpacity", void 0), _define_property(_this, "_hoverOpacity", void 0), _define_property(_this, "_hoverStyle", void 0), _define_property(_this, "_id", void 0), _define_property(_this, "_label", void 0), _define_property(_this, "_labelClass", void 0), _define_property(_this, "_labelConfig", void 0), _define_property(_this, "_labelBounds", void 0), _define_property(_this, "_name", void 0), _define_property(_this, "_opacity", void 0), _define_property(_this, "_pointerEvents", void 0), _define_property(_this, "_role", void 0), _define_property(_this, "_rotate", void 0), _define_property(_this, "_rx", void 0), _define_property(_this, "_ry", void 0), _define_property(_this, "_scale", void 0), _define_property(_this, "_shapeRendering", void 0), _define_property(_this, "_stroke", void 0), _define_property(_this, "_strokeDasharray", void 0), _define_property(_this, "_strokeLinecap", void 0), _define_property(_this, "_strokeOpacity", void 0), _define_property(_this, "_strokeWidth", void 0), _define_property(_this, "_tagName", void 0), _define_property(_this, "_textAnchor", void 0), _define_property(_this, "_texture", void 0), _define_property(_this, "_textureDefault", void 0), _define_property(_this, "_textureDefs", void 0), _define_property(_this, "_vectorEffect", void 0), _define_property(_this, "_verticalAlign", void 0), _define_property(_this, "_x", void 0), _define_property(_this, "_y", void 0), _define_property(_this, "_select", void 0), _define_property(_this, "_transition", void 0), _define_property(_this, "_sort", void 0), _define_property(_this, "_group", void 0), _define_property(_this, "_update", void 0), _define_property(_this, "_enter", void 0), _define_property(_this, "_exit", void 0), _define_property(_this, "_hoverGroup", void 0), _define_property(_this, "_activeGroup", void 0), _define_property(_this, "_hitArea", void 0), _define_property(_this, "_active", void 0), _define_property(_this, "_hover", void 0), _define_property(_this, "_discrete", void 0), _define_property(_this, "_path", void 0), _define_property(_this, "_defined", void 0), _define_property(_this, "_curve", void 0);
118
134
  _this._activeOpacity = 0.25;
119
135
  _this._activeStyle = {
120
- "stroke": function(d, i) {
136
+ stroke: function stroke(d, i) {
121
137
  var c = _this._fill(d, i);
122
138
  if ([
123
139
  "transparent",
@@ -139,7 +155,7 @@ var Shape = /*#__PURE__*/ function(BaseClass) {
139
155
  _this._fillOpacity = constant(1);
140
156
  _this._hoverOpacity = 0.5;
141
157
  _this._hoverStyle = {
142
- "stroke": function(d, i) {
158
+ stroke: function stroke(d, i) {
143
159
  var c = _this._fill(d, i);
144
160
  if ([
145
161
  "transparent",
@@ -158,7 +174,7 @@ var Shape = /*#__PURE__*/ function(BaseClass) {
158
174
  _this._label = constant(false);
159
175
  _this._labelClass = new TextBox();
160
176
  _this._labelConfig = {
161
- fontColor: function(d, i) {
177
+ fontColor: function fontColor(d, i) {
162
178
  return colorContrast(_this._fill(d, i));
163
179
  },
164
180
  fontSize: 12,
@@ -194,30 +210,27 @@ var Shape = /*#__PURE__*/ function(BaseClass) {
194
210
  _create_class(Shape, [
195
211
  {
196
212
  /**
197
- @memberof Shape
198
- @desc Given a specific data point and index, returns the aesthetic properties of the shape.
199
- @param {Object} *data point*
200
- @param {Number} *index*
201
- @private
202
- */ key: "_aes",
203
- value: function _aes() {
213
+ Given a specific data point and index, returns the aesthetic properties of the shape.
214
+ @param data point*
215
+ @param index @private
216
+ */ key: "_aes",
217
+ value: function _aes(_d, _i) {
204
218
  return {};
205
219
  }
206
220
  },
207
221
  {
208
222
  /**
209
- @memberof Shape
210
- @desc Adds event listeners to each shape group or hit area.
211
- @param {D3Selection} *update* The update cycle of the data binding.
223
+ Adds event listeners to each shape group or hit area.
212
224
  @private
213
- */ key: "_applyEvents",
225
+ */ key: "_applyEvents",
214
226
  value: function _applyEvents(handler) {
215
227
  var _loop = function(e) {
216
- handler.on(events[e], function(event, d, i) {
228
+ handler.on(events[e], function(event, d) {
229
+ var i = 0;
217
230
  if (!_this._on[events[e]]) return;
218
231
  if (d.i !== void 0) i = d.i;
219
232
  if (d.nested && d.values) {
220
- var calcPoint = function(d, i) {
233
+ var calcPoint = function calcPoint(d, i) {
221
234
  if (_this._discrete === "x") return [
222
235
  _this._x(d, i),
223
236
  cursor[1]
@@ -247,21 +260,19 @@ var Shape = /*#__PURE__*/ function(BaseClass) {
247
260
  },
248
261
  {
249
262
  /**
250
- @memberof Shape
251
- @desc Provides the updated styling to the given shape elements.
252
- @param {HTMLElement} *elem*
253
- @param {Object} *style*
263
+ Provides the updated styling to the given shape elements.
264
+
254
265
  @private
255
- */ key: "_updateStyle",
266
+ */ key: "_updateStyle",
256
267
  value: function _updateStyle(elem, style) {
257
268
  var that = this;
258
269
  if (elem.size() && elem.node().tagName === "g") elem = elem.selectAll("*");
259
270
  /**
260
- @desc Determines whether a shape is a nested collection of data points, and uses the appropriate data and index for the given function context.
261
- @param {Object} *d* data point
262
- @param {Number} *i* index
271
+ Determines whether a shape is a nested collection of data points, and uses the appropriate data and index for the given function context.
272
+ @param d data point
273
+ @param i index
263
274
  @private
264
- */ function styleLogic(d, i) {
275
+ */ function styleLogic(d, i) {
265
276
  return typeof this !== "function" ? this : d.nested && d.key && d.values ? this(d.values[0], that._data.indexOf(d.values[0])) : this(d, i);
266
277
  }
267
278
  var styleObject = {};
@@ -270,28 +281,28 @@ var Shape = /*#__PURE__*/ function(BaseClass) {
270
281
  styleObject[key] = styleLogic.bind(style[key]);
271
282
  }
272
283
  }
284
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
273
285
  elem.transition().duration(0).call(attrize, styleObject);
274
286
  }
275
287
  },
276
288
  {
277
289
  /**
278
- @memberof Shape
279
- @desc Provides the default styling to the shape elements.
280
- @param {HTMLElement} *elem*
281
- @private
282
- */ key: "_applyStyle",
290
+ Provides the default styling to the shape elements.
291
+ @param elem @private
292
+ */ key: "_applyStyle",
283
293
  value: function _applyStyle(elem) {
284
294
  var _this = this;
285
295
  var that = this;
286
296
  if (elem.size() && elem.node().tagName === "g") elem = elem.selectAll("*");
287
297
  /**
288
- @desc Determines whether a shape is a nested collection of data points, and uses the appropriate data and index for the given function context.
289
- @param {Object} *d* data point
290
- @param {Number} *i* index
298
+ Determines whether a shape is a nested collection of data points, and uses the appropriate data and index for the given function context.
299
+ @param d data point
300
+ @param i index
291
301
  @private
292
- */ function styleLogic(d, i) {
302
+ */ function styleLogic(d, i) {
293
303
  return typeof this !== "function" ? this : d.nested && d.key && d.values ? this(d.values[0], that._data.indexOf(d.values[0])) : this(d, i);
294
304
  }
305
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
295
306
  elem.attr("fill", function(d, i) {
296
307
  var texture = _this._getTextureKey.bind(_this)(d, i);
297
308
  return texture ? _this._textureDefs[texture].url() : styleLogic.bind(_this._fill)(d, i);
@@ -300,13 +311,12 @@ var Shape = /*#__PURE__*/ function(BaseClass) {
300
311
  },
301
312
  {
302
313
  /**
303
- @memberof Shape
304
- @desc Calculates the transform for the group elements.
305
- @param {HTMLElement} *elem*
306
- @private
307
- */ key: "_applyTransform",
314
+ Calculates the transform for the group elements.
315
+ @param elem @private
316
+ */ key: "_applyTransform",
308
317
  value: function _applyTransform(elem) {
309
318
  var _this = this;
319
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
310
320
  elem.attr("transform", function(d, i) {
311
321
  return "\n translate(".concat(d.__d3plusShape__ ? d.translate ? d.translate : "".concat(_this._x(d.data, d.i), ",").concat(_this._y(d.data, d.i)) : "".concat(_this._x(d, i), ",").concat(_this._y(d, i)), ")\n scale(").concat(d.__d3plusShape__ ? d.scale || _this._scale(d.data, d.i) : _this._scale(d, i), ")\n rotate(").concat(d.__d3plusShape__ ? d.rotate ? d.rotate : _this._rotate(d.data || d, d.i) : _this._rotate(d.data || d, d.i), ")");
312
322
  });
@@ -314,29 +324,29 @@ var Shape = /*#__PURE__*/ function(BaseClass) {
314
324
  },
315
325
  {
316
326
  /**
317
- @memberof Shape
318
- @desc Returns a full JSON string of the texture config for a given data point.
319
- @param {Object} *d*
320
- @param {Number} *i*
327
+ Returns a full JSON string of the texture config for a given data point.
328
+
321
329
  @private
322
- */ key: "_getTextureKey",
330
+ */ key: "_getTextureKey",
323
331
  value: function _getTextureKey(d, i) {
324
332
  var _this = this;
325
- var texture = this._texture(d, i);
326
- if (!texture) return false;
333
+ var textureVal = this._texture(d, i);
334
+ if (!textureVal) return false;
327
335
  /**
328
- @desc Determines whether a shape is a nested collection of data points, and uses the appropriate data and index for the given function context.
336
+ Determines whether a shape is a nested collection of data points, and uses the appropriate data and index for the given function context.
329
337
  @private
330
- */ var styleLogic = function(_) {
338
+ */ var styleLogic = function styleLogic(_) {
331
339
  return typeof _ !== "function" ? _ : d.nested && d.key && d.values ? _(d.values[0], _this._data.indexOf(d.values[0])) : _(d, i);
332
340
  };
333
341
  var fallback = this._textureDefault;
334
- if (!isObject(texture)) texture = {
335
- texture: texture
342
+ var texture;
343
+ if (!isObject(textureVal)) texture = {
344
+ texture: textureVal
336
345
  };
346
+ else texture = textureVal;
337
347
  if (!texture.background) texture.background = styleLogic(this._fill);
338
348
  if (!texture.stroke && !fallback.stroke) texture.stroke = styleLogic(this._stroke);
339
- var paths = [
349
+ var pathNames = [
340
350
  "squares",
341
351
  "nylon",
342
352
  "waves",
@@ -345,7 +355,7 @@ var Shape = /*#__PURE__*/ function(BaseClass) {
345
355
  "caps",
346
356
  "hexagons"
347
357
  ];
348
- if (paths.includes(texture.texture) || typeof texture.texture === "function") {
358
+ if (pathNames.includes(texture.texture) || typeof texture.texture === "function") {
349
359
  texture.d = texture.texture;
350
360
  texture.texture = "paths";
351
361
  } else if (texture.texture === "grid") {
@@ -365,11 +375,9 @@ var Shape = /*#__PURE__*/ function(BaseClass) {
365
375
  },
366
376
  {
367
377
  /**
368
- @memberof Shape
369
- @desc Checks for nested data and uses the appropriate variables for accessor functions.
370
- @param {HTMLElement} *elem*
371
- @private
372
- */ key: "_nestWrapper",
378
+ Checks for nested data and uses the appropriate variables for accessor functions.
379
+ @param elem @private
380
+ */ key: "_nestWrapper",
373
381
  value: function _nestWrapper(method) {
374
382
  return function(d, i) {
375
383
  return method(d.__d3plusShape__ ? d.data : d, d.__d3plusShape__ ? d.i : i);
@@ -378,14 +386,14 @@ var Shape = /*#__PURE__*/ function(BaseClass) {
378
386
  },
379
387
  {
380
388
  /**
381
- @memberof Shape
382
- @desc Modifies existing shapes to show active status.
389
+ Modifies existing shapes to show active status.
383
390
  @private
384
- */ key: "_renderActive",
391
+ */ key: "_renderActive",
385
392
  value: function _renderActive() {
386
393
  var that = this;
387
- this._group.selectAll(".d3plus-Shape, .d3plus-Image, .d3plus-textBox").each(function(d, i) {
388
- if (!d) d = {};
394
+ this._group.selectAll(".d3plus-Shape, .d3plus-Image, .d3plus-textBox")// eslint-disable-next-line @typescript-eslint/no-explicit-any
395
+ .each(function(_d, i) {
396
+ var d = _d || {};
389
397
  if (!d.parentNode) d.parentNode = this.parentNode;
390
398
  var parent = d.parentNode;
391
399
  if (select(this).classed("d3plus-textBox")) d = d.data;
@@ -399,7 +407,8 @@ var Shape = /*#__PURE__*/ function(BaseClass) {
399
407
  if (group !== this.parentNode) {
400
408
  group.appendChild(this);
401
409
  if (this.className.baseVal.includes("d3plus-Shape")) {
402
- if (parent === group) select(this).call(that._applyStyle.bind(that));
410
+ if (parent === group) // eslint-disable-next-line @typescript-eslint/no-explicit-any
411
+ select(this).call(that._applyStyle.bind(that));
403
412
  else select(this).call(that._updateStyle.bind(that, select(this), that._activeStyle));
404
413
  }
405
414
  }
@@ -411,17 +420,15 @@ var Shape = /*#__PURE__*/ function(BaseClass) {
411
420
  },
412
421
  {
413
422
  /**
414
- @memberof Shape
415
- @desc Modifies existing shapes to show hover status.
423
+ Modifies existing shapes to show hover status.
416
424
  @private
417
- */ key: "_renderHover",
425
+ */ key: "_renderHover",
418
426
  value: function _renderHover() {
419
427
  var that = this;
420
- this._group.selectAll("g.d3plus-".concat(this._name, "-shape, g.d3plus-").concat(this._name, "-image, g.d3plus-").concat(this._name, "-text, g.d3plus-").concat(this._name, "-hover")).selectAll(".d3plus-Shape, .d3plus-Image, .d3plus-textBox").each(function(d, i) {
421
- if (!d) d = {};
428
+ this._group.selectAll("g.d3plus-".concat(this._name, "-shape, g.d3plus-").concat(this._name, "-image, g.d3plus-").concat(this._name, "-text, g.d3plus-").concat(this._name, "-hover")).selectAll(".d3plus-Shape, .d3plus-Image, .d3plus-textBox")// eslint-disable-next-line @typescript-eslint/no-explicit-any
429
+ .each(function(_d, i) {
430
+ var d = _d || {};
422
431
  if (!d.parentNode) d.parentNode = this.parentNode;
423
- if (!d.dataIndex) d.dataIndex = i;
424
- var dataIndex = d.dataIndex;
425
432
  var parent = d.parentNode;
426
433
  var d3plusType = select(this).classed("d3plus-textBox") ? "textBox" : select(this).classed("d3plus-Image") ? "Image" : "Shape";
427
434
  if (d3plusType === "textBox") d = d.data;
@@ -434,16 +441,19 @@ var Shape = /*#__PURE__*/ function(BaseClass) {
434
441
  var notHovering = !that._hover || typeof that._hover !== "function" || !that._hover(d, i);
435
442
  var group = notHovering ? parent : that._hoverGroup.node();
436
443
  if (group !== this.parentNode) {
437
- var offset = d3plusType === "textBox" ? findLastIndexWithClass(group.childNodes, [
444
+ var afterIndex = d3plusType === "textBox" ? findLastIndexWithClass(group.childNodes, [
438
445
  "d3plus-Image",
439
446
  "d3plus-Shape"
440
447
  ]) : d3plusType === "Image" ? findLastIndexWithClass(group.childNodes, [
441
448
  "d3plus-Shape"
442
- ]) : 0;
443
- group.insertBefore(this, group.childNodes[offset + dataIndex]);
449
+ ]) : -1;
450
+ if (notHovering) group.appendChild(this);
451
+ else if (afterIndex === -1) group.prepend(this);
452
+ else group.childNodes[afterIndex].after(this);
444
453
  }
445
454
  if (this.className.baseVal.includes("d3plus-Shape")) {
446
- if (parent === group) select(this).call(that._applyStyle.bind(that));
455
+ if (parent === group) // eslint-disable-next-line @typescript-eslint/no-explicit-any
456
+ select(this).call(that._applyStyle.bind(that));
447
457
  else select(this).call(that._updateStyle.bind(that, select(this), that._hoverStyle));
448
458
  }
449
459
  });
@@ -454,10 +464,9 @@ var Shape = /*#__PURE__*/ function(BaseClass) {
454
464
  },
455
465
  {
456
466
  /**
457
- @memberof Shape
458
- @desc Adds background image to each shape group.
467
+ Adds background image to each shape group.
459
468
  @private
460
- */ key: "_renderImage",
469
+ */ key: "_renderImage",
461
470
  value: function _renderImage() {
462
471
  var _this = this;
463
472
  var imageData = [];
@@ -502,10 +511,9 @@ var Shape = /*#__PURE__*/ function(BaseClass) {
502
511
  },
503
512
  {
504
513
  /**
505
- @memberof Shape
506
- @desc Adds labels to each shape group.
514
+ Adds labels to each shape group.
507
515
  @private
508
- */ key: "_renderLabels",
516
+ */ key: "_renderLabels",
509
517
  value: function _renderLabels() {
510
518
  var _this = this;
511
519
  var labelData = [];
@@ -530,7 +538,8 @@ var Shape = /*#__PURE__*/ function(BaseClass) {
530
538
  for(var l = 0; l < labels.length; l++){
531
539
  var b = bounds.constructor === Array ? bounds[l] : Object.assign({}, bounds);
532
540
  var rotate = _this._rotate(d, i);
533
- var r = d.labelConfig && d.labelConfig.rotate ? d.labelConfig.rotate : bounds.angle !== undefined ? bounds.angle : 0;
541
+ var labelConfig = d.labelConfig;
542
+ var r = labelConfig && labelConfig.rotate ? labelConfig.rotate : bounds.angle !== undefined ? bounds.angle : 0;
534
543
  r += rotate;
535
544
  var rotateAnchor = rotate !== 0 ? [
536
545
  b.x * -1 || 0,
@@ -565,16 +574,15 @@ var Shape = /*#__PURE__*/ function(BaseClass) {
565
574
  update: {
566
575
  opacity: this._active ? this._activeOpacity : 1
567
576
  }
568
- }).node()).config(configPrep.bind(this)(this._labelConfig)).render();
577
+ }).node())// eslint-disable-next-line @typescript-eslint/no-explicit-any
578
+ .config(configPrep.bind(this)(this._labelConfig)).render();
569
579
  }
570
580
  },
571
581
  {
572
582
  /**
573
- @memberof Shape
574
- @desc Renders the current Shape to the page. If a *callback* is specified, it will be called once the shapes are done drawing.
575
- @param {Function} [*callback*]
576
- @chainable
577
- */ key: "render",
583
+ Renders the current Shape to the page. If a *callback* is specified, it will be called once the shapes are done drawing.
584
+ @param callback Optional callback invoked after rendering completes.
585
+ */ key: "render",
578
586
  value: function render(callback) {
579
587
  var _this = this;
580
588
  if (this._select === void 0) {
@@ -597,7 +605,8 @@ var Shape = /*#__PURE__*/ function(BaseClass) {
597
605
  var existingTextureDefs = Object.keys(this._textureDefs);
598
606
  existingTextureDefs.forEach(function(key) {
599
607
  if (!textureSet.includes(key)) {
600
- select(_this._select.select("pattern#".concat(_this._textureDefs[key].id())).node().parentNode).remove();
608
+ select(// eslint-disable-next-line @typescript-eslint/no-explicit-any
609
+ _this._select.select("pattern#".concat(_this._textureDefs[key].id())).node().parentNode).remove();
601
610
  delete _this._textureDefs[key];
602
611
  }
603
612
  });
@@ -614,6 +623,7 @@ var Shape = /*#__PURE__*/ function(BaseClass) {
614
623
  var config = JSON.parse(key);
615
624
  var textureClass = config.texture;
616
625
  delete config.texture;
626
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
617
627
  var t = textures[textureClass]();
618
628
  for(var k in config)_loop(k);
619
629
  _this._select.call(t);
@@ -621,7 +631,8 @@ var Shape = /*#__PURE__*/ function(BaseClass) {
621
631
  }
622
632
  });
623
633
  selectAll("g.d3plus-".concat(this._name, "-hover > *, g.d3plus-").concat(this._name, "-active > *")).each(function(d) {
624
- if (d && d.parentNode) d.parentNode.appendChild(this);
634
+ var dp = d;
635
+ if (dp && dp.parentNode) dp.parentNode.appendChild(this);
625
636
  else this.parentNode.removeChild(this);
626
637
  });
627
638
  // Makes the update state of the group selection accessible.
@@ -637,6 +648,7 @@ var Shape = /*#__PURE__*/ function(BaseClass) {
637
648
  // Orders and transforms the updating Shapes.
638
649
  update.order();
639
650
  if (this._duration) {
651
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
640
652
  update.transition(this._transition).call(this._applyTransform.bind(this));
641
653
  } else {
642
654
  update.call(this._applyTransform.bind(this));
@@ -668,12 +680,15 @@ var Shape = /*#__PURE__*/ function(BaseClass) {
668
680
  var isLine = this._name === "Line";
669
681
  if (isLine) {
670
682
  var curve = this._curve.bind(this)(this.config());
671
- isLine && this._path.curve(paths["curve".concat(curve.charAt(0).toUpperCase()).concat(curve.slice(1))]).defined(this._defined).x(this._x).y(this._y);
683
+ isLine && // eslint-disable-next-line @typescript-eslint/no-explicit-any
684
+ this._path.curve(// eslint-disable-next-line @typescript-eslint/no-explicit-any
685
+ paths["curve".concat(curve.charAt(0).toUpperCase()).concat(curve.slice(1))]).defined(this._defined).x(this._x).y(this._y);
672
686
  }
673
687
  var hitEnter = hitAreas.enter().append(isLine ? "path" : "rect").attr("class", function(d, i) {
674
688
  return "d3plus-HitArea d3plus-id-".concat(strip(_this._nestWrapper(_this._id)(d, i)));
675
689
  }).attr("fill", "black").attr("stroke", "black").attr("pointer-events", "painted").attr("opacity", 0).call(this._applyTransform.bind(this));
676
690
  var that = this;
691
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
677
692
  var hitUpdates = hitAreas.merge(hitEnter).each(function(d) {
678
693
  var i = that._data.indexOf(d);
679
694
  var h = that._hitArea(d, i, that._aes(d, i));
@@ -690,12 +705,7 @@ var Shape = /*#__PURE__*/ function(BaseClass) {
690
705
  }
691
706
  },
692
707
  {
693
- /**
694
- @memberof Shape
695
- @desc If *value* is specified, sets the highlight accessor to the specified function and returns the current class instance.
696
- @param {Function} [*value*]
697
- @chainable
698
- */ key: "active",
708
+ key: "active",
699
709
  value: function active(_) {
700
710
  if (!arguments.length || _ === undefined) return this._active;
701
711
  this._active = _;
@@ -708,111 +718,61 @@ var Shape = /*#__PURE__*/ function(BaseClass) {
708
718
  }
709
719
  },
710
720
  {
711
- /**
712
- @memberof Shape
713
- @desc When shapes are active, this is the opacity of any shape that is not active.
714
- @param {Number} *value* = 0.25
715
- @chainable
716
- */ key: "activeOpacity",
721
+ key: "activeOpacity",
717
722
  value: function activeOpacity(_) {
718
723
  return arguments.length ? (this._activeOpacity = _, this) : this._activeOpacity;
719
724
  }
720
725
  },
721
726
  {
722
- /**
723
- @memberof Shape
724
- @desc The style to apply to active shapes.
725
- @param {Object} *value*
726
- @chainable
727
- */ key: "activeStyle",
727
+ key: "activeStyle",
728
728
  value: function activeStyle(_) {
729
729
  return arguments.length ? (this._activeStyle = assign({}, this._activeStyle, _), this) : this._activeStyle;
730
730
  }
731
731
  },
732
732
  {
733
- /**
734
- @memberof Shape
735
- @desc If *value* is specified, sets the aria-label attribute to the specified function or string and returns the current class instance.
736
- @param {Function|String} *value*
737
- @chainable
738
- */ key: "ariaLabel",
733
+ key: "ariaLabel",
739
734
  value: function ariaLabel(_) {
740
735
  return _ !== undefined ? (this._ariaLabel = typeof _ === "function" ? _ : constant(_), this) : this._ariaLabel;
741
736
  }
742
737
  },
743
738
  {
744
- /**
745
- @memberof Shape
746
- @desc If *value* is specified, sets the background-image accessor to the specified function or string and returns the current class instance.
747
- @param {Function|String} [*value* = false]
748
- @chainable
749
- */ key: "backgroundImage",
739
+ key: "backgroundImage",
750
740
  value: function backgroundImage(_) {
751
741
  return arguments.length ? (this._backgroundImage = typeof _ === "function" ? _ : constant(_), this) : this._backgroundImage;
752
742
  }
753
743
  },
754
744
  {
755
- /**
756
- @memberof Shape
757
- @desc If *data* is specified, sets the data array to the specified array and returns the current class instance. If *data* is not specified, returns the current data array. A shape will be drawn for each object in the array.
758
- @param {Array} [*data* = []]
759
- @chainable
760
- */ key: "data",
745
+ key: "data",
761
746
  value: function data(_) {
762
747
  return arguments.length ? (this._data = _, this) : this._data;
763
748
  }
764
749
  },
765
750
  {
766
- /**
767
- @memberof Shape
768
- @desc Determines if either the X or Y position is discrete along a Line, which helps in determining the nearest data point on a line for a hit area event.
769
- @param {String} *value*
770
- @chainable
771
- */ key: "discrete",
751
+ key: "discrete",
772
752
  value: function discrete(_) {
773
753
  return arguments.length ? (this._discrete = _, this) : this._discrete;
774
754
  }
775
755
  },
776
756
  {
777
- /**
778
- @memberof Shape
779
- @desc If *ms* is specified, sets the animation duration to the specified number and returns the current class instance. If *ms* is not specified, returns the current animation duration.
780
- @param {Number} [*ms* = 600]
781
- @chainable
782
- */ key: "duration",
757
+ key: "duration",
783
758
  value: function duration(_) {
784
759
  return arguments.length ? (this._duration = _, this) : this._duration;
785
760
  }
786
761
  },
787
762
  {
788
- /**
789
- @memberof Shape
790
- @desc If *value* is specified, sets the fill accessor to the specified function or string and returns the current class instance.
791
- @param {Function|String} [*value* = "black"]
792
- @chainable
793
- */ key: "fill",
763
+ key: "fill",
794
764
  value: function fill(_) {
795
765
  return arguments.length ? (this._fill = typeof _ === "function" ? _ : constant(_), this) : this._fill;
796
766
  }
797
767
  },
798
768
  {
799
- /**
800
- @memberof Shape
801
- @desc Defines the "fill-opacity" attribute for the shapes.
802
- @param {Function|Number} [*value* = 1]
803
- @chainable
804
- */ key: "fillOpacity",
769
+ key: "fillOpacity",
805
770
  value: function fillOpacity(_) {
806
771
  return arguments.length ? (this._fillOpacity = typeof _ === "function" ? _ : constant(_), this) : this._fillOpacity;
807
772
  }
808
773
  },
809
774
  {
810
- /**
811
- @memberof Shape
812
- @desc If *value* is specified, sets the highlight accessor to the specified function and returns the current class instance.
813
- @param {Function} [*value*]
814
- @chainable
815
- */ key: "hover",
775
+ key: "hover",
816
776
  value: function hover(_) {
817
777
  if (!arguments.length || _ === void 0) return this._hover;
818
778
  this._hover = _;
@@ -825,350 +785,175 @@ var Shape = /*#__PURE__*/ function(BaseClass) {
825
785
  }
826
786
  },
827
787
  {
828
- /**
829
- @memberof Shape
830
- @desc The style to apply to hovered shapes.
831
- @param {Object} *value*
832
- @chainable
833
- */ key: "hoverStyle",
788
+ key: "hoverStyle",
834
789
  value: function hoverStyle(_) {
835
790
  return arguments.length ? (this._hoverStyle = assign({}, this._hoverStyle, _), this) : this._hoverStyle;
836
791
  }
837
792
  },
838
793
  {
839
- /**
840
- @memberof Shape
841
- @desc If *value* is specified, sets the hover opacity to the specified function and returns the current class instance.
842
- @param {Number} [*value* = 0.5]
843
- @chainable
844
- */ key: "hoverOpacity",
794
+ key: "hoverOpacity",
845
795
  value: function hoverOpacity(_) {
846
796
  return arguments.length ? (this._hoverOpacity = _, this) : this._hoverOpacity;
847
797
  }
848
798
  },
849
799
  {
850
- /**
851
- @memberof Shape
852
- @desc If *bounds* is specified, sets the mouse hit area to the specified function and returns the current class instance. If *bounds* is not specified, returns the current mouse hit area accessor.
853
- @param {Function} [*bounds*] The given function is passed the data point, index, and internally defined properties of the shape and should return an object containing the following values: `width`, `height`, `x`, `y`.
854
- @chainable
855
- @example
856
- function(d, i, shape) {
857
- return {
858
- "width": shape.width,
859
- "height": shape.height,
860
- "x": -shape.width / 2,
861
- "y": -shape.height / 2
862
- };
863
- }
864
- */ key: "hitArea",
800
+ key: "hitArea",
865
801
  value: function hitArea(_) {
866
802
  return arguments.length ? (this._hitArea = typeof _ === "function" ? _ : constant(_), this) : this._hitArea;
867
803
  }
868
804
  },
869
805
  {
870
- /**
871
- @memberof Shape
872
- @desc If *value* is specified, sets the id accessor to the specified function and returns the current class instance.
873
- @param {Function} [*value*]
874
- @chainable
875
- */ key: "id",
806
+ key: "id",
876
807
  value: function id(_) {
877
808
  return arguments.length ? (this._id = _, this) : this._id;
878
809
  }
879
810
  },
880
811
  {
881
- /**
882
- @memberof Shape
883
- @desc If *value* is specified, sets the label accessor to the specified function or string and returns the current class instance.
884
- @param {Function|String|Array} [*value*]
885
- @chainable
886
- */ key: "label",
812
+ key: "label",
887
813
  value: function label(_) {
888
814
  return arguments.length ? (this._label = typeof _ === "function" ? _ : constant(_), this) : this._label;
889
815
  }
890
816
  },
891
817
  {
892
- /**
893
- @memberof Shape
894
- @desc If *bounds* is specified, sets the label bounds to the specified function and returns the current class instance. If *bounds* is not specified, returns the current inner bounds accessor.
895
- @param {Function} [*bounds*] The given function is passed the data point, index, and internally defined properties of the shape and should return an object containing the following values: `width`, `height`, `x`, `y`. If an array is returned from the function, each value will be used in conjunction with each label.
896
- @chainable
897
- @example
898
- function(d, i, shape) {
899
- return {
900
- "width": shape.width,
901
- "height": shape.height,
902
- "x": -shape.width / 2,
903
- "y": -shape.height / 2
904
- };
905
- }
906
- */ key: "labelBounds",
818
+ key: "labelBounds",
907
819
  value: function labelBounds(_) {
908
820
  return arguments.length ? (this._labelBounds = typeof _ === "function" ? _ : constant(_), this) : this._labelBounds;
909
821
  }
910
822
  },
911
823
  {
912
- /**
913
- @memberof Shape
914
- @desc A pass-through to the config method of the TextBox class used to create a shape's labels.
915
- @param {Object} [*value*]
916
- @chainable
917
- */ key: "labelConfig",
824
+ key: "labelConfig",
918
825
  value: function labelConfig(_) {
919
826
  return arguments.length ? (this._labelConfig = assign(this._labelConfig, _), this) : this._labelConfig;
920
827
  }
921
828
  },
922
829
  {
923
- /**
924
- @memberof Shape
925
- @desc If *value* is specified, sets the opacity accessor to the specified function or number and returns the current class instance.
926
- @param {Number} [*value* = 1]
927
- @chainable
928
- */ key: "opacity",
830
+ key: "opacity",
929
831
  value: function opacity(_) {
930
832
  return arguments.length ? (this._opacity = typeof _ === "function" ? _ : constant(_), this) : this._opacity;
931
833
  }
932
834
  },
933
835
  {
934
- /**
935
- @memberof Shape
936
- @desc If *value* is specified, sets the pointerEvents accessor to the specified function or string and returns the current class instance.
937
- @param {String} [*value*]
938
- @chainable
939
- */ key: "pointerEvents",
836
+ key: "pointerEvents",
940
837
  value: function pointerEvents(_) {
941
838
  return arguments.length ? (this._pointerEvents = typeof _ === "function" ? _ : constant(_), this) : this._pointerEvents;
942
839
  }
943
840
  },
944
841
  {
945
- /**
946
- @memberof Shape
947
- @desc If *value* is specified, sets the role attribute to the specified function or string and returns the current class instance.
948
- @param {Function|String} *value*
949
- @chainable
950
- */ key: "role",
842
+ key: "role",
951
843
  value: function role(_) {
952
844
  return _ !== undefined ? (this._role = typeof _ === "function" ? _ : constant(_), this) : this._role;
953
845
  }
954
846
  },
955
847
  {
956
- /**
957
- @memberof Shape
958
- @desc If *value* is specified, sets the rotate accessor to the specified function or number and returns the current class instance.
959
- @param {Function|Number} [*value* = 0]
960
- @chainable
961
- */ key: "rotate",
848
+ key: "rotate",
962
849
  value: function rotate(_) {
963
850
  return arguments.length ? (this._rotate = typeof _ === "function" ? _ : constant(_), this) : this._rotate;
964
851
  }
965
852
  },
966
853
  {
967
- /**
968
- @memberof Shape
969
- @desc Defines the "rx" attribute for the shapes.
970
- @param {Function|Number} [*value* = 0]
971
- @chainable
972
- */ key: "rx",
854
+ key: "rx",
973
855
  value: function rx(_) {
974
856
  return arguments.length ? (this._rx = typeof _ === "function" ? _ : constant(_), this) : this._rx;
975
857
  }
976
858
  },
977
859
  {
978
- /**
979
- @memberof Shape
980
- @desc Defines the "rx" attribute for the shapes.
981
- @param {Function|Number} [*value* = 0]
982
- @chainable
983
- */ key: "ry",
860
+ key: "ry",
984
861
  value: function ry(_) {
985
862
  return arguments.length ? (this._ry = typeof _ === "function" ? _ : constant(_), this) : this._ry;
986
863
  }
987
864
  },
988
865
  {
989
- /**
990
- @memberof Shape
991
- @desc If *value* is specified, sets the scale accessor to the specified function or string and returns the current class instance.
992
- @param {Function|Number} [*value* = 1]
993
- @chainable
994
- */ key: "scale",
866
+ key: "scale",
995
867
  value: function scale(_) {
996
868
  return arguments.length ? (this._scale = typeof _ === "function" ? _ : constant(_), this) : this._scale;
997
869
  }
998
870
  },
999
871
  {
1000
- /**
1001
- @memberof Shape
1002
- @desc If *selector* is specified, sets the SVG container element to the specified d3 selector or DOM element and returns the current class instance. If *selector* is not specified, returns the current SVG container element.
1003
- @param {String|HTMLElement} [*selector* = d3.select("body").append("svg")]
1004
- @chainable
1005
- */ key: "select",
872
+ key: "select",
1006
873
  value: function select1(_) {
1007
874
  return arguments.length ? (this._select = select(_), this) : this._select;
1008
875
  }
1009
876
  },
1010
877
  {
1011
- /**
1012
- @memberof Shape
1013
- @desc If *value* is specified, sets the shape-rendering accessor to the specified function or string and returns the current class instance.
1014
- @param {Function|String} [*value* = "geometricPrecision"]
1015
- @chainable
1016
- @example
1017
- function(d) {
1018
- return d.x;
1019
- }
1020
- */ key: "shapeRendering",
878
+ key: "shapeRendering",
1021
879
  value: function shapeRendering(_) {
1022
880
  return arguments.length ? (this._shapeRendering = typeof _ === "function" ? _ : constant(_), this) : this._shapeRendering;
1023
881
  }
1024
882
  },
1025
883
  {
1026
- /**
1027
- @memberof Shape
1028
- @desc If *value* is specified, sets the sort comparator to the specified function and returns the current class instance.
1029
- @param {false|Function} [*value* = []]
1030
- @chainable
1031
- */ key: "sort",
884
+ key: "sort",
1032
885
  value: function sort(_) {
1033
- return arguments.length ? (this._sort = _, this) : this._sort;
886
+ return arguments.length ? (this._sort = _ !== null && _ !== void 0 ? _ : null, this) : this._sort;
1034
887
  }
1035
888
  },
1036
889
  {
1037
- /**
1038
- @memberof Shape
1039
- @desc If *value* is specified, sets the stroke accessor to the specified function or string and returns the current class instance.
1040
- @param {Function|String} [*value* = "black"]
1041
- @chainable
1042
- */ key: "stroke",
890
+ key: "stroke",
1043
891
  value: function stroke(_) {
1044
892
  return arguments.length ? (this._stroke = typeof _ === "function" ? _ : constant(_), this) : this._stroke;
1045
893
  }
1046
894
  },
1047
895
  {
1048
- /**
1049
- @memberof Shape
1050
- @desc Defines the "stroke-dasharray" attribute for the shapes.
1051
- @param {Function|String} [*value* = "1"]
1052
- @chainable
1053
- */ key: "strokeDasharray",
896
+ key: "strokeDasharray",
1054
897
  value: function strokeDasharray(_) {
1055
898
  return arguments.length ? (this._strokeDasharray = typeof _ === "function" ? _ : constant(_), this) : this._strokeDasharray;
1056
899
  }
1057
900
  },
1058
901
  {
1059
- /**
1060
- @memberof Shape
1061
- @desc Defines the "stroke-linecap" attribute for the shapes. Accepted values are `"butt"`, `"round"`, and `"square"`.
1062
- @param {Function|String} [*value* = "butt"]
1063
- @chainable
1064
- */ key: "strokeLinecap",
902
+ key: "strokeLinecap",
1065
903
  value: function strokeLinecap(_) {
1066
904
  return arguments.length ? (this._strokeLinecap = typeof _ === "function" ? _ : constant(_), this) : this._strokeLinecap;
1067
905
  }
1068
906
  },
1069
907
  {
1070
- /**
1071
- @memberof Shape
1072
- @desc Defines the "stroke-opacity" attribute for the shapes.
1073
- @param {Function|Number} [*value* = 1]
1074
- @chainable
1075
- */ key: "strokeOpacity",
908
+ key: "strokeOpacity",
1076
909
  value: function strokeOpacity(_) {
1077
910
  return arguments.length ? (this._strokeOpacity = typeof _ === "function" ? _ : constant(_), this) : this._strokeOpacity;
1078
911
  }
1079
912
  },
1080
913
  {
1081
- /**
1082
- @memberof Shape
1083
- @desc If *value* is specified, sets the stroke-width accessor to the specified function or string and returns the current class instance.
1084
- @param {Function|Number} [*value* = 0]
1085
- @chainable
1086
- */ key: "strokeWidth",
914
+ key: "strokeWidth",
1087
915
  value: function strokeWidth(_) {
1088
916
  return arguments.length ? (this._strokeWidth = typeof _ === "function" ? _ : constant(_), this) : this._strokeWidth;
1089
917
  }
1090
918
  },
1091
919
  {
1092
- /**
1093
- @memberof Shape
1094
- @desc If *value* is specified, sets the text-anchor accessor to the specified function or string and returns the current class instance.
1095
- @param {Function|String|Array} [*value* = "start"]
1096
- @chainable
1097
- */ key: "textAnchor",
920
+ key: "textAnchor",
1098
921
  value: function textAnchor(_) {
1099
922
  return arguments.length ? (this._textAnchor = typeof _ === "function" ? _ : constant(_), this) : this._textAnchor;
1100
923
  }
1101
924
  },
1102
925
  {
1103
- /**
1104
- @memberof Shape
1105
- @desc Defines the texture used inside of each shape. This uses the [textures.js](https://riccardoscalco.it/textures/) package, and expects either a simple string (`"lines"` or `"circles"`) or a more complex Object containing the various properties of the texture (ie. `{texture: "lines", orientation: "3/8", stroke: "darkorange"}`). If multiple textures are necessary, provide an accsesor Function that returns the correct String/Object for each given data point and index.
1106
- @param {String|Object|Function} [*value*]
1107
- @chainable
1108
- */ key: "texture",
926
+ key: "texture",
1109
927
  value: function texture(_) {
1110
928
  return arguments.length ? (this._texture = typeof _ === "function" ? _ : constant(_), this) : this._texture;
1111
929
  }
1112
930
  },
1113
931
  {
1114
- /**
1115
- @memberof Shape
1116
- @desc A series of global texture methods to be used for all textures (ie. `{stroke: "darkorange", strokeWidth: 2}`).
1117
- @param {Object} [*value*]
1118
- @chainable
1119
- */ key: "textureDefault",
932
+ key: "textureDefault",
1120
933
  value: function textureDefault(_) {
1121
934
  return arguments.length ? (this._textureDefault = assign(this._textureDefault, _), this) : this._textureDefault;
1122
935
  }
1123
936
  },
1124
937
  {
1125
- /**
1126
- @memberof Shape
1127
- @desc If *value* is specified, sets the vector-effect accessor to the specified function or string and returns the current class instance.
1128
- @param {Function|String} [*value* = "non-scaling-stroke"]
1129
- @chainable
1130
- */ key: "vectorEffect",
938
+ key: "vectorEffect",
1131
939
  value: function vectorEffect(_) {
1132
940
  return arguments.length ? (this._vectorEffect = typeof _ === "function" ? _ : constant(_), this) : this._vectorEffect;
1133
941
  }
1134
942
  },
1135
943
  {
1136
- /**
1137
- @memberof Shape
1138
- @desc If *value* is specified, sets the vertical alignment accessor to the specified function or string and returns the current class instance.
1139
- @param {Function|String|Array} [*value* = "start"]
1140
- @chainable
1141
- */ key: "verticalAlign",
944
+ key: "verticalAlign",
1142
945
  value: function verticalAlign(_) {
1143
946
  return arguments.length ? (this._verticalAlign = typeof _ === "function" ? _ : constant(_), this) : this._verticalAlign;
1144
947
  }
1145
948
  },
1146
949
  {
1147
- /**
1148
- @memberof Shape
1149
- @desc If *value* is specified, sets the x accessor to the specified function or number and returns the current class instance.
1150
- @param {Function|Number} [*value*]
1151
- @chainable
1152
- @example
1153
- function(d) {
1154
- return d.x;
1155
- }
1156
- */ key: "x",
950
+ key: "x",
1157
951
  value: function x(_) {
1158
952
  return arguments.length ? (this._x = typeof _ === "function" ? _ : constant(_), this) : this._x;
1159
953
  }
1160
954
  },
1161
955
  {
1162
- /**
1163
- @memberof Shape
1164
- @desc If *value* is specified, sets the y accessor to the specified function or number and returns the current class instance.
1165
- @param {Function|Number} [*value*]
1166
- @chainable
1167
- @example
1168
- function(d) {
1169
- return d.y;
1170
- }
1171
- */ key: "y",
956
+ key: "y",
1172
957
  value: function y(_) {
1173
958
  return arguments.length ? (this._y = typeof _ === "function" ? _ : constant(_), this) : this._y;
1174
959
  }
@@ -1177,7 +962,5 @@ function(d) {
1177
962
  return Shape;
1178
963
  }(BaseClass);
1179
964
  /**
1180
- @class Shape
1181
- @extends BaseClass
1182
- @desc An abstracted class for generating shapes.
965
+ An abstracted class for generating shapes.
1183
966
  */ export { Shape as default };