plottable 3.13.0 → 4.0.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 (131) hide show
  1. package/README.md +9 -2
  2. package/build/src/animators/easingAnimator.d.ts +2 -2
  3. package/build/src/animators/easingAnimator.js +1 -1
  4. package/build/src/animators/index.js +2 -2
  5. package/build/src/axes/axis.d.ts +1 -1
  6. package/build/src/axes/axis.js +5 -5
  7. package/build/src/axes/categoryAxis.js +8 -7
  8. package/build/src/axes/index.js +3 -3
  9. package/build/src/axes/numericAxis.js +1 -1
  10. package/build/src/axes/timeAxis.d.ts +5 -5
  11. package/build/src/axes/timeAxis.js +6 -6
  12. package/build/src/components/component.d.ts +4 -4
  13. package/build/src/components/component.js +4 -4
  14. package/build/src/components/componentContainer.js +1 -1
  15. package/build/src/components/dragBoxLayer.d.ts +1 -1
  16. package/build/src/components/dragBoxLayer.js +1 -1
  17. package/build/src/components/dragLineLayer.js +1 -1
  18. package/build/src/components/gridlines.js +1 -1
  19. package/build/src/components/group.js +1 -1
  20. package/build/src/components/guideLineLayer.js +1 -1
  21. package/build/src/components/index.js +14 -14
  22. package/build/src/components/interpolatedColorLegend.js +1 -1
  23. package/build/src/components/label.d.ts +1 -1
  24. package/build/src/components/label.js +3 -3
  25. package/build/src/components/legend.js +7 -7
  26. package/build/src/components/plotGroup.js +1 -1
  27. package/build/src/components/selectionBoxLayer.js +2 -2
  28. package/build/src/components/table.js +1 -1
  29. package/build/src/components/wrappedLabel.js +1 -1
  30. package/build/src/components/xDragBoxLayer.js +1 -1
  31. package/build/src/components/yDragBoxLayer.js +1 -1
  32. package/build/src/core/dataset.d.ts +1 -1
  33. package/build/src/core/formatters.d.ts +2 -2
  34. package/build/src/core/formatters.js +16 -13
  35. package/build/src/core/interfaces.d.ts +9 -9
  36. package/build/src/core/renderController.d.ts +1 -1
  37. package/build/src/core/renderController.js +6 -6
  38. package/build/src/core/symbolFactories.d.ts +2 -2
  39. package/build/src/core/symbolFactories.js +15 -15
  40. package/build/src/core/version.js +1 -1
  41. package/build/src/dispatchers/index.js +3 -3
  42. package/build/src/dispatchers/keyDispatcher.d.ts +1 -1
  43. package/build/src/dispatchers/keyDispatcher.js +1 -1
  44. package/build/src/dispatchers/mouseDispatcher.d.ts +1 -1
  45. package/build/src/dispatchers/mouseDispatcher.js +1 -1
  46. package/build/src/dispatchers/touchDispatcher.d.ts +1 -1
  47. package/build/src/dispatchers/touchDispatcher.js +1 -1
  48. package/build/src/drawers/arcDrawer.js +1 -1
  49. package/build/src/drawers/arcOutlineDrawer.js +1 -1
  50. package/build/src/drawers/areaDrawer.js +3 -3
  51. package/build/src/drawers/canvasBuffer.js +2 -2
  52. package/build/src/drawers/canvasDrawer.d.ts +1 -1
  53. package/build/src/drawers/canvasDrawer.js +8 -8
  54. package/build/src/drawers/drawStep.d.ts +2 -2
  55. package/build/src/drawers/index.js +11 -11
  56. package/build/src/drawers/lineDrawer.js +3 -3
  57. package/build/src/drawers/rectangleDrawer.js +2 -2
  58. package/build/src/drawers/segmentDrawer.js +1 -1
  59. package/build/src/drawers/symbolDrawer.js +3 -3
  60. package/build/src/index.js +14 -14
  61. package/build/src/interactions/clickInteraction.d.ts +1 -1
  62. package/build/src/interactions/clickInteraction.js +1 -1
  63. package/build/src/interactions/dragInteraction.d.ts +2 -2
  64. package/build/src/interactions/dragInteraction.js +1 -1
  65. package/build/src/interactions/index.js +5 -5
  66. package/build/src/interactions/keyInteraction.d.ts +1 -1
  67. package/build/src/interactions/keyInteraction.js +1 -1
  68. package/build/src/interactions/panZoomConstraints.js +5 -6
  69. package/build/src/interactions/panZoomInteraction.d.ts +4 -4
  70. package/build/src/interactions/panZoomInteraction.js +9 -10
  71. package/build/src/interactions/pointerInteraction.d.ts +1 -1
  72. package/build/src/interactions/pointerInteraction.js +1 -1
  73. package/build/src/memoize/index.js +3 -3
  74. package/build/src/memoize/memThunk.d.ts +1 -1
  75. package/build/src/memoize/memThunk.js +1 -2
  76. package/build/src/memoize/memoize.d.ts +1 -1
  77. package/build/src/memoize/memoize.js +1 -2
  78. package/build/src/memoize/memoizeProjectors.js +2 -3
  79. package/build/src/memoize/signature.d.ts +1 -1
  80. package/build/src/memoize/signature.js +10 -10
  81. package/build/src/plots/areaPlot.js +4 -3
  82. package/build/src/plots/barPlot.d.ts +3 -3
  83. package/build/src/plots/barPlot.js +6 -6
  84. package/build/src/plots/clusteredBarPlot.js +1 -1
  85. package/build/src/plots/commons.js +1 -1
  86. package/build/src/plots/index.js +12 -12
  87. package/build/src/plots/linePlot.d.ts +2 -3
  88. package/build/src/plots/linePlot.js +3 -2
  89. package/build/src/plots/piePlot.js +3 -2
  90. package/build/src/plots/plot.d.ts +2 -2
  91. package/build/src/plots/plot.js +9 -9
  92. package/build/src/plots/rectanglePlot.js +3 -4
  93. package/build/src/plots/scatterPlot.js +4 -4
  94. package/build/src/plots/segmentPlot.js +1 -1
  95. package/build/src/plots/stackedAreaPlot.js +5 -6
  96. package/build/src/plots/stackedBarPlot.js +4 -4
  97. package/build/src/plots/waterfallPlot.js +1 -1
  98. package/build/src/plots/xyPlot.js +3 -3
  99. package/build/src/scales/categoryScale.js +2 -2
  100. package/build/src/scales/colorScale.js +24 -5
  101. package/build/src/scales/index.js +9 -9
  102. package/build/src/scales/interpolatedColorScale.js +6 -6
  103. package/build/src/scales/linearScale.js +3 -3
  104. package/build/src/scales/logScale.js +3 -3
  105. package/build/src/scales/modifiedLogScale.js +2 -2
  106. package/build/src/scales/quantitativeScale.js +1 -1
  107. package/build/src/scales/scale.d.ts +1 -1
  108. package/build/src/scales/tickGenerators.js +2 -3
  109. package/build/src/scales/timeScale.js +4 -4
  110. package/build/src/utils/arrayUtils.js +5 -7
  111. package/build/src/utils/callbackSet.js +1 -1
  112. package/build/src/utils/coerceD3.js +1 -2
  113. package/build/src/utils/colorUtils.js +3 -4
  114. package/build/src/utils/d3ShapeUtils.d.ts +11 -0
  115. package/build/src/utils/d3ShapeUtils.js +17 -0
  116. package/build/src/utils/domUtils.js +20 -20
  117. package/build/src/utils/index.js +8 -8
  118. package/build/src/utils/makeEnum.js +1 -2
  119. package/build/src/utils/mathUtils.d.ts +2 -2
  120. package/build/src/utils/mathUtils.js +17 -18
  121. package/build/src/utils/objectUtils.js +1 -2
  122. package/build/src/utils/rTree.d.ts +1 -1
  123. package/build/src/utils/rTree.js +4 -4
  124. package/build/src/utils/rTreeSplitStrategies.d.ts +1 -1
  125. package/build/src/utils/stackingUtils.d.ts +6 -6
  126. package/build/src/utils/stackingUtils.js +6 -7
  127. package/build/src/utils/transformAwareTranslator.js +2 -2
  128. package/build/src/utils/windowUtils.js +4 -5
  129. package/package.json +12 -11
  130. package/plottable.js +17977 -18317
  131. package/plottable.js.map +1 -1
@@ -4,8 +4,10 @@
4
4
  * @license MIT
5
5
  */
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.createFilledArray = exports.flatten = exports.uniq = exports.add = void 0;
8
- var d3 = require("d3");
7
+ exports.add = add;
8
+ exports.uniq = uniq;
9
+ exports.flatten = flatten;
10
+ exports.createFilledArray = createFilledArray;
9
11
  var nativeArray = window.Array;
10
12
  /**
11
13
  * Takes two arrays of numbers and adds them together
@@ -20,7 +22,6 @@ function add(aList, bList) {
20
22
  }
21
23
  return aList.map(function (_, i) { return aList[i] + bList[i]; });
22
24
  }
23
- exports.add = add;
24
25
  /**
25
26
  * Take an array of values, and return the unique values.
26
27
  * Will work iff ∀ a, b, a.toString() == b.toString() => a == b; will break on Object inputs
@@ -29,7 +30,7 @@ exports.add = add;
29
30
  * @return {T[]} The unique values
30
31
  */
31
32
  function uniq(arr) {
32
- var seen = d3.set();
33
+ var seen = new Set();
33
34
  var result = [];
34
35
  arr.forEach(function (x) {
35
36
  if (!seen.has(String(x))) {
@@ -39,7 +40,6 @@ function uniq(arr) {
39
40
  });
40
41
  return result;
41
42
  }
42
- exports.uniq = uniq;
43
43
  /**
44
44
  * @param {T[][]} a The 2D array that will have its elements joined together.
45
45
  * @return {T[]} Every array in a, concatenated together in the order they appear.
@@ -47,7 +47,6 @@ exports.uniq = uniq;
47
47
  function flatten(a) {
48
48
  return nativeArray.prototype.concat.apply([], a);
49
49
  }
50
- exports.flatten = flatten;
51
50
  /**
52
51
  * Creates an array of length `count`, filled with value or (if value is a function), value()
53
52
  *
@@ -62,4 +61,3 @@ function createFilledArray(value, count) {
62
61
  }
63
62
  return out;
64
63
  }
65
- exports.createFilledArray = createFilledArray;
@@ -13,7 +13,7 @@ var set_1 = require("./set");
13
13
  * All callbacks should have the same signature.
14
14
  */
15
15
  var CallbackSet = /** @class */ (function (_super) {
16
- (0, tslib_1.__extends)(CallbackSet, _super);
16
+ tslib_1.__extends(CallbackSet, _super);
17
17
  function CallbackSet() {
18
18
  return _super !== null && _super.apply(this, arguments) || this;
19
19
  }
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.coerceExternalD3 = void 0;
3
+ exports.coerceExternalD3 = coerceExternalD3;
4
4
  var d3 = require("d3");
5
5
  /**
6
6
  * Coerce possibly external d3 instance into our own instance of d3 so we can use d3-selection-multi.
@@ -28,4 +28,3 @@ function coerceExternalD3(externalD3Selection) {
28
28
  return externalD3Selection;
29
29
  }
30
30
  }
31
- exports.coerceExternalD3 = coerceExternalD3;
@@ -4,7 +4,9 @@
4
4
  * @license MIT
5
5
  */
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.colorTest = exports.lightenColor = exports.contrast = void 0;
7
+ exports.contrast = contrast;
8
+ exports.lightenColor = lightenColor;
9
+ exports.colorTest = colorTest;
8
10
  var d3 = require("d3");
9
11
  var nativeMath = window.Math;
10
12
  /**
@@ -19,7 +21,6 @@ function contrast(a, b) {
19
21
  var l2 = luminance(b) + 0.05;
20
22
  return l1 > l2 ? l1 / l2 : l2 / l1;
21
23
  }
22
- exports.contrast = contrast;
23
24
  /**
24
25
  * Returns a brighter copy of this color. Each channel is multiplied by 0.7 ^ -factor.
25
26
  * Channel values are capped at the maximum value of 255, and the minimum value of 30.
@@ -28,7 +29,6 @@ function lightenColor(color, factor) {
28
29
  var brightened = d3.color(color).brighter(factor);
29
30
  return brightened.rgb().toString();
30
31
  }
31
- exports.lightenColor = lightenColor;
32
32
  /**
33
33
  * Gets the Hex Code of the color resulting by applying the className CSS class to the
34
34
  * colorTester selection. Returns null if the tester is transparent.
@@ -62,7 +62,6 @@ function colorTest(colorTester, className) {
62
62
  colorTester.classed(className, false);
63
63
  return hexCode;
64
64
  }
65
- exports.colorTest = colorTest;
66
65
  /**
67
66
  * Return relative luminance (defined here: http://www.w3.org/TR/2008/REC-WCAG20-20081211/#relativeluminancedef)
68
67
  * Based on implementation from chroma.js by Gregor Aisch (gka) (licensed under BSD)
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Copyright 2014-present Palantir Technologies
3
+ * @license MIT
4
+ */
5
+ /**
6
+ * Preserve full-precision SVG paths with d3-shape 3.2+, which rounds by default.
7
+ * Earlier versions have no digits() method and already use full precision.
8
+ */
9
+ export declare function withFullPrecision<T extends {
10
+ digits?: (digits: number | null) => unknown;
11
+ }>(generator: T): T;
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ /**
3
+ * Copyright 2014-present Palantir Technologies
4
+ * @license MIT
5
+ */
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.withFullPrecision = withFullPrecision;
8
+ /**
9
+ * Preserve full-precision SVG paths with d3-shape 3.2+, which rounds by default.
10
+ * Earlier versions have no digits() method and already use full precision.
11
+ */
12
+ function withFullPrecision(generator) {
13
+ if (typeof generator.digits === "function") {
14
+ generator.digits(null);
15
+ }
16
+ return generator;
17
+ }
@@ -4,7 +4,22 @@
4
4
  * @license MIT
5
5
  */
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.getElementTransform = exports.getHtmlElementAncestors = exports.intersectsBBox = exports.clientRectInside = exports.expandRect = exports.clientRectsOverlap = exports.getScaleValues = exports.getRotate = exports.getTranslateValues = exports.elementHeight = exports.elementWidth = exports.requestAnimationFramePolyfill = exports.SCREEN_REFRESH_RATE_MILLISECONDS = exports.entityBounds = exports.elementBBox = exports.contains = void 0;
7
+ exports.SCREEN_REFRESH_RATE_MILLISECONDS = void 0;
8
+ exports.contains = contains;
9
+ exports.elementBBox = elementBBox;
10
+ exports.entityBounds = entityBounds;
11
+ exports.requestAnimationFramePolyfill = requestAnimationFramePolyfill;
12
+ exports.elementWidth = elementWidth;
13
+ exports.elementHeight = elementHeight;
14
+ exports.getTranslateValues = getTranslateValues;
15
+ exports.getRotate = getRotate;
16
+ exports.getScaleValues = getScaleValues;
17
+ exports.clientRectsOverlap = clientRectsOverlap;
18
+ exports.expandRect = expandRect;
19
+ exports.clientRectInside = clientRectInside;
20
+ exports.intersectsBBox = intersectsBBox;
21
+ exports.getHtmlElementAncestors = getHtmlElementAncestors;
22
+ exports.getElementTransform = getElementTransform;
8
23
  var d3 = require("d3");
9
24
  var nativeMath = window.Math;
10
25
  /**
@@ -17,7 +32,6 @@ function contains(parent, child) {
17
32
  }
18
33
  return maybeParent === parent;
19
34
  }
20
- exports.contains = contains;
21
35
  /**
22
36
  * Gets the bounding box of an element.
23
37
  * @param {d3.Selection} element
@@ -34,7 +48,6 @@ function elementBBox(element) {
34
48
  }
35
49
  return bbox;
36
50
  }
37
- exports.elementBBox = elementBBox;
38
51
  function entityBounds(element) {
39
52
  if (element instanceof SVGElement) {
40
53
  return elementBBox(d3.select(element));
@@ -47,7 +60,6 @@ function entityBounds(element) {
47
60
  return { x: 0, y: 0, width: 0, height: 0 };
48
61
  }
49
62
  }
50
- exports.entityBounds = entityBounds;
51
63
  /**
52
64
  * Screen refresh rate which is assumed to be 60fps
53
65
  */
@@ -67,7 +79,6 @@ function requestAnimationFramePolyfill(callback) {
67
79
  setTimeout(callback, exports.SCREEN_REFRESH_RATE_MILLISECONDS);
68
80
  }
69
81
  }
70
- exports.requestAnimationFramePolyfill = requestAnimationFramePolyfill;
71
82
  /**
72
83
  * Calculates the width of the element.
73
84
  * The width includes the padding and the border on the element's left and right sides.
@@ -86,7 +97,6 @@ function elementWidth(elementOrSelection) {
86
97
  + _parseStyleValue(style, "border-left-width")
87
98
  + _parseStyleValue(style, "border-right-width");
88
99
  }
89
- exports.elementWidth = elementWidth;
90
100
  /**
91
101
  * Calculates the height of the element.
92
102
  * The height includes the padding the and the border on the element's top and bottom sides.
@@ -105,14 +115,13 @@ function elementHeight(elementOrSelection) {
105
115
  + _parseStyleValue(style, "border-top-width")
106
116
  + _parseStyleValue(style, "border-bottom-width");
107
117
  }
108
- exports.elementHeight = elementHeight;
109
118
  // taken from the BNF at https://www.w3.org/TR/SVG/coords.html
110
119
  var WSP = "\\s";
111
120
  var NUMBER = "(?:[-+]?[0-9]*\\.?[0-9]+)";
112
- var COMMA_WSP = "(?:(?:" + WSP + "+,?" + WSP + "*)|(?:," + WSP + "*))";
113
- var TRANSLATE_REGEX = new RegExp("translate" + WSP + "*\\(" + WSP + "*(" + NUMBER + ")(?:" + COMMA_WSP + "(" + NUMBER + "))?" + WSP + "*\\)");
114
- var ROTATE_REGEX = new RegExp("rotate" + WSP + "*\\(" + WSP + "*(" + NUMBER + ")" + WSP + "*\\)");
115
- var SCALE_REGEX = new RegExp("scale" + WSP + "*\\(" + WSP + "*(" + NUMBER + ")(?:" + COMMA_WSP + "(" + NUMBER + "))?" + WSP + "*\\)");
121
+ var COMMA_WSP = "(?:(?:".concat(WSP, "+,?").concat(WSP, "*)|(?:,").concat(WSP, "*))");
122
+ var TRANSLATE_REGEX = new RegExp("translate".concat(WSP, "*\\(").concat(WSP, "*(").concat(NUMBER, ")(?:").concat(COMMA_WSP, "(").concat(NUMBER, "))?").concat(WSP, "*\\)"));
123
+ var ROTATE_REGEX = new RegExp("rotate".concat(WSP, "*\\(").concat(WSP, "*(").concat(NUMBER, ")").concat(WSP, "*\\)"));
124
+ var SCALE_REGEX = new RegExp("scale".concat(WSP, "*\\(").concat(WSP, "*(").concat(NUMBER, ")(?:").concat(COMMA_WSP, "(").concat(NUMBER, "))?").concat(WSP, "*\\)"));
116
125
  /**
117
126
  * Accepts selections whose .transform contain a "translate(a, b)" and extracts the a and b
118
127
  */
@@ -126,7 +135,6 @@ function getTranslateValues(el) {
126
135
  return [0, 0];
127
136
  }
128
137
  }
129
- exports.getTranslateValues = getTranslateValues;
130
138
  /**
131
139
  * Accepts selections whose .transform contain a "rotate(angle)" and returns the angle
132
140
  */
@@ -140,7 +148,6 @@ function getRotate(el) {
140
148
  return 0;
141
149
  }
142
150
  }
143
- exports.getRotate = getRotate;
144
151
  function getScaleValues(el) {
145
152
  var match = SCALE_REGEX.exec(el.attr("transform"));
146
153
  if (match != null) {
@@ -151,7 +158,6 @@ function getScaleValues(el) {
151
158
  return [0, 0];
152
159
  }
153
160
  }
154
- exports.getScaleValues = getScaleValues;
155
161
  /**
156
162
  * Checks if the first ClientRect overlaps the second.
157
163
  *
@@ -174,7 +180,6 @@ function clientRectsOverlap(clientRectA, clientRectB) {
174
180
  }
175
181
  return true;
176
182
  }
177
- exports.clientRectsOverlap = clientRectsOverlap;
178
183
  /**
179
184
  * Return a new ClientRect that is the old ClientRect expanded by amount in all directions.
180
185
  * @param rect
@@ -190,7 +195,6 @@ function expandRect(rect, amount) {
190
195
  height: rect.height + amount * 2,
191
196
  };
192
197
  }
193
- exports.expandRect = expandRect;
194
198
  /**
195
199
  * Returns true if and only if innerClientRect is inside outerClientRect.
196
200
  *
@@ -204,7 +208,6 @@ function clientRectInside(innerClientRect, outerClientRect) {
204
208
  nativeMath.floor(innerClientRect.right) <= nativeMath.ceil(outerClientRect.right) &&
205
209
  nativeMath.floor(innerClientRect.bottom) <= nativeMath.ceil(outerClientRect.bottom));
206
210
  }
207
- exports.clientRectInside = clientRectInside;
208
211
  /**
209
212
  * Returns true if the supplied coordinates or Ranges intersect or are contained by bbox.
210
213
  *
@@ -230,7 +233,6 @@ function intersectsBBox(xValOrRange, yValOrRange, bbox, tolerance) {
230
233
  bbox.y + bbox.height >= yRange.min - tolerance &&
231
234
  bbox.y <= yRange.max + tolerance;
232
235
  }
233
- exports.intersectsBBox = intersectsBBox;
234
236
  /**
235
237
  * Create a Range from a number or an object with "min" and "max" defined.
236
238
  *
@@ -266,7 +268,6 @@ function getHtmlElementAncestors(elem) {
266
268
  }
267
269
  return elems;
268
270
  }
269
- exports.getHtmlElementAncestors = getHtmlElementAncestors;
270
271
  /**
271
272
  * Returns the `ICssTransformMatrix` of an element, if defined in its computed
272
273
  * style. Returns `null` if there is no transform on the element.
@@ -280,7 +281,6 @@ function getElementTransform(elem) {
280
281
  style.getPropertyValue("transform");
281
282
  return parseTransformMatrix(transform);
282
283
  }
283
- exports.getElementTransform = getElementTransform;
284
284
  var _MATRIX_REGEX = /^matrix\(([^)]+)\)$/;
285
285
  var _SPLIT_REGEX = /[, ]+/;
286
286
  /**
@@ -20,11 +20,11 @@ var Stacking = require("./stackingUtils");
20
20
  exports.Stacking = Stacking;
21
21
  var Window = require("./windowUtils");
22
22
  exports.Window = Window;
23
- (0, tslib_1.__exportStar)(require("./bucket"), exports);
24
- (0, tslib_1.__exportStar)(require("./callbackSet"), exports);
25
- (0, tslib_1.__exportStar)(require("./coerceD3"), exports);
26
- (0, tslib_1.__exportStar)(require("./entityStore"), exports);
27
- (0, tslib_1.__exportStar)(require("./map"), exports);
28
- (0, tslib_1.__exportStar)(require("./objectUtils"), exports);
29
- (0, tslib_1.__exportStar)(require("./set"), exports);
30
- (0, tslib_1.__exportStar)(require("./transformAwareTranslator"), exports);
23
+ tslib_1.__exportStar(require("./bucket"), exports);
24
+ tslib_1.__exportStar(require("./callbackSet"), exports);
25
+ tslib_1.__exportStar(require("./coerceD3"), exports);
26
+ tslib_1.__exportStar(require("./entityStore"), exports);
27
+ tslib_1.__exportStar(require("./map"), exports);
28
+ tslib_1.__exportStar(require("./objectUtils"), exports);
29
+ tslib_1.__exportStar(require("./set"), exports);
30
+ tslib_1.__exportStar(require("./transformAwareTranslator"), exports);
@@ -4,11 +4,10 @@
4
4
  * @license MIT
5
5
  */
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.makeEnum = void 0;
7
+ exports.makeEnum = makeEnum;
8
8
  function makeEnum(values) {
9
9
  return values.reduce(function (obj, v) {
10
10
  obj[v] = v;
11
11
  return obj;
12
12
  }, {});
13
13
  }
14
- exports.makeEnum = makeEnum;
@@ -19,8 +19,8 @@ import { Bounds, Point } from "../core/interfaces";
19
19
  *
20
20
  * https://developer.mozilla.org/en-US/docs/Web/CSS/transform-function/matrix
21
21
  */
22
- export declare type ICssTransformMatrix = [number, number, number, number, number, number];
23
- export declare type ITranslateVector = [number, number];
22
+ export type ICssTransformMatrix = [number, number, number, number, number, number];
23
+ export type ITranslateVector = [number, number];
24
24
  /**
25
25
  * Checks if x is between a and b.
26
26
  *
@@ -4,7 +4,23 @@
4
4
  * @license MIT
5
5
  */
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.applyTransform = exports.invertMatrix = exports.multiplyTranslate = exports.premultiplyTranslate = exports.multiplyMatrix = exports.getCumulativeTransform = exports.boundsIntersects = exports.within = exports.degreesToRadians = exports.distanceSquared = exports.range = exports.isValidNumber = exports.isNaN = exports.min = exports.max = exports.clamp = exports.inRange = void 0;
7
+ exports.inRange = inRange;
8
+ exports.clamp = clamp;
9
+ exports.max = max;
10
+ exports.min = min;
11
+ exports.isNaN = isNaN;
12
+ exports.isValidNumber = isValidNumber;
13
+ exports.range = range;
14
+ exports.distanceSquared = distanceSquared;
15
+ exports.degreesToRadians = degreesToRadians;
16
+ exports.within = within;
17
+ exports.boundsIntersects = boundsIntersects;
18
+ exports.getCumulativeTransform = getCumulativeTransform;
19
+ exports.multiplyMatrix = multiplyMatrix;
20
+ exports.premultiplyTranslate = premultiplyTranslate;
21
+ exports.multiplyTranslate = multiplyTranslate;
22
+ exports.invertMatrix = invertMatrix;
23
+ exports.applyTransform = applyTransform;
8
24
  var d3 = require("d3");
9
25
  var domUtils_1 = require("./domUtils");
10
26
  var nativeMath = window.Math;
@@ -20,7 +36,6 @@ var _IDENTITY_TRANSFORM = [1, 0, 0, 1, 0, 0];
20
36
  function inRange(x, a, b) {
21
37
  return (nativeMath.min(a, b) <= x && x <= nativeMath.max(a, b));
22
38
  }
23
- exports.inRange = inRange;
24
39
  /**
25
40
  * Clamps x to the range [min, max].
26
41
  *
@@ -32,28 +47,24 @@ exports.inRange = inRange;
32
47
  function clamp(x, min, max) {
33
48
  return nativeMath.min(nativeMath.max(min, x), max);
34
49
  }
35
- exports.clamp = clamp;
36
50
  function max(array, firstArg, secondArg) {
37
51
  var accessor = typeof (firstArg) === "function" ? firstArg : null;
38
52
  var defaultValue = accessor == null ? firstArg : secondArg;
39
53
  var maxValue = accessor == null ? d3.max(array) : d3.max(array, accessor);
40
54
  return maxValue !== undefined ? maxValue : defaultValue;
41
55
  }
42
- exports.max = max;
43
56
  function min(array, firstArg, secondArg) {
44
57
  var accessor = typeof (firstArg) === "function" ? firstArg : null;
45
58
  var defaultValue = accessor == null ? firstArg : secondArg;
46
59
  var minValue = accessor == null ? d3.min(array) : d3.min(array, accessor);
47
60
  return minValue !== undefined ? minValue : defaultValue;
48
61
  }
49
- exports.min = min;
50
62
  /**
51
63
  * Returns true **only** if x is NaN
52
64
  */
53
65
  function isNaN(n) {
54
66
  return n !== n;
55
67
  }
56
- exports.isNaN = isNaN;
57
68
  /**
58
69
  * Returns true if the argument is a number, which is not NaN
59
70
  * Numbers represented as strings do not pass this function
@@ -61,7 +72,6 @@ exports.isNaN = isNaN;
61
72
  function isValidNumber(n) {
62
73
  return typeof n === "number" && n - n < 1;
63
74
  }
64
- exports.isValidNumber = isValidNumber;
65
75
  /**
66
76
  * Generates an array of consecutive, strictly increasing numbers
67
77
  * in the range [start, stop) separeted by step
@@ -78,7 +88,6 @@ function range(start, stop, step) {
78
88
  }
79
89
  return range;
80
90
  }
81
- exports.range = range;
82
91
  /**
83
92
  * Returns the square of the distance between two points
84
93
  *
@@ -89,11 +98,9 @@ exports.range = range;
89
98
  function distanceSquared(p1, p2) {
90
99
  return nativeMath.pow(p2.y - p1.y, 2) + nativeMath.pow(p2.x - p1.x, 2);
91
100
  }
92
- exports.distanceSquared = distanceSquared;
93
101
  function degreesToRadians(degree) {
94
102
  return degree / 360 * nativeMath.PI * 2;
95
103
  }
96
- exports.degreesToRadians = degreesToRadians;
97
104
  /**
98
105
  * Returns if the point is within the bounds. Points along
99
106
  * the bounds are considered "within" as well.
@@ -106,7 +113,6 @@ function within(p, bounds) {
106
113
  && bounds.topLeft.y <= p.y
107
114
  && bounds.bottomRight.y >= p.y;
108
115
  }
109
- exports.within = within;
110
116
  /**
111
117
  * Returns whether the first bounds intersects the second bounds.
112
118
  * Pass primitive numbers directly for performance.
@@ -119,7 +125,6 @@ function boundsIntersects(aX, aY, aWidth, aHeight, bX, bY, bWidth, bHeight) {
119
125
  aY <= bY + bHeight &&
120
126
  bY <= aY + aHeight;
121
127
  }
122
- exports.boundsIntersects = boundsIntersects;
123
128
  /**
124
129
  * Returns a `ICssTransformMatrix` representing the cumulative transformation of
125
130
  * the element and all its parents. This transform converts from top-level
@@ -160,7 +165,6 @@ function getCumulativeTransform(element) {
160
165
  }
161
166
  return transform;
162
167
  }
163
- exports.getCumulativeTransform = getCumulativeTransform;
164
168
  /**
165
169
  * Straightforward matrix multiplication of homogenized css transform matrices.
166
170
  */
@@ -174,7 +178,6 @@ function multiplyMatrix(a, b) {
174
178
  a[1] * b[4] + a[3] * b[5] + a[5],
175
179
  ];
176
180
  }
177
- exports.multiplyMatrix = multiplyMatrix;
178
181
  /**
179
182
  * Prepends translation to transformation matrix.
180
183
  *
@@ -187,7 +190,6 @@ function premultiplyTranslate(v, b) {
187
190
  b[5] + v[1],
188
191
  ];
189
192
  }
190
- exports.premultiplyTranslate = premultiplyTranslate;
191
193
  /**
192
194
  * Appends translation to transformation matrix.
193
195
  *
@@ -200,7 +202,6 @@ function multiplyTranslate(a, v) {
200
202
  a[1] * v[0] + a[3] * v[1] + a[5],
201
203
  ];
202
204
  }
203
- exports.multiplyTranslate = multiplyTranslate;
204
205
  /**
205
206
  * Analytical inverse of a `ICssTransformMatrix` analogous to a non-singular
206
207
  * homogenous 3x3 matrix.
@@ -223,7 +224,6 @@ function invertMatrix(a) {
223
224
  inverseDeterminant * (a[1] * a[4] + -a[0] * a[5]),
224
225
  ];
225
226
  }
226
- exports.invertMatrix = invertMatrix;
227
227
  /**
228
228
  * Applies the `ICssTransformMatrix` to the `Point`.
229
229
  *
@@ -235,4 +235,3 @@ function applyTransform(a, p) {
235
235
  y: a[1] * p.x + a[3] * p.y + a[5],
236
236
  };
237
237
  }
238
- exports.applyTransform = applyTransform;
@@ -4,7 +4,7 @@
4
4
  * @license MIT
5
5
  */
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.assign = void 0;
7
+ exports.assign = assign;
8
8
  /**
9
9
  * Polyfill for Object.assign
10
10
  */
@@ -24,4 +24,3 @@ function assign() {
24
24
  }
25
25
  return result;
26
26
  }
27
- exports.assign = assign;
@@ -19,7 +19,7 @@ export declare enum QueryPredicateResult {
19
19
  * Returns the absolute distance to the nearest point on the edge of bounds or 0
20
20
  * if the point is in bounds.
21
21
  */
22
- export declare type IDistanceFunction = (bounds: RTreeBounds, p: Point) => number;
22
+ export type IDistanceFunction = (bounds: RTreeBounds, p: Point) => number;
23
23
  /**
24
24
  * Creates a node predicate for use with `RTree.queryNodes`
25
25
  *
@@ -4,7 +4,9 @@
4
4
  * @license MIT
5
5
  */
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.RTreeBounds = exports.RTreeNode = exports.RTree = exports.createNodeSort = exports.createMinimizingNodePredicate = exports.QueryPredicateResult = void 0;
7
+ exports.RTreeBounds = exports.RTreeNode = exports.RTree = exports.QueryPredicateResult = void 0;
8
+ exports.createMinimizingNodePredicate = createMinimizingNodePredicate;
9
+ exports.createNodeSort = createNodeSort;
8
10
  var rTreeSplitStrategies_1 = require("./rTreeSplitStrategies");
9
11
  /**
10
12
  * The maximum number of children in an r-tree node before we attempt to split.
@@ -28,7 +30,7 @@ var QueryPredicateResult;
28
30
  QueryPredicateResult[QueryPredicateResult["PASS"] = 0] = "PASS";
29
31
  QueryPredicateResult[QueryPredicateResult["FAIL"] = 1] = "FAIL";
30
32
  QueryPredicateResult[QueryPredicateResult["PASS_AND_OVERWRITE"] = 2] = "PASS_AND_OVERWRITE";
31
- })(QueryPredicateResult = exports.QueryPredicateResult || (exports.QueryPredicateResult = {}));
33
+ })(QueryPredicateResult || (exports.QueryPredicateResult = QueryPredicateResult = {}));
32
34
  /**
33
35
  * Creates a node predicate for use with `RTree.queryNodes`
34
36
  *
@@ -72,7 +74,6 @@ function createMinimizingNodePredicate(point, nearFn, farFn) {
72
74
  }
73
75
  };
74
76
  }
75
- exports.createMinimizingNodePredicate = createMinimizingNodePredicate;
76
77
  /**
77
78
  * Create a `Array.sort` function from a query point and a distance function.
78
79
  */
@@ -81,7 +82,6 @@ function createNodeSort(point, distanceFn) {
81
82
  return distanceFn(b.bounds, point) - distanceFn(a.bounds, point);
82
83
  };
83
84
  }
84
- exports.createNodeSort = createNodeSort;
85
85
  /**
86
86
  * R-Tree is a multidimensional spatial region tree. It stores entries that have
87
87
  * arbitrarily overlapping bounding boxes and supports efficient point and
@@ -3,7 +3,7 @@
3
3
  * @license MIT
4
4
  */
5
5
  import { RTreeNode } from "./rTree";
6
- export declare type NodePair<T> = [RTreeNode<T>, RTreeNode<T>];
6
+ export type NodePair<T> = [RTreeNode<T>, RTreeNode<T>];
7
7
  export interface IRTreeSplitStrategy {
8
8
  split: <T>(entries: RTreeNode<T>[], nodes: NodePair<T>) => void;
9
9
  }
@@ -6,7 +6,7 @@ import { Dataset } from "../core/dataset";
6
6
  import { IAccessor } from "../core/interfaces";
7
7
  import type { MemoizedFunction } from "lodash";
8
8
  import * as Utils from "./";
9
- export declare type GenericStackedDatum<D> = {
9
+ export type GenericStackedDatum<D> = {
10
10
  value: number;
11
11
  offset: number;
12
12
  axisValue: D;
@@ -14,12 +14,12 @@ export declare type GenericStackedDatum<D> = {
14
14
  originalIndex: number;
15
15
  originalDataset: Dataset;
16
16
  };
17
- export declare type StackExtent<D> = {
17
+ export type StackExtent<D> = {
18
18
  extent: number;
19
19
  axisValue: D;
20
20
  stackedDatum: GenericStackedDatum<D>;
21
21
  };
22
- export declare type StackedDatum = GenericStackedDatum<string>;
22
+ export type StackedDatum = GenericStackedDatum<string>;
23
23
  /**
24
24
  * Option type for stacking direction. By default, stacked bar and area charts
25
25
  * put the first data series at the bottom of the axis ("bottomup"), but this
@@ -30,13 +30,13 @@ export declare const IStackingOrder: {
30
30
  topdown: "topdown";
31
31
  bottomup: "bottomup";
32
32
  };
33
- export declare type IStackingOrder = keyof typeof IStackingOrder;
34
- export declare type GenericStackingResult<D> = Utils.Map<Dataset, Utils.Map<string | number, GenericStackedDatum<D>>>;
33
+ export type IStackingOrder = keyof typeof IStackingOrder;
34
+ export type GenericStackingResult<D> = Utils.Map<Dataset, Utils.Map<string | number, GenericStackedDatum<D>>>;
35
35
  /**
36
36
  * Map of Dataset to stacks.
37
37
  * @deprecated
38
38
  */
39
- export declare type StackingResult = GenericStackingResult<string>;
39
+ export type StackingResult = GenericStackingResult<string>;
40
40
  /**
41
41
  * Computes the StackingResult (value and offset) for each data point in each Dataset.
42
42
  *
@@ -4,8 +4,10 @@
4
4
  * @license MIT
5
5
  */
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.normalizeKey = exports.stackedExtent = exports.stackedExtents = exports.stack = exports.IStackingOrder = void 0;
8
- var d3 = require("d3");
7
+ exports.normalizeKey = exports.IStackingOrder = void 0;
8
+ exports.stack = stack;
9
+ exports.stackedExtents = stackedExtents;
10
+ exports.stackedExtent = stackedExtent;
9
11
  var memoize_1 = require("lodash-es/memoize");
10
12
  var Utils = require("./");
11
13
  var makeEnum_1 = require("./makeEnum");
@@ -28,8 +30,8 @@ var nativeMath = window.Math;
28
30
  */
29
31
  function stack(datasets, keyAccessor, valueAccessor, stackingOrder) {
30
32
  if (stackingOrder === void 0) { stackingOrder = "bottomup"; }
31
- var positiveOffsets = d3.map();
32
- var negativeOffsets = d3.map();
33
+ var positiveOffsets = new Map();
34
+ var negativeOffsets = new Map();
33
35
  var datasetToKeyToStackedDatum = new Utils.Map();
34
36
  if (stackingOrder === "topdown") {
35
37
  datasets = datasets.slice();
@@ -68,7 +70,6 @@ function stack(datasets, keyAccessor, valueAccessor, stackingOrder) {
68
70
  }
69
71
  return datasetToKeyToStackedDatum;
70
72
  }
71
- exports.stack = stack;
72
73
  /**
73
74
  * Computes the maximum and minimum extents of each stack individually.
74
75
  *
@@ -102,7 +103,6 @@ function stackedExtents(stackingResult) {
102
103
  });
103
104
  return { maximumExtents: maximumExtents, minimumExtents: minimumExtents };
104
105
  }
105
- exports.stackedExtents = stackedExtents;
106
106
  /**
107
107
  * Computes the total extent over all data points in all Datasets, taking stacking into consideration.
108
108
  *
@@ -129,7 +129,6 @@ function stackedExtent(stackingResult, keyAccessor, filter) {
129
129
  var minStackExtent = Utils.Math.min(extents, 0);
130
130
  return [nativeMath.min(minStackExtent, 0), nativeMath.max(0, maxStackExtent)];
131
131
  }
132
- exports.stackedExtent = stackedExtent;
133
132
  /**
134
133
  * Normalizes a key used for stacking
135
134
  *
@@ -4,7 +4,8 @@
4
4
  * @license MIT
5
5
  */
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.Translator = exports.getTranslator = void 0;
7
+ exports.Translator = void 0;
8
+ exports.getTranslator = getTranslator;
8
9
  var Utils = require("../utils");
9
10
  var _TRANSLATOR_KEY = "__Plottable_ClientTranslator";
10
11
  /**
@@ -19,7 +20,6 @@ function getTranslator(component) {
19
20
  }
20
21
  return translator;
21
22
  }
22
- exports.getTranslator = getTranslator;
23
23
  /**
24
24
  * The translator implements CSS transform aware position measuring. We manually
25
25
  * compute a cumulative CSS3 of the root element ancestors up to `<body>`.